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

Canvas: New basic elements #84205

Merged
merged 20 commits into from
Mar 21, 2024
Merged

Canvas: New basic elements #84205

merged 20 commits into from
Mar 21, 2024

Conversation

Develer
Copy link
Contributor

@Develer Develer commented Mar 11, 2024

What is this feature?

This PR implements new canvas elements like triangles, clouds, and parallelograms.

Which issue(s) does this PR fix?:

Fixes #83270 #74903

Special notes for your reviewer:

Please check that:

  • It works as expected from a user's perspective.
  • If this is a pre-GA feature, it is behind a feature toggle.
  • The docs are updated, and if this is a notable improvement, it's added to our What's New doc.
Screen.Recording.2024-03-18.at.17.57.38.mov

Added new shapes to existing canvas gdev dashboard for testing data links

Added.new.shapes.to.gdev.datalink.test.dashboard.mov

@Develer Develer added add to changelog area/panel/canvas Issues related to canvas panel no-backport Skip backport of PR area/dataviz Anything that relates to Data Visualisation work but is not specific to one panel labels Mar 11, 2024
@Develer Develer added this to the 11.0.x milestone Mar 11, 2024
@Develer Develer self-assigned this Mar 11, 2024
@Develer Develer changed the title WIP: Canvas: New basic elements Canvas: New basic elements Mar 12, 2024
@Develer Develer marked this pull request as ready for review March 12, 2024 16:58
@Develer Develer requested a review from a team as a code owner March 12, 2024 16:58
@Develer Develer requested review from leeoniya, adela-almasan, nmarrs and drew08t and removed request for a team March 12, 2024 16:58
@grafanabot
Copy link
Contributor

❌ Failed to run Playwright plugin e2e tests.

Click here to browse the Playwright report and trace viewer.
For information on how to run Playwright tests locally, refer to the Developer guide.

Copy link
Contributor

@nmarrs nmarrs left a comment

Choose a reason for hiding this comment

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

Great job on these @Develer!

Screen.Recording.2024-03-13.at.9.18.38.AM.mov

I think we need to figure out the question of how we handle these elements styling properties (such as background image / color / border)

With rectangle it is easy as the element fills the entire div making it very straightforward. However with ellipse and now these three added elements it is not clear that the styling should apply to the background of the element vs the element itself

IMO these settings should probably apply to the element themselves vs the background. How we address this might be a little tricky and is dependent on the WIP work here refactoring ellipse's approach to styling options

What I'm not sure about is providing ability to modify both element style and background styles and whether or not we need to update moveable's selection rendering (this might be very tricky, and maybe not necessary given draw.io does a box selection approach regardless of the element)

TLDR; I think we really need to figure out the current WIP of ellipse styling refactor, get to a "good enough" resolution for the time being to unblock this work

cc @lukasztyrala - interested in your thoughts here

public/app/features/canvas/elements/cloud.tsx Outdated Show resolved Hide resolved
public/app/features/canvas/elements/triangle.tsx Outdated Show resolved Hide resolved
public/app/features/canvas/elements/triangle.tsx Outdated Show resolved Hide resolved
public/app/features/canvas/elements/triangle.tsx Outdated Show resolved Hide resolved
public/app/features/canvas/elements/cloud.tsx Outdated Show resolved Hide resolved
Copy link
Contributor

@baldm0mma baldm0mma left a comment

Choose a reason for hiding this comment

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

LGTM!

@lukasztyrala
Copy link
Member

With rectangle it is easy as the element fills the entire div making it very straightforward. However with ellipse and now these three added elements it is not clear that the styling should apply to the background of the element vs the element itself

IMO these settings should probably apply to the element themselves vs the background. How we address this might be a little tricky and is dependent on #83714

From user's perspective, it will be expected that:

  1. The element's border option controls the border of the shape, not the container.
  2. The element's background option controls the color of the element, not the container.
  3. The background coloring based on Fields applies to the background of the element, not the container.

This is something we should address in future iterations. Apart from that, LGTM.

@Develer
Copy link
Contributor Author

Develer commented Mar 19, 2024

From user's perspective, it will be expected that:

  1. The element's border option controls the border of the shape, not the container.
  2. The element's background option controls the color of the element, not the container.
  3. The background coloring based on Fields applies to the background of the element, not the container.

This is something we should address in future iterations. Apart from that, LGTM.

Yes, that's what I already done in one of the last commits. At least ellipse, triangle, cloud, and parallelogram shapes have their own (not a container's) border and background.

Copy link
Collaborator

@codeincarnate codeincarnate left a comment

Choose a reason for hiding this comment

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

Looks pretty good! Did notice an issue with the cloud being cut off with larger border sizes. Also text layout on the triangle can get a little wonky but those can both be left for follow-ups I think 😄

Just an example of what I mean with the cloud:

Screenshot 2024-03-19 at 11 11 46 AM

Also, is the next step to add support for custom SVG elements 🤔 😆

public/app/features/canvas/elements/cloud.tsx Outdated Show resolved Hide resolved
public/app/features/canvas/elements/ellipse.tsx Outdated Show resolved Hide resolved
@Develer
Copy link
Contributor Author

Develer commented Mar 19, 2024

Looks pretty good! Did notice an issue with the cloud being cut off with larger border sizes. Also text layout on the triangle can get a little wonky but those can both be left for follow-ups I think 😄

Just an example of what I mean with the cloud:

Screenshot 2024-03-19 at 11 11 46 AM Also, is the next step to add support for custom SVG elements 🤔 😆

yes, I'm aware of it, I didn't find a quick solution, so definitely for a follow-up task 🙂

@Develer Develer requested a review from a team as a code owner March 20, 2024 23:00
@Develer Develer requested review from dprokop and ivanortegaalba and removed request for a team March 20, 2024 23:00
Copy link
Contributor

@nmarrs nmarrs left a comment

Choose a reason for hiding this comment

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

I will work on adding the migration code accounting for ellipse options changes and then I think this is in a "good enough" state to be merged, hopefully we can revisit the known bugs / issues as part of bug cleanup for actual G11 release build 😬

public/app/features/canvas/elements/cloud.tsx Outdated Show resolved Hide resolved
public/app/features/canvas/types.ts Show resolved Hide resolved
@nmarrs
Copy link
Contributor

nmarrs commented Mar 21, 2024

I tried to address an issue I noticed where transparency background color is displayed as all black / is broken for the svg elements but wasn't able to figure out what was going wrong / the difference between color handling between svg elements / rectangle. I suspect it may be related to:

if (!SVGElements.has(elementType)) {

Transparent color doesn't seem to work as expected

I created this github issue to follow up on this

@nmarrs
Copy link
Contributor

nmarrs commented Mar 21, 2024

I'm going to defer to @Develer to merge this / run through and test things to make sure my changes didn't break anything 😬 I think we have a fair bit to come back to and address as part of polishing this up for main release 😅

@drew08t drew08t mentioned this pull request Mar 21, 2024
7 tasks
@Develer Develer merged commit 8b32073 into main Mar 21, 2024
14 checks passed
@Develer Develer deleted the 83270-canvas-triangle-item branch March 21, 2024 14:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
add to changelog area/dataviz Anything that relates to Data Visualisation work but is not specific to one panel area/frontend area/panel/canvas Issues related to canvas panel no-backport Skip backport of PR
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Canvas: Add most impactful element types that users expect in flow charts
7 participants