From d2ec0823de785dd36990ae64db0e19be52ad68b3 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 11 Nov 2024 11:33:53 +0000 Subject: [PATCH] Closes #184 - Update ng2-charts to v6 --- web/jest.config.js | 11 ++++++ web/package.json | 2 +- web/src/app/app.module.ts | 5 +++ web/src/app/history/history.module.ts | 14 +++++-- .../task-history-query.component.html | 2 +- .../components/canvas/canvas.component.html | 2 +- .../canvas/canvas.component.spec.ts | 3 +- .../components/canvas/canvas.component.ts | 11 +++++- .../classification-report.component.html | 14 +++++-- .../classification-report.component.ts | 8 +++- .../monitor/monitor.component.spec.ts | 3 +- .../components/monitor/monitor.component.ts | 7 +++- .../report-table/report-table.component.ts | 6 ++- ...k-priority-report-filter.component.spec.ts | 4 +- .../task-priority-report-filter.component.ts | 12 +++++- .../task-priority-report.component.html | 2 +- .../task-priority-report.component.spec.ts | 19 +++++---- .../task-priority-report.component.ts | 35 ++++++++++++++++- .../task-report/task-report.component.html | 10 ++++- .../task-report/task-report.component.ts | 8 +++- .../timestamp-report.component.html | 2 +- .../timestamp-report.component.ts | 6 ++- .../workbasket-report-due-date.component.html | 12 ++++-- .../workbasket-report-due-date.component.ts | 8 +++- ...kbasket-report-planned-date.component.html | 12 ++++-- ...orkbasket-report-planned-date.component.ts | 8 +++- .../workbasket-report.component.html | 2 +- .../workbasket-report.component.ts | 9 ++++- web/src/app/monitor/monitor.module.ts | 19 +++++---- .../pipes/german-time-format.pipe.spec.ts | 38 ------------------ .../shared/pipes/german-time-format.pipe.ts | 39 ------------------- web/src/app/shared/shared.module.ts | 6 +-- .../task-list/task-list.component.html | 2 +- .../task-status-details.component.html | 10 ++--- web/src/app/workplace/workplace.module.ts | 14 +++++-- web/src/test.ts | 1 - web/yarn.lock | 18 ++++----- 37 files changed, 224 insertions(+), 160 deletions(-) delete mode 100644 web/src/app/shared/pipes/german-time-format.pipe.spec.ts delete mode 100644 web/src/app/shared/pipes/german-time-format.pipe.ts diff --git a/web/jest.config.js b/web/jest.config.js index 8d4487d0f..efe501204 100644 --- a/web/jest.config.js +++ b/web/jest.config.js @@ -1,6 +1,8 @@ const { pathsToModuleNameMapper } = require('ts-jest'); const { compilerOptions } = require('./tsconfig'); +const esModules = ['lodash-es'].join('|'); + module.exports = { preset: 'jest-preset-angular', roots: ['/src'], @@ -8,6 +10,15 @@ module.exports = { moduleDirectories: ['node_modules', 'src'], testMatch: ['**/+(*.)+(spec).+(ts)'], setupFilesAfterEnv: ['/src/test.ts'], + transform: { + '^.+\\.mjs$': [ + 'jest-preset-angular', + { + tsconfig: '/tsconfig.spec.json' + } + ] + }, + transformIgnorePatterns: [`node_modules/(?!.*\\.mjs$|${esModules})`], collectCoverage: true, coverageReporters: ['text'], coverageDirectory: 'coverage/kadai-web', diff --git a/web/package.json b/web/package.json index 289f33fba..c7d8248f4 100644 --- a/web/package.json +++ b/web/package.json @@ -43,7 +43,7 @@ "file-saver": "2.0.5", "globals": "^15.12.0", "lodash": "4.17.21", - "ng2-charts": "5.0.4", + "ng2-charts": "6.0.1", "ngx-bootstrap": "18.1.3", "ngx-infinite-scroll": "18.0.0", "rxjs": "7.8.1", diff --git a/web/src/app/app.module.ts b/web/src/app/app.module.ts index 919763590..bed37f63e 100644 --- a/web/src/app/app.module.ts +++ b/web/src/app/app.module.ts @@ -73,6 +73,9 @@ import { NgxsRouterPluginModule } from '@ngxs/router-plugin'; import { TreeModule } from '@ali-hm/angular-tree-component'; import { provideHttpClient, withXsrfConfiguration } from '@angular/common/http'; +import { registerLocaleData } from '@angular/common'; +import localeDe from '@angular/common/locales/de'; + const DECLARATIONS = [AppComponent, NavBarComponent, UserInformationComponent, NoAccessComponent, SidenavListComponent]; const MODULES = [ @@ -123,6 +126,8 @@ const PROVIDERS = [ provideHttpClient(withXsrfConfiguration({ cookieName: 'XSRF-TOKEN', headerName: 'X-XSRF-TOKEN' })) ]; +registerLocaleData(localeDe); + @NgModule({ declarations: DECLARATIONS, imports: MODULES, diff --git a/web/src/app/history/history.module.ts b/web/src/app/history/history.module.ts index d18425e0d..c223e83a4 100644 --- a/web/src/app/history/history.module.ts +++ b/web/src/app/history/history.module.ts @@ -16,8 +16,8 @@ * */ -import { NgModule } from '@angular/core'; -import { CommonModule } from '@angular/common'; +import { NgModule, LOCALE_ID } from '@angular/core'; +import { CommonModule, registerLocaleData } from '@angular/common'; import { FormsModule, ReactiveFormsModule } from '@angular/forms'; import { SharedModule } from 'app/shared/shared.module'; @@ -25,6 +25,7 @@ import { HistoryRoutingModule } from './history-routing.module'; import { TaskHistoryQueryComponent } from './task-history-query/task-history-query.component'; import { MatTableModule } from '@angular/material/table'; import { MatSortModule } from '@angular/material/sort'; +import localeDe from '@angular/common/locales/de'; @NgModule({ imports: [ @@ -36,6 +37,11 @@ import { MatSortModule } from '@angular/material/sort'; MatTableModule, MatSortModule ], - declarations: [TaskHistoryQueryComponent] + declarations: [TaskHistoryQueryComponent], + providers: [{ provide: LOCALE_ID, useValue: 'de' }] }) -export class HistoryModule {} +export class HistoryModule { + constructor() { + registerLocaleData(localeDe); + } +} diff --git a/web/src/app/history/task-history-query/task-history-query.component.html b/web/src/app/history/task-history-query/task-history-query.component.html index 3e0523c9c..d2778e651 100644 --- a/web/src/app/history/task-history-query/task-history-query.component.html +++ b/web/src/app/history/task-history-query/task-history-query.component.html @@ -42,7 +42,7 @@ Created - {{convertToTaskHistoryEventData(element).created | germanTimeFormat}} + {{convertToTaskHistoryEventData(element).created | date: 'medium'}} diff --git a/web/src/app/monitor/components/canvas/canvas.component.html b/web/src/app/monitor/components/canvas/canvas.component.html index 4b1fd06f4..95228c8f4 100644 --- a/web/src/app/monitor/components/canvas/canvas.component.html +++ b/web/src/app/monitor/components/canvas/canvas.component.html @@ -16,4 +16,4 @@ ~ --> - + diff --git a/web/src/app/monitor/components/canvas/canvas.component.spec.ts b/web/src/app/monitor/components/canvas/canvas.component.spec.ts index 71734cd94..e82276263 100644 --- a/web/src/app/monitor/components/canvas/canvas.component.spec.ts +++ b/web/src/app/monitor/components/canvas/canvas.component.spec.ts @@ -35,8 +35,7 @@ describe('CanvasComponent', () => { beforeEach(waitForAsync(() => { TestBed.configureTestingModule({ imports: [NgxsModule.forRoot([SettingsState]), MatDialogModule], - providers: [provideHttpClient(withInterceptorsFromDi()), provideHttpClientTesting()], - declarations: [CanvasComponent] + providers: [CanvasComponent, provideHttpClient(withInterceptorsFromDi()), provideHttpClientTesting()] }).compileComponents(); fixture = TestBed.createComponent(CanvasComponent); diff --git a/web/src/app/monitor/components/canvas/canvas.component.ts b/web/src/app/monitor/components/canvas/canvas.component.ts index a71914bb0..9b836213e 100644 --- a/web/src/app/monitor/components/canvas/canvas.component.ts +++ b/web/src/app/monitor/components/canvas/canvas.component.ts @@ -17,7 +17,7 @@ */ import { AfterViewInit, Component, Input, OnDestroy, OnInit } from '@angular/core'; -import { Chart } from 'chart.js'; +import { Chart, DoughnutController, ArcElement, Tooltip, Legend, Title } from 'chart.js'; import { ReportRow } from '../../models/report-row'; import { Select } from '@ngxs/store'; import { SettingsSelectors } from '../../../shared/store/settings-store/settings.selectors'; @@ -25,11 +25,14 @@ import { Observable, Subject } from 'rxjs'; import { Settings } from '../../../settings/models/settings'; import { takeUntil } from 'rxjs/operators'; import { SettingMembers } from '../../../settings/components/Settings/expected-members'; +import { provideCharts, withDefaultRegisterables } from 'ng2-charts'; @Component({ selector: 'kadai-monitor-canvas', templateUrl: './canvas.component.html', - styleUrls: ['./canvas.component.scss'] + styleUrls: ['./canvas.component.scss'], + providers: [provideCharts(withDefaultRegisterables())], + standalone: true }) export class CanvasComponent implements OnInit, AfterViewInit, OnDestroy { @Input() row: ReportRow; @@ -104,4 +107,8 @@ export class CanvasComponent implements OnInit, AfterViewInit, OnDestroy { this.destroy$.next(); this.destroy$.complete(); } + + constructor() { + Chart.register(DoughnutController, ArcElement, Tooltip, Legend, Title); + } } diff --git a/web/src/app/monitor/components/classification-report/classification-report.component.html b/web/src/app/monitor/components/classification-report/classification-report.component.html index b94a35a5c..36b87068f 100644 --- a/web/src/app/monitor/components/classification-report/classification-report.component.html +++ b/web/src/app/monitor/components/classification-report/classification-report.component.html @@ -18,15 +18,21 @@
-

{{reportData.meta.name}} ({{reportData.meta.date | germanTimeFormat}})

+

{{reportData.meta.name}} ({{reportData.meta.date | date: 'medium' }})

- + +
diff --git a/web/src/app/monitor/components/classification-report/classification-report.component.ts b/web/src/app/monitor/components/classification-report/classification-report.component.ts index 7b77c866b..0bc88acff 100644 --- a/web/src/app/monitor/components/classification-report/classification-report.component.ts +++ b/web/src/app/monitor/components/classification-report/classification-report.component.ts @@ -22,11 +22,17 @@ import { ChartData } from 'app/monitor/models/chart-data'; import { ReportData } from '../../models/report-data'; import { RequestInProgressService } from '../../../shared/services/request-in-progress/request-in-progress.service'; import { ChartConfiguration } from 'chart.js'; +import { CommonModule } from '@angular/common'; +import { ReportTableComponent } from '../report-table/report-table.component'; +import { BaseChartDirective, provideCharts, withDefaultRegisterables } from 'ng2-charts'; @Component({ selector: 'kadai-monitor-classification-report', templateUrl: './classification-report.component.html', - styleUrls: ['./classification-report.component.scss'] + styleUrls: ['./classification-report.component.scss'], + standalone: true, + imports: [CommonModule, ReportTableComponent, BaseChartDirective], + providers: [provideCharts(withDefaultRegisterables())] }) export class ClassificationReportComponent implements OnInit { reportData: ReportData; diff --git a/web/src/app/monitor/components/monitor/monitor.component.spec.ts b/web/src/app/monitor/components/monitor/monitor.component.spec.ts index f48505af1..e61d206ee 100644 --- a/web/src/app/monitor/components/monitor/monitor.component.spec.ts +++ b/web/src/app/monitor/components/monitor/monitor.component.spec.ts @@ -33,8 +33,7 @@ describe('MonitorComponent', () => { beforeEach(waitForAsync(() => { TestBed.configureTestingModule({ - declarations: [MonitorComponent], - imports: [MatTabsModule, RouterModule, RouterTestingModule, NoopAnimationsModule], + imports: [MatTabsModule, RouterModule, RouterTestingModule, NoopAnimationsModule, MonitorComponent], providers: [provideHttpClient(withInterceptorsFromDi()), provideHttpClientTesting()] }).compileComponents(); })); diff --git a/web/src/app/monitor/components/monitor/monitor.component.ts b/web/src/app/monitor/components/monitor/monitor.component.ts index 2c19f68cc..86f3a3eec 100644 --- a/web/src/app/monitor/components/monitor/monitor.component.ts +++ b/web/src/app/monitor/components/monitor/monitor.component.ts @@ -17,12 +17,15 @@ */ import { Component, OnInit } from '@angular/core'; -import { Router } from '@angular/router'; +import { Router, RouterLink, RouterOutlet } from '@angular/router'; +import { MatTabNav, MatTabLink, MatTabNavPanel } from '@angular/material/tabs'; @Component({ selector: 'kadai-monitor', templateUrl: './monitor.component.html', - styleUrls: ['./monitor.component.scss'] + styleUrls: ['./monitor.component.scss'], + standalone: true, + imports: [MatTabNav, MatTabLink, RouterLink, MatTabNavPanel, RouterOutlet] }) export class MonitorComponent implements OnInit { selectedTab = ''; diff --git a/web/src/app/monitor/components/report-table/report-table.component.ts b/web/src/app/monitor/components/report-table/report-table.component.ts index 6c883849c..24da60468 100644 --- a/web/src/app/monitor/components/report-table/report-table.component.ts +++ b/web/src/app/monitor/components/report-table/report-table.component.ts @@ -19,11 +19,15 @@ import { Component, Input, OnChanges } from '@angular/core'; import { ReportData } from 'app/monitor/models/report-data'; import { ReportRow } from '../../models/report-row'; +import { NgIf, NgFor, NgClass } from '@angular/common'; +import { MatButton } from '@angular/material/button'; @Component({ selector: 'kadai-monitor-report-table', templateUrl: './report-table.component.html', - styleUrls: ['./report-table.component.scss'] + styleUrls: ['./report-table.component.scss'], + standalone: true, + imports: [NgIf, NgFor, NgClass, MatButton] }) export class ReportTableComponent implements OnChanges { @Input() diff --git a/web/src/app/monitor/components/task-priority-report-filter/task-priority-report-filter.component.spec.ts b/web/src/app/monitor/components/task-priority-report-filter/task-priority-report-filter.component.spec.ts index 9d87dc600..c2dffdbdc 100644 --- a/web/src/app/monitor/components/task-priority-report-filter/task-priority-report-filter.component.spec.ts +++ b/web/src/app/monitor/components/task-priority-report-filter/task-priority-report-filter.component.spec.ts @@ -41,9 +41,9 @@ describe('TaskPriorityReportFilterComponent', () => { MatCheckboxModule, MatExpansionModule, NoopAnimationsModule, - MatDialogModule + MatDialogModule, + TaskPriorityReportFilterComponent ], - declarations: [TaskPriorityReportFilterComponent], providers: [provideHttpClient(withInterceptorsFromDi()), provideHttpClientTesting()] }).compileComponents(); diff --git a/web/src/app/monitor/components/task-priority-report-filter/task-priority-report-filter.component.ts b/web/src/app/monitor/components/task-priority-report-filter/task-priority-report-filter.component.ts index 43da776c8..ac72acb70 100644 --- a/web/src/app/monitor/components/task-priority-report-filter/task-priority-report-filter.component.ts +++ b/web/src/app/monitor/components/task-priority-report-filter/task-priority-report-filter.component.ts @@ -22,11 +22,21 @@ import { Observable, Subject } from 'rxjs'; import { SettingsSelectors } from '../../../shared/store/settings-store/settings.selectors'; import { Settings } from '../../../settings/models/settings'; import { takeUntil } from 'rxjs/operators'; +import { + MatAccordion, + MatExpansionPanel, + MatExpansionPanelHeader, + MatExpansionPanelTitle +} from '@angular/material/expansion'; +import { NgFor, NgIf } from '@angular/common'; +import { MatCheckbox } from '@angular/material/checkbox'; @Component({ selector: 'kadai-monitor-task-priority-report-filter', templateUrl: './task-priority-report-filter.component.html', - styleUrls: ['./task-priority-report-filter.component.scss'] + styleUrls: ['./task-priority-report-filter.component.scss'], + standalone: true, + imports: [MatAccordion, MatExpansionPanel, MatExpansionPanelHeader, MatExpansionPanelTitle, NgFor, MatCheckbox, NgIf] }) export class TaskPriorityReportFilterComponent implements OnInit, OnDestroy { isPanelOpen = false; diff --git a/web/src/app/monitor/components/task-priority-report/task-priority-report.component.html b/web/src/app/monitor/components/task-priority-report/task-priority-report.component.html index f50e33354..bd72bbd1f 100644 --- a/web/src/app/monitor/components/task-priority-report/task-priority-report.component.html +++ b/web/src/app/monitor/components/task-priority-report/task-priority-report.component.html @@ -20,7 +20,7 @@
-

{{reportData?.meta.name}} ({{reportData?.meta.date | germanTimeFormat +

{{reportData?.meta.name}} ({{reportData?.meta.date | date: 'medium' }})

diff --git a/web/src/app/monitor/components/task-priority-report/task-priority-report.component.spec.ts b/web/src/app/monitor/components/task-priority-report/task-priority-report.component.spec.ts index 2364d0177..3f8b6970e 100644 --- a/web/src/app/monitor/components/task-priority-report/task-priority-report.component.spec.ts +++ b/web/src/app/monitor/components/task-priority-report/task-priority-report.component.spec.ts @@ -31,13 +31,9 @@ import { provideHttpClientTesting } from '@angular/common/http/testing'; import { MatDividerModule } from '@angular/material/divider'; import { RequestInProgressService } from '../../../shared/services/request-in-progress/request-in-progress.service'; import { provideHttpClient, withInterceptorsFromDi } from '@angular/common/http'; - -@Pipe({ name: 'germanTimeFormat' }) -class GermanTimeFormatPipe implements PipeTransform { - transform(value: number): number { - return value; - } -} +import { NoopAnimationsModule } from '@angular/platform-browser/animations'; +import { registerLocaleData } from '@angular/common'; +import localeDe from '@angular/common/locales/de'; @Component({ selector: 'kadai-monitor-canvas', template: '' }) class CanvasStub { @@ -63,15 +59,18 @@ describe('TaskPriorityReportComponent', () => { let component: TaskPriorityReportComponent; beforeEach(waitForAsync(() => { + registerLocaleData(localeDe); + TestBed.configureTestingModule({ - imports: [NgxsModule.forRoot([SettingsState]), MatTableModule, MatDividerModule], - declarations: [TaskPriorityReportComponent, GermanTimeFormatPipe, CanvasStub, TaskPriorityReportFilterStub], + imports: [NgxsModule.forRoot([SettingsState]), MatTableModule, MatDividerModule, NoopAnimationsModule], + declarations: [CanvasStub, TaskPriorityReportFilterStub], providers: [ RequestInProgressService, { provide: MonitorService, useValue: monitorServiceSpy }, { provide: NotificationService, useValue: notificationServiceSpy }, provideHttpClient(withInterceptorsFromDi()), - provideHttpClientTesting() + provideHttpClientTesting(), + TaskPriorityReportComponent ] }).compileComponents(); diff --git a/web/src/app/monitor/components/task-priority-report/task-priority-report.component.ts b/web/src/app/monitor/components/task-priority-report/task-priority-report.component.ts index b88f758e6..22843f6ef 100644 --- a/web/src/app/monitor/components/task-priority-report/task-priority-report.component.ts +++ b/web/src/app/monitor/components/task-priority-report/task-priority-report.component.ts @@ -27,11 +27,44 @@ import { Settings } from '../../../settings/models/settings'; import { mergeMap, take, takeUntil } from 'rxjs/operators'; import { SettingMembers } from '../../../settings/components/Settings/expected-members'; import { RequestInProgressService } from '../../../shared/services/request-in-progress/request-in-progress.service'; +import { CommonModule } from '@angular/common'; +import { TaskPriorityReportFilterComponent } from '../task-priority-report-filter/task-priority-report-filter.component'; +import { MatDivider } from '@angular/material/divider'; +import { CanvasComponent } from '../canvas/canvas.component'; +import { + MatTable, + MatColumnDef, + MatHeaderCellDef, + MatHeaderCell, + MatCellDef, + MatCell, + MatHeaderRowDef, + MatHeaderRow, + MatRowDef, + MatRow +} from '@angular/material/table'; @Component({ selector: 'kadai-monitor-task-priority-report', templateUrl: './task-priority-report.component.html', - styleUrls: ['./task-priority-report.component.scss'] + styleUrls: ['./task-priority-report.component.scss'], + standalone: true, + imports: [ + CommonModule, + TaskPriorityReportFilterComponent, + MatDivider, + CanvasComponent, + MatTable, + MatColumnDef, + MatHeaderCellDef, + MatHeaderCell, + MatCellDef, + MatCell, + MatHeaderRowDef, + MatHeaderRow, + MatRowDef, + MatRow + ] }) export class TaskPriorityReportComponent implements OnInit, AfterViewChecked, OnDestroy { columns: string[] = ['priority', 'number']; diff --git a/web/src/app/monitor/components/task-report/task-report.component.html b/web/src/app/monitor/components/task-report/task-report.component.html index eb458a2c6..640fed703 100644 --- a/web/src/app/monitor/components/task-report/task-report.component.html +++ b/web/src/app/monitor/components/task-report/task-report.component.html @@ -18,11 +18,17 @@
-

{{reportData.meta.name}} ({{reportData.meta.date | germanTimeFormat}})

+

{{reportData.meta.name}} ({{reportData.meta.date | date: 'medium' }})

- + +
diff --git a/web/src/app/monitor/components/task-report/task-report.component.ts b/web/src/app/monitor/components/task-report/task-report.component.ts index 2097df5e7..6d5be59f2 100644 --- a/web/src/app/monitor/components/task-report/task-report.component.ts +++ b/web/src/app/monitor/components/task-report/task-report.component.ts @@ -23,11 +23,17 @@ import { takeUntil } from 'rxjs/operators'; import { Subject } from 'rxjs'; import { RequestInProgressService } from 'app/shared/services/request-in-progress/request-in-progress.service'; import { ChartConfiguration, ChartData, ChartType } from 'chart.js'; +import { CommonModule } from '@angular/common'; +import { ReportTableComponent } from '../report-table/report-table.component'; +import { BaseChartDirective, provideCharts, withDefaultRegisterables } from 'ng2-charts'; @Component({ selector: 'kadai-monitor-task-report', templateUrl: './task-report.component.html', - styleUrls: ['./task-report.component.scss'] + styleUrls: ['./task-report.component.scss'], + standalone: true, + imports: [CommonModule, ReportTableComponent, BaseChartDirective], + providers: [provideCharts(withDefaultRegisterables())] }) export class TaskReportComponent implements OnInit { pieChartData: ChartData<'pie', number[], string> = { labels: [], datasets: [] }; diff --git a/web/src/app/monitor/components/timestamp-report/timestamp-report.component.html b/web/src/app/monitor/components/timestamp-report/timestamp-report.component.html index f6b815eb4..4e5d27568 100644 --- a/web/src/app/monitor/components/timestamp-report/timestamp-report.component.html +++ b/web/src/app/monitor/components/timestamp-report/timestamp-report.component.html @@ -18,7 +18,7 @@
-

{{reportData.meta.name}} ({{reportData.meta.date | germanTimeFormat}})

+

{{reportData.meta.name}} ({{reportData.meta.date | date: 'medium' }})

diff --git a/web/src/app/monitor/components/timestamp-report/timestamp-report.component.ts b/web/src/app/monitor/components/timestamp-report/timestamp-report.component.ts index a6a04b42e..8688dea4f 100644 --- a/web/src/app/monitor/components/timestamp-report/timestamp-report.component.ts +++ b/web/src/app/monitor/components/timestamp-report/timestamp-report.component.ts @@ -20,11 +20,15 @@ import { Component, OnInit } from '@angular/core'; import { ReportData } from '../../models/report-data'; import { MonitorService } from '../../services/monitor.service'; import { RequestInProgressService } from '../../../shared/services/request-in-progress/request-in-progress.service'; +import { CommonModule } from '@angular/common'; +import { ReportTableComponent } from '../report-table/report-table.component'; @Component({ selector: 'kadai-monitor-timestamp-report', templateUrl: './timestamp-report.component.html', - styleUrls: ['./timestamp-report.component.scss'] + styleUrls: ['./timestamp-report.component.scss'], + standalone: true, + imports: [ReportTableComponent, CommonModule] }) export class TimestampReportComponent implements OnInit { reportData: ReportData; diff --git a/web/src/app/monitor/components/workbasket-report-due-date/workbasket-report-due-date.component.html b/web/src/app/monitor/components/workbasket-report-due-date/workbasket-report-due-date.component.html index c3ffef317..bc8498c89 100644 --- a/web/src/app/monitor/components/workbasket-report-due-date/workbasket-report-due-date.component.html +++ b/web/src/app/monitor/components/workbasket-report-due-date/workbasket-report-due-date.component.html @@ -19,9 +19,15 @@
- + +
diff --git a/web/src/app/monitor/components/workbasket-report-due-date/workbasket-report-due-date.component.ts b/web/src/app/monitor/components/workbasket-report-due-date/workbasket-report-due-date.component.ts index 2cc037c5e..a0b44ba13 100644 --- a/web/src/app/monitor/components/workbasket-report-due-date/workbasket-report-due-date.component.ts +++ b/web/src/app/monitor/components/workbasket-report-due-date/workbasket-report-due-date.component.ts @@ -23,11 +23,17 @@ import { MonitorService } from '../../services/monitor.service'; import { MetaInfoData } from '../../models/meta-info-data'; import { RequestInProgressService } from '../../../shared/services/request-in-progress/request-in-progress.service'; import { ChartConfiguration } from 'chart.js'; +import { NgIf } from '@angular/common'; +import { BaseChartDirective, provideCharts, withDefaultRegisterables } from 'ng2-charts'; +import { ReportTableComponent } from '../report-table/report-table.component'; @Component({ selector: 'kadai-monitor-workbasket-report-due-date', templateUrl: './workbasket-report-due-date.component.html', - styleUrls: ['./workbasket-report-due-date.component.scss'] + styleUrls: ['./workbasket-report-due-date.component.scss'], + standalone: true, + imports: [NgIf, BaseChartDirective, ReportTableComponent], + providers: [provideCharts(withDefaultRegisterables())] }) export class WorkbasketReportDueDateComponent implements OnInit { @Output() diff --git a/web/src/app/monitor/components/workbasket-report-planned-date/workbasket-report-planned-date.component.html b/web/src/app/monitor/components/workbasket-report-planned-date/workbasket-report-planned-date.component.html index c3ffef317..bc8498c89 100644 --- a/web/src/app/monitor/components/workbasket-report-planned-date/workbasket-report-planned-date.component.html +++ b/web/src/app/monitor/components/workbasket-report-planned-date/workbasket-report-planned-date.component.html @@ -19,9 +19,15 @@
- + +
diff --git a/web/src/app/monitor/components/workbasket-report-planned-date/workbasket-report-planned-date.component.ts b/web/src/app/monitor/components/workbasket-report-planned-date/workbasket-report-planned-date.component.ts index 89479ead6..ada81eb44 100644 --- a/web/src/app/monitor/components/workbasket-report-planned-date/workbasket-report-planned-date.component.ts +++ b/web/src/app/monitor/components/workbasket-report-planned-date/workbasket-report-planned-date.component.ts @@ -23,11 +23,17 @@ import { MonitorService } from '../../services/monitor.service'; import { MetaInfoData } from '../../models/meta-info-data'; import { RequestInProgressService } from '../../../shared/services/request-in-progress/request-in-progress.service'; import { ChartConfiguration } from 'chart.js'; +import { NgIf } from '@angular/common'; +import { ReportTableComponent } from '../report-table/report-table.component'; +import { BaseChartDirective, provideCharts, withDefaultRegisterables } from 'ng2-charts'; @Component({ selector: 'kadai-monitor-workbasket-report-planned-date', templateUrl: './workbasket-report-planned-date.component.html', - styleUrls: ['./workbasket-report-planned-date.component.scss'] + styleUrls: ['./workbasket-report-planned-date.component.scss'], + standalone: true, + imports: [NgIf, ReportTableComponent, BaseChartDirective], + providers: [provideCharts(withDefaultRegisterables())] }) export class WorkbasketReportPlannedDateComponent implements OnInit { @Output() diff --git a/web/src/app/monitor/components/workbasket-report/workbasket-report.component.html b/web/src/app/monitor/components/workbasket-report/workbasket-report.component.html index 30c077ee5..57ff64385 100644 --- a/web/src/app/monitor/components/workbasket-report/workbasket-report.component.html +++ b/web/src/app/monitor/components/workbasket-report/workbasket-report.component.html @@ -18,7 +18,7 @@
-

{{ getTitle() }} ({{ metaInformation?.date | germanTimeFormat }} +

{{ getTitle() }} ({{ metaInformation?.date| date:'medium' }} )

{ - it('create an instance', () => { - const pipe = new GermanTimeFormatPipe(); - expect(pipe).toBeTruthy(); - }); - - // This test currently doesn't work in GitHub CI, but runs on local machine - // Re-enable test when developing this pipe - it.skip('should convert ISO time to german time', () => { - const pipe = new GermanTimeFormatPipe(); - expect(pipe.transform('2021-08-20T09:31:41Z')).toMatch('20.08.2021, 11:31:41'); - }); - - it('should return input value when input is string but not a date', () => { - const pipe = new GermanTimeFormatPipe(); - expect(pipe.transform('totally not a date')).toMatch('totally not a date'); - }); -}); diff --git a/web/src/app/shared/pipes/german-time-format.pipe.ts b/web/src/app/shared/pipes/german-time-format.pipe.ts deleted file mode 100644 index e0a9de825..000000000 --- a/web/src/app/shared/pipes/german-time-format.pipe.ts +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright [2024] [envite consulting GmbH] - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * - */ - -import { Pipe, PipeTransform } from '@angular/core'; - -@Pipe({ - name: 'germanTimeFormat' -}) -export class GermanTimeFormatPipe implements PipeTransform { - transform(value: string): string { - const dateStr = Date.parse(value); - if (isNaN(dateStr)) return value; - return Intl.DateTimeFormat('de', this.options).format(dateStr); - } - - options = { - year: 'numeric', - month: '2-digit', - day: '2-digit', - hour: '2-digit', - minute: '2-digit', - second: '2-digit' - } as const; -} diff --git a/web/src/app/shared/shared.module.ts b/web/src/app/shared/shared.module.ts index da12c1a31..750a6469e 100644 --- a/web/src/app/shared/shared.module.ts +++ b/web/src/app/shared/shared.module.ts @@ -83,7 +83,6 @@ import { ClassificationsService } from 'app/shared/services/classifications/clas import { ObtainMessageService } from './services/obtain-message/obtain-message.service'; import { AccessIdsService } from './services/access-ids/access-ids.service'; import { DragAndDropDirective } from './directives/drag-and-drop.directive'; -import { GermanTimeFormatPipe } from './pipes/german-time-format.pipe'; import { ResizableWidthDirective } from './directives/resizable-width.directive'; import { TreeModule } from '@ali-hm/angular-tree-component'; import { environment } from '../../environments/environment'; @@ -127,8 +126,7 @@ const DECLARATIONS = [ WorkbasketFilterComponent, TaskFilterComponent, DragAndDropDirective, - ResizableWidthDirective, - GermanTimeFormatPipe + ResizableWidthDirective ]; export const httpClientInterceptor: HttpInterceptorFn = (request: HttpRequest, next: HttpHandlerFn) => { @@ -184,7 +182,7 @@ export const httpClientInterceptor: HttpInterceptorFn = (request: HttpRequest

{{ task.name }}{{ task.owner }}

State: {{ task.state }}

-

Due: {{ task.due | germanTimeFormat }}

+

Due: {{ task.due | date: 'medium' }}

diff --git a/web/src/app/workplace/components/task-status-details/task-status-details.component.html b/web/src/app/workplace/components/task-status-details/task-status-details.component.html index fc3048d65..9b3bdb0f1 100644 --- a/web/src/app/workplace/components/task-status-details/task-status-details.component.html +++ b/web/src/app/workplace/components/task-status-details/task-status-details.component.html @@ -25,7 +25,7 @@ Modification Date - @@ -35,7 +35,7 @@ Completion Date - @@ -77,7 +77,7 @@ Claim Date - @@ -86,7 +86,7 @@ Planned Date - @@ -95,7 +95,7 @@ Creation Date - diff --git a/web/src/app/workplace/workplace.module.ts b/web/src/app/workplace/workplace.module.ts index 715595164..ae0b74282 100644 --- a/web/src/app/workplace/workplace.module.ts +++ b/web/src/app/workplace/workplace.module.ts @@ -16,8 +16,8 @@ * */ -import { CommonModule } from '@angular/common'; -import { NgModule } from '@angular/core'; +import { CommonModule, registerLocaleData } from '@angular/common'; +import { NgModule, LOCALE_ID } from '@angular/core'; import { FormsModule } from '@angular/forms'; import { HttpHandlerFn, @@ -61,6 +61,7 @@ import { MatDatepickerModule } from '@angular/material/datepicker'; import { MatNativeDateModule } from '@angular/material/core'; import { MatTabsModule } from '@angular/material/tabs'; import { environment } from '../../environments/environment'; +import localeDe from '@angular/common/locales/de'; const MODULES = [ TypeaheadModule.forRoot(), @@ -116,7 +117,12 @@ export const tokenInterceptor: HttpInterceptorFn = (req: HttpRequest, n TaskService, ClassificationCategoriesService, WorkplaceService, - provideHttpClient(withInterceptors([tokenInterceptor])) + provideHttpClient(withInterceptors([tokenInterceptor])), + { provide: LOCALE_ID, useValue: 'de' } ] }) -export class WorkplaceModule {} +export class WorkplaceModule { + constructor() { + registerLocaleData(localeDe); + } +} diff --git a/web/src/test.ts b/web/src/test.ts index 2cb58665c..03b93f1df 100644 --- a/web/src/test.ts +++ b/web/src/test.ts @@ -17,7 +17,6 @@ */ import 'jest-preset-angular/setup-jest'; -import { fakeAsync } from '@angular/core/testing'; Object.defineProperty(window, 'CSS', { value: null }); Object.defineProperty(window, 'getComputedStyle', { diff --git a/web/yarn.lock b/web/yarn.lock index 82f9084ec..23ff5eeb0 100644 --- a/web/yarn.lock +++ b/web/yarn.lock @@ -10394,7 +10394,7 @@ __metadata: jest: "npm:29.7.0" jest-preset-angular: "npm:14.3.1" lodash: "npm:4.17.21" - ng2-charts: "npm:5.0.4" + ng2-charts: "npm:6.0.1" ngx-bootstrap: "npm:18.1.3" ngx-infinite-scroll: "npm:18.0.0" prettier: "npm:3.3.3" @@ -11265,20 +11265,20 @@ __metadata: languageName: node linkType: hard -"ng2-charts@npm:5.0.4": - version: 5.0.4 - resolution: "ng2-charts@npm:5.0.4" +"ng2-charts@npm:6.0.1": + version: 6.0.1 + resolution: "ng2-charts@npm:6.0.1" dependencies: lodash-es: "npm:^4.17.15" tslib: "npm:^2.3.0" peerDependencies: - "@angular/cdk": ">=16.0.0" - "@angular/common": ">=16.0.0" - "@angular/core": ">=16.0.0" - "@angular/platform-browser": ">=16.0.0" + "@angular/cdk": ">=17.0.0" + "@angular/common": ">=17.0.0" + "@angular/core": ">=17.0.0" + "@angular/platform-browser": ">=17.0.0" chart.js: ^3.4.0 || ^4.0.0 rxjs: ^6.5.3 || ^7.4.0 - checksum: 10c0/09c423c4e0bb2e39b03377bbd611ff454c70c1191c8739792226f01faf6d2ed19a390c1acbd1a9e02013f2f32891c318d0013680af4535af806d7942337ebcc2 + checksum: 10c0/9a2aae7b1560e6b6408712887eb30d1cf6de70e2abee6c507ec1bc72c405b01d2334a127cf550c737e88cd2b587a963c59af608bbd4e9fe2cac7ac0f53650a80 languageName: node linkType: hard