fix(ui): remove unsupported dashboard metrics

This commit is contained in:
sechmachine
2026-08-15 01:12:13 +07:00
parent f9ddef6861
commit f8db8a3e8b
7 changed files with 36 additions and 16 deletions
+1
View File
@@ -105,6 +105,7 @@
.panel-header { padding: .9rem 1rem; border-bottom: 1px solid var(--border); }
.panel-title { margin: 0; font-size: 1rem; }
.metric-strip { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); overflow: hidden; margin-bottom: 1rem; }
.metric-strip-three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.metric { min-width: 0; padding: 1rem; }
.metric + .metric { border-left: 1px solid var(--border); }
.metric-label { color: var(--muted); font-size: .78rem; }
@@ -10,12 +10,11 @@ public sealed interface DashboardView {
}
record Mentor(String displayName, long activeProjects, long activeMembers,
long blockedTasks, long pendingDecisions) implements DashboardView {
long blockedTasks) implements DashboardView {
}
record Intern(String displayName, AttendanceState attendanceState, long activeProjects,
long assignedTasks, long unreadNotifications,
List<AssignedTask> priorityTasks) implements DashboardView {
long assignedTasks, List<AssignedTask> priorityTasks) implements DashboardView {
}
record AssignedTask(String title, String projectName, String status, LocalDate dueDate) {
File diff suppressed because one or more lines are too long
@@ -13,11 +13,10 @@
</form>
<main>
<p class="page-description" th:text="${'Attendance, assigned work, and Project activity for ' + dashboard.displayName + '.'}">Today.</p>
<section class="panel metric-strip" aria-label="Intern metrics">
<section class="panel metric-strip metric-strip-three" aria-label="Intern metrics">
<div class="metric"><div class="metric-label">Attendance</div><div class="metric-value" th:text="${dashboard.attendanceState.label}">Not checked in</div><div class="metric-detail">Server-authoritative state</div></div>
<div class="metric"><div class="metric-label">Active Projects</div><div class="metric-value" th:text="${dashboard.activeProjects}">0</div><div class="metric-detail">Current memberships</div></div>
<div class="metric"><div class="metric-label">Assigned Tasks</div><div class="metric-value" th:text="${dashboard.assignedTasks}">0</div><div class="metric-detail">Current assignment scope</div></div>
<div class="metric"><div class="metric-label">Unread notifications</div><div class="metric-value" th:text="${dashboard.unreadNotifications}">0</div><div class="metric-detail">Own notifications only</div></div>
</section>
<section class="panel">
<header class="panel-header"><h2 class="panel-title">Priority Tasks</h2></header>
@@ -9,15 +9,13 @@
<body>
<a id="primary-action" class="button button-primary" th:href="@{/projects/new}">Create Project</a>
<main>
<p class="page-description">Review pending decisions, then scan attendance and owned Project health.</p>
<section class="panel metric-strip" aria-label="Mentor metrics">
<p class="page-description">Scan owned Project health, current eligible members, and blocked work.</p>
<section class="panel metric-strip metric-strip-three" aria-label="Mentor metrics">
<div class="metric"><div class="metric-label">Active owned Projects</div><div class="metric-value" th:text="${dashboard.activeProjects}">0</div><div class="metric-detail">Only your Project scope</div></div>
<div class="metric"><div class="metric-label">Active members</div><div class="metric-value" th:text="${dashboard.activeMembers}">0</div><div class="metric-detail">Across owned active Projects</div></div>
<div class="metric"><div class="metric-label">Blocked Tasks</div><div class="metric-value" th:text="${dashboard.blockedTasks}">0</div><div class="metric-detail">View and comment</div></div>
<div class="metric"><div class="metric-label">Pending decisions</div><div class="metric-value" th:text="${dashboard.pendingDecisions}">0</div><div class="metric-detail">Global leave and corrections</div></div>
</section>
<section class="panel" th:if="${dashboard.pendingDecisions == 0}"><th:block th:replace="~{fragments/components :: empty('No pending decisions', 'New leave and correction requests will appear in their queues.')} "></th:block></section>
<section class="panel" th:unless="${dashboard.pendingDecisions == 0}"><header class="panel-header"><h2 class="panel-title">Decision queue</h2></header><div class="alert" role="status"><strong th:text="${dashboard.pendingDecisions}">0</strong> request(s) need Mentor review.</div></section>
<section class="panel" th:if="${dashboard.activeProjects == 0}"><th:block th:replace="~{fragments/components :: empty('No active owned Projects', 'Create or activate a Project to begin tracking current work.')} "></th:block></section>
</main>
</body>
</html>
@@ -49,7 +49,8 @@ class DashboardTemplateWebTest {
.andExpect(status().isOk())
.andExpect(content().string(containsString("Good morning, Minh Mentor")))
.andExpect(content().string(containsString("Active owned Projects</div><div class=\"metric-value\">1")))
.andExpect(content().string(containsString("Pending decisions</div><div class=\"metric-value\">2")))
.andExpect(content().string(containsString("Blocked Tasks</div><div class=\"metric-value\">1")))
.andExpect(content().string(not(containsString("Pending decisions"))))
.andExpect(content().string(containsString("Create Project")))
.andExpect(content().string(not(containsString("Create account"))))
.andExpect(content().string(not(containsString("Check in"))));
@@ -65,6 +66,7 @@ class DashboardTemplateWebTest {
.andExpect(content().string(containsString("My real task")))
.andExpect(content().string(containsString("18/08/2026")))
.andExpect(content().string(containsString("Check out")))
.andExpect(content().string(not(containsString("Unread notifications"))))
.andExpect(content().string(not(containsString("Create Project"))))
.andExpect(content().string(not(containsString("Create account"))));
}
@@ -80,7 +82,7 @@ class DashboardTemplateWebTest {
@GetMapping("/template-contract/dashboard/mentor")
String mentor(Model model) {
model.addAttribute("dashboard", new DashboardView.Mentor("Minh Mentor", 1, 2, 1, 2));
model.addAttribute("dashboard", new DashboardView.Mentor("Minh Mentor", 1, 2, 1));
return "dashboard/mentor";
}
@@ -91,7 +93,6 @@ class DashboardTemplateWebTest {
DashboardView.AttendanceState.CHECKED_IN,
1,
1,
1,
List.of(new DashboardView.AssignedTask(
"My real task", "Intern Portal", "IN_PROGRESS", LocalDate.of(2026, 8, 18)))));
return "dashboard/intern";