Skip to content

Commit

Permalink
[doc] Add ADR for filtering tree based representations
Browse files Browse the repository at this point in the history
Bug: #1918
Signed-off-by: Axel RICHARD <axel.richard@obeo.fr>
  • Loading branch information
AxelRICHARD authored and sbegaudeau committed May 15, 2023
1 parent f581a74 commit fba8179
Show file tree
Hide file tree
Showing 3 changed files with 56 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
=== Architectural decision records

- [ADR-098] Use the editing context to compute the metamodels
- [ADR-099] Filter tree based representations

=== Breaking changes

Expand Down
54 changes: 54 additions & 0 deletions doc/adrs/099_filter_tree_based_representations.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
= ADR-099 - Filtering tree based representations

== Context

It is quite difficult to identify specific tree item(s) in a tree when this tree contains lots of tree items.

== Decision

Add a filtering capacity in the Explorer View and other tree based representations, by providing a textual filtering of the tree just like what is being done in VSCode using a simple textfield.

The solution should not slow-down the user interface.
The user interface must remains as smooth as it was before the developments of this filter.
The results displayed by the filter should be visible immediately, i.e. without any latency.
Otherwise, if the solution can only be implemented with a latency, then during the computation time, a "busy" indicator should be displayed, informing the user his request is processing.

The implementation of the solution will only modify the frontend.

=== Frontend

A new `FilterBar.tsx` component will be introduced.

[source,typescript]
----
export const FilterBar = ({ onTextChange, onFilterButtonClick, onClose }: FilterBarProps) => {
...
}
----

A new `FilterBar.types.ts` file will be introduced.

[source,typescript]
----
export interface FilterBarProps {
onTextChange: (newFilterText: string) => void;
onFilterButtonClick: (enabled: boolean) => void;
onClose: () => void;
}
----

`Tree.tsx` will be able to detect a new shortcut (ctrl+f).
This shortcut will enable a filter bar: a simple textfield, a filter button and a close button.
Material-UI will be used to provide the textfield and buttons.

`TreeItem.tsx` will be modified to be able to highlight the text typed in the filter bar and to potentially hide itself when the filter button is enabled.

== Status

WIP.

== Consequences

In most web browsers, the ctrl+f shortcut allows to enable the web browser search.
With this new feature, when the Explorer View of sirius-components or all other tree based representation is selected in sirius-components based applications, the ctrl+f shortcut will enable the filter bar instead.
We could choose to only enable the filter bar when a tree item is selected to reduce the scope of the ctrl+f shortcut overriding.
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ Each character added/removed in the filtering bar updates the highlighted tree i
User close the filtering bar with the close button.
All highlighted items are not highlighted anymore.

=== Scenario 2 - Hide elements using a rilter
=== Scenario 2 - Hide elements using a filter

User want to filter tree items containing a specific value as their label or part of their label.
User type the shortcut to enable the filtering bar.
Expand Down

0 comments on commit fba8179

Please sign in to comment.