Consolidate the 7 role dashboards into one role-aware /dashboard

Open
#282 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
20/100
Issue type
Refactor
Clarity
Clearly specified
Activity status
Quiet
Tech stack
nuxt, typescript

Research direction

Review the local implementation and the listed dashboard, navigation, layout, permissions, config, and requirements files first. Run nuxt build, eslint, and prettier, then live-test /dashboard for each role and verify the old dashboard URLs and all 13 tile destinations behave as specified.

Written by the indexing model from the issue text.

Description

enhancement tech-debt ui/ux

Summary

Collapse the seven role-specific dashboard pages into a single role-aware /dashboard whose tiles show/hide via conditionals on the signed-in user's permissions. This removes ~7 near-identical page files, deletes the per-role dashboard URLs, and simplifies the routing/composable layer that fanned users out to one-of-seven dashboards.

Status: design finalized + a full implementation exists locally (uncommitted, build-verified). Work is paused pending review before it goes onto a branch/PR. This issue captures the complete context to resume or re-do.

Motivation

The seven dashboards are the same page rendered seven ways — each is just useDashboardGuard(ROLE) + a computed tiles array + <DashboardTiles :tiles>:

File Route Role
pages/dashboard/admin.vue /admin ADMIN
pages/dashboard/iTServiceDashboard.vue /iTServiceDashboard IT_SERVICE
pages/dashboard/userServiceDashboard.vue /userServiceDashboard USER_SERVICE
pages/dashboard/therapistDashboard.vue /therapistDashboard THERAPIST
pages/dashboard/evaluatorDashboard.vue /dashboard/evaluatorDashboard EVALUATOR
pages/dashboard/parentDashboard.vue /parentDashboard PARENT
pages/dashboard/patientDashboard.vue /patientDashboard PATIENT
pages/dashboard/dashboard.vue /dashboard (fallback welcome)

Access is a set of role booleans (server/utils/permissions.ts → computePermissions), and every authenticated user carries USER: true, so a single /dashboard gated USER safely admits everyone (including PATIENT/PARENT). ADMIN is a declared superset of every employee capability (STAFF, USER_SERVICE, IT_SERVICE, THERAPIST, EVALUATOR).

The feature pages are NOT part of this — patientSearch, viewContactForms, scheduleView, referrals, etc. already exist as single permission-gated pages shared across roles. Two of them (patient/patientProfile/[id].vue with can('PATIENT')/can('THERAPIST') v-ifs, and admin/scheduleView.vue with USER_SERVICE/ADMIN branching) are already the exact "one page, role conditionals" pattern this issue applies to dashboards. No feature-page changes needed.

Decisions (settled)

  1. Multi-role behavior: show the union of every tile the user qualifies for (not one dashboard picked by priority). Strictly more capable.
  2. Tile gating: each tile is gated by the destination page's own permission (same rule the router enforces via pageAccessMap), so a tile only appears when the user can actually open it — no dead tiles.
  3. Old per-role URLs: deleted entirely (not redirected). Stale bookmarks 404 / bounce via middleware.
  4. Scope: dashboards only; feature pages audited and confirmed already-consolidated.

Design — unified tile catalog

One pages/dashboard/dashboard.vue, one catalog, each tile filtered by useAccess().can(...):

Tile Destination Gate (permission)
Schedule /scheduleView USER (all authenticated)
View Patients patient-patientSearch STAFF
Contact Forms /viewContactForms USER_SERVICE
Appointment Requests /viewAppointmentRequests USER_SERVICE
Assign Specialist /assignNeuroSpecialist USER_SERVICE
Create Referral evaluator-createReferral EVALUATOR
My Referrals evaluator-myReferrals EVALUATOR
Employees /admin/employeeSearch ADMIN
Create Account /admin/createAccount ADMIN
Children childSearch (/myChildren) PARENT
Profile myProfile-id PATIENT
Appointments /patient/appointments PATIENT
Request Services requestForm PATIENT

Latent bug this fixes

Today's dashboards link to routes the middleware forbids for that role:

  • IT dashboard shows Contact Forms / Employees / Create Account, but IT only has IT_SERVICE + STAFF + USER; those routes require USER_SERVICE/ADMIN, so clicking bounces IT — 3 of its 4 tiles are dead (it looks copy-pasted from the admin dashboard).
  • Evaluator dashboard shows Contact Forms (USER_SERVICE), which evaluators also can't open.

Capability-gating (decision #2) removes these dead tiles and, conversely, surfaces tiles a role can use (e.g. IT gains View Patients via STAFF).

Blast radius / files

Delete: the 7 role dashboard .vue files (keep dashboard/dashboard.vue, rewritten).
Rewire:

  • composables/auth/useDashboardNavigation.ts — collapse per-role branches → /dashboard
  • layouts/default.vue — dashboardPath → /dashboard; drop dead evaluator NAV_META entry + now-unused access
  • composables/auth/useUserLinks.ts — remove dead dashboard-evaluatorDashboard sidebar link
  • types/permissions.ts — remove 7 dead pageAccessMap entries (keep dashboard-dashboard: USER)
  • nuxt.config.ts — remove 6 dead routeOverrides
  • docs/REQUIREMENTS.md — §4.4 table → single-dashboard description

useDashboardGuard stays (still used by pages/patient/appointments.vue).

Verification done on the local implementation

  • nuxt build → exit 0 (all templates + types compile)
  • eslint → 0 errors (2 pre-existing multi-word-component-names warnings on filenames)
  • prettier → changed code files clean (REQUIREMENTS.md prettier warning is pre-existing at HEAD)
  • Built route table: all 7 old dashboard paths + bare /admin removed; /dashboard present; all 13 tile destinations resolve (by path or name)
  • Net diff: 14 files, +141 / −313

Next steps to resume

  • Move the local WIP onto a branch + open PR
  • Live click-through of /dashboard as each role (admin, user-service, IT, therapist, evaluator, parent, patient) — confirm union tiles + no dead tiles
  • Confirm the deleted-URL behavior (old bookmarks 404/bounce) is acceptable
  • Decide whether useDashboardGuard should also be removed from patient/appointments.vue (redundant with middleware)
Dominant language
Vue
Stars
0
Forks
1
PR merge metrics
No merged PRs in 30d

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from UTDallasEPICS/connected-care

All issues in UTDallasEPICS/connected-care

Similar issues

More Security issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.