Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Copy & Paste of Activity Directives between Plans #1627

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from

Conversation

ivydeliz
Copy link
Contributor

@ivydeliz ivydeliz commented Feb 10, 2025

Closes #1625

Extending the original Copy & Paste feature with a few things here...

  1. Let's use the system Clipboard, instead of session storage. This will allow us to deconflict having a separate special clipboard for Aerie, and it enables more features like...
  2. Copy & Paste between plans. Open two plans, you can copy from plan A and paste on plan B either on the table or on the timeline at a specific time.
  3. Now that we handle different plans, they can have different boundaries, so if you're pasting and the earliest start is out of bounds, then we're going to paste at the start of the plan.

@ivydeliz ivydeliz force-pushed the feature/copy-paste-directives-between-plans branch from fab1cfa to e5c2ec1 Compare February 10, 2025 21:28
@ivydeliz ivydeliz self-assigned this Feb 10, 2025
@ivydeliz ivydeliz marked this pull request as ready for review February 10, 2025 21:53
@ivydeliz ivydeliz requested a review from a team as a code owner February 10, 2025 21:53
@ivydeliz ivydeliz changed the title Copy & Paste of Activity Directives between Plans (#1625) Copy & Paste of Activity Directives between Plans Feb 10, 2025
<ContextMenuItem on:click={pasteActivityDirectives}>{getPasteActivityDirectivesText()}</ContextMenuItem>
<ContextMenuSeparator></ContextMenuSeparator>
{/if}
{#await canPasteActivityDirectives() then howMany}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we keep this option always visible, but disabled if they don't have anything to paste in?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it be possible to do this without the await wrapping the menu item?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@duranb it doesn't hide the single Paste menu item, but i found that it would await until that is done to show the context menu altogether. I can spend time figuring this out, but if we paste 100,000 activities i think the context menu lag might be a small problem compared to handling that kind of operation.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll see if I can test it out

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@duranb ok i tested, when you have around 20k activities in the clipboard context menu starts to lag. i started looking into caching this info, but the point of this feature is to work between plans so even if i cache the info on one instance, the other instance will be wrong. Let's tag up Monday.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds good! I think I'm less worried about it taking a while to load and more that the user isn't presented with all the options. Can we maybe kick off the serialization when it opens and show a loading message where the option to paste would normally go?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Or are you saying that the process of serialization is the part that's lagging the UI?

@ivydeliz ivydeliz force-pushed the feature/copy-paste-directives-between-plans branch from e5c2ec1 to 258e0ba Compare February 13, 2025 17:40
@ivydeliz ivydeliz force-pushed the feature/copy-paste-directives-between-plans branch from 258e0ba to 3796dac Compare February 13, 2025 17:50
@ivydeliz ivydeliz requested a review from duranb February 13, 2025 18:00
@ivydeliz
Copy link
Contributor Author

ivydeliz commented Feb 13, 2025

@duranb addressed feedback! and actually simplified it! Give it a look when you can.

@@ -432,18 +428,35 @@
>
Set Simulation End
</ContextMenuItem>
{#if canPasteActivityDirectives()}
{#await getActivityDirectivesClipboardCount() then directivesInClipboard}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there still a chance that this menu item won't show while it's loading the count? Is it always quick to pop in?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm sure there's still a chance if you're trying to copy/paste tens of thousands of activities

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah that makes sense. Can we instead save the count to a variable and instead of awaiting to show the menu option, just show the option with a 0 count and disabling it to be consistent with always showing options?

Copy link
Contributor Author

@ivydeliz ivydeliz Feb 25, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@duranb since we're using the system clipboard we first need to make sure the clipboard has activity directives and then we get how many there are. So keeping the count doesn't really help me because we still have to deserialize the clipboard to see if it's the right type of content.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But my concern here is that we're hiding menu items from the user while waiting for the clipboard to deserialize. It's probably not likely that it would take long to deserialize, but I just want to make sure that the UX is consistent.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

see my comment above, sorry we're having this chat in two different places where the same thing is happening 😄

@ivydeliz ivydeliz force-pushed the feature/copy-paste-directives-between-plans branch from 3796dac to 0f7ae85 Compare February 20, 2025 04:19
@ivydeliz ivydeliz force-pushed the feature/copy-paste-directives-between-plans branch from 0f7ae85 to 848dfbe Compare February 25, 2025 03:21
@ivydeliz ivydeliz requested a review from duranb February 25, 2025 03:23
@@ -67,6 +68,12 @@
errorCounts: activityDirectiveErrorRollupsMap?.[activityDirective.id]?.errorCounts,
}));

$: permissionErrorText = planReadOnly
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you mind changing this to not have a nested ternary? It can be a little difficult to immediately grok.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@duranb pushed a change to handle this

@@ -432,18 +428,35 @@
>
Set Simulation End
</ContextMenuItem>
{#if canPasteActivityDirectives()}
{#await getActivityDirectivesClipboardCount() then directivesInClipboard}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But my concern here is that we're hiding menu items from the user while waiting for the clipboard to deserialize. It's probably not likely that it would take long to deserialize, but I just want to make sure that the UX is consistent.

@ivydeliz ivydeliz force-pushed the feature/copy-paste-directives-between-plans branch from 848dfbe to 1207af9 Compare February 28, 2025 16:35
@ivydeliz ivydeliz deployed to test-workflow February 28, 2025 16:35 — with GitHub Actions Active
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Todo
Development

Successfully merging this pull request may close these issues.

Copy & Paste of Activity Directives between Plans
4 participants