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
[3429] Add diagram filter view in diagram panel #3430
base: master
Are you sure you want to change the base?
Conversation
87b9db0
to
22ccf5e
Compare
.../org/eclipse/sirius/web/application/views/explorer/services/ExplorerDescriptionProvider.java
Outdated
Show resolved
Hide resolved
packages/diagrams/frontend/sirius-components-diagrams/src/renderer/panel/DiagramPanel.tsx
Outdated
Show resolved
Hide resolved
...diagrams/frontend/sirius-components-diagrams/src/renderer/panel/DiagramPanelContribution.tsx
Outdated
Show resolved
Hide resolved
...irius/web/application/views/representations/services/DiagramFilterRefreshPolicyProvider.java
Outdated
Show resolved
Hide resolved
.../org/eclipse/sirius/web/application/views/explorer/services/ExplorerDescriptionProvider.java
Outdated
Show resolved
Hide resolved
...lication/views/diagramfilter/services/api/IDiagramFilterSplitButtonContributionProvider.java
Outdated
Show resolved
Hide resolved
.../org/eclipse/sirius/components/forms/tests/graphql/DiagramFilterEventSubscriptionRunner.java
Outdated
Show resolved
Hide resolved
...ava/org/eclipse/sirius/web/application/views/diagramfilter/services/DiagramFilterHelper.java
Outdated
Show resolved
Hide resolved
...n/java/org/eclipse/sirius/components/collaborative/forms/api/DiagramFilterConfiguration.java
Outdated
Show resolved
Hide resolved
7ec2a29
to
516b195
Compare
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 have not executed the feature yet to play with it but the code seems nice. Given the complexity of the work that you've done, don't be surprised by the number of comments. It was expected.
CHANGELOG.adoc
Outdated
@@ -109,6 +109,11 @@ image:doc/screenshots/inside_outside_labels.png[Isinde outside label example, 70 | |||
- https://github.com/eclipse-sirius/sirius-web/issues/3382[#3382] [diagram] Add a tool section in Node and Edge palettes with tools to hide/show/reset elements and their children. | |||
- https://github.com/eclipse-sirius/sirius-web/issues/3135[#3135] [diagram] Add new overflow strategies for node label : _wrap_ and _ellipsis_ | |||
- https://github.com/eclipse-sirius/sirius-web/issues/3425[#3425] [diagram] Make the direction applied during _arrangeAll_ configurable. | |||
- https://github.com/eclipse-sirius/sirius-web/issues/3429[#3429] [diagram] Add a diagram filter view in the diagram panel. | |||
This view presents diagram elements in a tree and allows to select them and apply tools on the selection (e.g. hide, show, collapse). |
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.
apply tools on the selection
I would rather say "update their visibility and status" or something like that because "tools" are defined by the specifier with any behavior they want. With this sentence, consumers of Sirius Web may believe that we have added the ability to execute tools on a batch of elements at once. It could be a nice addition in the future but it's not what you have done here.
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.
Done
@@ -57,6 +60,7 @@ export const DiagramPanel = memo( | |||
}); | |||
|
|||
const { readOnly } = useContext<DiagramContextValue>(DiagramContext); | |||
const { views } = useContext<DiagramPanelViewContextValue>(DiagramPanelViewContext); |
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.
Leverage the existing extension capabilities to add this new mechanism. See useComponents
for example. You should end up with something like this:
const diagramPanelActionComponents: ComponentExtension<DiagramPanelActionProps>[] = useComponents(diagramPanelActionExtensionPoint);
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.
done
{views.map((view) => { | ||
return ( | ||
<DiagramPanelContribution | ||
view={view} | ||
editingContextId={editingContextId} | ||
diagramId={diagramId} | ||
key={view.title} | ||
/> | ||
); | ||
})} |
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.
Just let people contribute any component they want here but ask for one which accept specific props. Something like:
interface DiagramPanelActionProps {
editingContextId: string;
diagramId: diagramId;
}
You can thus remove DiagramPanelContribution.tsx
and DiagramPanelContribution.types.ts
from here (the code would be used specifically in your filter action) but not everybody wants that specific behavior
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.
done
* Contributors: | ||
* Obeo - initial API and implementation | ||
*******************************************************************************/ | ||
import React from 'react'; |
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.
View
has multiple very specific meaning in Sirius Web but it's mostly the root concept where representation description are created or the workbench views like the explorer or the details/properties view. Try not to use this term as much as possible, there's not reason to have anything in this contribution named view.
You don't need a new context for this feature, use the extension capabilities of sirius-components-core
. You can remove this file entirely
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.
Renamed the contribution to "DiagramFilter", and the component containing the form to "DiagramFilterForm"
* Contributors: | ||
* Obeo - initial API and implementation | ||
*******************************************************************************/ | ||
import { WorkbenchViewComponentProps } from '@eclipse-sirius/sirius-components-core'; |
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.
Can be removed in favor of the extension capabilities of sirius-components-core
. Do not use WorkbenchViewComponentProps
, it exists to contribute new panels on the side of the workbench like the explorer. You can remove this file entirely
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.
done
} | ||
|
||
public IStatus sendDiagramEvent(VariableManager variableManager, IDiagramInput diagramInput) { | ||
IRepresentationEventProcessor representationEventProcessor = variableManager.get("diagramEventProcessor", IRepresentationEventProcessor.class).get(); |
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.
Use some constants to share the name of the variable between this class and DiagramFilterDescriptionProvider
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.
done
private final Logger logger = LoggerFactory.getLogger(DiagramFilterHelper.class); | ||
|
||
public Set<String> getSelectedElementIds(VariableManager variableManager) { | ||
Map<String, Boolean> checkMap = variableManager.get(DiagramFilterDescriptionProvider.SELECTED_TREE_NODES, Map.class).get(); |
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.
Don't use .get() on optional without testing that the value is present first.
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.
done
.foregroundColor("#000000") | ||
.build() | ||
) | ||
.helpTextProvider(variableManager -> "Pin selected elements") |
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.
Use the internationalization support for text sent back to the end user (this applies to other button description provider)
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.
done
var optTreeWidget = group.getWidgets().stream() | ||
.filter(TreeWidget.class::isInstance) | ||
.map(TreeWidget.class::cast) | ||
.findFirst(); |
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.
=you can continue using the form navigator to retrieve the tree widget and ensure that it is present
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 should know that 🙂
Done
.backgroundColor("#ffffff") | ||
.foregroundColor("#000000") |
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.
Do you need to change the default style of the buttons? Because #000000
is not the color of the text in Sirius Web and in most applications based on Sirius Web.
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.
@mbats asked me to put the background in white, because the default colors for the buttons weren't working fine (see screenshot below).
The default foreground color for buttons is white, so I had to change it to make the text visible. I updated it to use #261E58
to match the default text color in Sirius Web, but it will be hardcoded and won't change if the theme changes. Let me know if this is fine for you or if we need something else
148fcd0
to
5eeb50e
Compare
Bug: eclipse-sirius#3429 Signed-off-by: Gwendal Daniel <gwendal.daniel@obeosoft.com>
5eeb50e
to
35bc7d5
Compare
Bug: #3429
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?