Skip to content

Automate browser based workflows with AI

feat(SKY-11337): unified right-click + bulk action menus for the agents list (#6900)

Aaron Perez896d09837d34
diff --git a/skyvern-frontend/package-lock.json b/skyvern-frontend/package-lock.json
index 492b006eb..b31df037f 100644
--- a/skyvern-frontend/package-lock.json
+++ b/skyvern-frontend/package-lock.json
@@ -23,6 +23,7 @@
"@radix-ui/react-aspect-ratio": "^1.0.3",
"@radix-ui/react-checkbox": "^1.1.1",
"@radix-ui/react-collapsible": "^1.1.1",
+ "@radix-ui/react-context-menu": "^2.3.1",
"@radix-ui/react-dialog": "^1.1.2",
"@radix-ui/react-dropdown-menu": "^2.0.6",
"@radix-ui/react-icons": "^1.3.0",
@@ -1999,6 +2000,536 @@
}
}
},
+ "node_modules/@radix-ui/react-context-menu": {
+ "version": "2.3.1",
+ "resolved": "https://registry.npmjs.org/@radix-ui/react-context-menu/-/react-context-menu-2.3.1.tgz",
+ "integrity": "sha512-XbrxS68W5dyiE4fAb96yvJwSVU5x66B20A99sD5Mk3xSWK/LqeOnx6TZnim1KieMjXS/CTFq8reOAjWxas2G8Q==",
+ "license": "MIT",
+ "dependencies": {
+ "@radix-ui/primitive": "1.1.4",
+ "@radix-ui/react-context": "1.1.4",
+ "@radix-ui/react-menu": "2.1.18",
+ "@radix-ui/react-primitive": "2.1.6",
+ "@radix-ui/react-use-controllable-state": "1.2.3"
+ },
+ "peerDependencies": {
+ "@types/react": "*",
+ "@types/react-dom": "*",
+ "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc",
+ "react-dom": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc"
+ },
+ "peerDependenciesMeta": {
+ "@types/react": {
+ "optional": true
+ },
+ "@types/react-dom": {
+ "optional": true
+ }
+ }
+ },
+ "node_modules/@radix-ui/react-context-menu/node_modules/@radix-ui/primitive": {
+ "version": "1.1.4",
+ "resolved": "https://registry.npmjs.org/@radix-ui/primitive/-/primitive-1.1.4.tgz",
+ "integrity": "sha512-7AdCK9PQyiljKoBDbN8OuctCbd/esdwZPQ8RtOE3SsyQtUpiPb+ND75q0jEhC1m1ecBI0MFNeLJvwIh9iKHRcQ==",
+ "license": "MIT"
+ },
+ "node_modules/@radix-ui/react-context-menu/node_modules/@radix-ui/react-arrow": {
+ "version": "1.1.10",
+ "resolved": "https://registry.npmjs.org/@radix-ui/react-arrow/-/react-arrow-1.1.10.tgz",
+ "integrity": "sha512-j2VTDz1vgCsmuG0k5lBfOcM8n5JPFqZBcMryasFjHYMhwxYL5SRUV5lMSUpRdNtw3D/Sv8pzJtrlAgkssYSsQQ==",
+ "license": "MIT",
+ "dependencies": {
+ "@radix-ui/react-primitive": "2.1.6"
+ },
+ "peerDependencies": {
+ "@types/react": "*",
+ "@types/react-dom": "*",
+ "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc",
+ "react-dom": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc"
+ },
+ "peerDependenciesMeta": {
+ "@types/react": {
+ "optional": true
+ },
+ "@types/react-dom": {
+ "optional": true
+ }
+ }
+ },
+ "node_modules/@radix-ui/react-context-menu/node_modules/@radix-ui/react-collection": {
+ "version": "1.1.10",
+ "resolved": "https://registry.npmjs.org/@radix-ui/react-collection/-/react-collection-1.1.10.tgz",
+ "integrity": "sha512-IVVz4EvBcKjrzKgof714qDnz/SzQAkLA2Emh5edlHbgcE6fNd3Un6CJLlaYcnm8N4JmAtzQgse4dOKxcD2yc9g==",
+ "license": "MIT",
+ "dependencies": {
+ "@radix-ui/react-compose-refs": "1.1.3",
+ "@radix-ui/react-context": "1.1.4",
+ "@radix-ui/react-primitive": "2.1.6",
+ "@radix-ui/react-slot": "1.3.0"
+ },
+ "peerDependencies": {
+ "@types/react": "*",
+ "@types/react-dom": "*",
+ "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc",
+ "react-dom": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc"
+ },
+ "peerDependenciesMeta": {
+ "@types/react": {
+ "optional": true
+ },
+ "@types/react-dom": {
+ "optional": true
+ }
+ }
+ },
+ "node_modules/@radix-ui/react-context-menu/node_modules/@radix-ui/react-compose-refs": {
+ "version": "1.1.3",
+ "resolved": "https://registry.npmjs.org/@radix-ui/react-compose-refs/-/react-compose-refs-1.1.3.tgz",
+ "integrity": "sha512-rYOP8OMnuuPMQF1uhPVlGNcCDlkokKqGFE3JcxFViIkAXP7EvFWUliJAstrapypaBLJNHbZL6jGhbVDGTwmVhA==",
+ "license": "MIT",
+ "peerDependencies": {
+ "@types/react": "*",
+ "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc"
+ },
+ "peerDependenciesMeta": {
+ "@types/react": {
+ "optional": true
+ }
+ }
+ },
+ "node_modules/@radix-ui/react-context-menu/node_modules/@radix-ui/react-context": {
+ "version": "1.1.4",
+ "resolved": "https://registry.npmjs.org/@radix-ui/react-context/-/react-context-1.1.4.tgz",
+ "integrity": "sha512-QwH4PO5urrbO+FaGd5Aglg+YJgWTyyuZ3g/6mKvsqraLkglDdckw9JafgL5McL5VEJ6EPNduPaT3ZE9BttDAqg==",
+ "license": "MIT",
+ "peerDependencies": {
+ "@types/react": "*",
+ "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc"
+ },
+ "peerDependenciesMeta": {
+ "@types/react": {
+ "optional": true
+ }
+ }
+ },
+ "node_modules/@radix-ui/react-context-menu/node_modules/@radix-ui/react-direction": {
+ "version": "1.1.2",
+ "resolved": "https://registry.npmjs.org/@radix-ui/react-direction/-/react-direction-1.1.2.tgz",
+ "integrity": "sha512-C3vFhbyi4SW3PmbAi6Awpu4OzJtd0MxGurvSsYtr7p7nM8RNB3VAF3CUmnp2j50knpkrRcB7+ycVXzgLgF6yNA==",
+ "license": "MIT",
+ "peerDependencies": {
+ "@types/react": "*",
+ "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc"
+ },
+ "peerDependenciesMeta": {
+ "@types/react": {
+ "optional": true
+ }
+ }
+ },
+ "node_modules/@radix-ui/react-context-menu/node_modules/@radix-ui/react-dismissable-layer": {
+ "version": "1.1.13",
+ "resolved": "https://registry.npmjs.org/@radix-ui/react-dismissable-layer/-/react-dismissable-layer-1.1.13.tgz",
+ "integrity": "sha512-2v+zNAWWe0ySxgC0D0yeXMPQ23xZVgXZTerTz+JKlmdRj6gfTqmCcR29jb6d290DezXPGgruHWDX/vYUebtErg==",
+ "license": "MIT",
+ "dependencies": {
+ "@radix-ui/primitive": "1.1.4",
+ "@radix-ui/react-compose-refs": "1.1.3",
+ "@radix-ui/react-primitive": "2.1.6",
+ "@radix-ui/react-use-callback-ref": "1.1.2",
+ "@radix-ui/react-use-escape-keydown": "1.1.2"
+ },
+ "peerDependencies": {
+ "@types/react": "*",
+ "@types/react-dom": "*",
+ "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc",
+ "react-dom": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc"
+ },
+ "peerDependenciesMeta": {
+ "@types/react": {
+ "optional": true
+ },
+ "@types/react-dom": {
+ "optional": true
+ }
+ }
+ },
+ "node_modules/@radix-ui/react-context-menu/node_modules/@radix-ui/react-focus-guards": {
+ "version": "1.1.4",
+ "resolved": "https://registry.npmjs.org/@radix-ui/react-focus-guards/-/react-focus-guards-1.1.4.tgz",
+ "integrity": "sha512-cot/aB/mOm0IYVYTTmQcEEK1M48lZWi8FlYe5nDPQQ8NYZUlXEFgncJ9p2Kzer3RKSrY7cTTpEMLZKNo9QoP5Q==",
+ "license": "MIT",
+ "peerDependencies": {
+ "@types/react": "*",
+ "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc"
+ },
+ "peerDependenciesMeta": {
+ "@types/react": {
+ "optional": true
+ }
+ }
+ },
+ "node_modules/@radix-ui/react-context-menu/node_modules/@radix-ui/react-focus-scope": {
+ "version": "1.1.10",
+ "resolved": "https://registry.npmjs.org/@radix-ui/react-focus-scope/-/react-focus-scope-1.1.10.tgz",
+ "integrity": "sha512-Fas/lXQqhVvqwAb64s5RFeHiHYElZ6SUQbZaNd6EkfhP/Al7wTIQ9WIR4QVX475tlu5yFCEdDcJH6/UwsZjMWw==",
+ "license": "MIT",
+ "dependencies": {
+ "@radix-ui/react-compose-refs": "1.1.3",
+ "@radix-ui/react-primitive": "2.1.6",
+ "@radix-ui/react-use-callback-ref": "1.1.2"
+ },
+ "peerDependencies": {
+ "@types/react": "*",
+ "@types/react-dom": "*",
+ "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc",
+ "react-dom": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc"
+ },
+ "peerDependenciesMeta": {
+ "@types/react": {
+ "optional": true
+ },
+ "@types/react-dom": {
+ "optional": true
+ }
+ }
+ },
+ "node_modules/@radix-ui/react-context-menu/node_modules/@radix-ui/react-id": {
+ "version": "1.1.2",
+ "resolved": "https://registry.npmjs.org/@radix-ui/react-id/-/react-id-1.1.2.tgz",
+ "integrity": "sha512-orBC88futVpqCmhX1p4cvquNHsELQ+w+vBJnuj3ftETI5bJb0bZn3Tqu3SWN2IOcPycTnMGnhwoermvISt72sA==",
+ "license": "MIT",
+ "dependencies": {
+ "@radix-ui/react-use-layout-effect": "1.1.2"
+ },
+ "peerDependencies": {
+ "@types/react": "*",
+ "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc"
+ },
+ "peerDependenciesMeta": {
+ "@types/react": {
+ "optional": true
+ }
+ }
+ },
+ "node_modules/@radix-ui/react-context-menu/node_modules/@radix-ui/react-menu": {
+ "version": "2.1.18",
+ "resolved": "https://registry.npmjs.org/@radix-ui/react-menu/-/react-menu-2.1.18.tgz",
+ "integrity": "sha512-lj8Rxjtn6zJq1oSbE/uDtAwCbB9BnxgHD+8MwJMuTh6u1dPamYhW9iuELr/Z8d0D/UysFblYYHeBPwi7T4k0YQ==",
+ "license": "MIT",
+ "dependencies": {
+ "@radix-ui/primitive": "1.1.4",
+ "@radix-ui/react-collection": "1.1.10",
+ "@radix-ui/react-compose-refs": "1.1.3",
+ "@radix-ui/react-context": "1.1.4",
+ "@radix-ui/react-direction": "1.1.2",
+ "@radix-ui/react-dismissable-layer": "1.1.13",
+ "@radix-ui/react-focus-guards": "1.1.4",
+ "@radix-ui/react-focus-scope": "1.1.10",
+ "@radix-ui/react-id": "1.1.2",
+ "@radix-ui/react-popper": "1.3.1",
+ "@radix-ui/react-portal": "1.1.12",
+ "@radix-ui/react-presence": "1.1.6",
+ "@radix-ui/react-primitive": "2.1.6",
+ "@radix-ui/react-roving-focus": "1.1.13",
+ "@radix-ui/react-slot": "1.3.0",
+ "@radix-ui/react-use-callback-ref": "1.1.2",
+ "aria-hidden": "^1.2.4",
+ "react-remove-scroll": "^2.7.2"
+ },
+ "peerDependencies": {
+ "@types/react": "*",
+ "@types/react-dom": "*",
+ "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc",
+ "react-dom": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc"
+ },
+ "peerDependenciesMeta": {
+ "@types/react": {
+ "optional": true
+ },
+ "@types/react-dom": {
+ "optional": true
+ }
+ }
+ },
+ "node_modules/@radix-ui/react-context-menu/node_modules/@radix-ui/react-popper": {
+ "version": "1.3.1",
+ "resolved": "https://registry.npmjs.org/@radix-ui/react-popper/-/react-popper-1.3.1.tgz",
+ "integrity": "sha512-bhnq/0DEPTi2lsOD3J5rTL65qUKHbKbhqHsmN9TMiclSXpipi651ooUKPPp6G5lF/WiHBdn1s0Wuqsn+myVAvw==",
+ "license": "MIT",
+ "dependencies": {
+ "@floating-ui/react-dom": "^2.0.0",
+ "@radix-ui/react-arrow": "1.1.10",
+ "@radix-ui/react-compose-refs": "1.1.3",
+ "@radix-ui/react-context": "1.1.4",
+ "@radix-ui/react-primitive": "2.1.6",
+ "@radix-ui/react-use-callback-ref": "1.1.2",
+ "@radix-ui/react-use-layout-effect": "1.1.2",
+ "@radix-ui/react-use-rect": "1.1.2",
+ "@radix-ui/react-use-size": "1.1.2",
+ "@radix-ui/rect": "1.1.2"
+ },
+ "peerDependencies": {
+ "@types/react": "*",
+ "@types/react-dom": "*",
+ "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc",
+ "react-dom": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc"
+ },
+ "peerDependenciesMeta": {
+ "@types/react": {
+ "optional": true
+ },
+ "@types/react-dom": {
+ "optional": true
+ }
+ }
+ },
+ "node_modules/@radix-ui/react-context-menu/node_modules/@radix-ui/react-portal": {
+ "version": "1.1.12",
+ "resolved": "https://registry.npmjs.org/@radix-ui/react-portal/-/react-portal-1.1.12.tgz",
+ "integrity": "sha512-m309havGzsjLHHaIX50G5PlvRs3xkgPCsGk/5PTvYm8D5q33yG0J7w/712PTOhid7NTaFETtnSXjngHQavvhVw==",
+ "license": "MIT",
+ "dependencies": {
+ "@radix-ui/react-primitive": "2.1.6",
+ "@radix-ui/react-use-layout-effect": "1.1.2"
+ },
+ "peerDependencies": {
+ "@types/react": "*",
+ "@types/react-dom": "*",
+ "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc",
+ "react-dom": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc"
+ },
+ "peerDependenciesMeta": {
+ "@types/react": {
+ "optional": true
+ },
+ "@types/react-dom": {
+ "optional": true
+ }
+ }
+ },
+ "node_modules/@radix-ui/react-context-menu/node_modules/@radix-ui/react-presence": {
+ "version": "1.1.6",
+ "resolved": "https://registry.npmjs.org/@radix-ui/react-presence/-/react-presence-1.1.6.tgz",
+ "integrity": "sha512-zdTk4PlUO0E18HnZ3wYbW0KkJJxWCdiNYp6g6X1PtONFhxVkg01vliTJAmwIszU6mHiyBOoW9P0rAugl5/hULQ==",
+ "license": "MIT",
+ "dependencies": {
+ "@radix-ui/react-use-layout-effect": "1.1.2"
+ },
+ "peerDependencies": {
+ "@types/react": "*",
+ "@types/react-dom": "*",
+ "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc",
+ "react-dom": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc"
+ },
+ "peerDependenciesMeta": {
+ "@types/react": {
+ "optional": true
+ },
+ "@types/react-dom": {
+ "optional": true
+ }
+ }
+ },
+ "node_modules/@radix-ui/react-context-menu/node_modules/@radix-ui/react-primitive": {
+ "version": "2.1.6",
+ "resolved": "https://registry.npmjs.org/@radix-ui/react-primitive/-/react-primitive-2.1.6.tgz",
+ "integrity": "sha512-wetd0QI77DbvrPpTAvH1SqOxsYF2wZe5TNxqwOd5Ty4XDpV3dpV0s8K/1MGMJBeY5o7lg8ub5VIt1Ub+yVen6g==",
+ "license": "MIT",
+ "dependencies": {
+ "@radix-ui/react-slot": "1.3.0"
+ },
+ "peerDependencies": {
+ "@types/react": "*",
+ "@types/react-dom": "*",
+ "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc",
+ "react-dom": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc"
+ },
+ "peerDependenciesMeta": {
+ "@types/react": {
+ "optional": true
+ },
+ "@types/react-dom": {
+ "optional": true
+ }
+ }
+ },
+ "node_modules/@radix-ui/react-context-menu/node_modules/@radix-ui/react-roving-focus": {
+ "version": "1.1.13",
+ "resolved": "https://registry.npmjs.org/@radix-ui/react-roving-focus/-/react-roving-focus-1.1.13.tgz",
+ "integrity": "sha512-9gkwneI0guf8JDmrFxPjJF6Ozzgioyw+/lonYNCwefS9ZHA05er0BVHiXr+LbWGHxUfczvMY6G1oiZZi1VzjRw==",
+ "license": "MIT",
+ "dependencies": {
+ "@radix-ui/primitive": "1.1.4",
+ "@radix-ui/react-collection": "1.1.10",
+ "@radix-ui/react-compose-refs": "1.1.3",
+ "@radix-ui/react-context": "1.1.4",
+ "@radix-ui/react-direction": "1.1.2",
+ "@radix-ui/react-id": "1.1.2",
+ "@radix-ui/react-primitive": "2.1.6",
+ "@radix-ui/react-use-callback-ref": "1.1.2",
+ "@radix-ui/react-use-controllable-state": "1.2.3"
+ },
+ "peerDependencies": {
+ "@types/react": "*",
+ "@types/react-dom": "*",
+ "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc",
+ "react-dom": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc"
+ },
+ "peerDependenciesMeta": {
+ "@types/react": {
+ "optional": true
+ },
+ "@types/react-dom": {
+ "optional": true
+ }
+ }
+ },
+ "node_modules/@radix-ui/react-context-menu/node_modules/@radix-ui/react-slot": {
+ "version": "1.3.0",
+ "resolved": "https://registry.npmjs.org/@radix-ui/react-slot/-/react-slot-1.3.0.tgz",
+ "integrity": "sha512-MojKku4U/miO8Av4Dkb+ctMAQx7JmY96LmtDQlAarCRtd7rN52QCSzBF+XAvr5S6coSVj9HEPBgHAHKEJVk/WA==",
+ "license": "MIT",
+ "dependencies": {
+ "@radix-ui/react-compose-refs": "1.1.3"
+ },
+ "peerDependencies": {
+ "@types/react": "*",
+ "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc"
+ },
+ "peerDependenciesMeta": {
+ "@types/react": {
+ "optional": true
+ }
+ }
+ },
+ "node_modules/@radix-ui/react-context-menu/node_modules/@radix-ui/react-use-callback-ref": {
+ "version": "1.1.2",
+ "resolved": "https://registry.npmjs.org/@radix-ui/react-use-callback-ref/-/react-use-callback-ref-1.1.2.tgz",
+ "integrity": "sha512-xCso9j1/u8sEgP1RNHjFrXJLApL8LiqOkI1R4ywuN00rxWdYg4oQXuwKLS3i0j5NWLromUD27/4nlxj2UFVvIw==",
+ "license": "MIT",
+ "peerDependencies": {
+ "@types/react": "*",
+ "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc"
+ },
+ "peerDependenciesMeta": {
+ "@types/react": {
+ "optional": true
+ }
+ }
+ },
+ "node_modules/@radix-ui/react-context-menu/node_modules/@radix-ui/react-use-controllable-state": {
+ "version": "1.2.3",
+ "resolved": "https://registry.npmjs.org/@radix-ui/react-use-controllable-state/-/react-use-controllable-state-1.2.3.tgz",
+ "integrity": "sha512-PLzC90MS+ReootmjC597dvopoelpZ8Q61HJkDXZSExitIq7PL55vHNnesAHwguHK0aPfBnpdNzQtv1uliaqQrA==",
+ "license": "MIT",
+ "dependencies": {
+ "@radix-ui/react-use-effect-event": "0.0.3",
+ "@radix-ui/react-use-layout-effect": "1.1.2"
+ },
+ "peerDependencies": {
+ "@types/react": "*",
+ "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc"
+ },
+ "peerDependenciesMeta": {
+ "@types/react": {
+ "optional": true
+ }
+ }
+ },
+ "node_modules/@radix-ui/react-context-menu/node_modules/@radix-ui/react-use-effect-event": {
+ "version": "0.0.3",
+ "resolved": "https://registry.npmjs.org/@radix-ui/react-use-effect-event/-/react-use-effect-event-0.0.3.tgz",
+ "integrity": "sha512-6c8ZqvPTWILEKnyVkP53EGRCcpnJiKTC21sS/6R1GF5xKyHJJWQEPfkqlcgUkdRQivd6tb23abUwe4ngWmY0JA==",
+ "license": "MIT",
+ "dependencies": {
+ "@radix-ui/react-use-layout-effect": "1.1.2"
+ },
+ "peerDependencies": {
+ "@types/react": "*",
+ "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc"
+ },
+ "peerDependenciesMeta": {
+ "@types/react": {
+ "optional": true
+ }
+ }
+ },
+ "node_modules/@radix-ui/react-context-menu/node_modules/@radix-ui/react-use-escape-keydown": {
+ "version": "1.1.2",
+ "resolved": "https://registry.npmjs.org/@radix-ui/react-use-escape-keydown/-/react-use-escape-keydown-1.1.2.tgz",
+ "integrity": "sha512-2uVLvLjgO7NZCWw01/FdqRwmA42J0BcjPMUCA+koFEOAb+zjqIP7SiFz/7zWPrKnVmSqr76Omq2ALyCuX4dhLw==",
+ "license": "MIT",
+ "dependencies": {
+ "@radix-ui/react-use-callback-ref": "1.1.2"
+ },
+ "peerDependencies": {
+ "@types/react": "*",
+ "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc"
+ },
+ "peerDependenciesMeta": {
+ "@types/react": {
+ "optional": true
+ }
+ }
+ },
+ "node_modules/@radix-ui/react-context-menu/node_modules/@radix-ui/react-use-layout-effect": {
+ "version": "1.1.2",
+ "resolved": "https://registry.npmjs.org/@radix-ui/react-use-layout-effect/-/react-use-layout-effect-1.1.2.tgz",
+ "integrity": "sha512-jrBWOxZITuGcnjRCM2t2U5ZPkCLxD+Ym6DjfssS5haTj2iiak/DOb64JeN6OdLfLgptb6/e2kKR+ZuTrGoZTPA==",
+ "license": "MIT",
+ "peerDependencies": {
+ "@types/react": "*",
+ "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc"
+ },
+ "peerDependenciesMeta": {
+ "@types/react": {
+ "optional": true
+ }
+ }
+ },
+ "node_modules/@radix-ui/react-context-menu/node_modules/@radix-ui/react-use-rect": {
+ "version": "1.1.2",
+ "resolved": "https://registry.npmjs.org/@radix-ui/react-use-rect/-/react-use-rect-1.1.2.tgz",
+ "integrity": "sha512-d8a+bBY/FxikNPlgJJoaBHZX+zKVbWHYJGTLnLvveQgFSTntkGdEKv3JDtHrMS0DNYpllz2nRsTLGLKYttbpmw==",
+ "license": "MIT",
+ "dependencies": {
+ "@radix-ui/rect": "1.1.2"
+ },
+ "peerDependencies": {
+ "@types/react": "*",
+ "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc"
+ },
+ "peerDependenciesMeta": {
+ "@types/react": {
+ "optional": true
+ }
+ }
+ },
+ "node_modules/@radix-ui/react-context-menu/node_modules/@radix-ui/react-use-size": {
+ "version": "1.1.2",
+ "resolved": "https://registry.npmjs.org/@radix-ui/react-use-size/-/react-use-size-1.1.2.tgz",
+ "integrity": "sha512-giWQp+4mxjBPt4KZ0MmyuykFNWfbDxKt4x+fPkRYmgRFJSbCZFzUglvMb/Kjn38tm10YP4ufiQZDx3zna4LU6w==",
+ "license": "MIT",
+ "dependencies": {
+ "@radix-ui/react-use-layout-effect": "1.1.2"
+ },
+ "peerDependencies": {
+ "@types/react": "*",
+ "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc"
+ },
+ "peerDependenciesMeta": {
+ "@types/react": {
+ "optional": true
+ }
+ }
+ },
+ "node_modules/@radix-ui/react-context-menu/node_modules/@radix-ui/rect": {
+ "version": "1.1.2",
+ "resolved": "https://registry.npmjs.org/@radix-ui/rect/-/rect-1.1.2.tgz",
+ "integrity": "sha512-xnXE7wG13PI+cxieVssYXlQJuYVRhH9NBoxt3KNwzghDIA69GMm7d4wXRouHIYjE+KvS6U/MsMO73NdS2MH9ZA==",
+ "license": "MIT"
+ },
"node_modules/@radix-ui/react-dialog": {
"version": "1.1.15",
"resolved": "https://registry.npmjs.org/@radix-ui/react-dialog/-/react-dialog-1.1.15.tgz",
diff --git a/skyvern-frontend/package.json b/skyvern-frontend/package.json
index 9071439e1..132d932a7 100644
--- a/skyvern-frontend/package.json
+++ b/skyvern-frontend/package.json
@@ -34,6 +34,7 @@
"@radix-ui/react-aspect-ratio": "^1.0.3",
"@radix-ui/react-checkbox": "^1.1.1",
"@radix-ui/react-collapsible": "^1.1.1",
+ "@radix-ui/react-context-menu": "^2.3.1",
"@radix-ui/react-dialog": "^1.1.2",
"@radix-ui/react-dropdown-menu": "^2.0.6",
"@radix-ui/react-icons": "^1.3.0",
diff --git a/skyvern-frontend/src/components/SelectionCheckbox.tsx b/skyvern-frontend/src/components/SelectionCheckbox.tsx
index 9cfa77db4..839adf860 100644
--- a/skyvern-frontend/src/components/SelectionCheckbox.tsx
+++ b/skyvern-frontend/src/components/SelectionCheckbox.tsx
@@ -45,7 +45,7 @@ function SelectionCheckbox({
className={cn(
"pointer-events-none transition-opacity",
!hasSelection &&
- "opacity-0 focus-visible:opacity-100 group-hover/row:opacity-100",
+ "opacity-0 focus-visible:opacity-100 group-hover/row:opacity-100 group-data-[row-active]/row:opacity-100",
)}
/>
</div>
diff --git a/skyvern-frontend/src/components/ui/context-menu.tsx b/skyvern-frontend/src/components/ui/context-menu.tsx
new file mode 100644
index 000000000..b0026205b
--- /dev/null
+++ b/skyvern-frontend/src/components/ui/context-menu.tsx
@@ -0,0 +1,203 @@
+import * as React from "react";
+import * as ContextMenuPrimitive from "@radix-ui/react-context-menu";
+import {
+ CheckIcon,
+ ChevronRightIcon,
+ DotFilledIcon,
+} from "@radix-ui/react-icons";
+
+import { cn } from "@/util/utils";
+
+const ContextMenu = ContextMenuPrimitive.Root;
+
+const ContextMenuTrigger = ContextMenuPrimitive.Trigger;
+
+const ContextMenuGroup = ContextMenuPrimitive.Group;
+
+const ContextMenuPortal = ContextMenuPrimitive.Portal;
+
+const ContextMenuSub = ContextMenuPrimitive.Sub;
+
+const ContextMenuRadioGroup = ContextMenuPrimitive.RadioGroup;
+
+const ContextMenuSubTrigger = React.forwardRef<
+ React.ElementRef<typeof ContextMenuPrimitive.SubTrigger>,
+ React.ComponentPropsWithoutRef<typeof ContextMenuPrimitive.SubTrigger> & {
+ inset?: boolean;
+ }
+>(({ className, inset, children, ...props }, ref) => (
+ <ContextMenuPrimitive.SubTrigger
+ ref={ref}
+ className={cn(
+ "flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent data-[state=open]:bg-accent",
+ inset && "pl-8",
+ className,
+ )}
+ {...props}
+ >
+ {children}
+ <ChevronRightIcon className="ml-auto h-4 w-4" />
+ </ContextMenuPrimitive.SubTrigger>
+));
+ContextMenuSubTrigger.displayName = ContextMenuPrimitive.SubTrigger.displayName;
+
+const ContextMenuSubContent = React.forwardRef<
+ React.ElementRef<typeof ContextMenuPrimitive.SubContent>,
+ React.ComponentPropsWithoutRef<typeof ContextMenuPrimitive.SubContent>
+>(({ className, ...props }, ref) => (
+ <ContextMenuPrimitive.SubContent
+ ref={ref}
+ className={cn(
+ "z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-lg data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",
+ className,
+ )}
+ {...props}
+ />
+));
+ContextMenuSubContent.displayName = ContextMenuPrimitive.SubContent.displayName;
+
+const ContextMenuContent = React.forwardRef<
+ React.ElementRef<typeof ContextMenuPrimitive.Content>,
+ React.ComponentPropsWithoutRef<typeof ContextMenuPrimitive.Content>
+>(({ className, ...props }, ref) => (
+ <ContextMenuPrimitive.Portal>
+ <ContextMenuPrimitive.Content
+ ref={ref}
+ className={cn(
+ "z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md",
+ "data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",
+ className,
+ )}
+ {...props}
+ />
+ </ContextMenuPrimitive.Portal>
+));
+ContextMenuContent.displayName = ContextMenuPrimitive.Content.displayName;
+
+const ContextMenuItem = React.forwardRef<
+ React.ElementRef<typeof ContextMenuPrimitive.Item>,
+ React.ComponentPropsWithoutRef<typeof ContextMenuPrimitive.Item> & {
+ inset?: boolean;
+ }
+>(({ className, inset, ...props }, ref) => (
+ <ContextMenuPrimitive.Item
+ ref={ref}
+ className={cn(
+ "relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
+ inset && "pl-8",
+ className,
+ )}
+ {...props}
+ />
+));
+ContextMenuItem.displayName = ContextMenuPrimitive.Item.displayName;
+
+const ContextMenuCheckboxItem = React.forwardRef<
+ React.ElementRef<typeof ContextMenuPrimitive.CheckboxItem>,
+ React.ComponentPropsWithoutRef<typeof ContextMenuPrimitive.CheckboxItem>
+>(({ className, children, checked, ...props }, ref) => (
+ <ContextMenuPrimitive.CheckboxItem
+ ref={ref}
+ className={cn(
+ "relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
+ className,
+ )}
+ checked={checked}
+ {...props}
+ >
+ <span className="absolute left-2 flex h-3.5 w-3.5 items-center justify-center">
+ <ContextMenuPrimitive.ItemIndicator>
+ <CheckIcon className="h-4 w-4" />
+ </ContextMenuPrimitive.ItemIndicator>
+ </span>
+ {children}
+ </ContextMenuPrimitive.CheckboxItem>
+));
+ContextMenuCheckboxItem.displayName =
+ ContextMenuPrimitive.CheckboxItem.displayName;
+
+const ContextMenuRadioItem = React.forwardRef<
+ React.ElementRef<typeof ContextMenuPrimitive.RadioItem>,
+ React.ComponentPropsWithoutRef<typeof ContextMenuPrimitive.RadioItem>
+>(({ className, children, ...props }, ref) => (
+ <ContextMenuPrimitive.RadioItem
+ ref={ref}
+ className={cn(
+ "relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
+ className,
+ )}
+ {...props}
+ >
+ <span className="absolute left-2 flex h-3.5 w-3.5 items-center justify-center">
+ <ContextMenuPrimitive.ItemIndicator>
+ <DotFilledIcon className="h-4 w-4 fill-current" />
+ </ContextMenuPrimitive.ItemIndicator>
+ </span>
+ {children}
+ </ContextMenuPrimitive.RadioItem>
+));
+ContextMenuRadioItem.displayName = ContextMenuPrimitive.RadioItem.displayName;
+
+const ContextMenuLabel = React.forwardRef<
+ React.ElementRef<typeof ContextMenuPrimitive.Label>,
+ React.ComponentPropsWithoutRef<typeof ContextMenuPrimitive.Label> & {
+ inset?: boolean;
+ }
+>(({ className, inset, ...props }, ref) => (
+ <ContextMenuPrimitive.Label
+ ref={ref}
+ className={cn(
+ "px-2 py-1.5 text-sm font-semibold text-foreground",
+ inset && "pl-8",
+ className,
+ )}
+ {...props}
+ />
+));
+ContextMenuLabel.displayName = ContextMenuPrimitive.Label.displayName;
+
+const ContextMenuSeparator = React.forwardRef<
+ React.ElementRef<typeof ContextMenuPrimitive.Separator>,
+ React.ComponentPropsWithoutRef<typeof ContextMenuPrimitive.Separator>
+>(({ className, ...props }, ref) => (
+ <ContextMenuPrimitive.Separator
+ ref={ref}
+ className={cn("-mx-1 my-1 h-px bg-muted", className)}
+ {...props}
+ />
+));
+ContextMenuSeparator.displayName = ContextMenuPrimitive.Separator.displayName;
+
+const ContextMenuShortcut = ({
+ className,
+ ...props
+}: React.HTMLAttributes<HTMLSpanElement>) => {
+ return (
+ <span
+ className={cn(
+ "ml-auto text-xs tracking-widest text-muted-foreground",
+ className,
+ )}
+ {...props}
+ />
+ );
+};
+ContextMenuShortcut.displayName = "ContextMenuShortcut";
+
+export {
+ ContextMenu,
+ ContextMenuTrigger,
+ ContextMenuContent,
+ ContextMenuItem,
+ ContextMenuCheckboxItem,
+ ContextMenuRadioItem,
+ ContextMenuLabel,
+ ContextMenuSeparator,
+ ContextMenuShortcut,
+ ContextMenuGroup,
+ ContextMenuPortal,
+ ContextMenuSub,
+ ContextMenuSubContent,
+ ContextMenuSubTrigger,
+ ContextMenuRadioGroup,
+};
diff --git a/skyvern-frontend/src/routes/workflows/WorkflowActions.tsx b/skyvern-frontend/src/routes/workflows/WorkflowActions.tsx
index 65734c58d..145d3c2d7 100644
--- a/skyvern-frontend/src/routes/workflows/WorkflowActions.tsx
+++ b/skyvern-frontend/src/routes/workflows/WorkflowActions.tsx
@@ -1,4 +1,3 @@
-import { getClient } from "@/api/AxiosClient";
import { GarbageIcon } from "@/components/icons/GarbageIcon";
import { Button } from "@/components/ui/button";
import {
@@ -22,8 +21,6 @@ import {
DropdownMenuSubTrigger,
DropdownMenuTrigger,
} from "@/components/ui/dropdown-menu";
-import { toast } from "@/components/ui/use-toast";
-import { useCredentialGetter } from "@/hooks/useCredentialGetter";
import {
BookmarkFilledIcon,
BookmarkIcon,
@@ -33,12 +30,7 @@ import {
MixerHorizontalIcon,
ReloadIcon,
} from "@radix-ui/react-icons";
-import { useMutation, useQueryClient } from "@tanstack/react-query";
-import { AxiosError } from "axios";
-import { stringify as convertToYAML } from "yaml";
-import { useNodeCollapseStore } from "./editor/collapse/useNodeCollapseStore";
-import { convert } from "./editor/workflowEditorUtils";
-import { useCreateWorkflowMutation } from "./hooks/useCreateWorkflowMutation";
+import { useWorkflowRowActions } from "./hooks/useWorkflowRowActions";
import { WorkflowApiResponse } from "./types/workflowTypes";
type Props = {
@@ -49,22 +41,6 @@ type Props = {
onToggleParameters?: () => void;
};
-function downloadFile(fileName: string, contents: string) {
- const element = document.createElement("a");
- element.setAttribute(
- "href",
- "data:text/plain;charset=utf-8," + encodeURIComponent(contents),
- );
- element.setAttribute("download", fileName);
-
- element.style.display = "none";
- document.body.appendChild(element);
-
- element.click();
-
- document.body.removeChild(element);
-}
-
function WorkflowActions({
workflow,
onSuccessfullyDeleted,
@@ -72,86 +48,14 @@ function WorkflowActions({
parametersExpanded,
onToggleParameters,
}: Props) {
- const credentialGetter = useCredentialGetter();
- const queryClient = useQueryClient();
-
- function handleExport(type: "json" | "yaml") {
- if (!workflow) {
- return;
- }
- const fileName = `${workflow.title}.${type}`;
- const contents =
- type === "json"
- ? JSON.stringify(convert(workflow), null, 2)
- : convertToYAML(convert(workflow));
- downloadFile(fileName, contents);
- }
-
- const createWorkflowMutation = useCreateWorkflowMutation();
-
- const deleteWorkflowMutation = useMutation({
- mutationFn: async (id: string) => {
- const client = await getClient(credentialGetter);
- return client.delete(`/workflows/${id}`);
- },
- onSuccess: (_data, deletedId) => {
- queryClient.invalidateQueries({
- queryKey: ["workflows"],
- });
- queryClient.invalidateQueries({
- queryKey: ["folders"],
- });
- useNodeCollapseStore.getState().pruneWorkflow(deletedId);
- onSuccessfullyDeleted?.();
- },
- onError: (error: AxiosError) => {
- toast({
- variant: "destructive",
- title: "Failed to delete agent",
- description: error.message,
- });
- },
- });
-
- const templateMutation = useMutation({
- mutationFn: async ({
- workflowPermanentId,
- isTemplate,
- }: {
- workflowPermanentId: string;
- isTemplate: boolean;
- }) => {
- // Template endpoint only exists on /v1 (no /api prefix)
- const client = await getClient(credentialGetter, "sans-api-v1");
- return client.put(
- `/workflows/${workflowPermanentId}/template?is_template=${isTemplate}`,
- );
- },
- onSuccess: (_, variables) => {
- queryClient.invalidateQueries({
- queryKey: ["workflows"],
- });
- queryClient.invalidateQueries({
- queryKey: ["orgTemplates"],
- });
- queryClient.invalidateQueries({
- queryKey: ["workflow", variables.workflowPermanentId],
- });
- toast({
- title: variables.isTemplate
- ? "Saved as template"
- : "Removed from templates",
- variant: "success",
- });
- },
- onError: (error: AxiosError) => {
- toast({
- variant: "destructive",
- title: "Failed to update template status",
- description: error.message,
- });
- },
- });
+ const {
+ clone,
+ toggleTemplate,
+ exportAs,
+ deleteWorkflow,
+ isDeleting,
+ isTogglingTemplate,
+ } = useWorkflowRowActions(workflow);
return (
<Dialog>
@@ -183,31 +87,14 @@ function WorkflowActions({
<DropdownMenuSeparator />
</>
) : null}
- <DropdownMenuItem
- onSelect={() => {
- if (!workflow) {
- return;
- }
- const clonedWorkflow = convert({
- ...workflow,
- title: `Copy of ${workflow.title}`,
- });
- createWorkflowMutation.mutate(clonedWorkflow);
- }}
- className="p-2"
- >
+ <DropdownMenuItem onSelect={() => clone()} className="p-2">
<CopyIcon className="mr-2 h-4 w-4" />
Clone Agent
</DropdownMenuItem>
<DropdownMenuItem
- onSelect={() => {
- templateMutation.mutate({
- workflowPermanentId: workflow.workflow_permanent_id,
- isTemplate: !workflow.is_template,
- });
- }}
+ onSelect={() => toggleTemplate()}
className="p-2"
- disabled={templateMutation.isPending}
+ disabled={isTogglingTemplate}
>
{workflow.is_template ? (
<BookmarkFilledIcon className="mr-2 h-4 w-4" />
@@ -226,18 +113,10 @@ function WorkflowActions({
</DropdownMenuSubTrigger>
<DropdownMenuPortal>
<DropdownMenuSubContent>
- <DropdownMenuItem
- onSelect={() => {
- handleExport("yaml");
- }}
- >
+ <DropdownMenuItem onSelect={() => exportAs("yaml")}>
YAML
</DropdownMenuItem>
- <DropdownMenuItem
- onSelect={() => {
- handleExport("json");
- }}
- >
+ <DropdownMenuItem onSelect={() => exportAs("json")}>
JSON
</DropdownMenuItem>
</DropdownMenuSubContent>
@@ -266,14 +145,10 @@ function WorkflowActions({
</DialogClose>
<Button
variant="destructive"
- onClick={() => {
- deleteWorkflowMutation.mutate(workflow.workflow_permanent_id);
- }}
- disabled={deleteWorkflowMutation.isPending}
+ onClick={() => deleteWorkflow({ onSuccess: onSuccessfullyDeleted })}
+ disabled={isDeleting}
>
- {deleteWorkflowMutation.isPending && (
- <ReloadIcon className="mr-2 h-4 w-4 animate-spin" />
- )}
+ {isDeleting && <ReloadIcon className="mr-2 h-4 w-4 animate-spin" />}
Delete
</Button>
</DialogFooter>
diff --git a/skyvern-frontend/src/routes/workflows/WorkflowsFlat.tsx b/skyvern-frontend/src/routes/workflows/WorkflowsFlat.tsx
index cf43a949b..0c70c4aa5 100644
--- a/skyvern-frontend/src/routes/workflows/WorkflowsFlat.tsx
+++ b/skyvern-frontend/src/routes/workflows/WorkflowsFlat.tsx
@@ -53,8 +53,8 @@ import { cn } from "@/util/utils";
import {
BookmarkFilledIcon,
ChevronDownIcon,
- DotsHorizontalIcon,
LightningBoltIcon,
+ MixerHorizontalIcon,
Pencil2Icon,
PlayIcon,
PlusIcon,
@@ -82,11 +82,11 @@ import {
} from "@/components/ui/dropdown-menu";
import { NarrativeCard } from "./components/header/NarrativeCard";
import { BulkActionBar } from "./components/BulkActionBar";
+import { WorkflowRowContextMenu } from "./components/WorkflowRowContextMenu";
import { FolderCard } from "./components/FolderCard";
import { CreateFolderDialog } from "./components/CreateFolderDialog";
import { CreateFromTemplateDialog } from "./components/CreateFromTemplateDialog";
import { ViewAllFoldersDialog } from "./components/ViewAllFoldersDialog";
-import { WorkflowFolderSelector } from "./components/WorkflowFolderSelector";
import { HighlightText } from "./components/HighlightText";
import { useCreateWorkflowMutation } from "./hooks/useCreateWorkflowMutation";
import { useFoldersQuery } from "./hooks/useFoldersQuery";
@@ -96,7 +96,6 @@ import { useWorkflowTagsBatchQuery } from "./hooks/useWorkflowTagsBatchQuery";
import { useActiveImportsPolling } from "./hooks/useActiveImportsPolling";
import { TagChipList } from "./components/tagging/TagChipList";
import { WorkflowTagFilter } from "./components/tagging/WorkflowTagFilter";
-import { WorkflowTagEditor } from "./components/tagging/WorkflowTagEditor";
import {
parseTagFilter,
serializeTagFilter,
@@ -106,7 +105,6 @@ import { ImportWorkflowButton } from "./ImportWorkflowButton";
import { useNodeCollapseStore } from "./editor/collapse/useNodeCollapseStore";
import { convert } from "./editor/workflowEditorUtils";
import { WorkflowApiResponse } from "./types/workflowTypes";
-import { WorkflowActions } from "./WorkflowActions";
import { WorkflowTemplates } from "../discover/WorkflowTemplates";
import { Skeleton } from "@/components/ui/skeleton";
import { TableSearchInput } from "@/components/TableSearchInput";
@@ -841,7 +839,7 @@ function WorkflowsFlat() {
</div>
</div>
<div className="overflow-hidden rounded-lg border border-border">
- <Table className="table-fixed">
+ <Table className="table-fixed [&_td:last-child]:pr-6 [&_th:last-child]:pr-6">
<TableHeader>
<TableRow className="group/header">
{showCheckbox && (
@@ -954,243 +952,227 @@ function WorkflowsFlat() {
</TableCell>
<TableCell>
<div className="flex justify-end gap-0.5">
- {selected.size === 0 && (
- <Button size="icon" variant="ghost" disabled>
- <FolderIcon className="h-4 w-4" />
- </Button>
- )}
<Button size="icon" variant="ghost" disabled>
- <Pencil2Icon className="h-4 w-4" />
+ <PlayIcon className="h-4 w-4" />
</Button>
<Button size="icon" variant="ghost" disabled>
- <PlayIcon className="h-4 w-4" />
+ <Pencil2Icon className="h-4 w-4" />
</Button>
- {selected.size === 0 && (
- <Button size="icon" variant="ghost" disabled>
- <DotsHorizontalIcon className="h-4 w-4" />
- </Button>
- )}
</div>
</TableCell>
</TableRow>
) : (
- <TableRow
- className="group/row cursor-pointer select-none"
- data-state={isRowSelected ? "selected" : undefined}
+ <WorkflowRowContextMenu
+ workflow={workflow}
+ tagKeys={tagKeys}
+ labelSuggestions={labelSuggestions}
+ valueSuggestionsByKey={valueSuggestionsByKey}
+ taggingEnabled={taggingEnabled}
+ selectedCount={selected.size}
+ onNavigate={(path) => navigate(path)}
+ onDeleted={(id) => {
+ if (!selected.has(id)) return;
+ const next = new Set(selected);
+ next.delete(id);
+ replaceSelection(next);
+ }}
>
- {showCheckbox && (
- <SelectionCheckboxCell
- className="select-none"
- index={selectableIndex}
- checked={isRowSelected}
- hasSelection={selected.size > 0}
- onSelect={handleSelect}
- ariaLabel={`Select ${workflow.title}`}
- />
- )}
- <TableCell
- onClick={(event) => {
- handleRowClick(
- event,
- workflow.workflow_permanent_id,
- );
- }}
+ <TableRow
+ className="group/row cursor-pointer select-none"
+ data-state={isRowSelected ? "selected" : undefined}
>
- <div
- className="truncate font-mono text-xs text-muted-foreground"
- title={workflow.workflow_permanent_id}
- >
- <HighlightText
- text={workflow.workflow_permanent_id}
- query={debouncedSearch}
+ {showCheckbox && (
+ <SelectionCheckboxCell
+ className="select-none"
+ index={selectableIndex}
+ checked={isRowSelected}
+ hasSelection={selected.size > 0}
+ onSelect={handleSelect}
+ ariaLabel={`Select ${workflow.title}`}
/>
- </div>
- </TableCell>
- <TableCell
- onClick={(event) => {
- handleRowClick(
- event,
- workflow.workflow_permanent_id,
- );
- }}
- >
- <div className="flex min-w-0 flex-col gap-1">
- <div className="flex min-w-0 items-center gap-2">
- <span
- className="truncate"
- title={workflow.title}
- >
- <HighlightText
- text={workflow.title}
- query={debouncedSearch}
+ )}
+ <TableCell
+ onClick={(event) => {
+ handleRowClick(
+ event,
+ workflow.workflow_permanent_id,
+ );
+ }}
+ >
+ <div
+ className="truncate font-mono text-xs text-muted-foreground"
+ title={workflow.workflow_permanent_id}
+ >
+ <HighlightText
+ text={workflow.workflow_permanent_id}
+ query={debouncedSearch}
+ />
+ </div>
+ </TableCell>
+ <TableCell
+ onClick={(event) => {
+ handleRowClick(
+ event,
+ workflow.workflow_permanent_id,
+ );
+ }}
+ >
+ <div className="flex min-w-0 flex-col gap-1">
+ <div className="flex min-w-0 items-center gap-2">
+ <span
+ className="truncate"
+ title={workflow.title}
+ >
+ <HighlightText
+ text={workflow.title}
+ query={debouncedSearch}
+ />
+ </span>
+ {workflow.is_template && (
+ <TooltipProvider>
+ <Tooltip>
+ <TooltipTrigger asChild>
+ <BookmarkFilledIcon className="h-3.5 w-3.5 shrink-0 text-blue-500" />
+ </TooltipTrigger>
+ <TooltipContent>
+ Template
+ </TooltipContent>
+ </Tooltip>
+ </TooltipProvider>
+ )}
+ </div>
+ {taggingEnabled &&
+ workflowTags &&
+ workflowTags.length > 0 ? (
+ <TagChipList
+ tags={workflowTags}
+ descriptions={tagDescriptions}
+ colors={tagColors}
/>
- </span>
- {workflow.is_template && (
- <TooltipProvider>
- <Tooltip>
- <TooltipTrigger asChild>
- <BookmarkFilledIcon className="h-3.5 w-3.5 shrink-0 text-blue-500" />
- </TooltipTrigger>
- <TooltipContent>Template</TooltipContent>
- </Tooltip>
- </TooltipProvider>
- )}
+ ) : null}
</div>
- {taggingEnabled &&
- workflowTags &&
- workflowTags.length > 0 ? (
- <TagChipList
- tags={workflowTags}
- descriptions={tagDescriptions}
- colors={tagColors}
- />
- ) : null}
- </div>
- </TableCell>
- <TableCell
- onClick={(event) => {
- handleRowClick(
- event,
- workflow.workflow_permanent_id,
- );
- }}
- >
- {workflow.folder_id ? (
- <div className="flex min-w-0 items-center gap-1.5">
- <FolderIcon className="h-3.5 w-3.5 shrink-0 text-blue-400" />
- <span
- className="truncate text-sm"
- title={
- foldersMap.get(workflow.folder_id)?.title ||
- workflow.folder_id
- }
- >
- <HighlightText
- text={
+ </TableCell>
+ <TableCell
+ onClick={(event) => {
+ handleRowClick(
+ event,
+ workflow.workflow_permanent_id,
+ );
+ }}
+ >
+ {workflow.folder_id ? (
+ <div className="flex min-w-0 items-center gap-1.5">
+ <FolderIcon className="h-3.5 w-3.5 shrink-0 text-blue-400" />
+ <span
+ className="truncate text-sm"
+ title={
foldersMap.get(workflow.folder_id)
?.title || workflow.folder_id
}
- query={debouncedSearch}
- />
- </span>
- </div>
- ) : (
- <span className="text-muted-foreground">-</span>
- )}
- </TableCell>
- <TableCell
- onClick={(event) => {
- handleRowClick(
- event,
- workflow.workflow_permanent_id,
- );
- }}
- className="text-muted-foreground"
- title={basicTimeFormat(workflow.created_at)}
- >
- {compactLocalDateTime(workflow.created_at)}
- </TableCell>
- <TableCell>
- <div className="flex justify-end gap-0.5">
- {/* Folder, tags, and the row menu yield to the bulk bar while any selection is active; Edit and Run stay. */}
- {selected.size === 0 && (
- <>
+ >
+ <HighlightText
+ text={
+ foldersMap.get(workflow.folder_id)
+ ?.title || workflow.folder_id
+ }
+ query={debouncedSearch}
+ />
+ </span>
+ </div>
+ ) : (
+ <span className="text-muted-foreground">-</span>
+ )}
+ </TableCell>
+ <TableCell
+ onClick={(event) => {
+ handleRowClick(
+ event,
+ workflow.workflow_permanent_id,
+ );
+ }}
+ className="text-muted-foreground"
+ title={basicTimeFormat(workflow.created_at)}
+ >
+ {compactLocalDateTime(workflow.created_at)}
+ </TableCell>
+ <TableCell>
+ <div className="flex justify-end gap-0.5">
+ {hasParameters && (
<TooltipProvider>
<Tooltip>
<TooltipTrigger asChild>
- <div>
- <WorkflowFolderSelector
- workflowPermanentId={
- workflow.workflow_permanent_id
- }
- currentFolderId={workflow.folder_id}
- disabled={isBulkOperating}
- />
- </div>
+ <Button
+ size="icon"
+ variant="ghost"
+ className="text-muted-foreground hover:text-foreground"
+ onClick={() =>
+ toggleParametersExpanded(
+ workflow.workflow_permanent_id,
+ )
+ }
+ >
+ <MixerHorizontalIcon className="h-4 w-4" />
+ </Button>
</TooltipTrigger>
<TooltipContent>
- Assign to Folder
+ {isExpanded
+ ? "Hide parameters"
+ : "Show parameters"}
</TooltipContent>
</Tooltip>
</TooltipProvider>
- {taggingEnabled ? (
- <WorkflowTagEditor
- workflowPermanentId={
- workflow.workflow_permanent_id
- }
- tags={workflowTags ?? []}
- tagKeys={tagKeys}
- labelSuggestions={labelSuggestions}
- valueSuggestionsByKey={
- valueSuggestionsByKey
- }
- colorMap={tagColors}
- />
- ) : null}
- </>
- )}
- <TooltipProvider>
- <Tooltip>
- <TooltipTrigger asChild>
- <Button
- size="icon"
- variant="ghost"
- className="text-muted-foreground hover:text-foreground"
- onClick={(event) => {
- handleIconClick(
- event,
- workflowEditorPath(
- workflow.workflow_permanent_id,
- studioEnabled,
- ),
- );
- }}
- >
- <Pencil2Icon className="h-4 w-4" />
- </Button>
- </TooltipTrigger>
- <TooltipContent>
- Open in Editor
- </TooltipContent>
- </Tooltip>
- </TooltipProvider>
- <TooltipProvider>
- <Tooltip>
- <TooltipTrigger asChild>
- <Button
- size="icon"
- variant="ghost"
- className="text-cta hover:text-cta"
- onClick={(event) => {
- handleIconClick(
- event,
- `/workflows/${workflow.workflow_permanent_id}/run`,
- );
- }}
- >
- <PlayIcon className="h-4 w-4" />
- </Button>
- </TooltipTrigger>
- <TooltipContent>
- Create New Run
- </TooltipContent>
- </Tooltip>
- </TooltipProvider>
- {selected.size === 0 && (
- <WorkflowActions
- workflow={workflow}
- hasParameters={hasParameters}
- parametersExpanded={isExpanded}
- onToggleParameters={() =>
- toggleParametersExpanded(
- workflow.workflow_permanent_id,
- )
- }
- />
- )}
- </div>
- </TableCell>
- </TableRow>
+ )}
+ <TooltipProvider>
+ <Tooltip>
+ <TooltipTrigger asChild>
+ <Button
+ size="icon"
+ variant="ghost"
+ className="text-cta hover:text-cta"
+ onClick={(event) => {
+ handleIconClick(
+ event,
+ `/workflows/${workflow.workflow_permanent_id}/run`,
+ );
+ }}
+ >
+ <PlayIcon className="h-4 w-4" />
+ </Button>
+ </TooltipTrigger>
+ <TooltipContent>
+ Create New Run
+ </TooltipContent>
+ </Tooltip>
+ </TooltipProvider>
+ <TooltipProvider>
+ <Tooltip>
+ <TooltipTrigger asChild>
+ <Button
+ size="icon"
+ variant="ghost"
+ className="text-muted-foreground hover:text-foreground"
+ onClick={(event) => {
+ handleIconClick(
+ event,
+ workflowEditorPath(
+ workflow.workflow_permanent_id,
+ studioEnabled,
+ ),
+ );
+ }}
+ >
+ <Pencil2Icon className="h-4 w-4" />
+ </Button>
+ </TooltipTrigger>
+ <TooltipContent>
+ Open in Editor
+ </TooltipContent>
+ </Tooltip>
+ </TooltipProvider>
+ </div>
+ </TableCell>
+ </TableRow>
+ </WorkflowRowContextMenu>
)}
{/* Expanded parameters section */}
diff --git a/skyvern-frontend/src/routes/workflows/WorkflowsTree.tsx b/skyvern-frontend/src/routes/workflows/WorkflowsTree.tsx
index fd335f6cb..a25860c2f 100644
--- a/skyvern-frontend/src/routes/workflows/WorkflowsTree.tsx
+++ b/skyvern-frontend/src/routes/workflows/WorkflowsTree.tsx
@@ -713,6 +713,12 @@ function WorkflowsTree() {
matchesParameter,
handleRowClick,
handleIconClick,
+ onRowDeleted: (id) => {
+ if (!selected.has(id)) return;
+ const next = new Set(selected);
+ next.delete(id);
+ replaceSelection(next);
+ },
};
const showFlatInitialSkeleton =
@@ -998,7 +1004,7 @@ function WorkflowsTree() {
</div>
<WorkflowsListContext.Provider value={listContextValue}>
<div className="overflow-hidden rounded-lg border border-border">
- <Table className="table-fixed">
+ <Table className="table-fixed [&_td:last-child]:pr-6 [&_th:last-child]:pr-6">
<TableHeader>
<TableRow className="group/header">
{showCheckbox && (
diff --git a/skyvern-frontend/src/routes/workflows/components/BulkActionBar.tsx b/skyvern-frontend/src/routes/workflows/components/BulkActionBar.tsx
index de6e4681c..d016e1d8a 100644
--- a/skyvern-frontend/src/routes/workflows/components/BulkActionBar.tsx
+++ b/skyvern-frontend/src/routes/workflows/components/BulkActionBar.tsx
@@ -1,13 +1,15 @@
import { getClient } from "@/api/AxiosClient";
+import { useState } from "react";
import { FolderIcon } from "@/components/icons/FolderIcon";
import { GarbageIcon } from "@/components/icons/GarbageIcon";
-import { SelectionBar, SelectionBarDivider } from "@/components/SelectionBar";
+import { SelectionBar } from "@/components/SelectionBar";
import { Button } from "@/components/ui/button";
import {
DropdownMenu,
DropdownMenuContent,
DropdownMenuItem,
DropdownMenuPortal,
+ DropdownMenuSeparator,
DropdownMenuSub,
DropdownMenuSubContent,
DropdownMenuSubTrigger,
@@ -22,17 +24,18 @@ import {
import {
BookmarkFilledIcon,
BookmarkIcon,
+ ChevronDownIcon,
CopyIcon,
- DotsHorizontalIcon,
DownloadIcon,
+ TokensIcon,
} from "@radix-ui/react-icons";
import { useQueryClient } from "@tanstack/react-query";
import { stringify as convertToYAML } from "yaml";
import { convert } from "../editor/workflowEditorUtils";
import { Tag, TagKey } from "../types/tagTypes";
import { WorkflowApiResponse } from "../types/workflowTypes";
-import { BulkTagPicker } from "./tagging/BulkTagPicker";
-import { WorkflowFolderSelector } from "./WorkflowFolderSelector";
+import { FolderPickerCommand } from "./FolderPickerCommand";
+import { TagPickerCommand } from "./tagging/TagPickerCommand";
type Props = {
selectedWorkflows: WorkflowApiResponse[];
@@ -84,6 +87,7 @@ function BulkActionBar({
const templates = selectedWorkflows.filter(
(workflow) => workflow.is_template,
);
+ const [tagError, setTagError] = useState<string | null>(null);
async function handleBulkClone() {
onOperatingChange(true);
@@ -176,6 +180,11 @@ function BulkActionBar({
}
async function handleBulkTagApply(tag: Tag) {
+ // The submenu stays open after a pick (tagging is additive), so guard against
+ // a second apply racing the first set of POSTs for the same selection.
+ if (isOperating) {
+ return;
+ }
onOperatingChange(true);
try {
const client = await getClient(credentialGetter);
@@ -235,51 +244,76 @@ function BulkActionBar({
downloadFile(`agents-export-${selectedWorkflows.length}.${type}`, contents);
}
+ const agentNoun = count === 1 ? "agent" : "agents";
+
return (
<SelectionBar
count={count}
isOperating={isOperating}
onClear={onClearSelection}
>
- <WorkflowFolderSelector
- currentFolderId={null}
- bulkCount={count}
- onBulkFolderSelect={onMoveToFolder}
- bulkHasFolders={selectedWorkflows.some(
- (workflow) => workflow.folder_id !== null,
- )}
- disabled={isOperating}
- trigger={
- <Button size="sm" variant="ghost" disabled={isOperating}>
- <FolderIcon className="mr-1.5 h-4 w-4" />
- Move to folder
- </Button>
- }
- />
- {taggingEnabled && (
- <BulkTagPicker
- bulkCount={count}
- tagKeys={tagKeys}
- labelSuggestions={labelSuggestions}
- valueSuggestionsByKey={valueSuggestionsByKey}
- disabled={isOperating}
- onApplyTag={handleBulkTagApply}
- />
- )}
- <DropdownMenu>
+ <DropdownMenu
+ onOpenChange={(open) => {
+ if (!open) {
+ setTagError(null);
+ }
+ }}
+ >
<DropdownMenuTrigger asChild>
<Button size="sm" variant="ghost" disabled={isOperating}>
- <DotsHorizontalIcon className="mr-1.5 h-4 w-4" />
- More
+ Actions
+ <ChevronDownIcon className="ml-1.5 h-4 w-4" />
</Button>
</DropdownMenuTrigger>
- <DropdownMenuContent align="end" side="top">
- <DropdownMenuItem
- className="p-2"
- onSelect={() => void handleBulkClone()}
- >
+ <DropdownMenuContent align="start" side="top" className="w-56">
+ {taggingEnabled && (
+ <DropdownMenuSub
+ onOpenChange={(open) => {
+ if (!open) {
+ setTagError(null);
+ }
+ }}
+ >
+ <DropdownMenuSubTrigger>
+ <TokensIcon className="mr-2 h-4 w-4" />
+ Tag {count} {agentNoun}
+ </DropdownMenuSubTrigger>
+ <DropdownMenuPortal>
+ <DropdownMenuSubContent className="w-72 p-0">
+ <TagPickerCommand
+ tagKeys={tagKeys}
+ labelSuggestions={labelSuggestions}
+ valueSuggestionsByKey={valueSuggestionsByKey}
+ error={tagError}
+ onErrorChange={setTagError}
+ disabled={isOperating}
+ onApply={(tag) => void handleBulkTagApply(tag)}
+ />
+ </DropdownMenuSubContent>
+ </DropdownMenuPortal>
+ </DropdownMenuSub>
+ )}
+ <DropdownMenuSub>
+ <DropdownMenuSubTrigger>
+ <FolderIcon className="mr-2 h-4 w-4" />
+ Move {count} to folder
+ </DropdownMenuSubTrigger>
+ <DropdownMenuPortal>
+ <DropdownMenuSubContent className="w-72 p-0">
+ <FolderPickerCommand
+ currentFolderId={null}
+ showRemove={selectedWorkflows.some(
+ (workflow) => workflow.folder_id !== null,
+ )}
+ onSelect={(folderId) => void onMoveToFolder(folderId)}
+ />
+ </DropdownMenuSubContent>
+ </DropdownMenuPortal>
+ </DropdownMenuSub>
+ <DropdownMenuSeparator />
+ <DropdownMenuItem onSelect={() => void handleBulkClone()}>
<CopyIcon className="mr-2 h-4 w-4" />
- Clone
+ Clone {count}
</DropdownMenuItem>
<DropdownMenuSub>
<DropdownMenuSubTrigger>
@@ -312,7 +346,7 @@ function BulkActionBar({
<DropdownMenuSub>
<DropdownMenuSubTrigger>
<DownloadIcon className="mr-2 h-4 w-4" />
- Export as...
+ Export
</DropdownMenuSubTrigger>
<DropdownMenuPortal>
<DropdownMenuSubContent>
@@ -325,19 +359,16 @@ function BulkActionBar({
</DropdownMenuSubContent>
</DropdownMenuPortal>
</DropdownMenuSub>
+ <DropdownMenuSeparator />
+ <DropdownMenuItem
+ className="text-destructive focus:text-destructive"
+ onSelect={() => onDeleteRequest()}
+ >
+ <GarbageIcon className="mr-2 h-4 w-4 text-destructive" />
+ Delete {count}
+ </DropdownMenuItem>
</DropdownMenuContent>
</DropdownMenu>
- <SelectionBarDivider />
- <Button
- size="sm"
- variant="ghost"
- className="text-destructive hover:bg-destructive/10 hover:text-destructive"
- onClick={onDeleteRequest}
- disabled={isOperating}
- >
- <GarbageIcon className="mr-1.5 h-4 w-4" />
- Delete
- </Button>
</SelectionBar>
);
}
diff --git a/skyvern-frontend/src/routes/workflows/components/FolderPickerCommand.test.tsx b/skyvern-frontend/src/routes/workflows/components/FolderPickerCommand.test.tsx
new file mode 100644
index 000000000..7510a07ae
--- /dev/null
+++ b/skyvern-frontend/src/routes/workflows/components/FolderPickerCommand.test.tsx
@@ -0,0 +1,84 @@
+// @vitest-environment jsdom
+import {
+ afterAll,
+ afterEach,
+ beforeAll,
+ describe,
+ expect,
+ it,
+ vi,
+} from "vitest";
+import { cleanup, fireEvent, render, screen } from "@testing-library/react";
+
+import { FolderPickerCommand } from "./FolderPickerCommand";
+import type { Folder } from "../types/folderTypes";
+
+const foldersResult: { data: Folder[]; isFetching: boolean } = {
+ data: [],
+ isFetching: false,
+};
+vi.mock("../hooks/useFoldersQuery", () => ({
+ useFoldersQuery: () => foldersResult,
+}));
+
+// cmdk needs ResizeObserver and scrollIntoView, which jsdom lacks.
+class MockResizeObserver {
+ observe() {}
+ unobserve() {}
+ disconnect() {}
+}
+const originalScrollIntoView = Element.prototype.scrollIntoView;
+beforeAll(() => {
+ vi.stubGlobal("ResizeObserver", MockResizeObserver);
+ Element.prototype.scrollIntoView = () => {};
+});
+afterAll(() => {
+ vi.unstubAllGlobals();
+ if (originalScrollIntoView) {
+ Element.prototype.scrollIntoView = originalScrollIntoView;
+ } else {
+ delete (Element.prototype as { scrollIntoView?: unknown }).scrollIntoView;
+ }
+});
+afterEach(() => {
+ foldersResult.data = [];
+ foldersResult.isFetching = false;
+ cleanup();
+});
+
+function folder(folder_id: string, title: string): Folder {
+ return { folder_id, title } as unknown as Folder;
+}
+
+describe("FolderPickerCommand", () => {
+ it("shows the empty state when no folders match", () => {
+ render(<FolderPickerCommand currentFolderId={null} onSelect={() => {}} />);
+
+ expect(screen.getByText("No folders found.")).toBeTruthy();
+ });
+
+ it("reports the chosen folder id", () => {
+ foldersResult.data = [folder("f1", "Prospects")];
+ const onSelect = vi.fn();
+ render(<FolderPickerCommand currentFolderId={null} onSelect={onSelect} />);
+
+ fireEvent.click(screen.getByText("Prospects"));
+
+ expect(onSelect).toHaveBeenCalledWith("f1");
+ });
+
+ it("offers Remove from folder and reports a null selection", () => {
+ const onSelect = vi.fn();
+ render(
+ <FolderPickerCommand
+ currentFolderId="f1"
+ showRemove
+ onSelect={onSelect}
+ />,
+ );
+
+ fireEvent.click(screen.getByText("Remove from folder"));
+
+ expect(onSelect).toHaveBeenCalledWith(null);
+ });
+});
diff --git a/skyvern-frontend/src/routes/workflows/components/FolderPickerCommand.tsx b/skyvern-frontend/src/routes/workflows/components/FolderPickerCommand.tsx
new file mode 100644
index 000000000..36ad4006a
--- /dev/null
+++ b/skyvern-frontend/src/routes/workflows/components/FolderPickerCommand.tsx
@@ -0,0 +1,99 @@
+import * as React from "react";
+import { CheckIcon, Cross2Icon } from "@radix-ui/react-icons";
+import { useDebounce } from "use-debounce";
+import { FolderIcon } from "@/components/icons/FolderIcon";
+import {
+ Command,
+ CommandEmpty,
+ CommandGroup,
+ CommandInput,
+ CommandItem,
+ CommandList,
+} from "@/components/ui/command";
+import { useFoldersQuery } from "../hooks/useFoldersQuery";
+
+type Props = {
+ currentFolderId: string | null;
+ // Force-show "Remove from folder" independent of currentFolderId (bulk: any selected has a folder).
+ showRemove?: boolean;
+ onSelect: (folderId: string | null) => void;
+};
+
+const FOLDER_PICKER_PAGE_SIZE = 50;
+
+// Compact cmdk folder list for the row context menu. Server-side search keeps it
+// usable past the page cap; "Remove from folder" shows only when the agent has one.
+function FolderPickerCommand({ currentFolderId, showRemove, onSelect }: Props) {
+ const [query, setQuery] = React.useState("");
+ const [debouncedQuery] = useDebounce(query, 300);
+ const inputRef = React.useRef<HTMLInputElement>(null);
+
+ React.useEffect(() => {
+ // Radix MenuSubContent moves focus to its container on open; re-focus the
+ // input on the next frame so typing lands in the command, not the menu.
+ const frame = requestAnimationFrame(() => inputRef.current?.focus());
+ return () => cancelAnimationFrame(frame);
+ }, []);
+
+ const { data: folders = [], isFetching } = useFoldersQuery({
+ page_size: FOLDER_PICKER_PAGE_SIZE,
+ search: debouncedQuery.trim() || undefined,
+ });
+
+ return (
+ <Command
+ shouldFilter={false}
+ onKeyDown={(event) => {
+ // Let Escape bubble so the menu can close; keep every other key from
+ // reaching the parent menu's typeahead so cmdk can handle it.
+ if (event.key !== "Escape") {
+ event.stopPropagation();
+ }
+ }}
+ >
+ <CommandInput
+ ref={inputRef}
+ placeholder="Search folders…"
+ value={query}
+ onValueChange={setQuery}
+ />
+ <CommandList>
+ {(showRemove ?? currentFolderId !== null) ? (
+ <CommandGroup>
+ <CommandItem value="__remove__" onSelect={() => onSelect(null)}>
+ <Cross2Icon className="mr-2 h-4 w-4 text-destructive" />
+ Remove from folder
+ </CommandItem>
+ </CommandGroup>
+ ) : null}
+ {folders.length === 0 ? (
+ <CommandEmpty>
+ {isFetching ? "Searching folders…" : "No folders found."}
+ </CommandEmpty>
+ ) : (
+ <CommandGroup heading="Folders">
+ {folders.map((folder) => {
+ const isCurrent = folder.folder_id === currentFolderId;
+ return (
+ <CommandItem
+ key={folder.folder_id}
+ value={`folder-${folder.folder_id}`}
+ disabled={isCurrent}
+ onSelect={() => onSelect(folder.folder_id)}
+ >
+ <FolderIcon className="mr-2 h-4 w-4 shrink-0 text-blue-400" />
+ <span className="truncate">{folder.title}</span>
+ {isCurrent ? (
+ <CheckIcon className="ml-auto h-4 w-4 text-blue-400" />
+ ) : null}
+ </CommandItem>
+ );
+ })}
+ </CommandGroup>
+ )}
+ </CommandList>
+ </Command>
+ );
+}
+
+export { FolderPickerCommand };
diff --git a/skyvern-frontend/src/routes/workflows/components/WorkflowFolderSelector.tsx b/skyvern-frontend/src/routes/workflows/components/WorkflowFolderSelector.tsx
deleted file mode 100644
index 1ce44df9d..000000000
--- a/skyvern-frontend/src/routes/workflows/components/WorkflowFolderSelector.tsx
+++ /dev/null
@@ -1,227 +0,0 @@
-import { useMemo, useState } from "react";
-import {
- CheckIcon,
- Cross2Icon,
- MagnifyingGlassIcon,
- ReloadIcon,
-} from "@radix-ui/react-icons";
-import { FolderIcon } from "@/components/icons/FolderIcon";
-import { Button } from "@/components/ui/button";
-import {
- Popover,
- PopoverContent,
- PopoverTrigger,
-} from "@/components/ui/popover";
-import { Input } from "@/components/ui/input";
-import { cn, handleInfiniteScroll } from "@/util/utils";
-import { useInfiniteFoldersQuery } from "../hooks/useInfiniteFoldersQuery";
-import { useUpdateWorkflowFolderMutation } from "../hooks/useFolderMutations";
-import { useDebounce } from "use-debounce";
-import { Skeleton } from "@/components/ui/skeleton";
-import { toast } from "@/components/ui/use-toast";
-
-interface WorkflowFolderSelectorProps {
- workflowPermanentId?: string;
- currentFolderId: string | null;
- bulkCount?: number;
- onBulkFolderSelect?: (folderId: string | null) => Promise<void>;
- bulkHasFolders?: boolean;
- disabled?: boolean;
- trigger?: React.ReactNode;
-}
-
-function WorkflowFolderSelector({
- workflowPermanentId,
- currentFolderId,
- bulkCount,
- onBulkFolderSelect,
- bulkHasFolders = true,
- disabled = false,
- trigger,
-}: WorkflowFolderSelectorProps) {
- const [open, setOpen] = useState(false);
- const [search, setSearch] = useState("");
- const [debouncedSearch] = useDebounce(search, 500);
- const isTyping = search !== debouncedSearch;
- const isBulkMode = (bulkCount ?? 0) > 0 && Boolean(onBulkFolderSelect);
-
- const { data, fetchNextPage, hasNextPage, isFetchingNextPage, isFetching } =
- useInfiniteFoldersQuery({
- search: debouncedSearch,
- page_size: 20,
- });
-
- const folders = useMemo(() => {
- return data?.pages.flatMap((page) => page) ?? [];
- }, [data]);
-
- const updateFolderMutation = useUpdateWorkflowFolderMutation();
-
- async function handleFolderSelect(folderId: string | null) {
- // Close before the request; progress feedback lives in the caller (toast
- // or the bulk bar's Processing label), not in a hanging popover.
- setOpen(false);
- setSearch("");
- if (isBulkMode && onBulkFolderSelect) {
- await onBulkFolderSelect(folderId);
- } else if (workflowPermanentId) {
- try {
- await updateFolderMutation.mutateAsync({
- workflowPermanentId,
- data: { folder_id: folderId },
- });
- } catch (error) {
- toast({
- variant: "destructive",
- title: folderId
- ? "Failed to move agent to folder"
- : "Failed to remove agent from folder",
- description: error instanceof Error ? error.message : undefined,
- });
- }
- } else if (import.meta.env.DEV) {
- console.warn(
- "WorkflowFolderSelector needs workflowPermanentId (single mode) or onBulkFolderSelect (bulk mode).",
- );
- }
- }
-
- const showRemoveFromFolder = isBulkMode
- ? bulkHasFolders
- : Boolean(currentFolderId);
-
- return (
- <Popover open={open} onOpenChange={setOpen}>
- <PopoverTrigger asChild>
- {trigger ?? (
- <Button
- variant="ghost"
- size="icon"
- disabled={disabled}
- className={cn(
- "text-muted-foreground hover:text-foreground",
- currentFolderId && "text-blue-400 hover:text-blue-400",
- )}
- >
- <FolderIcon className="h-4 w-4" />
- </Button>
- )}
- </PopoverTrigger>
- <PopoverContent
- className="w-80 p-0"
- align="end"
- onCloseAutoFocus={(e) => e.preventDefault()}
- >
- <div className="border-b p-3">
- <h4 className="mb-2 text-sm font-medium">
- {isBulkMode
- ? `Move ${bulkCount} agent${bulkCount === 1 ? "" : "s"} to folder`
- : "Move to folder"}
- </h4>
- <div className="relative">
- <MagnifyingGlassIcon className="absolute left-2 top-1/2 h-4 w-4 -translate-y-1/2 text-slate-400" />
- <Input
- placeholder="Search folders..."
- value={search}
- onChange={(e) => setSearch(e.target.value)}
- className="h-8 pl-8"
- autoFocus
- />
- </div>
- </div>
- <div
- className="max-h-[300px] overflow-y-auto overflow-x-hidden [&::-webkit-scrollbar-thumb]:rounded-full [&::-webkit-scrollbar-thumb]:border-2 [&::-webkit-scrollbar-thumb]:border-slate-100 [&::-webkit-scrollbar-thumb]:bg-slate-300 dark:[&::-webkit-scrollbar-thumb]:border-slate-800 dark:[&::-webkit-scrollbar-thumb]:bg-slate-600 [&::-webkit-scrollbar-track]:bg-slate-100 dark:[&::-webkit-scrollbar-track]:bg-slate-800 [&::-webkit-scrollbar]:w-2"
- onScroll={(e) =>
- handleInfiniteScroll(
- e,
- fetchNextPage,
- hasNextPage,
- isFetchingNextPage,
- )
- }
- >
- {showRemoveFromFolder && (
- <button
- type="button"
- onClick={() => {
- void handleFolderSelect(null);
- }}
- disabled={disabled || updateFolderMutation.isPending}
- className="flex w-full items-center justify-between border-b px-3 py-2 text-left text-sm transition-colors hover:bg-slate-50 disabled:opacity-50 dark:hover:bg-slate-800"
- >
- <div className="flex items-center gap-2">
- <Cross2Icon className="h-4 w-4 text-red-400" />
- <span>Remove from folder</span>
- </div>
- </button>
- )}
-
- {(isFetching || isTyping) && folders.length === 0 ? (
- <>
- {Array.from({ length: 8 }).map((_, index) => (
- <div
- key={`skeleton-${index}`}
- className="flex w-full items-center gap-2 px-3 py-2"
- >
- <Skeleton className="h-4 w-4" />
- <div className="flex flex-1 flex-col gap-1">
- <Skeleton className="h-4 w-3/4" />
- <Skeleton className="h-3 w-1/2" />
- </div>
- </div>
- ))}
- </>
- ) : folders.length === 0 ? (
- <div className="px-3 py-8 text-center text-sm text-slate-400">
- No folders found
- </div>
- ) : (
- <>
- {folders.map((folder) => {
- const isCurrentFolder =
- !isBulkMode && currentFolderId === folder.folder_id;
- return (
- <button
- key={folder.folder_id}
- type="button"
- onClick={() => {
- void handleFolderSelect(folder.folder_id);
- }}
- disabled={
- disabled ||
- updateFolderMutation.isPending ||
- isCurrentFolder
- }
- className="flex w-full items-center justify-between px-3 py-2 text-left text-sm transition-colors hover:bg-slate-50 disabled:opacity-50 dark:hover:bg-slate-800"
- >
- <div className="flex min-w-0 items-center gap-2">
- <FolderIcon className="h-4 w-4 shrink-0 text-blue-400" />
- <div className="flex min-w-0 flex-col">
- <span className="break-words">{folder.title}</span>
- {folder.description && (
- <span className="line-clamp-2 break-words text-xs text-slate-400 [overflow-wrap:anywhere]">
- {folder.description}
- </span>
- )}
- </div>
- </div>
- {isCurrentFolder && (
- <CheckIcon className="h-4 w-4 text-blue-400" />
- )}
- </button>
- );
- })}
- {isFetchingNextPage && (
- <div className="flex items-center justify-center py-2">
- <ReloadIcon className="h-3 w-3 animate-spin text-slate-400" />
- </div>
- )}
- </>
- )}
- </div>
- </PopoverContent>
- </Popover>
- );
-}
-
-export { WorkflowFolderSelector };
diff --git a/skyvern-frontend/src/routes/workflows/components/WorkflowRowContextMenu.delete.test.tsx b/skyvern-frontend/src/routes/workflows/components/WorkflowRowContextMenu.delete.test.tsx
new file mode 100644
index 000000000..380795bdb
--- /dev/null
+++ b/skyvern-frontend/src/routes/workflows/components/WorkflowRowContextMenu.delete.test.tsx
@@ -0,0 +1,112 @@
+// @vitest-environment jsdom
+import * as React from "react";
+import {
+ cleanup,
+ fireEvent,
+ render,
+ screen,
+ within,
+} from "@testing-library/react";
+import { MemoryRouter } from "react-router-dom";
+import { afterEach, describe, expect, it, vi } from "vitest";
+
+// Flatten the Radix context menu so the Delete item (wrapped in a DialogTrigger)
+// is directly reachable; render submenu bodies as null so the tag/folder pickers
+// (which need query providers) never mount.
+vi.mock("@/components/ui/context-menu", () => {
+ const Pass = ({ children }: { children?: React.ReactNode }) => (
+ <>{children}</>
+ );
+ const Item = React.forwardRef(function Item(
+ { children, onSelect, ...props }: Record<string, unknown>,
+ ref: React.Ref<HTMLButtonElement>,
+ ) {
+ return (
+ <button ref={ref} onClick={onSelect as () => void} {...props}>
+ {children as React.ReactNode}
+ </button>
+ );
+ });
+ return {
+ ContextMenu: Pass,
+ ContextMenuTrigger: Pass,
+ ContextMenuContent: Pass,
+ ContextMenuItem: Item,
+ ContextMenuLabel: Pass,
+ ContextMenuSeparator: () => null,
+ ContextMenuSub: Pass,
+ ContextMenuSubTrigger: () => null,
+ ContextMenuSubContent: () => null,
+ };
+});
+
+const deleteWorkflow = vi.fn((opts?: { onSuccess?: () => void }) =>
+ opts?.onSuccess?.(),
+);
+vi.mock("../hooks/useWorkflowRowActions", () => ({
+ useWorkflowRowActions: () => ({
+ clone: vi.fn(),
+ toggleTemplate: vi.fn(),
+ exportAs: vi.fn(),
+ deleteWorkflow,
+ isDeleting: false,
+ isTogglingTemplate: false,
+ }),
+}));
+vi.mock("@/hooks/useWorkflowStudioEnabled", () => ({
+ useWorkflowStudioEnabled: () => false,
+}));
+vi.mock("../hooks/useFolderMutations", () => ({
+ useUpdateWorkflowFolderMutation: () => ({ mutateAsync: vi.fn() }),
+}));
+vi.mock("../hooks/useWorkflowTagMutations", () => ({
+ useApplyWorkflowTagsMutation: () => ({ mutate: vi.fn() }),
+}));
+
+import { WorkflowRowContextMenu } from "./WorkflowRowContextMenu";
+import type { WorkflowApiResponse } from "../types/workflowTypes";
+
+function buildWorkflow(): WorkflowApiResponse {
+ return {
+ workflow_permanent_id: "wpid_1",
+ title: "Scrape leads",
+ is_template: false,
+ folder_id: null,
+ } as unknown as WorkflowApiResponse;
+}
+
+function renderMenu(props?: {
+ selectedCount?: number;
+ onDeleted?: (id: string) => void;
+}) {
+ return render(
+ <MemoryRouter>
+ <WorkflowRowContextMenu
+ workflow={buildWorkflow()}
+ tagKeys={[]}
+ labelSuggestions={[]}
+ valueSuggestionsByKey={new Map()}
+ onNavigate={() => {}}
+ selectedCount={props?.selectedCount ?? 1}
+ onDeleted={props?.onDeleted}
+ >
+ <div>row</div>
+ </WorkflowRowContextMenu>
+ </MemoryRouter>,
+ );
+}
+
+afterEach(cleanup);
+
+describe("WorkflowRowContextMenu single-row delete", () => {
+ it("notifies onDeleted with the workflow id after a successful delete", () => {
+ const onDeleted = vi.fn();
+ renderMenu({ selectedCount: 1, onDeleted });
+
+ fireEvent.click(screen.getByText("Delete"));
+ const dialog = screen.getByRole("dialog");
+ fireEvent.click(within(dialog).getByRole("button", { name: /delete/i }));
+
+ expect(onDeleted).toHaveBeenCalledWith("wpid_1");
+ });
+});
diff --git a/skyvern-frontend/src/routes/workflows/components/WorkflowRowContextMenu.tsx b/skyvern-frontend/src/routes/workflows/components/WorkflowRowContextMenu.tsx
new file mode 100644
index 000000000..2fc7c5aea
--- /dev/null
+++ b/skyvern-frontend/src/routes/workflows/components/WorkflowRowContextMenu.tsx
@@ -0,0 +1,312 @@
+import * as React from "react";
+import {
+ BookmarkFilledIcon,
+ BookmarkIcon,
+ CopyIcon,
+ DownloadIcon,
+ Pencil2Icon,
+ PlayIcon,
+ ReloadIcon,
+ TokensIcon,
+} from "@radix-ui/react-icons";
+import { FolderIcon } from "@/components/icons/FolderIcon";
+import { GarbageIcon } from "@/components/icons/GarbageIcon";
+import { Button } from "@/components/ui/button";
+import {
+ ContextMenu,
+ ContextMenuContent,
+ ContextMenuItem,
+ ContextMenuLabel,
+ ContextMenuSeparator,
+ ContextMenuSub,
+ ContextMenuSubContent,
+ ContextMenuSubTrigger,
+ ContextMenuTrigger,
+} from "@/components/ui/context-menu";
+import {
+ Dialog,
+ DialogContent,
+ DialogDescription,
+ DialogFooter,
+ DialogHeader,
+ DialogTitle,
+ DialogTrigger,
+} from "@/components/ui/dialog";
+import { toast } from "@/components/ui/use-toast";
+import { cn } from "@/util/utils";
+import { useWorkflowStudioEnabled } from "@/hooks/useWorkflowStudioEnabled";
+import { useUpdateWorkflowFolderMutation } from "../hooks/useFolderMutations";
+import { useApplyWorkflowTagsMutation } from "../hooks/useWorkflowTagMutations";
+import { useWorkflowRowActions } from "../hooks/useWorkflowRowActions";
+import { workflowEditorPath } from "../studioNavigation";
+import { Tag, TagKey } from "../types/tagTypes";
+import { WorkflowApiResponse } from "../types/workflowTypes";
+import { FolderPickerCommand } from "./FolderPickerCommand";
+import { TagPickerCommand } from "./tagging/TagPickerCommand";
+
+type Props = {
+ workflow: WorkflowApiResponse;
+ tagKeys: Array<TagKey>;
+ labelSuggestions: Array<string>;
+ valueSuggestionsByKey?: Map<string, Array<string>>;
+ onNavigate: (path: string) => void;
+ // Lets the list prune this id from its multi-select set after a single-row
+ // delete, so the selection header/bulk bar can't get stuck on a gone row.
+ onDeleted?: (workflowId: string) => void;
+ // Single-row nav (Open in editor / Run) hides when a multi-selection is active.
+ selectedCount?: number;
+ // Defaults to shown; only an explicit false (cloud flag off) hides tagging.
+ taggingEnabled?: boolean;
+ children: React.ReactNode;
+};
+
+function WorkflowRowContextMenu({
+ workflow,
+ tagKeys,
+ labelSuggestions,
+ valueSuggestionsByKey,
+ onNavigate,
+ onDeleted,
+ selectedCount = 0,
+ taggingEnabled = true,
+ children,
+}: Props) {
+ const studioEnabled = useWorkflowStudioEnabled();
+ const updateFolderMutation = useUpdateWorkflowFolderMutation();
+ const applyTagsMutation = useApplyWorkflowTagsMutation();
+ const [deleteOpen, setDeleteOpen] = React.useState(false);
+ const [menuOpen, setMenuOpen] = React.useState(false);
+ const [tagError, setTagError] = React.useState<string | null>(null);
+ // Right-click still targets the single clicked row; until SKY-11504 lets it act
+ // on the whole selection, steer multi-select to the bulk Actions bar.
+ const isMultiSelect = selectedCount > 1;
+
+ const {
+ clone,
+ toggleTemplate,
+ exportAs,
+ deleteWorkflow,
+ isDeleting,
+ isTogglingTemplate,
+ } = useWorkflowRowActions(workflow);
+
+ function applyTag(tag: Tag) {
+ applyTagsMutation.mutate(
+ {
+ workflowPermanentId: workflow.workflow_permanent_id,
+ data: { tags: [tag] },
+ },
+ {
+ onSuccess: () => {
+ const tagLabel =
+ tag.key !== null ? `${tag.key}: ${tag.value}` : tag.value;
+ toast({ title: `Tagged with ${tagLabel}.`, variant: "success" });
+ },
+ },
+ );
+ }
+
+ async function moveToFolder(folderId: string | null) {
+ try {
+ await updateFolderMutation.mutateAsync({
+ workflowPermanentId: workflow.workflow_permanent_id,
+ data: { folder_id: folderId },
+ });
+ toast({
+ title: folderId ? "Moved to folder." : "Removed from folder.",
+ variant: "success",
+ });
+ } catch (error) {
+ toast({
+ variant: "destructive",
+ title: folderId
+ ? "Failed to move agent to folder"
+ : "Failed to remove agent from folder",
+ description: error instanceof Error ? error.message : undefined,
+ });
+ }
+ }
+
+ // Keep the row highlighted while its context menu is open (the cursor leaves it).
+ // Children.only throws a clear error if the trigger ever wraps more than one node.
+ const child = React.Children.only(children) as React.ReactElement<{
+ className?: string;
+ }>;
+ const rowProps = {
+ className: cn(child.props.className, "data-[row-active]:bg-muted/50"),
+ "data-row-active": menuOpen ? "" : undefined,
+ };
+
+ return (
+ <Dialog
+ open={deleteOpen}
+ onOpenChange={(open) => {
+ if (!isDeleting) {
+ setDeleteOpen(open);
+ }
+ }}
+ >
+ <ContextMenu
+ onOpenChange={(open) => {
+ setMenuOpen(open);
+ if (!open) {
+ setTagError(null);
+ }
+ }}
+ >
+ <ContextMenuTrigger asChild>
+ {React.cloneElement(child, rowProps)}
+ </ContextMenuTrigger>
+ <ContextMenuContent className="w-56">
+ {isMultiSelect && (
+ <>
+ <ContextMenuLabel className="text-xs font-normal text-muted-foreground">
+ Acts on this agent only — use the Actions bar for all{" "}
+ {selectedCount}.
+ </ContextMenuLabel>
+ <ContextMenuSeparator />
+ </>
+ )}
+ {selectedCount <= 1 && (
+ <>
+ <ContextMenuItem
+ onSelect={() =>
+ onNavigate(
+ workflowEditorPath(
+ workflow.workflow_permanent_id,
+ studioEnabled,
+ ),
+ )
+ }
+ >
+ <Pencil2Icon className="mr-2 h-4 w-4" />
+ Open in editor
+ </ContextMenuItem>
+ <ContextMenuItem
+ onSelect={() =>
+ onNavigate(`/workflows/${workflow.workflow_permanent_id}/run`)
+ }
+ >
+ <PlayIcon className="mr-2 h-4 w-4" />
+ Run
+ </ContextMenuItem>
+ <ContextMenuSeparator />
+ </>
+ )}
+ {taggingEnabled ? (
+ <ContextMenuSub
+ onOpenChange={(open) => {
+ if (!open) {
+ setTagError(null);
+ }
+ }}
+ >
+ <ContextMenuSubTrigger>
+ <TokensIcon className="mr-2 h-4 w-4" />
+ Tags
+ </ContextMenuSubTrigger>
+ <ContextMenuSubContent className="w-72 p-0">
+ <TagPickerCommand
+ tagKeys={tagKeys}
+ labelSuggestions={labelSuggestions}
+ valueSuggestionsByKey={valueSuggestionsByKey}
+ error={tagError}
+ onErrorChange={setTagError}
+ onApply={applyTag}
+ />
+ </ContextMenuSubContent>
+ </ContextMenuSub>
+ ) : null}
+ <ContextMenuSub>
+ <ContextMenuSubTrigger>
+ <FolderIcon className="mr-2 h-4 w-4" />
+ Move to folder
+ </ContextMenuSubTrigger>
+ <ContextMenuSubContent className="w-72 p-0">
+ <FolderPickerCommand
+ currentFolderId={workflow.folder_id ?? null}
+ onSelect={(folderId) => void moveToFolder(folderId)}
+ />
+ </ContextMenuSubContent>
+ </ContextMenuSub>
+ <ContextMenuSeparator />
+ <ContextMenuItem onSelect={() => clone()} disabled={isMultiSelect}>
+ <CopyIcon className="mr-2 h-4 w-4" />
+ Clone
+ </ContextMenuItem>
+ <ContextMenuItem
+ onSelect={() => toggleTemplate()}
+ disabled={isMultiSelect || isTogglingTemplate}
+ >
+ {workflow.is_template ? (
+ <BookmarkFilledIcon className="mr-2 h-4 w-4" />
+ ) : (
+ <BookmarkIcon className="mr-2 h-4 w-4" />
+ )}
+ {workflow.is_template ? "Remove from template" : "Save as template"}
+ </ContextMenuItem>
+ <ContextMenuSub>
+ <ContextMenuSubTrigger disabled={isMultiSelect}>
+ <DownloadIcon className="mr-2 h-4 w-4" />
+ Export
+ </ContextMenuSubTrigger>
+ <ContextMenuSubContent>
+ <ContextMenuItem onSelect={() => exportAs("yaml")}>
+ YAML
+ </ContextMenuItem>
+ <ContextMenuItem onSelect={() => exportAs("json")}>
+ JSON
+ </ContextMenuItem>
+ </ContextMenuSubContent>
+ </ContextMenuSub>
+ <ContextMenuSeparator />
+ <DialogTrigger asChild>
+ <ContextMenuItem
+ className="text-destructive focus:text-destructive"
+ disabled={isMultiSelect}
+ >
+ <GarbageIcon className="mr-2 h-4 w-4 text-destructive" />
+ Delete
+ </ContextMenuItem>
+ </DialogTrigger>
+ </ContextMenuContent>
+ </ContextMenu>
+ <DialogContent onCloseAutoFocus={(e) => e.preventDefault()}>
+ <DialogHeader>
+ <DialogTitle>Are you sure?</DialogTitle>
+ <DialogDescription>
+ The agent{" "}
+ <span className="font-semibold text-primary">{workflow.title}</span>{" "}
+ will be deleted.
+ </DialogDescription>
+ </DialogHeader>
+ <DialogFooter>
+ <Button
+ variant="secondary"
+ onClick={() => setDeleteOpen(false)}
+ disabled={isDeleting}
+ >
+ Cancel
+ </Button>
+ <Button
+ variant="destructive"
+ onClick={() =>
+ deleteWorkflow({
+ onSuccess: () => {
+ setDeleteOpen(false);
+ onDeleted?.(workflow.workflow_permanent_id);
+ },
+ })
+ }
+ disabled={isDeleting}
+ >
+ {isDeleting && <ReloadIcon className="mr-2 h-4 w-4 animate-spin" />}
+ Delete
+ </Button>
+ </DialogFooter>
+ </DialogContent>
+ </Dialog>
+ );
+}
+
+export { WorkflowRowContextMenu };
diff --git a/skyvern-frontend/src/routes/workflows/components/tagging/BulkTagPicker.tsx b/skyvern-frontend/src/routes/workflows/components/tagging/BulkTagPicker.tsx
deleted file mode 100644
index ad7fbddc9..000000000
--- a/skyvern-frontend/src/routes/workflows/components/tagging/BulkTagPicker.tsx
+++ /dev/null
@@ -1,183 +0,0 @@
-import * as React from "react";
-import { PlusIcon, TokensIcon } from "@radix-ui/react-icons";
-import { Button } from "@/components/ui/button";
-import {
- Command,
- CommandEmpty,
- CommandGroup,
- CommandInput,
- CommandItem,
- CommandList,
-} from "@/components/ui/command";
-import {
- Popover,
- PopoverContent,
- PopoverTrigger,
-} from "@/components/ui/popover";
-import {
- MAX_AUTOCOMPLETE_SUGGESTIONS,
- Tag,
- TagKey,
- parseTagInput,
- parseTypedTagQuery,
- validateTag,
-} from "../../types/tagTypes";
-
-type Props = {
- bulkCount: number;
- tagKeys: Array<TagKey>;
- labelSuggestions: Array<string>;
- valueSuggestionsByKey?: Map<string, Array<string>>;
- disabled?: boolean;
- onApplyTag: (tag: Tag) => Promise<void>;
-};
-
-function BulkTagPicker({
- bulkCount,
- tagKeys,
- labelSuggestions,
- valueSuggestionsByKey,
- disabled = false,
- onApplyTag,
-}: Props) {
- const [open, setOpen] = React.useState(false);
- const [query, setQuery] = React.useState("");
- const [error, setError] = React.useState<string | null>(null);
-
- React.useEffect(() => {
- if (!open) {
- setQuery("");
- setError(null);
- }
- }, [open]);
-
- function applyTag(tag: Tag) {
- const validationError = validateTag(tag);
- if (validationError) {
- setError(validationError);
- return;
- }
- setOpen(false);
- void onApplyTag(tag);
- }
-
- const trimmedQuery = query.trim();
- const normalizedQuery = trimmedQuery.toLowerCase();
- const candidate = parseTagInput(query);
- const { typedKey, typedValuePartial } = parseTypedTagQuery(trimmedQuery);
-
- const groupSuggestions =
- typedKey === null
- ? tagKeys
- .filter((tk) => tk.key.toLowerCase().includes(normalizedQuery))
- .slice(0, MAX_AUTOCOMPLETE_SUGGESTIONS)
- : [];
- const labelMatches =
- typedKey === null
- ? labelSuggestions
- .filter((value) => value.toLowerCase().includes(normalizedQuery))
- .slice(0, MAX_AUTOCOMPLETE_SUGGESTIONS)
- : [];
- const groupedValueMatches =
- typedKey !== null
- ? (valueSuggestionsByKey?.get(typedKey) ?? [])
- .filter((value) => value.toLowerCase().includes(typedValuePartial))
- .slice(0, MAX_AUTOCOMPLETE_SUGGESTIONS)
- : [];
- const hasItems =
- candidate !== null ||
- groupSuggestions.length > 0 ||
- labelMatches.length > 0 ||
- groupedValueMatches.length > 0;
-
- return (
- <Popover open={open} onOpenChange={setOpen}>
- <PopoverTrigger asChild>
- <Button size="sm" variant="ghost" disabled={disabled}>
- <TokensIcon className="mr-1.5 h-4 w-4" />
- Tags
- </Button>
- </PopoverTrigger>
- <PopoverContent className="w-80 p-0" align="start">
- <div className="border-b p-3">
- <h4 className="text-sm font-medium">
- Add tag to {bulkCount} agent{bulkCount === 1 ? "" : "s"}
- </h4>
- {error ? (
- <div className="mt-1 text-xs text-destructive">{error}</div>
- ) : null}
- </div>
- <Command shouldFilter={false}>
- <CommandInput
- placeholder="Label or group:label…"
- value={query}
- onValueChange={(value) => {
- setQuery(value);
- setError(null);
- }}
- />
- <CommandList>
- {candidate !== null && (
- <CommandGroup>
- <CommandItem
- value={`add-${trimmedQuery}`}
- onSelect={() => applyTag(candidate)}
- >
- <PlusIcon className="mr-2 h-4 w-4" />
- Add{" "}
- {candidate.key !== null
- ? `${candidate.key}: ${candidate.value}`
- : candidate.value}
- </CommandItem>
- </CommandGroup>
- )}
- {typedKey !== null && groupedValueMatches.length > 0 && (
- <CommandGroup heading={`${typedKey}:`}>
- {groupedValueMatches.map((value) => (
- <CommandItem
- key={value}
- value={`${typedKey}:${value}`}
- onSelect={() => applyTag({ key: typedKey, value })}
- >
- {value}
- </CommandItem>
- ))}
- </CommandGroup>
- )}
- {groupSuggestions.length > 0 && (
- <CommandGroup heading="Groups">
- {groupSuggestions.map((tk) => (
- <CommandItem
- key={tk.key}
- value={`group-${tk.key}`}
- onSelect={() => setQuery(`${tk.key}: `)}
- >
- {tk.key}:
- </CommandItem>
- ))}
- </CommandGroup>
- )}
- {labelMatches.length > 0 && (
- <CommandGroup heading="Labels">
- {labelMatches.map((value) => (
- <CommandItem
- key={value}
- value={`label-${value}`}
- onSelect={() => applyTag({ key: null, value })}
- >
- {value}
- </CommandItem>
- ))}
- </CommandGroup>
- )}
- {!hasItems && (
- <CommandEmpty>Type a label or group:label to add.</CommandEmpty>
- )}
- </CommandList>
- </Command>
- </PopoverContent>
- </Popover>
- );
-}
-
-export { BulkTagPicker };
diff --git a/skyvern-frontend/src/routes/workflows/components/tagging/TagPickerCommand.test.tsx b/skyvern-frontend/src/routes/workflows/components/tagging/TagPickerCommand.test.tsx
new file mode 100644
index 000000000..471af09a5
--- /dev/null
+++ b/skyvern-frontend/src/routes/workflows/components/tagging/TagPickerCommand.test.tsx
@@ -0,0 +1,122 @@
+// @vitest-environment jsdom
+import {
+ afterAll,
+ afterEach,
+ beforeAll,
+ describe,
+ expect,
+ it,
+ vi,
+} from "vitest";
+import { cleanup, fireEvent, render, screen } from "@testing-library/react";
+
+import { TagPickerCommand } from "./TagPickerCommand";
+import type { Tag } from "../../types/tagTypes";
+
+// cmdk needs ResizeObserver and scrollIntoView, which jsdom lacks. Install them
+// for this suite only and restore afterward so they don't leak into other test
+// files sharing the Vitest process.
+class MockResizeObserver {
+ observe() {}
+ unobserve() {}
+ disconnect() {}
+}
+
+const originalScrollIntoView = Element.prototype.scrollIntoView;
+
+beforeAll(() => {
+ vi.stubGlobal("ResizeObserver", MockResizeObserver);
+ Element.prototype.scrollIntoView = () => {};
+});
+
+afterAll(() => {
+ vi.unstubAllGlobals();
+ if (originalScrollIntoView) {
+ Element.prototype.scrollIntoView = originalScrollIntoView;
+ } else {
+ delete (Element.prototype as { scrollIntoView?: unknown }).scrollIntoView;
+ }
+});
+
+afterEach(cleanup);
+
+function renderPicker(
+ onApply: (tag: Tag) => void,
+ props?: Partial<React.ComponentProps<typeof TagPickerCommand>>,
+) {
+ return render(
+ <TagPickerCommand
+ tagKeys={[]}
+ labelSuggestions={[]}
+ valueSuggestionsByKey={new Map()}
+ onApply={onApply}
+ {...props}
+ />,
+ );
+}
+
+function type(query: string) {
+ fireEvent.change(screen.getByPlaceholderText(/label or group:label/i), {
+ target: { value: query },
+ });
+}
+
+describe("TagPickerCommand group-vs-value clarity", () => {
+ it("treats a bare entry as a value-only label (key: null)", () => {
+ const onApply = vi.fn();
+ renderPicker(onApply);
+
+ type("prod");
+
+ const option = screen.getByRole("option");
+ expect(option.textContent).toContain("Add prod");
+ fireEvent.click(option);
+
+ expect(onApply).toHaveBeenCalledWith({ key: null, value: "prod" });
+ });
+
+ it("treats a key:value entry as a grouped label, splitting on the first colon", () => {
+ const onApply = vi.fn();
+ renderPicker(onApply);
+
+ type("env:prod");
+
+ const option = screen.getByRole("option");
+ expect(option.textContent).toContain("Add env: prod");
+ fireEvent.click(option);
+
+ expect(onApply).toHaveBeenCalledWith({ key: "env", value: "prod" });
+ });
+
+ it("detects a group prefix and offers that group's values, not an Add-label affordance", () => {
+ const onApply = vi.fn();
+ renderPicker(onApply, {
+ tagKeys: [{ key: "env", description: null, workflow_count: 1 }],
+ valueSuggestionsByKey: new Map([["env", ["prod", "staging"]]]),
+ });
+
+ type("env:");
+
+ // No "Add" affordance: "env:" has no value yet, so it is not a tag to add.
+ expect(screen.queryByText(/^Add /)).toBeNull();
+ // The group's known values are offered under the group's heading.
+ expect(screen.getByText("env:")).toBeTruthy();
+ expect(screen.getByText("prod")).toBeTruthy();
+ expect(screen.getByText("staging")).toBeTruthy();
+
+ fireEvent.click(screen.getByText("prod"));
+ expect(onApply).toHaveBeenCalledWith({ key: "env", value: "prod" });
+ });
+});
+
+describe("TagPickerCommand disabled state", () => {
+ it("does not apply a tag while disabled (guards a bulk apply already in flight)", () => {
+ const onApply = vi.fn();
+ renderPicker(onApply, { disabled: true });
+
+ type("prod");
+ fireEvent.click(screen.getByText(/Add prod/));
+
+ expect(onApply).not.toHaveBeenCalled();
+ });
+});
diff --git a/skyvern-frontend/src/routes/workflows/components/tagging/TagPickerCommand.tsx b/skyvern-frontend/src/routes/workflows/components/tagging/TagPickerCommand.tsx
new file mode 100644
index 000000000..763c2b43c
--- /dev/null
+++ b/skyvern-frontend/src/routes/workflows/components/tagging/TagPickerCommand.tsx
@@ -0,0 +1,186 @@
+import * as React from "react";
+import { PlusIcon } from "@radix-ui/react-icons";
+import {
+ Command,
+ CommandEmpty,
+ CommandGroup,
+ CommandInput,
+ CommandItem,
+ CommandList,
+} from "@/components/ui/command";
+import {
+ MAX_AUTOCOMPLETE_SUGGESTIONS,
+ Tag,
+ TagKey,
+ parseTagInput,
+ parseTypedTagQuery,
+ validateTag,
+} from "../../types/tagTypes";
+
+type Props = {
+ tagKeys: Array<TagKey>;
+ labelSuggestions: Array<string>;
+ valueSuggestionsByKey?: Map<string, Array<string>>;
+ onApply: (tag: Tag) => void;
+ error?: string | null;
+ onErrorChange?: (error: string | null) => void;
+ // While a bulk apply is in flight, freeze the picker so a second pick can't
+ // start a competing apply for the same selection.
+ disabled?: boolean;
+};
+
+// The cmdk body of the tag picker: suggestions plus an "Add label/group:label"
+// affordance. Wrapper-agnostic so it can live in a Radix menu submenu (the row
+// context menu and the bulk Actions menu) without duplicating the cmdk.
+function TagPickerCommand({
+ tagKeys,
+ labelSuggestions,
+ valueSuggestionsByKey,
+ onApply,
+ error,
+ onErrorChange,
+ disabled,
+}: Props) {
+ const [query, setQuery] = React.useState("");
+ const inputRef = React.useRef<HTMLInputElement>(null);
+
+ React.useEffect(() => {
+ // Radix MenuSubContent moves focus to its container on open; re-focus the
+ // input on the next frame so typing lands in the command, not the menu.
+ const frame = requestAnimationFrame(() => inputRef.current?.focus());
+ return () => cancelAnimationFrame(frame);
+ }, []);
+
+ function applyTag(tag: Tag) {
+ if (disabled) {
+ return;
+ }
+ const validationError = validateTag(tag);
+ if (validationError) {
+ onErrorChange?.(validationError);
+ return;
+ }
+ onApply(tag);
+ }
+
+ const trimmedQuery = query.trim();
+ const normalizedQuery = trimmedQuery.toLowerCase();
+ const candidate = parseTagInput(query);
+ const { typedKey, typedValuePartial } = parseTypedTagQuery(trimmedQuery);
+
+ const groupSuggestions =
+ typedKey === null
+ ? tagKeys
+ .filter((tk) => tk.key.toLowerCase().includes(normalizedQuery))
+ .slice(0, MAX_AUTOCOMPLETE_SUGGESTIONS)
+ : [];
+ const labelMatches =
+ typedKey === null
+ ? labelSuggestions
+ .filter((value) => value.toLowerCase().includes(normalizedQuery))
+ .slice(0, MAX_AUTOCOMPLETE_SUGGESTIONS)
+ : [];
+ const groupedValueMatches =
+ typedKey !== null
+ ? (valueSuggestionsByKey?.get(typedKey) ?? [])
+ .filter((value) => value.toLowerCase().includes(typedValuePartial))
+ .slice(0, MAX_AUTOCOMPLETE_SUGGESTIONS)
+ : [];
+ const hasItems =
+ candidate !== null ||
+ groupSuggestions.length > 0 ||
+ labelMatches.length > 0 ||
+ groupedValueMatches.length > 0;
+
+ return (
+ <Command
+ shouldFilter={false}
+ onKeyDown={(event) => {
+ // Let Escape bubble so the popover/menu can close; keep every other key
+ // from reaching the parent menu's typeahead so cmdk can handle it.
+ if (event.key !== "Escape") {
+ event.stopPropagation();
+ }
+ }}
+ >
+ <CommandInput
+ ref={inputRef}
+ placeholder="Label or group:label…"
+ value={query}
+ onValueChange={(value) => {
+ setQuery(value);
+ onErrorChange?.(null);
+ }}
+ />
+ {error ? (
+ <div className="border-b px-3 py-2 text-xs text-destructive">
+ {error}
+ </div>
+ ) : null}
+ <CommandList>
+ {candidate !== null && (
+ <CommandGroup>
+ <CommandItem
+ value={`add-${trimmedQuery}`}
+ disabled={disabled}
+ onSelect={() => applyTag(candidate)}
+ >
+ <PlusIcon className="mr-2 h-4 w-4" />
+ Add{" "}
+ {candidate.key !== null
+ ? `${candidate.key}: ${candidate.value}`
+ : candidate.value}
+ </CommandItem>
+ </CommandGroup>
+ )}
+ {typedKey !== null && groupedValueMatches.length > 0 && (
+ <CommandGroup heading={`${typedKey}:`}>
+ {groupedValueMatches.map((value) => (
+ <CommandItem
+ key={value}
+ value={`${typedKey}:${value}`}
+ disabled={disabled}
+ onSelect={() => applyTag({ key: typedKey, value })}
+ >
+ {value}
+ </CommandItem>
+ ))}
+ </CommandGroup>
+ )}
+ {groupSuggestions.length > 0 && (
+ <CommandGroup heading="Groups">
+ {groupSuggestions.map((tk) => (
+ <CommandItem
+ key={tk.key}
+ value={`group-${tk.key}`}
+ disabled={disabled}
+ onSelect={() => setQuery(`${tk.key}: `)}
+ >
+ {tk.key}:
+ </CommandItem>
+ ))}
+ </CommandGroup>
+ )}
+ {labelMatches.length > 0 && (
+ <CommandGroup heading="Labels">
+ {labelMatches.map((value) => (
+ <CommandItem
+ key={value}
+ value={`label-${value}`}
+ disabled={disabled}
+ onSelect={() => applyTag({ key: null, value })}
+ >
+ {value}
+ </CommandItem>
+ ))}
+ </CommandGroup>
+ )}
+ {!hasItems && (
+ <CommandEmpty>Type a label or group:label to add.</CommandEmpty>
+ )}
+ </CommandList>
+ </Command>
+ );
+}
+
+export { TagPickerCommand };
diff --git a/skyvern-frontend/src/routes/workflows/components/tagging/WorkflowTagEditor.clarity.test.tsx b/skyvern-frontend/src/routes/workflows/components/tagging/WorkflowTagEditor.clarity.test.tsx
deleted file mode 100644
index 27909cb3a..000000000
--- a/skyvern-frontend/src/routes/workflows/components/tagging/WorkflowTagEditor.clarity.test.tsx
+++ /dev/null
@@ -1,91 +0,0 @@
-// @vitest-environment jsdom
-import {
- afterAll,
- afterEach,
- beforeAll,
- describe,
- expect,
- it,
- vi,
-} from "vitest";
-import { cleanup, fireEvent, render, screen } from "@testing-library/react";
-
-import { WorkflowTagEditor } from "./WorkflowTagEditor";
-
-// cmdk needs ResizeObserver and scrollIntoView, which jsdom lacks. Install them
-// for this suite only and restore afterward so they don't leak into other test
-// files sharing the Vitest process.
-class MockResizeObserver {
- observe() {}
- unobserve() {}
- disconnect() {}
-}
-
-const originalScrollIntoView = Element.prototype.scrollIntoView;
-
-beforeAll(() => {
- vi.stubGlobal("ResizeObserver", MockResizeObserver);
- Element.prototype.scrollIntoView = () => {};
-});
-
-afterAll(() => {
- vi.unstubAllGlobals();
- if (originalScrollIntoView) {
- Element.prototype.scrollIntoView = originalScrollIntoView;
- } else {
- delete (Element.prototype as { scrollIntoView?: unknown }).scrollIntoView;
- }
-});
-
-vi.mock("../../hooks/useWorkflowTagMutations", () => ({
- useApplyWorkflowTagsMutation: () => ({ mutate: vi.fn(), isPending: false }),
-}));
-
-afterEach(cleanup);
-
-function renderEditor() {
- return render(
- <WorkflowTagEditor workflowPermanentId="wpid_1" tags={[]} tagKeys={[]} />,
- );
-}
-
-function openAndType(query: string) {
- fireEvent.click(screen.getByRole("button", { name: /edit tags/i }));
- const input = screen.getByPlaceholderText(/add a tag/i);
- fireEvent.change(input, { target: { value: query } });
-}
-
-describe("WorkflowTagEditor group-vs-value clarity", () => {
- it("shows a bare entry as a value-only label: empty group slot, no color", () => {
- renderEditor();
- openAndType("prod");
- // The group half renders the empty "no group" slot...
- expect(screen.getByText("no group")).toBeTruthy();
- // ...and the typed value fills the label half.
- expect(screen.getAllByText("prod").length).toBeGreaterThan(0);
- // Color is grouped-only, so a value-only label exposes no swatches.
- expect(screen.queryByRole("button", { name: "blue" })).toBeNull();
- });
-
- it("shows a key:value entry as a grouped label: filled group + color", () => {
- renderEditor();
- openAndType("env:prod");
- // No empty group slot — the group half is filled with the key.
- expect(screen.queryByText("no group")).toBeNull();
- expect(screen.getAllByText("env").length).toBeGreaterThan(0);
- expect(screen.getAllByText("prod").length).toBeGreaterThan(0);
- // Grouped labels expose the color picker.
- expect(screen.getByRole("button", { name: "blue" })).toBeTruthy();
- });
-
- it("treats a group prefix as grouped before the value is typed", () => {
- renderEditor();
- openAndType("env:");
- // Group half is already filled; the label half prompts for the value.
- expect(screen.getAllByText("env").length).toBeGreaterThan(0);
- expect(screen.getByText("type a label")).toBeTruthy();
- expect(screen.queryByText("no group")).toBeNull();
- // Already in group mode, so the color picker is available.
- expect(screen.getByRole("button", { name: "blue" })).toBeTruthy();
- });
-});
diff --git a/skyvern-frontend/src/routes/workflows/components/tagging/WorkflowTagEditor.tsx b/skyvern-frontend/src/routes/workflows/components/tagging/WorkflowTagEditor.tsx
deleted file mode 100644
index 06a7262b7..000000000
--- a/skyvern-frontend/src/routes/workflows/components/tagging/WorkflowTagEditor.tsx
+++ /dev/null
@@ -1,490 +0,0 @@
-import * as React from "react";
-import {
- ChevronRightIcon,
- PlusIcon,
- ReloadIcon,
- TokensIcon,
-} from "@radix-ui/react-icons";
-import { Button } from "@/components/ui/button";
-import {
- Command,
- CommandEmpty,
- CommandGroup,
- CommandInput,
- CommandItem,
- CommandList,
-} from "@/components/ui/command";
-import {
- Popover,
- PopoverContent,
- PopoverTrigger,
-} from "@/components/ui/popover";
-import {
- Tooltip,
- TooltipContent,
- TooltipProvider,
- TooltipTrigger,
-} from "@/components/ui/tooltip";
-import { toast } from "@/components/ui/use-toast";
-import {
- MAX_AUTOCOMPLETE_SUGGESTIONS,
- MAX_TAGS_PER_WORKFLOW,
- parseTagInput,
- parseTypedTagQuery,
- serializeTagFilterTerm,
- sortTags,
- tagElementKey,
- validateTag,
- type Tag,
- type TagDeleteInput,
- type TagKey,
-} from "../../types/tagTypes";
-import { useApplyWorkflowTagsMutation } from "../../hooks/useWorkflowTagMutations";
-import {
- paletteDotClass,
- randomPaletteColor,
- tagColorFor,
- type PaletteColorName,
- type TagColorMap,
-} from "../../types/tagColors";
-import { cn } from "@/util/utils";
-import { TagChip } from "./TagChip";
-import { TagColorSwatchPicker } from "./TagColorSwatchPicker";
-
-const MICRO_LABEL = "text-[10px] font-medium uppercase tracking-wider";
-
-// One half of the tag anatomy: a captioned cell that reads "filled" (the part
-// the entry actually creates) or "empty" (the part it leaves blank), so the
-// group/value split is visible structure rather than prose.
-function AnatomyCell({
- part,
- value,
- placeholder,
- dotClass,
-}: {
- part: string;
- value: string | null;
- placeholder: string;
- dotClass?: string;
-}) {
- const filled = value !== null && value !== "";
- return (
- <div className="min-w-0 flex-1 space-y-1">
- <div className={cn(MICRO_LABEL, "text-muted-foreground")}>{part}</div>
- <div
- className={cn(
- "flex h-7 items-center gap-1.5 rounded-md border px-2 text-sm",
- filled
- ? "bg-secondary text-secondary-foreground"
- : "border-dashed text-muted-foreground",
- )}
- >
- {dotClass ? (
- <span
- aria-hidden="true"
- className={cn("h-2 w-2 shrink-0 rounded-full", dotClass)}
- />
- ) : null}
- <span className="truncate">{filled ? value : placeholder}</span>
- </div>
- </div>
- );
-}
-
-// Live anatomy of the tag the current input will create: a Label|Group mode
-// strip plus the two labeled halves (group filled + colored vs. an empty "no
-// group" slot), so a value-only label and a grouped one are unmistakable.
-function TagCreatePreview({
- groupName,
- labelValue,
- isGroupMode,
- colorDotClass,
-}: {
- groupName: string | null;
- labelValue: string | null;
- isGroupMode: boolean;
- colorDotClass: string;
-}) {
- return (
- <div className="space-y-2.5">
- {/* Visual reinforcement only — the mode is conveyed in text by the
- anatomy cells below, so hide the decorative segments from SR. */}
- <div
- aria-hidden="true"
- className="inline-flex rounded-md bg-muted p-0.5 text-[11px] font-medium"
- >
- <span
- className={cn(
- "rounded px-2 py-0.5",
- isGroupMode
- ? "text-muted-foreground"
- : "bg-background text-foreground shadow-sm",
- )}
- >
- Label
- </span>
- <span
- className={cn(
- "rounded px-2 py-0.5",
- isGroupMode
- ? "bg-background text-foreground shadow-sm"
- : "text-muted-foreground",
- )}
- >
- Group
- </span>
- </div>
- <div className="flex items-end gap-1.5">
- <AnatomyCell
- part="Group"
- value={isGroupMode ? groupName : null}
- placeholder="no group"
- dotClass={isGroupMode ? colorDotClass : ""}
- />
- <ChevronRightIcon
- aria-hidden="true"
- className={cn(
- "mb-1.5 h-4 w-4 shrink-0",
- isGroupMode ? "text-muted-foreground" : "text-muted-foreground/40",
- )}
- />
- <AnatomyCell
- part="Label"
- value={labelValue}
- placeholder="type a label"
- />
- </div>
- </div>
- );
-}
-
-type Props = {
- workflowPermanentId: string;
- tags: Array<Tag>;
- // Registered groups (keys) for autocomplete; standalone labels aren't here.
- tagKeys: Array<TagKey>;
- // Standalone label values observed on the page, suggested when typing a label.
- labelSuggestions?: Array<string>;
- // Grouped values observed per key, suggested after typing `group:`.
- valueSuggestionsByKey?: Map<string, Array<string>>;
- // (key, value) -> palette color, to color existing chips and preselect the
- // swatch when re-adding an already-colored grouped tag.
- colorMap?: TagColorMap;
-};
-
-// Inline tag editor: type a bare `label` for a standalone tag or `group:label`
-// for a grouped one. Re-adding overwrites that group's label (backend set-wins).
-function WorkflowTagEditor({
- workflowPermanentId,
- tags,
- tagKeys,
- labelSuggestions = [],
- valueSuggestionsByKey,
- colorMap,
-}: Props) {
- const [open, setOpen] = React.useState(false);
- const [query, setQuery] = React.useState("");
- const [error, setError] = React.useState<string | null>(null);
- // Default a new grouped tag to a random swatch (re-seeded after each add); the
- // user can override, or it syncs to the existing color when re-adding one.
- const [selectedColor, setSelectedColor] =
- React.useState<PaletteColorName>(randomPaletteColor);
-
- const applyMutation = useApplyWorkflowTagsMutation();
- const isPending = applyMutation.isPending;
-
- React.useEffect(() => {
- if (!open) {
- setQuery("");
- setError(null);
- }
- }, [open]);
-
- const sortedTags = React.useMemo(() => sortTags(tags), [tags]);
-
- function addTag(tag: Tag, color?: PaletteColorName) {
- // A write is in flight; ignore further adds so a quick double Enter/click
- // can't queue racing POSTs whose arrival order would decide the final tag.
- if (isPending) {
- return;
- }
- const validationError = validateTag(tag);
- if (validationError) {
- setError(validationError);
- return;
- }
- const exactExists = tags.some(
- (existing) => existing.key === tag.key && existing.value === tag.value,
- );
- if (exactExists) {
- setQuery("");
- setError(null);
- return;
- }
- // A grouped tag with an existing key overwrites that group's label (no new
- // identity); anything else is a new tag and counts against the cap.
- const previousInGroup =
- tag.key !== null
- ? tags.find((existing) => existing.key === tag.key)
- : undefined;
- const isOverwrite = previousInGroup !== undefined;
- if (!isOverwrite && tags.length >= MAX_TAGS_PER_WORKFLOW) {
- setError(`A workflow can have at most ${MAX_TAGS_PER_WORKFLOW} tags.`);
- return;
- }
- applyMutation.mutate(
- {
- workflowPermanentId,
- data: {
- tags: [{ key: tag.key, value: tag.value }],
- // Color is key-scoped and only applies to grouped tags.
- ...(tag.key !== null && color
- ? { colors: { [tag.key]: color } }
- : {}),
- },
- },
- {
- onSuccess: () => {
- setQuery("");
- setError(null);
- setSelectedColor(randomPaletteColor());
- if (isOverwrite && previousInGroup) {
- toast({
- title: "Tag overwritten",
- description: `“${tag.key}” changed from “${previousInGroup.value}” to “${tag.value}”.`,
- });
- }
- },
- },
- );
- }
-
- function removeTag(tag: Tag) {
- if (isPending) {
- return;
- }
- // Grouped tags delete by key, standalone labels by value.
- const target: TagDeleteInput =
- tag.key !== null ? { key: tag.key } : { value: tag.value };
- applyMutation.mutate({
- workflowPermanentId,
- data: { tags_to_delete: [target] },
- });
- }
-
- const trimmedQuery = query.trim();
- const normalizedQuery = trimmedQuery.toLowerCase();
- const candidate = parseTagInput(query);
- const candidateExists =
- candidate !== null &&
- tags.some((t) => t.key === candidate.key && t.value === candidate.value);
- const showAdd = candidate !== null && !candidateExists;
- const isGroupedCandidate = candidate !== null && candidate.key !== null;
-
- // Re-adding an already-colored (key, value) should keep its color, so sync the
- // swatch to it; brand-new values keep the random/user-picked selection.
- const candidateExistingColor =
- candidate !== null
- ? tagColorFor(colorMap, candidate.key, candidate.value)
- : undefined;
- React.useEffect(() => {
- if (candidateExistingColor) {
- setSelectedColor(candidateExistingColor);
- }
- }, [candidateExistingColor]);
-
- // When the user has typed `group:partial`, suggest existing values for that
- // group; otherwise suggest groups (to start a grouped tag) and labels.
- const { typedKey, typedValuePartial } = parseTypedTagQuery(trimmedQuery);
-
- // A group key can be present before the value completes the candidate, so the
- // mode follows the typed key, not only a finished candidate.
- const isGroupMode = isGroupedCandidate || typedKey !== null;
-
- const groupSuggestions =
- typedKey === null
- ? tagKeys
- .filter((tk) => tk.key.toLowerCase().includes(normalizedQuery))
- .slice(0, MAX_AUTOCOMPLETE_SUGGESTIONS)
- : [];
- const labelMatches =
- typedKey === null
- ? labelSuggestions
- .filter((value) => value.toLowerCase().includes(normalizedQuery))
- .filter(
- (value) => !tags.some((t) => t.key === null && t.value === value),
- )
- .slice(0, MAX_AUTOCOMPLETE_SUGGESTIONS)
- : [];
- const groupedValueMatches =
- typedKey !== null
- ? (valueSuggestionsByKey?.get(typedKey) ?? [])
- .filter((value) => value.toLowerCase().includes(typedValuePartial))
- .slice(0, MAX_AUTOCOMPLETE_SUGGESTIONS)
- : [];
-
- return (
- <Popover open={open} onOpenChange={setOpen}>
- <TooltipProvider>
- <Tooltip>
- <TooltipTrigger asChild>
- <PopoverTrigger asChild>
- <Button
- size="icon"
- variant="ghost"
- aria-label="Edit tags"
- className="text-muted-foreground hover:text-foreground"
- >
- <TokensIcon className="h-4 w-4" />
- </Button>
- </PopoverTrigger>
- </TooltipTrigger>
- <TooltipContent>Edit Tags</TooltipContent>
- </Tooltip>
- </TooltipProvider>
- <PopoverContent className="w-80 p-0" align="end">
- <div className="space-y-2 p-3">
- <div className="text-sm font-medium">Tags</div>
- {sortedTags.length > 0 ? (
- <div className="flex flex-wrap gap-1">
- {sortedTags.map((tag) => (
- <TagChip
- key={tagElementKey(tag)}
- tagKey={tag.key}
- value={tag.value}
- color={tagColorFor(colorMap, tag.key, tag.value)}
- onRemove={() => removeTag(tag)}
- />
- ))}
- </div>
- ) : (
- <div className="text-xs text-muted-foreground">No tags yet.</div>
- )}
- {error ? (
- <div className="text-xs text-destructive">{error}</div>
- ) : null}
- </div>
- <Command shouldFilter={false}>
- <CommandInput
- placeholder="Add a tag — label or group:label…"
- value={query}
- onValueChange={(value) => {
- setQuery(value);
- setError(null);
- }}
- onKeyDown={(event) => {
- if (event.key === "Enter" && candidate && showAdd) {
- event.preventDefault();
- addTag(
- candidate,
- isGroupedCandidate ? selectedColor : undefined,
- );
- }
- }}
- />
- {candidate !== null || typedKey !== null ? (
- <div className="space-y-3 border-b px-3 py-3">
- <TagCreatePreview
- groupName={candidate?.key ?? typedKey}
- labelValue={candidate?.value ?? null}
- isGroupMode={isGroupMode}
- colorDotClass={paletteDotClass(selectedColor)}
- />
- {isGroupMode ? (
- <div className="space-y-1.5">
- <div className={cn(MICRO_LABEL, "text-muted-foreground")}>
- Color
- </div>
- <TagColorSwatchPicker
- value={selectedColor}
- onChange={setSelectedColor}
- />
- </div>
- ) : null}
- </div>
- ) : null}
- <CommandList>
- <CommandEmpty>
- Type a label, or group:label to file it under a group.
- </CommandEmpty>
- {showAdd && candidate ? (
- <CommandGroup>
- <CommandItem
- value={`__add__,${trimmedQuery}`}
- onSelect={() =>
- addTag(
- candidate,
- isGroupedCandidate ? selectedColor : undefined,
- )
- }
- >
- {isPending ? (
- <ReloadIcon className="mr-2 h-4 w-4 animate-spin" />
- ) : (
- <PlusIcon className="mr-2 h-4 w-4" />
- )}
- {isGroupedCandidate ? (
- <>
- Add “{candidate.value}” to {candidate.key}
- </>
- ) : (
- <>Add label “{candidate.value}”</>
- )}
- </CommandItem>
- </CommandGroup>
- ) : null}
- {groupSuggestions.length > 0 ? (
- <CommandGroup heading="Groups">
- {groupSuggestions.map((tk) => (
- <CommandItem
- key={tk.key}
- value={`__group__,${tk.key}`}
- // Selecting a group seeds `group:` so the next keystrokes
- // type the label.
- onSelect={() => setQuery(`${tk.key}:`)}
- >
- <span className="font-medium">{tk.key}</span>
- <span className="text-muted-foreground">:</span>
- {tk.description ? (
- <span className="ml-2 truncate text-xs text-muted-foreground">
- {tk.description}
- </span>
- ) : null}
- </CommandItem>
- ))}
- </CommandGroup>
- ) : null}
- {labelMatches.length > 0 ? (
- <CommandGroup heading="Labels">
- {labelMatches.map((value) => (
- <CommandItem
- key={`label:${value}`}
- value={`__label__,${value}`}
- onSelect={() => addTag({ key: null, value })}
- >
- {value}
- </CommandItem>
- ))}
- </CommandGroup>
- ) : null}
- {groupedValueMatches.length > 0 && typedKey !== null ? (
- <CommandGroup heading={`Existing ${typedKey} values`}>
- {groupedValueMatches.map((value) => (
- <CommandItem
- key={`gv:${value}`}
- value={`__gv__,${value}`}
- onSelect={() => addTag({ key: typedKey, value })}
- >
- {serializeTagFilterTerm({ key: typedKey, value })}
- </CommandItem>
- ))}
- </CommandGroup>
- ) : null}
- </CommandList>
- </Command>
- </PopoverContent>
- </Popover>
- );
-}
-
-export { WorkflowTagEditor };
diff --git a/skyvern-frontend/src/routes/workflows/components/tree/FolderTreeNode.test.tsx b/skyvern-frontend/src/routes/workflows/components/tree/FolderTreeNode.test.tsx
index 0ab044877..33f5eae0e 100644
--- a/skyvern-frontend/src/routes/workflows/components/tree/FolderTreeNode.test.tsx
+++ b/skyvern-frontend/src/routes/workflows/components/tree/FolderTreeNode.test.tsx
@@ -75,6 +75,7 @@ const contextValue: WorkflowsListContextValue = {
matchesParameter: () => false,
handleRowClick: () => {},
handleIconClick: () => {},
+ onRowDeleted: () => {},
};
function renderNode({
diff --git a/skyvern-frontend/src/routes/workflows/components/tree/WorkflowRow.tagging.test.tsx b/skyvern-frontend/src/routes/workflows/components/tree/WorkflowRow.tagging.test.tsx
index 2f70e7b56..35bb9e738 100644
--- a/skyvern-frontend/src/routes/workflows/components/tree/WorkflowRow.tagging.test.tsx
+++ b/skyvern-frontend/src/routes/workflows/components/tree/WorkflowRow.tagging.test.tsx
@@ -1,6 +1,8 @@
// @vitest-environment jsdom
+import type { ReactNode } from "react";
import { cleanup, render, screen } from "@testing-library/react";
+import { MemoryRouter } from "react-router-dom";
import { afterEach, describe, expect, it, vi } from "vitest";
import { FeatureFlagContext } from "@/hooks/useFeatureFlag";
@@ -11,20 +13,14 @@ import {
type WorkflowsListContextValue,
} from "./WorkflowsListContext";
-// Isolate WorkflowRow's gating: stub the tagging children (and the unrelated
-// row actions) so the assertions only reflect whether the row chose to render
-// tagging UI, not the children's own internals.
+// Isolate WorkflowRow's tagging gate: stub the tag chips and pass the row through
+// its context-menu wrapper (whose own data hooks are irrelevant here) so the
+// assertions only reflect whether the row chose to render the tag chips.
vi.mock("../tagging/TagChipList", () => ({
TagChipList: () => <span data-testid="tag-chip-list" />,
}));
-vi.mock("../tagging/WorkflowTagEditor", () => ({
- WorkflowTagEditor: () => <span data-testid="workflow-tag-editor" />,
-}));
-vi.mock("../WorkflowFolderSelector", () => ({
- WorkflowFolderSelector: () => <span data-testid="folder-selector" />,
-}));
-vi.mock("../../WorkflowActions", () => ({
- WorkflowActions: () => <span data-testid="workflow-actions" />,
+vi.mock("../WorkflowRowContextMenu", () => ({
+ WorkflowRowContextMenu: ({ children }: { children: ReactNode }) => children,
}));
vi.mock("@/hooks/useWorkflowStudioEnabled", () => ({
useWorkflowStudioEnabled: () => false,
@@ -60,19 +56,22 @@ const contextValue: WorkflowsListContextValue = {
matchesParameter: () => false,
handleRowClick: () => {},
handleIconClick: () => {},
+ onRowDeleted: () => {},
};
function renderRow(flagValue: boolean | undefined) {
return render(
- <FeatureFlagContext.Provider value={() => flagValue}>
- <WorkflowsListContext.Provider value={contextValue}>
- <table>
- <tbody>
- <WorkflowRow workflow={buildWorkflow()} />
- </tbody>
- </table>
- </WorkflowsListContext.Provider>
- </FeatureFlagContext.Provider>,
+ <MemoryRouter>
+ <FeatureFlagContext.Provider value={() => flagValue}>
+ <WorkflowsListContext.Provider value={contextValue}>
+ <table>
+ <tbody>
+ <WorkflowRow workflow={buildWorkflow()} />
+ </tbody>
+ </table>
+ </WorkflowsListContext.Provider>
+ </FeatureFlagContext.Provider>
+ </MemoryRouter>,
);
}
@@ -81,17 +80,15 @@ describe("WorkflowRow tagging gate", () => {
cleanup();
});
- it("hides tag chips and the tag editor when WORKFLOW_TAGGING is off", () => {
+ it("hides the tag chips when WORKFLOW_TAGGING is off", () => {
renderRow(false);
expect(screen.queryByTestId("tag-chip-list")).toBeNull();
- expect(screen.queryByTestId("workflow-tag-editor")).toBeNull();
});
- it("shows tag chips and the tag editor when the flag is unresolved (default on)", () => {
+ it("shows the tag chips when the flag is unresolved (default on)", () => {
renderRow(undefined);
expect(screen.getByTestId("tag-chip-list")).toBeTruthy();
- expect(screen.getByTestId("workflow-tag-editor")).toBeTruthy();
});
});
diff --git a/skyvern-frontend/src/routes/workflows/components/tree/WorkflowRow.tsx b/skyvern-frontend/src/routes/workflows/components/tree/WorkflowRow.tsx
index 8247169f3..57867f51a 100644
--- a/skyvern-frontend/src/routes/workflows/components/tree/WorkflowRow.tsx
+++ b/skyvern-frontend/src/routes/workflows/components/tree/WorkflowRow.tsx
@@ -1,7 +1,7 @@
import React from "react";
import {
BookmarkFilledIcon,
- DotsHorizontalIcon,
+ MixerHorizontalIcon,
Pencil2Icon,
PlayIcon,
ReloadIcon,
@@ -18,7 +18,6 @@ import {
} from "@/components/ui/tooltip";
import { basicTimeFormat, compactLocalDateTime } from "@/util/timeFormat";
import { WorkflowApiResponse } from "../../types/workflowTypes";
-import { WorkflowActions } from "../../WorkflowActions";
import { useWorkflowStudioEnabled } from "@/hooks/useWorkflowStudioEnabled";
import { useFeatureFlag } from "@/hooks/useFeatureFlag";
import { WORKFLOW_TAGGING_FLAG } from "@/util/featureFlags";
@@ -26,9 +25,9 @@ import { workflowEditorPath } from "../../studioNavigation";
import { HighlightText } from "../HighlightText";
import { ParameterDisplayInline } from "../ParameterDisplayInline";
import { TagChipList } from "../tagging/TagChipList";
-import { WorkflowTagEditor } from "../tagging/WorkflowTagEditor";
-import { WorkflowFolderSelector } from "../WorkflowFolderSelector";
+import { WorkflowRowContextMenu } from "../WorkflowRowContextMenu";
import { useWorkflowsListContext } from "./WorkflowsListContext";
+import { useNavigate } from "react-router-dom";
// Pixels of left padding added per level of folder nesting. Level 0 (flat search
// results and ungrouped agents) uses the cell's default padding. depth 1 lands
@@ -55,7 +54,6 @@ function WorkflowRow({ workflow, depth = 0 }: WorkflowRowProps) {
showCheckbox,
columnCount,
debouncedSearch,
- isBulkOperating,
selectedCount,
foldersMap,
workflowTagsMap,
@@ -72,8 +70,10 @@ function WorkflowRow({ workflow, depth = 0 }: WorkflowRowProps) {
matchesParameter,
handleRowClick,
handleIconClick,
+ onRowDeleted,
} = useWorkflowsListContext();
const studioEnabled = useWorkflowStudioEnabled();
+ const navigate = useNavigate();
// undefined (OSS / pre-load) shows tagging; only an explicit cloud `false` hides it.
const taggingEnabled = useFeatureFlag(WORKFLOW_TAGGING_FLAG) !== false;
@@ -115,22 +115,12 @@ function WorkflowRow({ workflow, depth = 0 }: WorkflowRowProps) {
</TableCell>
<TableCell>
<div className="flex justify-end gap-0.5">
- {selectedCount === 0 && (
- <Button size="icon" variant="ghost" disabled>
- <FolderIcon className="h-4 w-4" />
- </Button>
- )}
<Button size="icon" variant="ghost" disabled>
- <Pencil2Icon className="h-4 w-4" />
+ <PlayIcon className="h-4 w-4" />
</Button>
<Button size="icon" variant="ghost" disabled>
- <PlayIcon className="h-4 w-4" />
+ <Pencil2Icon className="h-4 w-4" />
</Button>
- {selectedCount === 0 && (
- <Button size="icon" variant="ghost" disabled>
- <DotsHorizontalIcon className="h-4 w-4" />
- </Button>
- )}
</div>
</TableCell>
</TableRow>
@@ -139,190 +129,188 @@ function WorkflowRow({ workflow, depth = 0 }: WorkflowRowProps) {
return (
<React.Fragment>
- <TableRow
- className="group/row cursor-pointer select-none"
- data-state={isRowSelected ? "selected" : undefined}
+ <WorkflowRowContextMenu
+ workflow={workflow}
+ tagKeys={tagKeys}
+ labelSuggestions={labelSuggestions}
+ valueSuggestionsByKey={valueSuggestionsByKey}
+ selectedCount={selectedCount}
+ taggingEnabled={taggingEnabled}
+ onNavigate={(path) => navigate(path)}
+ onDeleted={onRowDeleted}
>
- {showCheckbox && (
- <SelectionCheckboxCell
- className="select-none"
- index={selectableIndex}
- checked={isRowSelected}
- hasSelection={selectedCount > 0}
- onSelect={handleSelect}
- ariaLabel={`Select ${workflow.title}`}
- />
- )}
- <TableCell
- style={firstCellStyle}
- onClick={(event) => {
- handleRowClick(event, workflow.workflow_permanent_id);
- }}
+ <TableRow
+ className="group/row cursor-pointer select-none"
+ data-state={isRowSelected ? "selected" : undefined}
>
- <div
- className="truncate font-mono text-xs text-muted-foreground"
- title={workflow.workflow_permanent_id}
- >
- <HighlightText
- text={workflow.workflow_permanent_id}
- query={debouncedSearch}
+ {showCheckbox && (
+ <SelectionCheckboxCell
+ className="select-none"
+ index={selectableIndex}
+ checked={isRowSelected}
+ hasSelection={selectedCount > 0}
+ onSelect={handleSelect}
+ ariaLabel={`Select ${workflow.title}`}
/>
- </div>
- </TableCell>
- <TableCell
- onClick={(event) => {
- handleRowClick(event, workflow.workflow_permanent_id);
- }}
- >
- <div className="flex min-w-0 flex-col gap-1">
- <div className="flex min-w-0 items-center gap-2">
- <span className="truncate" title={workflow.title}>
- <HighlightText text={workflow.title} query={debouncedSearch} />
- </span>
- {workflow.is_template && (
- <TooltipProvider>
- <Tooltip>
- <TooltipTrigger asChild>
- <BookmarkFilledIcon className="h-3.5 w-3.5 shrink-0 text-blue-500" />
- </TooltipTrigger>
- <TooltipContent>Template</TooltipContent>
- </Tooltip>
- </TooltipProvider>
- )}
- </div>
- {taggingEnabled && workflowTags && workflowTags.length > 0 ? (
- <TagChipList
- tags={workflowTags}
- descriptions={tagDescriptions}
- colors={tagColors}
+ )}
+ <TableCell
+ style={firstCellStyle}
+ onClick={(event) => {
+ handleRowClick(event, workflow.workflow_permanent_id);
+ }}
+ >
+ <div
+ className="truncate font-mono text-xs text-muted-foreground"
+ title={workflow.workflow_permanent_id}
+ >
+ <HighlightText
+ text={workflow.workflow_permanent_id}
+ query={debouncedSearch}
/>
- ) : null}
- </div>
- </TableCell>
- <TableCell
- onClick={(event) => {
- handleRowClick(event, workflow.workflow_permanent_id);
- }}
- >
- {workflow.folder_id ? (
- <div className="flex min-w-0 items-center gap-1.5">
- <FolderIcon className="h-3.5 w-3.5 shrink-0 text-blue-400" />
- <span
- className="truncate text-sm"
- title={
- foldersMap.get(workflow.folder_id)?.title ||
- workflow.folder_id
- }
- >
- <HighlightText
- text={
+ </div>
+ </TableCell>
+ <TableCell
+ onClick={(event) => {
+ handleRowClick(event, workflow.workflow_permanent_id);
+ }}
+ >
+ <div className="flex min-w-0 flex-col gap-1">
+ <div className="flex min-w-0 items-center gap-2">
+ <span className="truncate" title={workflow.title}>
+ <HighlightText
+ text={workflow.title}
+ query={debouncedSearch}
+ />
+ </span>
+ {workflow.is_template && (
+ <TooltipProvider>
+ <Tooltip>
+ <TooltipTrigger asChild>
+ <BookmarkFilledIcon className="h-3.5 w-3.5 shrink-0 text-blue-500" />
+ </TooltipTrigger>
+ <TooltipContent>Template</TooltipContent>
+ </Tooltip>
+ </TooltipProvider>
+ )}
+ </div>
+ {taggingEnabled && workflowTags && workflowTags.length > 0 ? (
+ <TagChipList
+ tags={workflowTags}
+ descriptions={tagDescriptions}
+ colors={tagColors}
+ />
+ ) : null}
+ </div>
+ </TableCell>
+ <TableCell
+ onClick={(event) => {
+ handleRowClick(event, workflow.workflow_permanent_id);
+ }}
+ >
+ {workflow.folder_id ? (
+ <div className="flex min-w-0 items-center gap-1.5">
+ <FolderIcon className="h-3.5 w-3.5 shrink-0 text-blue-400" />
+ <span
+ className="truncate text-sm"
+ title={
foldersMap.get(workflow.folder_id)?.title ||
workflow.folder_id
}
- query={debouncedSearch}
- />
- </span>
- </div>
- ) : (
- <span className="text-muted-foreground">-</span>
- )}
- </TableCell>
- <TableCell
- onClick={(event) => {
- handleRowClick(event, workflow.workflow_permanent_id);
- }}
- className="text-muted-foreground"
- title={basicTimeFormat(workflow.created_at)}
- >
- {compactLocalDateTime(workflow.created_at)}
- </TableCell>
- <TableCell>
- <div className="flex justify-end gap-0.5">
- {/* Folder, tags, and the row menu yield to the bulk bar while any selection is active; Edit and Run stay. */}
- {selectedCount === 0 && (
- <>
+ >
+ <HighlightText
+ text={
+ foldersMap.get(workflow.folder_id)?.title ||
+ workflow.folder_id
+ }
+ query={debouncedSearch}
+ />
+ </span>
+ </div>
+ ) : (
+ <span className="text-muted-foreground">-</span>
+ )}
+ </TableCell>
+ <TableCell
+ onClick={(event) => {
+ handleRowClick(event, workflow.workflow_permanent_id);
+ }}
+ className="text-muted-foreground"
+ title={basicTimeFormat(workflow.created_at)}
+ >
+ {compactLocalDateTime(workflow.created_at)}
+ </TableCell>
+ <TableCell>
+ <div className="flex justify-end gap-0.5">
+ {hasParameters && (
<TooltipProvider>
<Tooltip>
<TooltipTrigger asChild>
- <div>
- <WorkflowFolderSelector
- workflowPermanentId={workflow.workflow_permanent_id}
- currentFolderId={workflow.folder_id}
- disabled={isBulkOperating}
- />
- </div>
+ <Button
+ size="icon"
+ variant="ghost"
+ className="text-muted-foreground hover:text-foreground"
+ onClick={() =>
+ toggleParametersExpanded(
+ workflow.workflow_permanent_id,
+ )
+ }
+ >
+ <MixerHorizontalIcon className="h-4 w-4" />
+ </Button>
</TooltipTrigger>
- <TooltipContent>Assign to Folder</TooltipContent>
+ <TooltipContent>
+ {isExpanded ? "Hide parameters" : "Show parameters"}
+ </TooltipContent>
</Tooltip>
</TooltipProvider>
- {taggingEnabled ? (
- <WorkflowTagEditor
- workflowPermanentId={workflow.workflow_permanent_id}
- tags={workflowTags ?? []}
- tagKeys={tagKeys}
- labelSuggestions={labelSuggestions}
- valueSuggestionsByKey={valueSuggestionsByKey}
- colorMap={tagColors}
- />
- ) : null}
- </>
- )}
- <TooltipProvider>
- <Tooltip>
- <TooltipTrigger asChild>
- <Button
- size="icon"
- variant="ghost"
- className="text-muted-foreground hover:text-foreground"
- onClick={(event) => {
- handleIconClick(
- event,
- workflowEditorPath(
- workflow.workflow_permanent_id,
- studioEnabled,
- ),
- );
- }}
- >
- <Pencil2Icon className="h-4 w-4" />
- </Button>
- </TooltipTrigger>
- <TooltipContent>Open in Editor</TooltipContent>
- </Tooltip>
- </TooltipProvider>
- <TooltipProvider>
- <Tooltip>
- <TooltipTrigger asChild>
- <Button
- size="icon"
- variant="ghost"
- className="text-cta hover:text-cta"
- onClick={(event) => {
- handleIconClick(
- event,
- `/workflows/${workflow.workflow_permanent_id}/run`,
- );
- }}
- >
- <PlayIcon className="h-4 w-4" />
- </Button>
- </TooltipTrigger>
- <TooltipContent>Create New Run</TooltipContent>
- </Tooltip>
- </TooltipProvider>
- {selectedCount === 0 && (
- <WorkflowActions
- workflow={workflow}
- hasParameters={hasParameters}
- parametersExpanded={isExpanded}
- onToggleParameters={() =>
- toggleParametersExpanded(workflow.workflow_permanent_id)
- }
- />
- )}
- </div>
- </TableCell>
- </TableRow>
+ )}
+ <TooltipProvider>
+ <Tooltip>
+ <TooltipTrigger asChild>
+ <Button
+ size="icon"
+ variant="ghost"
+ className="text-cta hover:text-cta"
+ onClick={(event) => {
+ handleIconClick(
+ event,
+ `/workflows/${workflow.workflow_permanent_id}/run`,
+ );
+ }}
+ >
+ <PlayIcon className="h-4 w-4" />
+ </Button>
+ </TooltipTrigger>
+ <TooltipContent>Create New Run</TooltipContent>
+ </Tooltip>
+ </TooltipProvider>
+ <TooltipProvider>
+ <Tooltip>
+ <TooltipTrigger asChild>
+ <Button
+ size="icon"
+ variant="ghost"
+ className="text-muted-foreground hover:text-foreground"
+ onClick={(event) => {
+ handleIconClick(
+ event,
+ workflowEditorPath(
+ workflow.workflow_permanent_id,
+ studioEnabled,
+ ),
+ );
+ }}
+ >
+ <Pencil2Icon className="h-4 w-4" />
+ </Button>
+ </TooltipTrigger>
+ <TooltipContent>Open in Editor</TooltipContent>
+ </Tooltip>
+ </TooltipProvider>
+ </div>
+ </TableCell>
+ </TableRow>
+ </WorkflowRowContextMenu>
{isExpanded && hasParameters && (
<TableRow>
diff --git a/skyvern-frontend/src/routes/workflows/components/tree/WorkflowsListContext.ts b/skyvern-frontend/src/routes/workflows/components/tree/WorkflowsListContext.ts
index 262a2ebec..b73d99058 100644
--- a/skyvern-frontend/src/routes/workflows/components/tree/WorkflowsListContext.ts
+++ b/skyvern-frontend/src/routes/workflows/components/tree/WorkflowsListContext.ts
@@ -33,6 +33,9 @@ export interface WorkflowsListContextValue {
workflowPermanentId: string,
) => void;
handleIconClick: (event: MouseEvent<HTMLButtonElement>, path: string) => void;
+ // Prune a single-row-deleted id from the selection so the header/bulk bar
+ // can't get stuck on a gone row.
+ onRowDeleted: (id: string) => void;
}
const WorkflowsListContext = createContext<WorkflowsListContextValue | null>(
diff --git a/skyvern-frontend/src/routes/workflows/hooks/useWorkflowRowActions.ts b/skyvern-frontend/src/routes/workflows/hooks/useWorkflowRowActions.ts
new file mode 100644
index 000000000..ee01d8be6
--- /dev/null
+++ b/skyvern-frontend/src/routes/workflows/hooks/useWorkflowRowActions.ts
@@ -0,0 +1,138 @@
+import { getClient } from "@/api/AxiosClient";
+import { toast } from "@/components/ui/use-toast";
+import { useCredentialGetter } from "@/hooks/useCredentialGetter";
+import { useMutation, useQueryClient } from "@tanstack/react-query";
+import { AxiosError } from "axios";
+import { stringify as convertToYAML } from "yaml";
+import { useNodeCollapseStore } from "../editor/collapse/useNodeCollapseStore";
+import { convert } from "../editor/workflowEditorUtils";
+import { useCreateWorkflowMutation } from "./useCreateWorkflowMutation";
+import { WorkflowApiResponse } from "../types/workflowTypes";
+
+function downloadFile(fileName: string, contents: string) {
+ const element = document.createElement("a");
+ element.setAttribute(
+ "href",
+ "data:text/plain;charset=utf-8," + encodeURIComponent(contents),
+ );
+ element.setAttribute("download", fileName);
+
+ element.style.display = "none";
+ document.body.appendChild(element);
+
+ element.click();
+
+ document.body.removeChild(element);
+}
+
+// Single-row mutations shared by WorkflowActions (the workflow page's actions
+// dropdown) and the agents-list right-click context menu so they can't drift.
+function useWorkflowRowActions(workflow: WorkflowApiResponse) {
+ const credentialGetter = useCredentialGetter();
+ const queryClient = useQueryClient();
+ const createWorkflowMutation = useCreateWorkflowMutation();
+
+ const deleteWorkflowMutation = useMutation({
+ mutationFn: async (id: string) => {
+ const client = await getClient(credentialGetter);
+ return client.delete(`/workflows/${id}`);
+ },
+ onSuccess: (_data, deletedId) => {
+ queryClient.invalidateQueries({
+ queryKey: ["workflows"],
+ });
+ queryClient.invalidateQueries({
+ queryKey: ["folders"],
+ });
+ useNodeCollapseStore.getState().pruneWorkflow(deletedId);
+ },
+ onError: (error: AxiosError) => {
+ toast({
+ variant: "destructive",
+ title: "Failed to delete agent",
+ description: error.message,
+ });
+ },
+ });
+
+ const templateMutation = useMutation({
+ mutationFn: async ({
+ workflowPermanentId,
+ isTemplate,
+ }: {
+ workflowPermanentId: string;
+ isTemplate: boolean;
+ }) => {
+ // Template endpoint only exists on /v1 (no /api prefix)
+ const client = await getClient(credentialGetter, "sans-api-v1");
+ return client.put(
+ `/workflows/${workflowPermanentId}/template?is_template=${isTemplate}`,
+ );
+ },
+ onSuccess: (_, variables) => {
+ queryClient.invalidateQueries({
+ queryKey: ["workflows"],
+ });
+ queryClient.invalidateQueries({
+ queryKey: ["orgTemplates"],
+ });
+ queryClient.invalidateQueries({
+ queryKey: ["workflow", variables.workflowPermanentId],
+ });
+ toast({
+ title: variables.isTemplate
+ ? "Saved as template"
+ : "Removed from templates",
+ variant: "success",
+ });
+ },
+ onError: (error: AxiosError) => {
+ toast({
+ variant: "destructive",
+ title: "Failed to update template status",
+ description: error.message,
+ });
+ },
+ });
+
+ function clone() {
+ const clonedWorkflow = convert({
+ ...workflow,
+ title: `Copy of ${workflow.title}`,
+ });
+ createWorkflowMutation.mutate(clonedWorkflow);
+ }
+
+ function toggleTemplate() {
+ templateMutation.mutate({
+ workflowPermanentId: workflow.workflow_permanent_id,
+ isTemplate: !workflow.is_template,
+ });
+ }
+
+ function exportAs(type: "json" | "yaml") {
+ const fileName = `${workflow.title}.${type}`;
+ const contents =
+ type === "json"
+ ? JSON.stringify(convert(workflow), null, 2)
+ : convertToYAML(convert(workflow));
+ downloadFile(fileName, contents);
+ }
+
+ function deleteWorkflow(options?: { onSuccess?: () => void }) {
+ deleteWorkflowMutation.mutate(workflow.workflow_permanent_id, {
+ onSuccess: options?.onSuccess,
+ });
+ }
+
+ return {
+ clone,
+ toggleTemplate,
+ exportAs,
+ deleteWorkflow,
+ isDeleting: deleteWorkflowMutation.isPending,
+ isTogglingTemplate: templateMutation.isPending,
+ };
+}
+
+export { useWorkflowRowActions };