-
Notifications
You must be signed in to change notification settings - Fork 29
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
feat(Canvas): Add dynamic labels to Canvas' nodes #556
Conversation
@ all sorry for the noisy diff, but since we're removing the |
286af88
to
45630b1
Compare
@@ -208,14 +207,10 @@ export class CanvasService { | |||
return edges; | |||
} | |||
|
|||
private static getNode( | |||
id: string, | |||
options: { label?: string; parentNode?: string; data?: CanvasNode['data'] } = {}, |
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.
Removing label
from the getNode
method
<DefaultNode element={element} showStatusDecorator {...rest}> | ||
<g data-testid={`custom-node__${vizNode?.id}`}> | ||
<DefaultNode element={element} label={label} truncateLength={15} {...rest} showStatusDecorator> | ||
<g data-testid={`custom-node__${vizNode?.id}`} data-nodelabel={label}> |
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.
@tplevko Since long labels might be truncated, the entire label will be held in the data-nodelabel
attribute, I updated the e2e commands to reflect this.
if (camelElementLookup.componentName !== undefined) { | ||
return camelElementLookup.componentName; | ||
} | ||
|
||
const uriString = getUriString(definition); |
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.
Streamlined how to extract the uri
string, considering whether the definition is a string or if it's an object with a uri
property in it. It also handles empty string cases.
@@ -141,11 +146,15 @@ export class CamelComponentSchemaService { | |||
*/ | |||
// eslint-disable-next-line @typescript-eslint/no-explicit-any | |||
private static getCamelElement(processorName: keyof ProcessorDefinition, definition: any): ICamelElementLookupResult { | |||
if (!isDefined(definition)) { |
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.
If there's no node definition, it's probably that the node no longer exists, so better to fallback to the processorName
45630b1
to
804f4c7
Compare
That inline? hover looks nice 👍 |
Currently, the node's label is set once while creating the graph. This commit changes this behavior by reading the label on each node, by leveraging the new `getLabel` method in `IVisualizationNode`, `CamelRouteVisualEntity` and `PipeVisualEntity` classes. By removing the `label` property from the `data` object from `VisualizationNode`, the node id become more relevant. fix: KaotoIO#483
804f4c7
to
92bbd87
Compare
Context
Currently, the node's label is set once while creating the graph.
Changes
This pull request changes this behavior by reading the label on each node, by leveraging the new
getLabel
method inIVisualizationNode
,CamelRouteVisualEntity
andPipeVisualEntity
classes.By removing the
label
property from thedata
object fromVisualizationNode
, the node id become more relevant.Screenshots
Node with a short description
Node with a long description
A longer description on hover
fix: #483