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

Populate empty tab buttons from available create options #4575

Merged
merged 2 commits into from
Oct 8, 2024

Conversation

marstamm
Copy link
Member

@marstamm marstamm commented Oct 1, 2024

Proposed Changes

related to #4568

I noticed that with the plugin, the new file dialog from the OS menu does not work. Start page and client side new-tab worked, as we added the special action handling there.

With this change, we allow action and options to be an array for #triggerAction, so menu actions can easily add options, even when triggered via a backend module.

image

Try it out:

Checklist

To ensure you provided everything we need to look at your PR:

  • Brief textual description of the changes present
  • Visual demo attached
  • Steps to try out present, i.e. using the @bpmn-io/sr tool
  • Related issue linked via Closes {LINK_TO_ISSUE} or Related to {LINK_TO_ISSUE}

@marstamm marstamm requested a review from a team October 1, 2024 12:45
@marstamm marstamm self-assigned this Oct 1, 2024
@marstamm marstamm requested review from philippfromme and abdul99ahad and removed request for a team October 1, 2024 12:45
@bpmn-io-tasks bpmn-io-tasks bot added the needs review Review pending label Oct 1, 2024
Copy link

github-actions bot commented Oct 1, 2024

This Pull Request targets develop branch, but contains fix commits.

Consider targeting main instead.

action = action[0];
}

console.log(action, options);
Copy link
Member

Choose a reason for hiding this comment

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

Get rid of this

Suggested change
console.log(action, options);
console.log(action, options);

Copy link
Member Author

Choose a reason for hiding this comment

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

🤦

Fixed in 88646ed

client/src/app/App.js Outdated Show resolved Hide resolved
@nikku
Copy link
Member

nikku commented Oct 1, 2024

Could you elaborate what exactly is missing from the current way to trigger menus?

I verified via 1163371 and e53e2f3 to see that we can already pass context.

I propose that we update the existing examples / plug-ins to feature the new extension point / usage patterns within the DEV environment. This makes it simpler for you to test things, but also allows us to verify that we don't break E2E scenarios in the future.

@nikku nikku force-pushed the fix-editor-events branch from 5fc71cc to e53e2f3 Compare October 1, 2024 13:13
@marstamm marstamm marked this pull request as draft October 1, 2024 13:26
@bpmn-io-tasks bpmn-io-tasks bot added in progress Currently worked on and removed needs review Review pending labels Oct 1, 2024
@marstamm
Copy link
Member Author

marstamm commented Oct 1, 2024

You are right, this is not the correct way to implement this. The problem is that we use the tab provider both the frontend (right plus button) as well as the backend (File menu).

The Frontend implementation does not support adding options, the backend does. This needs to be fixed in the frontend code that renders the Menu, as well as add the option for "options" in the Slot on the front page. I will revisit this PR

@marstamm
Copy link
Member Author

marstamm commented Oct 1, 2024

I adjusted the code to accept options for triggered actions and added a simple sample tab plugin that shows a hello world page.

Recording 2024-10-01 at 15 49 45

With this change, you can open new Tabs and trigger events properly from all places we need them

@marstamm marstamm marked this pull request as ready for review October 1, 2024 13:52
@bpmn-io-tasks bpmn-io-tasks bot added needs review Review pending and removed in progress Currently worked on labels Oct 1, 2024
@nikku
Copy link
Member

nikku commented Oct 1, 2024

The Frontend implementation does not support adding options, the backend does. This needs to be fixed in the frontend code that renders the Menu, as well as add the option for "options" in the Slot on the front page. I will revisit this PR

What we could consider for a good integration:

  • Render + and options based off registered tab providers.
  • Ensures that UX is always decent (i.e. we could hide ROBOT and friends behind a ... on the landing page
  • New file types are always represented in all relevant areas, just because they are registered.

The current way of doing things is error-prone.

@marstamm
Copy link
Member Author

marstamm commented Oct 2, 2024

Render + and options based off registered tab providers.

We already do this

hide ROBOT and friends behind a ... on the landing page

I would not hide them, we have enough space on the landing page and I do not see us having a lot of additional Providers. If we get to the point, we can reiterate and hide them.

New file types are always represented in all relevant areas, just because they are registered.

The only place we do not do that yet is the Welcome page. I added this in 7ee2c34

@nikku
Copy link
Member

nikku commented Oct 2, 2024

7ee2c34 is great, because it sets us up to do whatever optimizations on the welcome page in the future. Good stuff.

@nikku nikku force-pushed the fix-editor-events branch 2 times, most recently from a74aff0 to 016fe71 Compare October 2, 2024 12:22
Copy link
Member

@nikku nikku left a comment

Choose a reason for hiding this comment

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

I struggled to get this up and running just to realize that we did not check-in the test-plugin distro (as we do with other distributions). Fixed via d1f280b.

Then I checked the welcome page designs. Via 016fe71 I made sure that the UI scales, independent on how many options we offer.

The overall changes look good to me.

Copy link
Member

@nikku nikku left a comment

Choose a reason for hiding this comment

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

You could do another round of cleanup on the commit history, but otherwise it looks good to merge.

@marstamm
Copy link
Member Author

marstamm commented Oct 2, 2024

Also noticed that we need key attribute on the Button elements so React plays nicely. Will make the adjustments and squash the commits

@nikku nikku self-requested a review October 6, 2024 16:28
@marstamm
Copy link
Member Author

marstamm commented Oct 7, 2024

I did a small refactoring in EmptyTab to add key to the dynamically rendered buttons and squashed the commits. Please have a final look at the refactoring :)

@nikku nikku force-pushed the fix-editor-events branch from 4e17a0a to dd4eace Compare October 7, 2024 15:24
Copy link
Member

@nikku nikku left a comment

Choose a reason for hiding this comment

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

It seems like the new way of declaring the EmptyTab is incompatible with our ref-based approach, cf. errors thrown in the developer console:

screenshot EGuwtO

@bpmn-io-tasks bpmn-io-tasks bot added in progress Currently worked on and removed needs review Review pending labels Oct 7, 2024
@marstamm
Copy link
Member Author

marstamm commented Oct 8, 2024

Fixed via 24e086a. As the functions called on the ref are all implemented by the child, we are fine to simply forward the ref to the EmptyTab component.

@marstamm marstamm requested a review from nikku October 8, 2024 08:48
@bpmn-io-tasks bpmn-io-tasks bot added needs review Review pending and removed in progress Currently worked on labels Oct 8, 2024
@nikku nikku force-pushed the fix-editor-events branch from 24e086a to 45be9f0 Compare October 8, 2024 09:12
@nikku
Copy link
Member

nikku commented Oct 8, 2024

Thanks for the update.

The change still did not fully work, as triggerAction in your proposed fix was not implemented on the HelloWorld tab. What I propose instead is to implement a proper tab there: 45be9f0. This allows us to work with the HellowWorld tab without problems.

@nikku
Copy link
Member

nikku commented Oct 8, 2024

Once CI passes I'll squash the changes and merge this PR. 🎉

@nikku nikku force-pushed the fix-editor-events branch from 45be9f0 to 620a778 Compare October 8, 2024 14:56
@nikku nikku merged commit f8d5a6c into develop Oct 8, 2024
12 checks passed
@nikku nikku deleted the fix-editor-events branch October 8, 2024 15:04
@bpmn-io-tasks bpmn-io-tasks bot removed the needs review Review pending label Oct 8, 2024
@github-actions github-actions bot added this to the M82 milestone Oct 8, 2024
@nikku nikku changed the title fix(App): allow #triggerAction to receive action and options as array Populate empty tab buttons from available create options Oct 8, 2024
@jarekdanielak jarekdanielak mentioned this pull request Oct 29, 2024
38 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants