-
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
[doc] Add initial ADR for the selection dialog as a tree #3723
Conversation
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.
Ok on my side
3f6485e
to
f9ec7fb
Compare
4736d31
to
350670a
Compare
|
||
In addition, the Selection computed by the `SelectionRender` by the server will now return the containment information: | ||
The GraphQL subscription query will thus have a fixed depth. The containment information will be owned by a field called `parentId`. |
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.
Are you sure about that? What about an update of the subscription that will modify the depth of the tree?
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 looked at the TreePropertySection and it uses that kind of data structure to deal with that issue.
I did not understand the first time why we made this choice but when I started to implement this ADR I understood why: we can't build a recursive query without knowing the tree depth.
Are you sure about that? What about an update of the subscription that will modify the depth of the tree?
I'm not sure to understand: that would suppose to have the depth information updated and sent a new request with the same containment depth with
objects {
...
objects {
...
objects {
etc.
}
}
}
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.
Note that it is what we doing for diagrams but I suppose that it makes sense to limit the node hierarchy:
(see in diagramFragment.ts)
nodes {
...nodeFragment
borderNodes {
...nodeFragment
}
childNodes {
...nodeFragment
borderNodes {
...nodeFragment
}
childNodes {
...nodeFragment
borderNodes {
...nodeFragment
}
childNodes {
...nodeFragment
borderNodes {
...nodeFragment
}
childNodes {
...nodeFragment
borderNodes {
...nodeFragment
}
childNodes {
...nodeFragment
borderNodes {
...nodeFragment
}
}
}
}
}
}
}
@@ -107,6 +118,8 @@ Root | |||
|_ (F) | |||
``` | |||
|
|||
==== Frontend |
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.
What about an update of the subscription that will modify the tree? You should also be able to keep the already expanded nodes expanded.
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.
IMO, keeping the expanded state locally to the user makes sense since we don't share the representation with others.
e129ca6
to
ea2acd9
Compare
f9ec7fb
to
c022bec
Compare
ea2acd9
to
810efc0
Compare
a8b0435
to
5d1ab9b
Compare
810efc0
to
bd950bb
Compare
I've rebased the PR, I'll look into it |
|
||
== Context | ||
|
||
We have restored the previous deactivated Selection Dialog in the context of the ADR: _[ADR-152] Reactivate the Selection Dialog Tool_. |
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.
The reference of the ADR has been modified
The `SelectionDialogDescription` from the Diagram View model will have two additional boolean attributes: | ||
|
||
* `displayedAsTree`: to indicate whether the dialog layout should be a tree. | ||
* `expandedAtOpening`: to indicate if the tree should be expanded by default (that means all tree items are expanded at opening) |
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 don't think that this can realistically ever be a viable option given the MASSIVE performance cost that this would create in any meaningful project.
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.
The idea is to let the possibility for the specifier to reveal in the tree the selectable elements.
That would avoid for the end user to unfold each tree item to search for a specific element.
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.
And there's a difference between expanding some elements and expanding all elements (which would have a MASSIVE performance cost)
* `displayedAsTree`: to indicate whether the dialog layout should be a tree. | ||
* `expandedAtOpening`: to indicate if the tree should be expanded by default (that means all tree items are expanded at opening) | ||
|
||
==== Backend and GraphQL API |
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.
We won't re-invent a tree representation, open an alternate version of the dialog with a <TreeView />
inside and use the tree representation directly. It support more than enough features.
e2da79d
to
d9c93d8
Compare
The specifier will choose whether the objects returned by the candidates expression will be displayed as a tree or as a flat list. | ||
|
||
The `SelectionDialogDescription` from the Diagram View model will have an additional boolean attributes: | ||
|
||
* `displayedAsTree`: to indicate whether the dialog layout should be a tree. |
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 it be enough? How can you figure out how to display a simple list as a tree? We should probably hardcore a TreeDescription in the view converter for now
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'm not sure to understand. For me, we will have an hard-coded TreeDescription but provider by an IEditingContextRepresentationDescriptionProvider ?
|
||
==== Backend and GraphQL API | ||
|
||
If the displayedAsTree is true, we will rely on the TreeRepresentation instead of the current SelectionRepresentation. |
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.
How will the specifier be able to configure that?
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.
For me, the specifier will only indicate by a boolean (a checkbox in the studio) in the SelectionDescription whether he want to display the selectable element as a list or as a tree.
displayedAsTree: Boolean! | ||
objects: [SelectionObject!]! |
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 need to reuse a tree subscription instead of the raw selection subscription with its list of objects. I don't understand why this needs to be modified and why displayedAsTree
should exist on both Selection
and its description.
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.
Ok with that but I still have a problem with the "message"
I agree to avoid opening a subscription toward the SelectionRepresentation if the SelectionDialog is intended to represent selectable elements as a tree (in this case we will rely on the TreeView).
The message specified by the specifier is for now not interpreted but the SelectionDescription java pojo code relies on a messageProvider (Function<VariableManager, String>) so it could be interpreted in the future.
So in this case, I'm not sure what I should do to compute the dialog message which is common for both flat and tree representations.
Should I provide the displayAsTree and the message statically by passing them in the graphQL API :
instead of :
type SingleClickOnDiagramElementTool implements Tool {
id: ID!
label: String!
iconURL: [String!]!
appliesToDiagramRoot: Boolean!
dialogDescriptionId: String
targetDescriptions: [DiagramElementDescription!]!
}
We will have :
type SingleClickOnDiagramElementTool implements Tool {
id: ID!
label: String!
iconURL: [String!]!
appliesToDiagramRoot: Boolean!
dialogDescription: DialogDescription
targetDescriptions: [DiagramElementDescription!]!
}
type DialogDescription {
id: String!
parameters; [DialogDescriptionParamter!]!
}
type DialogDescriptionParamter {
key: String!
value; String!
}
==== Tree computation Algorithm | ||
|
||
Starting from objects returned by the candidates expression, we will compute all the ancestors hierarchy until we reach the root document. | ||
|
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.
We will use the tree subscription which let the specifier define how the tree structure is organized. We won't define any magic algorithm to create a tree, it's the plain old tree representation which can be organized any way we want. It may not follow EMF's EObject#eContents topological structure
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.
The idea is to describe how we will represent selectable elements.
It will be similar to org.eclipse.sirius.components.collaborative.widget.reference.browser.ModelBrowsersDescriptionProvider which remove all non selectable leaf from the result in getChildren
|
||
If the value of `displayedAsTree` is false, then we keep the current behavior. | ||
|
||
If the value of `displayedAsTree` is true, then we will use the `TreeView` component to display the content. We will have something similar to the following code: |
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 agree, and if it's not true, we will fallback on the existing selection subscription which means that this displayedAsTree boolean cannot be part of the selection subscription in the first place.
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.
See #3723 (comment)
Signed-off-by: Florian Barbin <[email protected]>
d9c93d8
to
72144db
Compare
This ADR has served its purpose as a support for the discussion, I'll merge it as is for now, it can be updated later to reflect the final state of the choices made. |
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?
Please describe here the various use cases to test this pull request