Skip to content
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

Smart Connector UIExtension #308

Open
wants to merge 27 commits into
base: master
Choose a base branch
from

Conversation

yentelmanero
Copy link

@yentelmanero yentelmanero commented Nov 30, 2023

This PR is part of my bachelor research conducted in TU Wien in the Business Informatics Group.


In this PR, the Smart Connector UIExtension, which is a Tool that hovers around the selected node, simplifying the creation of new nodes and edges, was created.

Here are some screenshots of the UIExtension:

image
image
(different types of nodes can have different options)

Server PR
Theia PR

@yentelmanero yentelmanero changed the title glsp-client merge smart connector Smart Connector UIExtension Nov 30, 2023
Copy link
Contributor

@haydar-metin haydar-metin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR! I did just a preliminary look through the code. After the server-side compiles correctly, I will try it out and look deeper into the code.

Can you also add some description to your PR and reference the other PRs you have created, something like:

This PR is part of my bachelor research conducted in TU Wien in the [Business Informatics Group](https://www.big.tuwien.ac.at/).

---

<Little Description>

<Other PR references>

packages/client/src/utils/html-utils.ts Outdated Show resolved Hide resolved
packages/protocol/src/action-protocol/smart-connector.ts Outdated Show resolved Hide resolved
this.createTool(item);
}
if (event.ctrlKey) {
// matchesKeystroke with Ctrl and Ctrl+F does not seem to work on Windows 11/Chrome
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reminder to find out why afterward

@yentelmanero
Copy link
Author

Thanks for the PR! I did just a preliminary look through the code. After the server-side compiles correctly, I will try it out and look deeper into the code.

Can you also add some description to your PR and reference the other PRs you have created, something like:

This PR is part of my bachelor research conducted in TU Wien in the [Business Informatics Group](https://www.big.tuwien.ac.at/).

---

<Little Description>

<Other PR references>

@haydar-metin, unfortunately, the server cannot build because of the missing packages from this PR. Is there a way to circumvent this issue?

Copy link
Contributor

@haydar-metin haydar-metin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you very much, I just tested it and reviewed the code. Largely the code looks good. There are some small requests from me. Functionality wise it looks very good! Just small remarks.

Can you also add the finished solution as an image to the PR? Similar to the images provided here.

Styling

image

I think visually it would be more appealing if the boxes would have a top and bottom border. Otherwise it looks like there is more.

Usage

image

I think in those cases nothing should be shown?


We are almost there! Good job!

packages/protocol/src/action-protocol/smart-connector.ts Outdated Show resolved Hide resolved
yentelmanero and others added 2 commits January 30, 2024 15:28
… change Smart Connector state, added top and bottom borders to Smart Connector
@haydar-metin
Copy link
Contributor

UI

image

  1. You probably need to add a background. .smart-connector-group-container is transparent
  2. The arrow is not correctly aligned
  3. Scrollbar is not visible - in the CSS you want to show it but is not shown

Can you add a listener for Escape that closes the smart connector

Other

  1. Please resolve all the comments I have written and which are already finished (I can not to that)
  2. Please install Prettier and run the auto format for all of your files
  3. I will then notify someone else and then we can probably merge it if everything works as intended

@yentelmanero
Copy link
Author

UI

image

  1. You probably need to add a background. .smart-connector-group-container is transparent
  2. The arrow is not correctly aligned
  3. Scrollbar is not visible - in the CSS you want to show it but is not shown

Can you add a listener for Escape that closes the smart connector

Other

  1. Please resolve all the comments I have written and which are already finished (I can not to that)
  2. Please install Prettier and run the auto format for all of your files
  3. I will then notify someone else and then we can probably merge it if everything works as intended

Hi, how are you running the project? I am running the client and then the theia integration and there are no issues here as you can see in a similar image:

image

@haydar-metin
Copy link
Contributor

haydar-metin commented Feb 9, 2024

Hey, I also tested the standalone version, that means you need to build the client with yarn and start your node server with yarn start -w -p 8081. Then you need to open the file: file:///.../glsp-client/examples/workflow-standalone/app/diagram.html in your browser. I think you just need to move some of your CSS there. (PS: You need to recompile the workflow-standalone after changes)

https://github.com/eclipse-glsp/glsp-client?tab=readme-ov-file#how-to-start-the-workflow-diagram-example

this.hideSmartConnector();
// assumes that the graph is always the last child of base div
// this focus is done to "reactivate" the key listener to re-open if needed
document.getElementById(this.options.baseDiv)?.last().focus();
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since the focus is lost when the connector is closed, the KeyListener does not react to any inputs. It does also not react when any tool is selected. Because of this, I just added a onkeydown event on every tool and when it closes, it refocuses on the base div (the graph). Is this assumption here correct? Or is there a better way to get the base div?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure what you mean, why is it bad that the focus is lost when you hide the connector?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because the KeyListener does not react anymore. So if I, for example, open the connector with space, close it again with escape and then try to open it again, it won't work

@yentelmanero
Copy link
Author

@haydar-metin Hi, is there any information regarding the status of the PR? Are there any more changes to be done?

@haydar-metin
Copy link
Contributor

@yentelmanero I requested a second review internally. After that, we can merge it.

@tortmayr tortmayr self-requested a review March 25, 2024 07:48
Copy link
Contributor

@tortmayr tortmayr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In general the code looks good to me and the SmartConnector seems to work really well.
I have a couple of inline comments/suggestions.

As we discussed offline we would prefer to drop the concept of SmartConnector in favor of a more generic SelectionPalette and SelectionPaletteProvider API.

Please rename the corresponding artifacts accordingly.

Also there seems to be some room for improvements regarding the positing of the smartconnector when moving/resizing a node and scrolling/zooming:

  • Scrolling/zooming: When scrolling or zooming the smart connector gets hidden although the node is still selected
  • Resize: The position of the + button is not recentered when resizing
  • Moving: The smart connector gets hidden during move (which is fine imo) but is not set visible again once the move is finished. (Node is still selected)

However, these are issue that can be addressed in a follow-up PR and don't necessarily have to be covered by you.

packages/client/src/default-modules.ts Outdated Show resolved Hide resolved
packages/client/src/utils/htmlelement-extensions.ts Outdated Show resolved Hide resolved
packages/protocol/src/action-protocol/smart-connector.ts Outdated Show resolved Hide resolved
packages/protocol/src/action-protocol/smart-connector.ts Outdated Show resolved Hide resolved
packages/protocol/src/action-protocol/smart-connector.ts Outdated Show resolved Hide resolved
@yentelmanero
Copy link
Author

yentelmanero commented Apr 2, 2024

Hi @tortmayr, thanks for the feedback.

I changed the code snippets as requested and also added that the selection palette does not disappear when panning and zooming, since that changed seemed simple enough to do it relatively quickly.

Since I changed quite a bit of code there, because I am not using the DOM measurements anymore but the Viewport and GNode data, I would ask you to please review those parts once again. The reason I changed that is because element.getBoundingClientRect() was too slow in delivering the needed information, so I would calculate with the old frame, while already showing a new frame, resulting in wrong behaviour when zooming.

I am also not entirely sure if the way I added the explicit module imports (for both workflow-standalone and workflow-theia) was done correctly, but it worked after I added those and it did not before.

@yentelmanero
Copy link
Author

Hi @tortmayr, thanks for the feedback.

I changed the code snippets as requested and also added that the selection palette does not disappear when panning and zooming, since that changed seemed simple enough to do it relatively quickly.

Since I changed quite a bit of code there, because I am not using the DOM measurements anymore but the Viewport and GNode data, I would ask you to please review those parts once again. The reason I changed that is because element.getBoundingClientRect() was too slow in delivering the needed information, so I would calculate with the old frame, while already showing a new frame, resulting in wrong behaviour when zooming.

I am also not entirely sure if the way I added the explicit module imports (for both workflow-standalone and workflow-theia) was done correctly, but it worked after I added those and it did not before.

Update: now also added the selection palette moving when resizing or moving nodes, since I could not find an explanation why I did not do it when writing my thesis. Please review

@tortmayr
Copy link
Contributor

@yentelmanero
Thank your for this awesome contribution.
I have reviewed and tested the changes. Everything seems to work as expected and all review comments have been addressed.
Nice work!

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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants