fix(dashboard): add --layout flag to widget add for predictable placement#700
fix(dashboard): add --layout flag to widget add for predictable placement#700
Conversation
…ment (#691) Replace the greedy first-fit auto-placer with a two-mode system: - "sequential" (default): cursor-based append that places widgets after the last one, wrapping to a new row on overflow. Never backfills interior gaps beside taller widgets. - "dense": preserves the original gap-filling behavior for users who want compact layouts. The new --layout/-l flag on `sentry dashboard widget add` selects the mode. Existing --x/--y/--width/--height flags continue to work as explicit overrides on top of either mode.
Semver Impact of This PR🟢 Patch (bug fixes) 📋 Changelog PreviewThis is how your changes will appear in the changelog. New Features ✨
Bug Fixes 🐛Dashboard
Other
Internal Changes 🔧
🤖 This preview updates automatically when you update the PR. |
|
Codecov Results 📊✅ 134 passed | Total: 134 | Pass Rate: 100% | Execution Time: 0ms 📊 Comparison with Base Branch
✨ No test changes detected All tests are passing successfully. ✅ Patch coverage is 98.53%. Project has 1480 uncovered lines. Files with missing lines (1)
Coverage diff@@ Coverage Diff @@
## main #PR +/-##
==========================================
- Coverage 95.47% 95.46% -0.01%
==========================================
Files 224 224 —
Lines 32534 32591 +57
Branches 0 0 —
==========================================
+ Hits 31059 31111 +52
- Misses 1475 1480 +5
- Partials 0 0 —Generated by Codecov Action |
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.
Reviewed by Cursor Bugbot for commit 522cb2f. Configure here.
Move the validation check before the layoutMode ternary assignment so invalid values throw before any variable references them.

Summary
Fixes #691.
--layout/-lflag tosentry dashboard widget addwith two modes:sequential(default) — cursor-based append that places widgets after the last one, wrapping to a new row on overflow. Interior gaps beside taller widgets are never backfilled.dense— preserves the original first-fit gap-filling behavior for compact layouts.--x/--y/--width/--heightflags continue to work as explicit overrides on top of either mode.Changes
src/types/dashboard.tsWidgetLayoutModetype, extractedassignLayoutDense/assignLayoutSequentialhelpers, updatedassignDefaultLayoutsignaturesrc/commands/dashboard/widget/add.ts--layout/-lflag with validationtest/types/dashboard.test.tstest/types/dashboard.property.test.tstest/commands/dashboard/widget/add.test.ts--layoutflag