Skip to content

feat(dashboard): seed default widget bundle on new dashboards + loading shim#129

Merged
rubenvdlinde merged 3 commits intodevelopmentfrom
feature/default-widgets-and-loading-state
May 5, 2026
Merged

feat(dashboard): seed default widget bundle on new dashboards + loading shim#129
rubenvdlinde merged 3 commits intodevelopmentfrom
feature/default-widgets-and-loading-state

Conversation

@rubenvdlinde
Copy link
Copy Markdown
Contributor

Summary

  • Every user-created dashboard now bootstraps with a preconfigured widget bundle: three tile widgets (Conduction, Sendent, Nextcloud — last uses the icon-nextcloud CSS class) on the top row plus a files widget below. Admin-template dashboards untouched.
  • The empty-state CTA ("No dashboard yet") no longer flashes during the initial fetch — a loading shim with NcLoadingIcon renders while loading=true and activeDashboard is null.

Backend

  • DashboardService::createDashboard() gains bool $seedDefaults = false; controller path opts in. Bootstrap path keeps it false (its own role-default seed runs).
  • New private seedDefaultWidgets() inserts the four placements with tileType='preset' so WidgetPlacement::jsonSerialize() emits the flat tile* fields the renderer reads.
  • New public findPlacements(int $dashboardId): array exposes the placement mapper to the controller.
  • DashboardApiController::create() returns placements in the same envelope shape as getActive() so the store populates widgetPlacements without an extra round-trip.

Frontend

  • Views.vue adds a v-else-if="loading" branch with NcLoadingIcon.
  • Dashboard store's createDashboard action reads response.data.placements ?? [].

Tests

  • DashboardServiceCreateDefaultsTest (2 cases) — seed contract.
  • Views.loadingState.spec.js (2 cases) — loading-shim vs empty-state.
  • Newman tightened: pins placements.length === 4, per-tile shape (widgetId, tileType, tileTitle, tileLinkValue, grid coords), plus widgetId order on empty-body create path.

(Note: this is a re-open of PR #126 after a branch rename — feat/*feature/* to satisfy the org Branch Policy.)

…s + loading shim

Three preconfigured tile widgets (Conduction, Sendent, Nextcloud) plus a
Files widget are now inserted on every dashboard created via the sidebar
"+" affordance. The bootstrap path keeps its own role-default-driven seed
so admin templates and template-applied dashboards are unaffected.

The empty-state CTA ("No dashboard yet" / Create dashboard) used to flash
during the initial fetch because `activeDashboard` is null until
`loadDashboards()` resolves. A loading shim now renders while the store's
`loading` flag is set.

- DashboardService::createDashboard gains a `seedDefaults` flag and a
  private seedDefaultWidgets() helper that persists the bundle via the
  existing tile* columns on WidgetPlacement.
- DashboardApiController::create opts in and returns the placements in
  the same envelope shape as getActive() so the store populates
  widgetPlacements without an extra round-trip.
- Frontend dashboard store reads placements from the create response.
- Views.vue gains a `v-else-if="loading"` branch with NcLoadingIcon.
…Newman

Without `tileType`, `WidgetPlacement::jsonSerialize()` skips emitting the
flat tile* fields, so the seeded Conduction/Sendent/Nextcloud tiles
shipped to the frontend without a title, icon, or link. Setting
`tileType='preset'` makes the renderer's flat-column path work; the
sentinel intentionally differs from the legacy `'custom'` value so the
placements stay on the registry-backed render path in DashboardGrid.vue
rather than the pre-registry tile branch.

Newman now pins the contract:
- POST /api/dashboard returns exactly 4 placements
- positions 0..2 are tiles with the expected tileType, tileTitle,
  tileLinkValue, and grid coords
- position 3 is `files` spanning the second row
- the empty-body create path asserts the same widgetId order when 2xx
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 5, 2026

Quality Report — ConductionNL/mydash @ 562aba1

Check PHP Vue Security License Tests
lint
phpcs
phpmd
psalm
phpstan
phpmetrics
eslint
stylelint
composer ✅ 100/100
npm ✅ 501/501
PHPUnit
Newman
Playwright ⏭️

Coverage: 90.7% (127/140 statements)


Quality workflow — 2026-05-05 21:05 UTC

Download the full PDF report from the workflow artifacts.

@rubenvdlinde rubenvdlinde merged commit d6c712e into development May 5, 2026
49 checks passed
@rubenvdlinde rubenvdlinde deleted the feature/default-widgets-and-loading-state branch May 5, 2026 21:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant