Repository navigation
Conversation
Add ability to duplicate dashboards from the options dropdown menu. This creates a copy of the dashboard with all tiles, tags, and filters. Changes: - Backend: Add duplicateDashboard controller function - Backend: Add POST /dashboards/:id/duplicate API endpoint - Frontend: Add useDuplicateDashboard hook - Frontend: Add "Duplicate Dashboard" option to menu dropdown Closes #1253 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Tom Alexander <teeohhem@users.noreply.github.com>
|
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
@claude lintiing is failing .Please run yarn run lint and fix the errors |
|
Claude finished @teeohhem's task —— View job Linting Issue Fixed ✓
Fixed: Removed unused The linting error has been resolved and pushed to the branch. View Job Run • Branch: |
Code Review SummaryThank you for implementing the dashboard duplication feature! The implementation follows good patterns from the codebase, but I have identified one critical bug and several recommendations for improvement. Critical Issue: Alert Conflicts with Duplicated TilesSeverity: High When duplicating a dashboard, the tile IDs are preserved from the original dashboard. This creates a serious problem: alerts associated with tiles in the original dashboard will conflict with alerts in the duplicated dashboard because they share the same tile IDs. Since alerts are keyed by tileId (see packages/api/src/controllers/alerts.ts), duplicating a dashboard with alerts will cause:
Solution: Regenerate tile IDs when duplicating by mapping over tiles and creating new IDs with randomUUID() from the crypto module. Missing Test CoverageLocation: packages/api/src/routers/api/tests/dashboard.test.ts The PR lacks test coverage for the new duplication feature. Based on the existing test patterns, you should add:
Code Quality & Best Practices1. Redundant Dashboard Lookup (packages/api/src/routers/api/dashboards.ts:102)The router already fetches the dashboard to check if it exists, but duplicateDashboard fetches it again. Recommendation: Remove the check from the router and let the controller return null instead of throwing an error. This matches the pattern used in updateDashboard (line 149-159). 2. Missing Import in FrontendThe ContactSupportText component is used but not imported in packages/app/src/DBDashboardPage.tsx:962. Performance ConsiderationsThe implementation is efficient and follows existing patterns:
Security AnalysisStatus: Secure ✅
Frontend UX FeedbackThe UX flow looks good:
Minor suggestion: Consider adding a loading state while duplicating to provide visual feedback. Action ItemsMust Fix:
Should Fix: Nice to Have: Great work overall! The architecture and patterns are solid. Once the tile ID issue is fixed and tests are added, this will be ready to merge. 🚀 |
Co-authored-by: Tom Alexander <teeohhem@users.noreply.github.com>
E2E Test Results✅ All tests passed • 25 passed • 3 skipped • 190s
|
Code Review: Dashboard Duplication FeatureGreat work on implementing the dashboard duplication feature! The code is well-structured and follows the project's patterns. Here's my detailed feedback: ✅ Strengths
🔍 Issues & Recommendations1. Missing Test Coverage (High Priority)The PR lacks tests for the new duplication endpoint. Based on
2. Redundant Dashboard Fetch (Medium Priority)In 3. Tile ID Collision Risk (Low Priority)The current implementation preserves the original tile IDs when duplicating. While tile IDs are scoped to dashboards, this could cause confusion if users expect completely independent tiles. However, since alerts are properly duplicated with new IDs via 4. Potential Name Collision (Low Priority)Multiple duplications result in "Dashboard Name (Copy)", "Dashboard Name (Copy) (Copy)", etc. Consider using a counter or timestamp for clearer naming, though the current approach is acceptable. 🔒 Security✅ Properly validates team ownership - no security concerns ⚡ Performance✅ No performance issues. Single DB query is efficient. 📝 Code Quality
🎯 Recommendations Priority
Great feature addition overall! 🎉 |
|
@claude still one linting error 962:61 error Insert `{'·'}⏎·····························` prettier/prettier
✖ 1 problem (1 error, 0 warnings)
1 error and 0 warnings potentially fixable with the `--fix` option.
```
Also please add test coverage and fix the tile id duplication you pointed out in the most recent code review |
|
Claude finished @teeohhem's task —— View job All fixes completed ✓
Summary of Changes1. Fixed Prettier Linting Error (
2. Fixed Tile ID Duplication Bug (
3. Added Comprehensive Test Coverage (
All changes have been committed and pushed to the branch. The CI pipeline will verify linting and run the new tests. View Job Run • Branch: |
…est coverage - Fix prettier formatting error in DBDashboardPage.tsx - Regenerate tile IDs when duplicating dashboards to prevent alert conflicts - Add comprehensive test coverage for dashboard duplication: - Test basic duplication functionality - Test 404 error handling for non-existent dashboards - Test alert duplication with new tile IDs Co-authored-by: Tom Alexander <teeohhem@users.noreply.github.com> 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
Pull Request Review: Dashboard Duplication FeatureGreat work on implementing the dashboard duplication feature! The implementation is solid and follows the codebase patterns well. Here's my detailed feedback: ✅ Strengths
🐛 Potential IssuesCritical: Race Condition in Alert Creation// packages/api/src/controllers/dashboard.ts:212-222
const newDashboard = await createDashboard(
teamId,
{
name: `${dashboardData.name} (Copy)`,
tiles: tilesWithNewIds,
tags: dashboardData.tags,
filters: dashboardData.filters,
},
userId,
);Issue: The Potential Problem: If the alert objects contain
Recommendation: Strip alert metadata before duplication: const tilesWithNewIds = dashboardData.tiles.map(tile => {
const newTile = {
...tile,
id: randomUUID(),
};
// If tile has alert config, strip metadata fields
if (newTile.config?.alert) {
const { _id, createdAt, updatedAt, ...alertData } = newTile.config.alert;
newTile.config.alert = alertData;
}
return newTile;
});Missing Field: Query from
|
Add ability to duplicate dashboards from the options dropdown menu.
Closes #1253
Changes
Generated with Claude Code