Skip to content

Commit

Permalink
feat(core): make subtitle and explanation for all dashboard widgets o…
Browse files Browse the repository at this point in the history
…verwritable via config (#2656)

closes #2594
  • Loading branch information
sadaf895 authored and sleidig committed Nov 15, 2024
1 parent cded9be commit e0e2298
Show file tree
Hide file tree
Showing 13 changed files with 40 additions and 15 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<app-dashboard-list-widget
icon="exclamation-triangle"
subtitle="Notes needing follow-up"
i18n-subtitle="subtitle|dashboard showing notes that require action"
[subtitle]="subtitle"
[explanation]="explanation"
theme="note"
entityType="Note"
[dataMapper]="dataMapper"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,11 @@ export class ImportantNotesDashboardComponent extends DashboardWidget {
super();
}

@Input() subtitle: string =
$localize`:dashboard widget subtitle:Notes needing follow-up`;
@Input() explanation: string =
$localize`:dashboard widget explanation:Notes require immediate attention or follow-up actions`;

private noteIsRelevant(note: Note): boolean {
return this.warningLevels.includes(note.warningLevel.id);
}
Expand Down
1 change: 0 additions & 1 deletion src/app/core/config/config-fix.ts
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,6 @@ export const defaultJsonConfig = {
},
{
component: "TodosDashboard",
config: {},
},
{
component: "NotesDashboard",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<app-dashboard-list-widget
icon="birthday-cake"
theme="child"
subtitle="Upcoming Birthdays"
i18n-subtitle="Subtitle of the birthday widget"
[subtitle]="subtitle"
[explanation]="explanation"
[entries]="entries"
>
<div class="table-wrapper">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,10 @@ export class BirthdayDashboardComponent

entries: EntityWithBirthday[];

@Input() subtitle: string =
$localize`:dashboard widget subtitle:Upcoming Birthdays`;
@Input() explanation: string;

constructor(private entityMapper: EntityMapperService) {
super();
this.today = new Date();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
[icon]="entityIcon"
theme="child"
[title]="totalEntities"
[subtitle]="label"
[subtitle]="subtitle ?? label"
[explanation]="explanation"
[entries]="entityGroupCounts[groupBy[currentGroupIndex]]"
[paginationPageSize]="4"
>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,10 @@ export class EntityCountDashboardComponent
label: string;
entityIcon: IconName;

@Input() subtitle: string;
@Input() explanation: string =
$localize`:dashboard widget explanation:Counting all "active" records. If configured, you can view different disaggregations by using the arrows below.`;

constructor(
private entityMapper: EntityMapperService,
private router: Router,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
<app-dashboard-list-widget
icon="list"
theme="child"
[subtitle]="data?.title"
[subtitle]="subtitle ?? data.title"
[explanation]="explanation"
[entries]="data?.parts"
>
<div class="table-wrapper">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,11 @@ export class ProgressDashboardComponent
@Input() dashboardConfigId = "";
data: ProgressDashboardConfig;

@Input() subtitle: string =
$localize`:dashboard widget subtitle: Progress Overview`;
@Input() explanation: string =
$localize`:dashboard widget explanation: Shows the progress of different parts of project tasks. You can use this to track any kind of targets.`;

constructor(
private entityMapper: EntityMapperService,
private dialog: MatDialog,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
<app-dashboard-list-widget
icon="external-link-alt"
theme="general"
subtitle="Quick actions"
i18n-subtitle="
Title of dashboard widget that shows a list of certain actions a user can
click on
"
[subtitle]="subtitle"
[explanation]="explanation"
[entries]="_shortcuts"
>
<div class="table-container">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,11 @@ export class ShortcutDashboardComponent {
}
_shortcuts: MenuItem[] = [];

@Input() subtitle: string =
$localize`:dashboard widget subtitle:Quick Actions`;
@Input() explanation: string =
$localize`:dashboard widget explanation:Shortcuts to quickly navigate to common actions`;

constructor(
private routePermissionsService: RoutePermissionsService,
private locationStrategy: LocationStrategy,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<app-dashboard-list-widget
icon="tasks"
subtitle="Tasks due"
i18n-subtitle="subtitle|dashboard showing open todos"
[subtitle]="subtitle"
[explanation]="explanation"
theme="note"
entityType="Todo"
[dataMapper]="dataMapper"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Component } from "@angular/core";
import { Component, Input } from "@angular/core";
import { DynamicComponent } from "../../../core/config/dynamic-components/dynamic-component.decorator";
import { Todo } from "../model/todo";
import { FormDialogService } from "../../../core/form-dialog/form-dialog.service";
Expand Down Expand Up @@ -35,6 +35,10 @@ export class TodosDashboardComponent extends DashboardWidget {

startDateLabel: string = Todo.schema.get("startDate").label;

@Input() subtitle: string = $localize`:dashboard widget subtitle:Tasks due`;
@Input() explanation: string =
$localize`:dashboard widget explanation:Tasks that are beyond their deadline`;

constructor(
private formDialog: FormDialogService,
private currentUser: CurrentUserSubject,
Expand Down

0 comments on commit e0e2298

Please sign in to comment.