Handlers for Smart Connector UIExtension#70
Conversation
…t, right, up, down)
|
Thanks for the PR! I will test it after the changes are done! Can you also add some description to your PR and reference the other PRs you have created, something like: |
|
|
||
| createSmartConnectorGroupItem(handlers: CreateOperationHandler[], kind: string, selectedNodeType: string, | ||
| showOnly?: SmartConnectorGroupUIType): PaletteItem[] { | ||
| const includedInNodeFilter = (e: string): boolean => this.nodeOperationFilter[selectedNodeType].includes(e); |
There was a problem hiding this comment.
The this.nodeOperationFilter[selectedNodeType].includes(e) part can cause an error if the selectedNodeType does not exist in nodeOperationFilter. Check the updated types provided before.
There was a problem hiding this comment.
Solution could be something like !!this.nodeOperationFilter[selectedNodeType]?.includes(e)
merge newest to fork
|
Did not mean to mention that PR with that last commit |
tortmayr
left a comment
There was a problem hiding this comment.
Thanks, in general the code looks good to me.
I have a few inline comments/suggestions.
As discussed offline we like to have a more generic SelectionPaletteProvider API instead of the SmartConnectorAPI. Please rename the artifacts accordingly.
Other than that the change works really well!
| }; | ||
|
|
||
| protected override nodeOperationFilter = { | ||
| [ModelTypes.AUTOMATED_TASK]: [ModelTypes.WEIGHTED_EDGE, ModelTypes.AUTOMATED_TASK, ModelTypes.MANUAL_TASK, |
There was a problem hiding this comment.
This could be handled generically. All the required information is present in the typehints of the DiagramConfiguration.
Could be moved up to the DefaultSmartConnectorProvider.
I don't expect that this is handled with this PR but we should create a follow-up for that.
| * A {@link ContextActionsProvider} for {@link PaletteItem}s in the Smart Connector which appears when a node is selected. | ||
| */ | ||
| @injectable() | ||
| export abstract class SmartConnectorItemProvider implements ContextActionsProvider { |
There was a problem hiding this comment.
As discussed offline we would like to use a more generic SelectionPaletteProvider API (that is inline with CommandPaletteProvider and ToolpaletteProvider) and the current SmartConnector is then just the default implementation of that provider.
So please rename this to SelectionPaletteProvider.
| }; | ||
|
|
||
| @injectable() | ||
| export class DefaultSmartConnectorItemProvider extends SmartConnectorItemProvider { |
There was a problem hiding this comment.
| export class DefaultSmartConnectorItemProvider extends SmartConnectorItemProvider { | |
| export class DefaultSelectionPaletteProvider` extends SelectionPaletteProvider { |
| * Returns the context id of the provider. | ||
| */ | ||
| get contextId(): string { | ||
| return 'smart-connector'; |
There was a problem hiding this comment.
| return 'smart-connector'; | |
| return 'selection-palette'; |
| container.children.push(element); | ||
| element.parent = container; | ||
| this.actionDispatcher.dispatchAfterNextUpdate(SelectAction.create({ selectedElementsIDs: [element.id] })); | ||
| // Creates default edge on node creation when a source ID is given in the CreateNodeOperation |
There was a problem hiding this comment.
I understand why this is done this way, but we should find a more generic solution here.
Ideally we would dispatch a CompoundOperation on the client-side that contains the CreateNode and CreateEdge operations. Currently the API does not support this, because we need context-specific information. i.e. the CreateEdge operation needs to know the id of the newly created node it should connect to.
We should create a follow-up for that.
| import { GNode } from '@eclipse-glsp/graph'; | ||
|
|
||
| @injectable() | ||
| export class OpenSmartConnectorActionHandler implements ActionHandler { |
There was a problem hiding this comment.
This should be handled entirely on client side.
The server should only provide the selection palette actions via the RequestContextActions handler but should not need to know any other implementation details about how they will be handled/rendered on the client side.
| binding.add(SaveModelActionHandler); | ||
| binding.add(UndoRedoActionHandler); | ||
| binding.add(ComputedBoundsActionHandler); | ||
| binding.add(OpenSmartConnectorActionHandler); |
There was a problem hiding this comment.
Should be handled on client side
…handler, is now handled client side
|
@yentelmanero We will keep this PR open and merge it after the 2.2.0 Release is done (end of May). This way we have a full release cycle to polish the feature and address follow-up issues before we are shipping it to adopters. In any case, from our side this concludes the practical aspect of your bachelor thesis. We don't require/desire any more changes from your side. Congrats! |
This PR is part of my bachelor research conducted in TU Wien in the Business Informatics Group.
In this PR, the ActionHandler and ContextActionProvider as well as the related workflow example implementations for the Smart Connector UIExtension are included (more info on Smart Connector in Client PR)
Client PR
Theia PR