Skip to content

Enabled multi-selection support for several commands#2620

Merged
sebjulliand merged 24 commits intomasterfrom
multiActionSupport
May 6, 2025
Merged

Enabled multi-selection support for several commands#2620
sebjulliand merged 24 commits intomasterfrom
multiActionSupport

Conversation

@sebjulliand
Copy link
Copy Markdown
Member

@sebjulliand sebjulliand commented Apr 19, 2025

Changes

As discussed here: https://github.com/orgs/codefori/discussions/2612

This PR enables multi-selection support for the following commands:

  • Generate binder source
  • Browse/edit members
  • Browse/edit IFS files
  • Maintain filter
  • Custom actions
  • Search source file
  • Search in IFS
  • Find in IFS

Run multiple custom actions

Some noticeable changes were done to allow running custom actions on multiple items.

  • All the selected items must share the same nature (i.e. URI scheme) (otherwise a warning is shown)

  • If the command must be prompted , it will do so for each item:

    • If the action is run on a single item, it will be prompted as usual
    • If the action is run on multiple items, it will be prompted once, keeping the variables placeholders
  • The whole execution can now be cancelled. It will stop the process after the current item is done being processed
    image

  • The output webview had been enhanced to display multiple outputs. The left side displays items' path and the right side shows the selected item output. The icon in front of the item shows the execution result (ok, failed or not run).
    image

  • Running an action on a single item will only show the single output (no need for navigating through multiple results)

Search in members / Search/find in streamfiles

Finding or searching can be cancelled. The search will stop after the current path is done being processed.
Once a path has been processed, the results are added to the Search Results view, which means the view gets populated dynamically while the search is running.

How to test this PR

  1. Use ctrl+click or shift+click to select multiple items in the Object browser or IFS browser
  2. Check that actions are consistently shown
  3. The the actions mentioned in the description

Checklist

  • have tested my change

Signed-off-by: Seb Julliand <sebjulliand@gmail.com>
Signed-off-by: Seb Julliand <sebjulliand@gmail.com>
Signed-off-by: Seb Julliand <sebjulliand@gmail.com>
Signed-off-by: Seb Julliand <sebjulliand@gmail.com>
Signed-off-by: Seb Julliand <sebjulliand@gmail.com>
Signed-off-by: Seb Julliand <sebjulliand@gmail.com>
Signed-off-by: Seb Julliand <sebjulliand@gmail.com>
Signed-off-by: Seb Julliand <sebjulliand@gmail.com>
Signed-off-by: Seb Julliand <sebjulliand@gmail.com>
Signed-off-by: Seb Julliand <sebjulliand@gmail.com>
Signed-off-by: Seb Julliand <sebjulliand@gmail.com>
Signed-off-by: Seb Julliand <sebjulliand@gmail.com>
Signed-off-by: Seb Julliand <sebjulliand@gmail.com>
@sebjulliand sebjulliand added the enhancement New feature or request label Apr 19, 2025
@sebjulliand sebjulliand requested a review from a team April 19, 2025 10:16
@sebjulliand sebjulliand self-assigned this Apr 19, 2025
@sebjulliand sebjulliand temporarily deployed to testing_environment April 19, 2025 10:16 — with GitHub Actions Inactive
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 19, 2025

👋 A new build is available for this PR based on 0b16e33.

Signed-off-by: Seb Julliand <sebjulliand@gmail.com>
@sebjulliand sebjulliand temporarily deployed to testing_environment April 19, 2025 12:34 — with GitHub Actions Inactive
@sebjulliand
Copy link
Copy Markdown
Member Author

Edit: on second thought, prompted custom actions should be prompted once and executed many times instead of prompting each item.

Copy link
Copy Markdown
Member

@worksofliam worksofliam left a comment

Choose a reason for hiding this comment

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

Generally the code looks ok but I left some comments.

Comment thread src/webviews/filters/index.ts Outdated
Comment thread src/ui/actions.ts
Comment thread src/ui/actions.ts
Signed-off-by: Seb Julliand <sebjulliand@gmail.com>
Signed-off-by: Seb Julliand <sebjulliand@gmail.com>
Signed-off-by: Seb Julliand <sebjulliand@gmail.com>
@sebjulliand
Copy link
Copy Markdown
Member Author

Thanks @worksofliam ; see my comment and give it a go 😀

@worksofliam
Copy link
Copy Markdown
Member

@sebjulliand Generally it's looking good. I want to also add at least one test case for each file system in src/testing/action.ts which run an action against multiple files. What do you think?

Signed-off-by: Seb Julliand <sebjulliand@gmail.com>
Signed-off-by: Seb Julliand <sebjulliand@gmail.com>
Signed-off-by: Seb Julliand <sebjulliand@gmail.com>
@sebjulliand sebjulliand had a problem deploying to testing_environment May 2, 2025 15:30 — with GitHub Actions Failure
Signed-off-by: Seb Julliand <sebjulliand@gmail.com>
Signed-off-by: Seb Julliand <sebjulliand@gmail.com>
Signed-off-by: Seb Julliand <sebjulliand@gmail.com>
@sebjulliand sebjulliand had a problem deploying to testing_environment May 3, 2025 17:12 — with GitHub Actions Failure
@sebjulliand
Copy link
Copy Markdown
Member Author

@worksofliam tests are in, one for each scheme as requested.
I'll let you have a final look. Thanks!

Copy link
Copy Markdown
Member

@worksofliam worksofliam left a comment

Choose a reason for hiding this comment

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

It's looking great. This is a serious UX improvement for everyone! Fab work here. Please see my comment for peace of mind. Merge when ready.

image

Comment thread src/commands/actions.ts
export function registerActionsCommands(instance: Instance): Disposable[] {
return [
commands.registerCommand(`code-for-ibmi.runAction`, async (target: TreeItem | BrowserItem | Uri, group?: any, action?: Action, method?: DeploymentMethod, workspaceFolder?: WorkspaceFolder) => {
commands.registerCommand(`code-for-ibmi.runAction`, async (item?: (TreeItem | BrowserItem | Uri), items?: (TreeItem | BrowserItem | Uri)[], action?: Action, method?: DeploymentMethod, workspaceFolder?: WorkspaceFolder) => {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Just to confirm: you changed group to items here, and I don't think this is a breaking change because group was never used, right?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Yep, it was put here as a placeholder, when Project Explorer started to call it I think. So that second argument was mandatory in case the command was called with multiple item selected (otherwise it would have shifted the other arguments).
Long story short: it was never used (it was grayed out in the editor), now it is. 🤘🏻

Copy link
Copy Markdown
Member

@worksofliam worksofliam left a comment

Choose a reason for hiding this comment

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

Whoops, pressing the Run Action button on the editor UI causes this error.

image

@sebjulliand
Copy link
Copy Markdown
Member Author

Whoops, pressing the Run Action button on the editor UI causes this error.
image

Darn 😅 I'll see it fixed.

Signed-off-by: Seb Julliand <sebjulliand@gmail.com>
@sebjulliand sebjulliand had a problem deploying to testing_environment May 5, 2025 20:36 — with GitHub Actions Failure
@sebjulliand
Copy link
Copy Markdown
Member Author

Whoops, pressing the Run Action button on the editor UI causes this error.

Fixed it! Turned out calling a command from the editor UI sends the command's group id as the second parameter, and not undefined or an array as when run from a tree view.

@sebjulliand sebjulliand requested a review from worksofliam May 5, 2025 20:39
Copy link
Copy Markdown
Member

@worksofliam worksofliam left a comment

Choose a reason for hiding this comment

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

Working now! Thanks for the fix! Merge when you're ready.

@sebjulliand sebjulliand merged commit 564c128 into master May 6, 2025
4 of 5 checks passed
@sebjulliand sebjulliand deleted the multiActionSupport branch May 6, 2025 06:45
@chrjorgensen
Copy link
Copy Markdown
Collaborator

@sebjulliand I've just used your excellent change for the first time (using the prerelease version), and I have an idea for improvement:

Can we show the path of the member or streamfile for which the action is being run? Currently it's a count, but it would be nice to know the file also - especially if something hangs or is slow.

WDYT? 🤔

@sebjulliand
Copy link
Copy Markdown
Member Author

@sebjulliand I've just used your excellent change for the first time (using the prerelease version), and I have an idea for improvement:

Can we show the path of the member or streamfile for which the action is being run? Currently it's a count, but it would be nice to know the file also - especially if something hangs or is slow.

WDYT? 🤔

Thank you @chrjorgensen !
It sure is a good idea - do you want to take care of it? Else I can, no problem, I have the exact location under my eyes 😁

@chrjorgensen
Copy link
Copy Markdown
Collaborator

@sebjulliand Unfortunately I'm still very busy with work, so I don't have the time... 😭
but I would be grateful if you can fix this. 🙏

@sebjulliand
Copy link
Copy Markdown
Member Author

@sebjulliand Unfortunately I'm still very busy with work, so I don't have the time... 😭 but I would be grateful if you can fix this. 🙏

You can count on me 🤝🏻

@sebjulliand
Copy link
Copy Markdown
Member Author

There you go @chrjorgensen : #2674

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants