feat(dashboard): add duplicate widget option#1503
feat(dashboard): add duplicate widget option#1503okxint wants to merge 2 commits intolmnr-ai:devfrom
Conversation
|
@okxint thanks for your contribution! Please do the following:
|
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Adds a "Duplicate" option to the chart dropdown menu between "Edit" and "Delete". Clicking it creates a new chart with the same query, config, and a " (copy)" suffix on the name. The new chart is placed at the default position and the dashboard revalidates via SWR. Closes lmnr-ai#1498
31814ca to
47fe02b
Compare
|
Rebased onto the latest CLA is signed. Will add a screenshot of the duplicate option in the dropdown menu shortly. |
|
Here's how the duplicate option looks in the dropdown menu: The "Duplicate" option sits between Edit and Delete in the chart's kebab menu (⋮). On click, it creates a copy of the chart with " (copy)" appended to the name, using the same query and config. The new chart appears at the default position and existing charts reflow automatically. Unfortunately I can't easily spin up the full stack locally for a screenshot since it requires backend services. Happy to provide one if you can point me to a dev environment setup guide, or if the code review + the description above is sufficient to proceed. |

Summary
POST /api/projects/:projectId/dashboard-chartsendpoint to create a copy with the same query, config, and a " (copy)" suffix on the nameChanges
chart-header.tsx: Accept fullchartprop instead of justname/id, addCopyicon import, addhandleDuplicateChartcallback and "Duplicate" menu itemchart.tsx: Passchartobject toChartHeaderCloses #1498
Note
Low Risk
Low risk UI change that adds a new dashboard action calling an existing create-chart endpoint; main risk is cache consistency/optimistic update behavior and handling of API failures.
Overview
Adds a Duplicate action to the dashboard chart header menu, creating a new chart via
POST /api/projects/:projectId/dashboard-chartswith the samequeryandsettings.configand a" (copy)"name suffix, and updating the SWR cache (with revalidation) plus error toast on failure.Refactors
ChartHeaderto accept the fullchartobject (instead ofid/name) and updateschart.tsxto pass that object through.Written by Cursor Bugbot for commit 47fe02b. This will update automatically on new commits. Configure here.