-
Notifications
You must be signed in to change notification settings - Fork 58
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
[4373] Allow backend definition of ExpandAll tool in the explorer #4378
base: master
Are you sure you want to change the base?
[4373] Allow backend definition of ExpandAll tool in the explorer #4378
Conversation
|
||
export const treeItemBackendContextMenuEntryExtensionPoint: ComponentExtensionPoint<TreeItemContextMenuComponentProps> = | ||
{ | ||
identifier: 'treeItem#backendContextMenuEntry', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I defined a new extension point for these components because treeItem#contextMenuEntry
corresponds to pure frontend components: their precondition is evaluated in the frontend, and is the only thing that matters to display them or not.
On the other hand, treeItem#backendContextMenuEntry
corresponds to frontend components that can be received from the backend (they may be in the received payload, or not). As a result, they are added to the menu only if they are part of the payload.
There is maybe a better way to do that, but my main idea was to limit the changes to ExpandAll, and not change other contributions using the treeItem#contextMenuEntry
extension point. This implementation also ensures that the behavior of existing contributions using the treeItem#contextMenuEntry
remains the same after this PR.
} | ||
`; | ||
|
||
export const useExpandAll = (expanded: string[], maxDepth: number): UseExpandAllValue => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I created a hook for the "default expand all behavior", because this feature is not only needed by the ExpandAll tool in the contextual menu, but also by the model browser and selection widget.
The new Sirius Web ExpandAll contribution uses this hook, but downstream applications can override it while keeping the existing behavior of the model browser and reference widget.
* This constructs an instance from a factory and a notifier. <!-- | ||
* begin-user-doc --> <!-- end-user-doc --> | ||
* This constructs an instance from a factory and a notifier. <!-- begin-user-doc --> <!-- end-user-doc --> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tried to fix the formatting but couldn't make it work. I guess my configuration is different from the one of the previous committer. Let me know if this is not acceptable and I'll manually update it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I reused the icon for the SingleClickTreeItemContextMenuEntry. Let me know if I should use something else.
The main idea of the PR is to extract the ExpandAll context menu entry as a Sirius Web contribution. This implies that the expand all logic should be removed from sirius-components-trees. Trees now provide a single function to update the expanded items they contain. On the backend side, the View DSL now contains a Sirius Web has been updated to define an ExpandAll contribution that matches the previous behavior. This contribution is used in all the places where ExpandAll was previously available. |
f7e5f0d
to
c92f64d
Compare
Bug: eclipse-sirius#4373 Signed-off-by: Gwendal Daniel <[email protected]>
c92f64d
to
8d20c63
Compare
Bug: #4373
Pull request template
General purpose
What is the main goal of this pull request?
Project management
priority:
andpr:
labels been added to the pull request? (In case of doubt, start with the labelspriority: low
andpr: to review later
)area:
,difficulty:
,type:
)CHANGELOG.adoc
been updated to reference the relevant issues?CHANGELOG.adoc
? (Including changes in the GraphQL API)CHANGELOG.adoc
? For example indoc/screenshots/2022.5.0-my-new-feature.png
Architectural decision records (ADR)
[doc]
?CHANGELOG.adoc
?Dependencies
CHANGELOG.adoc
?CHANGELOG.adoc
?Frontend
This section is not relevant if your contribution does not come with changes to the frontend.
General purpose
Typing
We need to improve the typing of our code, as such, we require every contribution to come with proper TypeScript typing for both changes contributing new files and those modifying existing files.
Please ensure that the following statements are true for each file created or modified (this may require you to improve code outside of your contribution).
useMutation<DATA_TYPE, VARIABLE_TYPE>(…)
useQuery<DATA_TYPE, VARIABLE_TYPE>(…)
useSubscription<DATA_TYPE, VARIABLE_TYPE>(…)
useMachine<CONTEXT_TYPE, EVENTS_TYPE>(…)
useState<STATE_TYPE>(…)
?.
(if the GraphQL API specifies that a field cannot benull
, do not treat it has potentiallynull
for example)let diagram: Diagram | null = null;
)Backend
This section is not relevant if your contribution does not come with changes to the backend.
General purpose
Architecture
Review
How to test this PR?
This PR shouldn't change the current behavior of Sirius Web.
To test that expand all is working as before, open a studio and:
Ensure that the ExpandAll tool is available and works as expected in the default explorer
Ensure that the ExpandAll tool is available and works as expected in the domain explorer
Ensure that the ExpandAll tool is available and works as expected in a domain tree representation
Ensure that the ExpandAll button is available and works as expected in the model browser
Open a papaya project and:
Ensure that the ExpandAll button is available and works as expected in the selection widget
Has the Kiwi TCMS test suite been updated with tests for this contribution?