feat(Canvas): copy-paste yaml support#3449
Conversation
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
📝 WalkthroughWalkthroughThis PR replaces the JSON clipboard model with YAML-backed ChangesClipboard model migration
Estimated code review effort: 4 (Complex) | ~60 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
3bf1fa1 to
a8405c9
Compare
There was a problem hiding this comment.
Actionable comments posted: 3
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
packages/ui/src/models/visualization/flows/citrus-test-visual-entity.ts (1)
243-267: 🎯 Functional Correctness | 🟠 Major | ⚡ Quick winReturn the raw action payload from
getCopiedContent()
definitionshould be the action object itself, not{ print: {...} };ClipboardService.copy()already wraps it undername, so the current shape serializes to double-nested YAML and breaks cross-app clipboard compatibility.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@packages/ui/src/models/visualization/flows/citrus-test-visual-entity.ts` around lines 243 - 267, getCopiedContent() is returning the action payload in an extra wrapper shape, which causes clipboard data to be nested incorrectly. Update CitrusTestVisualEntity.getCopiedContent() so the returned clipboard definition is the raw action object itself for a copied step, while still keeping the root test case behavior unchanged; this will let ClipboardService.copy() handle the outer name wrapper and avoid double-nested serialization. Ensure the same structure is what pasteStep() expects when it reads clipboardContent.definition.
🧹 Nitpick comments (5)
packages/ui/src/services/visualization/clipboard.service.ts (1)
39-43: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueDuplicated
ClipboardItem.supports?.(KAOTO_MIME_TYPE)check.
copy()andgetBestMimeType()both re-implement the same "is the custom Kaoto MIME type supported" check. Extracting a small private helper (e.g.isKaotoMimeTypeSupported()) would remove the duplication.Also applies to: 55-70
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@packages/ui/src/services/visualization/clipboard.service.ts` around lines 39 - 43, The Kaoto MIME type support check is duplicated in ClipboardService between copy() and getBestMimeType(), so extract it into a private helper such as isKaotoMimeTypeSupported() and use that helper in both places. Update the ClipboardService methods to call the shared helper instead of rechecking ClipboardItem.supports?.(ClipboardService.KAOTO_MIME_TYPE) inline, keeping the existing behavior unchanged.packages/ui/src/services/visualization/clipboard.service.test.ts (1)
151-165: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick winConsider adding a test for shorthand string step values.
Coverage is solid, but there's no test for parsing YAML where the value under the key is a plain string (e.g.
to: mock:middle), which is valid Camel YAML DSL syntax and currently accepted as-is byparseYamlToClipboardContentdespite thedefinition: objectcontract. Adding a case here would pin down the intended behavior once the parsing gap inclipboard.service.tsis addressed.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@packages/ui/src/services/visualization/clipboard.service.test.ts` around lines 151 - 165, Add a test case in ClipboardService.paste coverage for shorthand string step values, since parseYamlToClipboardContent currently accepts plain-string YAML values even though the clipboard content contract expects an object definition. Extend the existing clipboard.service.test.ts suite near the current raw-YAML test to cover an input like a key mapped to a string, and assert the intended ClipboardService.paste result so the behavior is pinned down once clipboard.service.ts is updated.packages/ui/src/models/visualization/flows/pipe-visual-entity.test.ts (1)
730-757: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winMissing test coverage for the new root-path copy branch.
getCopiedContentnow special-casespath === this.getRootPath()to return{ name: 'pipe', definition: this.pipe }(pipe-visual-entity.ts, lines 150-153), but thisdescribe('getCopiedContent', ...)block only covers step paths and the invalid-path case. Consider adding a test asserting the root-path branch returns the full pipe CR.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@packages/ui/src/models/visualization/flows/pipe-visual-entity.test.ts` around lines 730 - 757, Add a test in getCopiedContent to cover the new root-path branch in pipeVisualEntity.getCopiedContent. The current describe('getCopiedContent', ...) only verifies step paths and invalid/undefined input, so include a case where the path matches pipeVisualEntity.getRootPath() and assert it returns the full pipe CR shape with name 'pipe' and definition set to pipeVisualEntity.pipe.packages/ui-tests/cypress/support/next-commands/default.ts (2)
395-410: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winDeduplicate the two MIME-type parsing branches.
The
web text/kaotoandtext/plainbranches are identical apart from the MIME type string; extract a shared helper to read/parse/normalize a clipboard item.♻️ Proposed refactor
+async function readAndNormalize(item: ClipboardItem, mimeType: string) { + const blob = await item.getType(mimeType); + const yamlText = await blob.text(); + return normalizeClipboardContent(parse(yamlText)); +} + if (item.types.includes('web text/kaoto')) { - const blob = await item.getType('web text/kaoto'); - const yamlText = await blob.text(); - const parsedContent = parse(yamlText); - - // Normalize parsed YAML to IClipboardContent format - const clipboardContent = normalizeClipboardContent(parsedContent); + const clipboardContent = await readAndNormalize(item, 'web text/kaoto'); expect(clipboardContent).to.deep.equal(value); } if (item.types.includes('text/plain')) { - const blob = await item.getType('text/plain'); - const yamlText = await blob.text(); - const parsedContent = parse(yamlText); - - // Normalize parsed YAML to IClipboardContent format - const clipboardContent = normalizeClipboardContent(parsedContent); + const clipboardContent = await readAndNormalize(item, 'text/plain'); expect(clipboardContent).to.deep.equal(value); }🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@packages/ui-tests/cypress/support/next-commands/default.ts` around lines 395 - 410, The `item.types.includes('web text/kaoto')` and `item.types.includes('text/plain')` branches in `next-commands/default.ts` duplicate the same read/parse/normalize/assert flow. Extract that repeated logic into a shared helper near the clipboard handling code, and have both MIME-type checks call it with the item; keep the existing `normalizeClipboardContent` and `parse` behavior unchanged.
421-445: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winExport the clipboard parser and reuse it here.
packages/ui-testscan’t importpackages/ui/src/services/visualization/clipboard.service.tsdirectly, so this helper duplicatesClipboardService.parseYamlToClipboardContentand can drift. Re-export that parser throughpackages/ui’s testing API and import it here instead.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@packages/ui-tests/cypress/support/next-commands/default.ts` around lines 421 - 445, The YAML clipboard normalization logic in normalizeClipboardContent is duplicating ClipboardService.parseYamlToClipboardContent, which risks divergence. Re-export the parser through the packages/ui testing API and update the Cypress support code to import and use that shared parser instead of maintaining a local copy. Keep the existing normalizeClipboardContent call sites aligned with the shared parser’s return shape.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@packages/ui-tests/cypress/support/next-commands/default.ts`:
- Around line 421-445: The normalizeClipboardContent helper still accepts a null
first element in the array branch because typeof null is object, which can cause
Object.keys(parsed[0]) to throw. Update the array handling in
normalizeClipboardContent to explicitly reject null before reading keys,
alongside the existing parsed[0] shape checks, so invalid clipboard payloads
return null safely for both array and object formats.
In `@packages/ui/src/models/visualization/flows/kamelet-visual-entity.ts`:
- Around line 94-104: Add test coverage for the root-path branch in
getCopiedContent on KameletVisualEntity: verify that when the input matches
getRootPath() it returns an IClipboardContent with name set to kamelet and
definition pointing to this.kamelet, and also confirm that non-root paths still
fall through to the inherited super.getCopiedContent(path) behavior.
In `@packages/ui/src/services/visualization/clipboard.service.ts`:
- Around line 17-18: The hardcoded ENTITY_TYPES whitelist in ClipboardService is
missing root entities like errorHandler and restConfiguration, causing copy() to
wrap them in arrays and alter the YAML shape. Update ClipboardService.copy() to
treat all canonical root entity names as top-level entities by deriving
ENTITY_TYPES from the shared entity-type source instead of maintaining a
separate static list, and ensure the logic that decides whether to wrap in an
array uses that canonical set.
---
Outside diff comments:
In `@packages/ui/src/models/visualization/flows/citrus-test-visual-entity.ts`:
- Around line 243-267: getCopiedContent() is returning the action payload in an
extra wrapper shape, which causes clipboard data to be nested incorrectly.
Update CitrusTestVisualEntity.getCopiedContent() so the returned clipboard
definition is the raw action object itself for a copied step, while still
keeping the root test case behavior unchanged; this will let
ClipboardService.copy() handle the outer name wrapper and avoid double-nested
serialization. Ensure the same structure is what pasteStep() expects when it
reads clipboardContent.definition.
---
Nitpick comments:
In `@packages/ui-tests/cypress/support/next-commands/default.ts`:
- Around line 395-410: The `item.types.includes('web text/kaoto')` and
`item.types.includes('text/plain')` branches in `next-commands/default.ts`
duplicate the same read/parse/normalize/assert flow. Extract that repeated logic
into a shared helper near the clipboard handling code, and have both MIME-type
checks call it with the item; keep the existing `normalizeClipboardContent` and
`parse` behavior unchanged.
- Around line 421-445: The YAML clipboard normalization logic in
normalizeClipboardContent is duplicating
ClipboardService.parseYamlToClipboardContent, which risks divergence. Re-export
the parser through the packages/ui testing API and update the Cypress support
code to import and use that shared parser instead of maintaining a local copy.
Keep the existing normalizeClipboardContent call sites aligned with the shared
parser’s return shape.
In `@packages/ui/src/models/visualization/flows/pipe-visual-entity.test.ts`:
- Around line 730-757: Add a test in getCopiedContent to cover the new root-path
branch in pipeVisualEntity.getCopiedContent. The current
describe('getCopiedContent', ...) only verifies step paths and invalid/undefined
input, so include a case where the path matches pipeVisualEntity.getRootPath()
and assert it returns the full pipe CR shape with name 'pipe' and definition set
to pipeVisualEntity.pipe.
In `@packages/ui/src/services/visualization/clipboard.service.test.ts`:
- Around line 151-165: Add a test case in ClipboardService.paste coverage for
shorthand string step values, since parseYamlToClipboardContent currently
accepts plain-string YAML values even though the clipboard content contract
expects an object definition. Extend the existing clipboard.service.test.ts
suite near the current raw-YAML test to cover an input like a key mapped to a
string, and assert the intended ClipboardService.paste result so the behavior is
pinned down once clipboard.service.ts is updated.
In `@packages/ui/src/services/visualization/clipboard.service.ts`:
- Around line 39-43: The Kaoto MIME type support check is duplicated in
ClipboardService between copy() and getBestMimeType(), so extract it into a
private helper such as isKaotoMimeTypeSupported() and use that helper in both
places. Update the ClipboardService methods to call the shared helper instead of
rechecking ClipboardItem.supports?.(ClipboardService.KAOTO_MIME_TYPE) inline,
keeping the existing behavior unchanged.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: da11c9f2-9ec0-4463-a29f-5192d0451f47
📒 Files selected for processing (42)
packages/ui-tests/cypress/e2e/designer/basicNodeActions/stepCopy.cy.tspackages/ui-tests/cypress/e2e/designer/basicNodeActions/stepPaste.cy.tspackages/ui-tests/cypress/support/next-commands/default.tspackages/ui/src/components/DataMapper/on-copy-datamapper.test.tspackages/ui/src/components/DataMapper/on-copy-datamapper.tspackages/ui/src/components/DataMapper/on-duplicate-datamapper.test.tspackages/ui/src/components/DataMapper/on-duplicate-datamapper.tspackages/ui/src/components/DataMapper/on-paste-data-mapper.test.tspackages/ui/src/components/DataMapper/on-paste-data-mapper.tspackages/ui/src/components/Visualization/Custom/ContextMenu/item-interaction-helper.tspackages/ui/src/components/Visualization/Custom/Node/CustomNodeUtils.tspackages/ui/src/components/Visualization/Custom/hooks/copy-step.hook.test.tsxpackages/ui/src/components/Visualization/Custom/hooks/copy-step.hook.tsxpackages/ui/src/components/Visualization/Custom/hooks/duplicate-step.hook.tsxpackages/ui/src/components/Visualization/Custom/hooks/move-step.hook.test.tsxpackages/ui/src/components/Visualization/Custom/hooks/paste-step.hook.test.tsxpackages/ui/src/components/Visualization/Custom/hooks/paste-step.hook.tsxpackages/ui/src/components/registers/interactions/node-interaction-addon.model.tspackages/ui/src/hooks/usePasteEntity.test.tsxpackages/ui/src/hooks/usePasteEntity.tspackages/ui/src/main.tsxpackages/ui/src/models/visualization/base-visual-entity.tspackages/ui/src/models/visualization/clipboard.tspackages/ui/src/models/visualization/flows/abstract-camel-visual-entity.test.tspackages/ui/src/models/visualization/flows/abstract-camel-visual-entity.tspackages/ui/src/models/visualization/flows/camel-error-handler-visual-entity.test.tspackages/ui/src/models/visualization/flows/camel-error-handler-visual-entity.tspackages/ui/src/models/visualization/flows/camel-rest-configuration-visual-entity.test.tspackages/ui/src/models/visualization/flows/camel-rest-configuration-visual-entity.tspackages/ui/src/models/visualization/flows/citrus-test-visual-entity.test.tspackages/ui/src/models/visualization/flows/citrus-test-visual-entity.tspackages/ui/src/models/visualization/flows/kamelet-visual-entity.tspackages/ui/src/models/visualization/flows/pipe-visual-entity.test.tspackages/ui/src/models/visualization/flows/pipe-visual-entity.tspackages/ui/src/models/visualization/flows/support/camel-component-schema.service.test.tspackages/ui/src/models/visualization/flows/support/camel-component-schema.service.tspackages/ui/src/models/visualization/visualization-node.test.tspackages/ui/src/models/visualization/visualization-node.tspackages/ui/src/services/visualization/clipboard.service.test.tspackages/ui/src/services/visualization/clipboard.service.tspackages/ui/src/utils/ClipboardManager.test.tspackages/ui/src/utils/ClipboardManager.ts
💤 Files with no reviewable changes (4)
- packages/ui/src/utils/ClipboardManager.ts
- packages/ui/src/utils/ClipboardManager.test.ts
- packages/ui/src/components/Visualization/Custom/hooks/move-step.hook.test.tsx
- packages/ui/src/models/visualization/flows/citrus-test-visual-entity.test.ts
igarashitm
left a comment
There was a problem hiding this comment.
No issue is found from DataMapper PoV 👍
lordrip
left a comment
There was a problem hiding this comment.
I tried it locally and it works very well. Considering that we're reading/writing XLM from/to the clipboard, I think we should move away from using markers and custom serialization and instead use plain string. XML support should be added in an upcoming PR.
| @@ -1,3 +1,4 @@ | |||
| import './components/SourceCode/workers/enable-workers'; // Configure Monaco loader before anything else | |||
There was a problem hiding this comment.
It was a Claude suggestion and I digged a bit and what this does is to load Monaco first so that it avoids falling into the CDN based loading. If for ex. it uses the CDN one, we could have version incompatibility at some point or possible failures. I think it's worth trying out. In my end I didn't notice any issue so I decided to keep the change here in case we can enjoy some benefits also in the E2E experience.
There was a problem hiding this comment.
I deleted this file from the PR as it doesn't influence directly tnis. But I think we should think about this in relation of those random E2E fails
| definition: { id: 'to-1913', uri: 'amqp', parameters: {} }, | ||
| __kaoto_marker: 'kaoto-node', | ||
| cy.window().then(async (win) => { | ||
| const yamlContent = '- to:\n id: to-1913\n uri: amqp\n parameters: {}\n'; |
There was a problem hiding this comment.
| const yamlContent = '- to:\n id: to-1913\n uri: amqp\n parameters: {}\n'; | |
| const yamlContent = ``` | |
| - to: | |
| id: to-1913 | |
| uri: amqp | |
| parameters: {} | |
| ```; |
| cy.uploadFixture('flows/camelRoute/basic.yaml'); | ||
| // Simulate clipboard content written by an external editor — raw YAML, no __kaoto_marker | ||
| cy.window().then(async (win) => { | ||
| const externalYaml = '- log:\n message: hello from external\n'; |
There was a problem hiding this comment.
| const externalYaml = '- log:\n message: hello from external\n'; | |
| const externalYaml = ``` | |
| - log: | |
| message: hello from external | |
| ```; |
cb6378f to
e635bf3
Compare
There was a problem hiding this comment.
🧹 Nitpick comments (1)
packages/ui/src/services/visualization/clipboard.service.test.ts (1)
99-101: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueConsider using
stringify()instead of hardcoded YAML strings.Lines 100, 120, and 140 assert exact YAML output with hardcoded strings. If the
yamllibrary changes formatting (indentation, quoting, etc.), these tests will break even though the service logic is correct. Usingstringify()to compute expected values (as done at line 43) would make these tests more resilient.♻️ Optional refactor example for line 100
- expect(yaml).toBe('errorHandler:\n deadLetterChannel:\n deadLetterUri: log:dlq\n'); + expect(yaml).toBe(stringify({ errorHandler: { deadLetterChannel: { deadLetterUri: 'log:dlq' } } }));Also applies to: 119-121, 139-141
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@packages/ui/src/services/visualization/clipboard.service.test.ts` around lines 99 - 101, The clipboard service tests are asserting exact YAML with hardcoded strings, which makes them brittle to formatting changes in the yaml library. Update the expectations in clipboard.service.test.ts to build the expected YAML using stringify() like the existing pattern in the file, and compare against that value in the affected cases around the clipboard serialization checks (including the errorHandler, nested map, and array cases).
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In `@packages/ui/src/services/visualization/clipboard.service.test.ts`:
- Around line 99-101: The clipboard service tests are asserting exact YAML with
hardcoded strings, which makes them brittle to formatting changes in the yaml
library. Update the expectations in clipboard.service.test.ts to build the
expected YAML using stringify() like the existing pattern in the file, and
compare against that value in the affected cases around the clipboard
serialization checks (including the errorHandler, nested map, and array cases).
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: e30ead18-c0a1-4b60-a0cc-367687f95c10
📒 Files selected for processing (42)
packages/ui-tests/cypress/e2e/designer/basicNodeActions/stepCopy.cy.tspackages/ui-tests/cypress/e2e/designer/basicNodeActions/stepPaste.cy.tspackages/ui-tests/cypress/support/next-commands/default.tspackages/ui/src/components/DataMapper/on-copy-datamapper.test.tspackages/ui/src/components/DataMapper/on-copy-datamapper.tspackages/ui/src/components/DataMapper/on-duplicate-datamapper.test.tspackages/ui/src/components/DataMapper/on-duplicate-datamapper.tspackages/ui/src/components/DataMapper/on-paste-data-mapper.test.tspackages/ui/src/components/DataMapper/on-paste-data-mapper.tspackages/ui/src/components/Visualization/Custom/ContextMenu/item-interaction-helper.tspackages/ui/src/components/Visualization/Custom/Node/CustomNodeUtils.tspackages/ui/src/components/Visualization/Custom/hooks/copy-step.hook.test.tsxpackages/ui/src/components/Visualization/Custom/hooks/copy-step.hook.tsxpackages/ui/src/components/Visualization/Custom/hooks/duplicate-step.hook.tsxpackages/ui/src/components/Visualization/Custom/hooks/move-step.hook.test.tsxpackages/ui/src/components/Visualization/Custom/hooks/paste-step.hook.test.tsxpackages/ui/src/components/Visualization/Custom/hooks/paste-step.hook.tsxpackages/ui/src/components/registers/interactions/node-interaction-addon.model.tspackages/ui/src/hooks/usePasteEntity.test.tsxpackages/ui/src/hooks/usePasteEntity.tspackages/ui/src/main.tsxpackages/ui/src/models/visualization/base-visual-entity.tspackages/ui/src/models/visualization/clipboard.tspackages/ui/src/models/visualization/flows/abstract-camel-visual-entity.test.tspackages/ui/src/models/visualization/flows/abstract-camel-visual-entity.tspackages/ui/src/models/visualization/flows/camel-error-handler-visual-entity.test.tspackages/ui/src/models/visualization/flows/camel-error-handler-visual-entity.tspackages/ui/src/models/visualization/flows/camel-rest-configuration-visual-entity.test.tspackages/ui/src/models/visualization/flows/camel-rest-configuration-visual-entity.tspackages/ui/src/models/visualization/flows/citrus-test-visual-entity.test.tspackages/ui/src/models/visualization/flows/citrus-test-visual-entity.tspackages/ui/src/models/visualization/flows/kamelet-visual-entity.tspackages/ui/src/models/visualization/flows/pipe-visual-entity.test.tspackages/ui/src/models/visualization/flows/pipe-visual-entity.tspackages/ui/src/models/visualization/flows/support/camel-component-schema.service.test.tspackages/ui/src/models/visualization/flows/support/camel-component-schema.service.tspackages/ui/src/models/visualization/visualization-node.test.tspackages/ui/src/models/visualization/visualization-node.tspackages/ui/src/services/visualization/clipboard.service.test.tspackages/ui/src/services/visualization/clipboard.service.tspackages/ui/src/utils/ClipboardManager.test.tspackages/ui/src/utils/ClipboardManager.ts
💤 Files with no reviewable changes (4)
- packages/ui/src/utils/ClipboardManager.ts
- packages/ui/src/utils/ClipboardManager.test.ts
- packages/ui/src/components/Visualization/Custom/hooks/move-step.hook.test.tsx
- packages/ui/src/models/visualization/flows/citrus-test-visual-entity.test.ts
✅ Files skipped from review due to trivial changes (4)
- packages/ui/src/components/DataMapper/on-copy-datamapper.ts
- packages/ui/src/components/Visualization/Custom/hooks/copy-step.hook.tsx
- packages/ui/src/components/Visualization/Custom/Node/CustomNodeUtils.ts
- packages/ui/src/components/DataMapper/on-duplicate-datamapper.ts
🚧 Files skipped from review as they are similar to previous changes (33)
- packages/ui/src/models/visualization/visualization-node.test.ts
- packages/ui/src/models/visualization/flows/support/camel-component-schema.service.ts
- packages/ui/src/models/visualization/flows/camel-rest-configuration-visual-entity.test.ts
- packages/ui/src/components/DataMapper/on-copy-datamapper.test.ts
- packages/ui/src/models/visualization/flows/abstract-camel-visual-entity.ts
- packages/ui/src/models/visualization/clipboard.ts
- packages/ui/src/models/visualization/flows/support/camel-component-schema.service.test.ts
- packages/ui/src/components/Visualization/Custom/ContextMenu/item-interaction-helper.ts
- packages/ui/src/models/visualization/flows/camel-rest-configuration-visual-entity.ts
- packages/ui-tests/cypress/support/next-commands/default.ts
- packages/ui/src/models/visualization/visualization-node.ts
- packages/ui/src/components/DataMapper/on-duplicate-datamapper.test.ts
- packages/ui-tests/cypress/e2e/designer/basicNodeActions/stepPaste.cy.ts
- packages/ui/src/components/DataMapper/on-paste-data-mapper.ts
- packages/ui/src/models/visualization/base-visual-entity.ts
- packages/ui/src/main.tsx
- packages/ui/src/components/Visualization/Custom/hooks/duplicate-step.hook.tsx
- packages/ui/src/models/visualization/flows/camel-error-handler-visual-entity.test.ts
- packages/ui/src/components/Visualization/Custom/hooks/copy-step.hook.test.tsx
- packages/ui/src/models/visualization/flows/citrus-test-visual-entity.ts
- packages/ui/src/models/visualization/flows/pipe-visual-entity.ts
- packages/ui/src/models/visualization/flows/kamelet-visual-entity.ts
- packages/ui/src/models/visualization/flows/camel-error-handler-visual-entity.ts
- packages/ui/src/components/DataMapper/on-paste-data-mapper.test.ts
- packages/ui/src/components/Visualization/Custom/hooks/paste-step.hook.tsx
- packages/ui/src/models/visualization/flows/abstract-camel-visual-entity.test.ts
- packages/ui/src/components/Visualization/Custom/hooks/paste-step.hook.test.tsx
- packages/ui-tests/cypress/e2e/designer/basicNodeActions/stepCopy.cy.ts
- packages/ui/src/components/registers/interactions/node-interaction-addon.model.ts
- packages/ui/src/services/visualization/clipboard.service.ts
- packages/ui/src/hooks/usePasteEntity.ts
- packages/ui/src/models/visualization/flows/pipe-visual-entity.test.ts
- packages/ui/src/hooks/usePasteEntity.test.tsx
8d9cc8d to
d7c8eb8
Compare
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@packages/ui/src/services/visualization/clipboard.service.test.ts`:
- Around line 45-47: Update the beforeEach setup in the clipboard service tests
to call vi.restoreAllMocks() so spy implementations, including
navigator.clipboard.write and console.error, are restored between tests; retain
mock history reset if needed for independent assertions.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 507b91be-2f31-4d16-9df6-7f2982751835
📒 Files selected for processing (42)
packages/ui-tests/cypress/e2e/designer/basicNodeActions/stepCopy.cy.tspackages/ui-tests/cypress/e2e/designer/basicNodeActions/stepPaste.cy.tspackages/ui-tests/cypress/support/next-commands/default.tspackages/ui/src/components/DataMapper/on-copy-datamapper.test.tspackages/ui/src/components/DataMapper/on-copy-datamapper.tspackages/ui/src/components/DataMapper/on-duplicate-datamapper.test.tspackages/ui/src/components/DataMapper/on-duplicate-datamapper.tspackages/ui/src/components/DataMapper/on-paste-data-mapper.test.tspackages/ui/src/components/DataMapper/on-paste-data-mapper.tspackages/ui/src/components/Visualization/Custom/ContextMenu/item-interaction-helper.tspackages/ui/src/components/Visualization/Custom/Node/CustomNodeUtils.tspackages/ui/src/components/Visualization/Custom/hooks/copy-step.hook.test.tsxpackages/ui/src/components/Visualization/Custom/hooks/copy-step.hook.tsxpackages/ui/src/components/Visualization/Custom/hooks/duplicate-step.hook.tsxpackages/ui/src/components/Visualization/Custom/hooks/move-step.hook.test.tsxpackages/ui/src/components/Visualization/Custom/hooks/paste-step.hook.test.tsxpackages/ui/src/components/Visualization/Custom/hooks/paste-step.hook.tsxpackages/ui/src/components/registers/interactions/node-interaction-addon.model.tspackages/ui/src/hooks/usePasteEntity.test.tsxpackages/ui/src/hooks/usePasteEntity.tspackages/ui/src/main.tsxpackages/ui/src/models/visualization/base-visual-entity.tspackages/ui/src/models/visualization/clipboard.tspackages/ui/src/models/visualization/flows/abstract-camel-visual-entity.test.tspackages/ui/src/models/visualization/flows/abstract-camel-visual-entity.tspackages/ui/src/models/visualization/flows/camel-error-handler-visual-entity.test.tspackages/ui/src/models/visualization/flows/camel-error-handler-visual-entity.tspackages/ui/src/models/visualization/flows/camel-rest-configuration-visual-entity.test.tspackages/ui/src/models/visualization/flows/camel-rest-configuration-visual-entity.tspackages/ui/src/models/visualization/flows/citrus-test-visual-entity.test.tspackages/ui/src/models/visualization/flows/citrus-test-visual-entity.tspackages/ui/src/models/visualization/flows/kamelet-visual-entity.tspackages/ui/src/models/visualization/flows/pipe-visual-entity.test.tspackages/ui/src/models/visualization/flows/pipe-visual-entity.tspackages/ui/src/models/visualization/flows/support/camel-component-schema.service.test.tspackages/ui/src/models/visualization/flows/support/camel-component-schema.service.tspackages/ui/src/models/visualization/visualization-node.test.tspackages/ui/src/models/visualization/visualization-node.tspackages/ui/src/services/visualization/clipboard.service.test.tspackages/ui/src/services/visualization/clipboard.service.tspackages/ui/src/utils/ClipboardManager.test.tspackages/ui/src/utils/ClipboardManager.ts
💤 Files with no reviewable changes (4)
- packages/ui/src/utils/ClipboardManager.test.ts
- packages/ui/src/utils/ClipboardManager.ts
- packages/ui/src/components/Visualization/Custom/hooks/move-step.hook.test.tsx
- packages/ui/src/models/visualization/flows/citrus-test-visual-entity.test.ts
🚧 Files skipped from review as they are similar to previous changes (32)
- packages/ui/src/main.tsx
- packages/ui/src/components/Visualization/Custom/hooks/duplicate-step.hook.tsx
- packages/ui/src/components/DataMapper/on-duplicate-datamapper.ts
- packages/ui/src/components/DataMapper/on-copy-datamapper.ts
- packages/ui/src/components/DataMapper/on-duplicate-datamapper.test.ts
- packages/ui/src/models/visualization/flows/camel-error-handler-visual-entity.test.ts
- packages/ui/src/models/visualization/visualization-node.ts
- packages/ui/src/models/visualization/flows/camel-error-handler-visual-entity.ts
- packages/ui/src/models/visualization/flows/kamelet-visual-entity.ts
- packages/ui/src/models/visualization/visualization-node.test.ts
- packages/ui/src/models/visualization/flows/pipe-visual-entity.test.ts
- packages/ui-tests/cypress/e2e/designer/basicNodeActions/stepPaste.cy.ts
- packages/ui/src/models/visualization/base-visual-entity.ts
- packages/ui/src/models/visualization/flows/citrus-test-visual-entity.ts
- packages/ui/src/components/registers/interactions/node-interaction-addon.model.ts
- packages/ui/src/components/Visualization/Custom/hooks/copy-step.hook.test.tsx
- packages/ui/src/models/visualization/flows/support/camel-component-schema.service.test.ts
- packages/ui/src/models/visualization/flows/support/camel-component-schema.service.ts
- packages/ui/src/models/visualization/clipboard.ts
- packages/ui-tests/cypress/support/next-commands/default.ts
- packages/ui/src/models/visualization/flows/abstract-camel-visual-entity.test.ts
- packages/ui/src/models/visualization/flows/camel-rest-configuration-visual-entity.test.ts
- packages/ui/src/components/Visualization/Custom/Node/CustomNodeUtils.ts
- packages/ui/src/services/visualization/clipboard.service.ts
- packages/ui/src/models/visualization/flows/pipe-visual-entity.ts
- packages/ui/src/hooks/usePasteEntity.ts
- packages/ui/src/components/Visualization/Custom/hooks/paste-step.hook.tsx
- packages/ui/src/components/DataMapper/on-paste-data-mapper.ts
- packages/ui/src/components/DataMapper/on-paste-data-mapper.test.ts
- packages/ui/src/models/visualization/flows/abstract-camel-visual-entity.ts
- packages/ui-tests/cypress/e2e/designer/basicNodeActions/stepCopy.cy.ts
- packages/ui/src/hooks/usePasteEntity.test.tsx
c4e8109 to
f613100
Compare
f613100 to
243d8df
Compare
|



Summary
This PR introduces native YAML clipboard support for copying and pasting visual entities (routes, pipes,
kamelets, steps) in the Kaoto canvas. Users can now copy entities as YAML and paste them from external sources
or between different parts of the application.
What changed
Core clipboard functionality
(packages/ui/src/services/visualization/clipboard.service.ts)
(packages/ui/src/services/visualization/clipboard.service.ts)
key names instead of metadata
with leading dash)
({ stepName: {...} })
interoperability
Updated components and hooks
service
key names against active canvas type
Test updates
Why it changed
User value
Technical improvements
metadata
How it was verified
Unit tests
E2e tests
Manual testing checklist
Reviewer notes
Key files to review
logic
Design decisions
single-element arrays to match YAML DSL conventions (leading dash)
Backwards compatibility
fix: #2652
Summary by CodeRabbit
Summary by CodeRabbit