diff --git a/.github/workflows/continuous-integration.yml b/.github/workflows/continuous-integration.yml index 21aa75c7f..214de651c 100644 --- a/.github/workflows/continuous-integration.yml +++ b/.github/workflows/continuous-integration.yml @@ -207,12 +207,12 @@ jobs: run: ./mvnw install -pl :taskana-web - name: Test working-directory: web - run: npm run test -- --coverageReporters text-summary + run: yarn run test -- --coverageReporters text-summary - name: Cypress tests working-directory: web run: | ../mvnw -B spring-boot:run -P history.plugin -f .. -pl :taskana-rest-spring-example-boot & - npx wait-port -t 30000 localhost:8080 && npm run e2e-standalone + npx wait-port -t 30000 localhost:8080 && yarn run e2e-standalone - name: Upload Cypress tests if: failure() uses: actions/upload-artifact@v2 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 e8ed260fe..e52ceeaca 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 @@ -24,7 +24,7 @@ Created - {{convertToTaskHistoryEventData(element).created}} + {{convertToTaskHistoryEventData(element).created | germanTimeFormat}} 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 d86acdac4..4ce7ae4d1 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 @@ -1,6 +1,6 @@
-

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

+

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

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 755944d34..a5f641aec 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 @@ -1,6 +1,6 @@
-

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

+

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

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 eb6c11da5..caf5d9645 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 @@ -1,6 +1,6 @@
-

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

+

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

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 68a2de70f..6fea332b3 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 @@ -1,6 +1,6 @@
-

{{getTitle()}} ({{metaInformation?.date | date : 'dd.MM.yyyy HH:mm:ss'}})

+

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

diff --git a/web/src/app/shared/pipes/german-time-format.pipe.spec.ts b/web/src/app/shared/pipes/german-time-format.pipe.spec.ts new file mode 100644 index 000000000..541737821 --- /dev/null +++ b/web/src/app/shared/pipes/german-time-format.pipe.spec.ts @@ -0,0 +1,20 @@ +import { GermanTimeFormatPipe } from './german-time-format.pipe'; + +describe('GermanTimeFormatPipe', () => { + 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 new file mode 100644 index 000000000..14f2e8d96 --- /dev/null +++ b/web/src/app/shared/pipes/german-time-format.pipe.ts @@ -0,0 +1,21 @@ +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 21e8d97cf..c5a2283fb 100644 --- a/web/src/app/shared/shared.module.ts +++ b/web/src/app/shared/shared.module.ts @@ -58,6 +58,7 @@ import { WorkbasketService } from 'app/shared/services/workbasket/workbasket.ser import { ClassificationsService } from 'app/shared/services/classifications/classifications.service'; import { ObtainMessageService } from './services/obtain-message/obtain-message.service'; import { AccessIdsService } from './services/access-ids/access-ids.service'; +import { GermanTimeFormatPipe } from './pipes/german-time-format.pipe'; const MODULES = [ CommonModule, @@ -99,11 +100,12 @@ const DECLARATIONS = [ ProgressSpinnerComponent, DialogPopUpComponent, WorkbasketFilterComponent, - TaskFilterComponent + TaskFilterComponent, + GermanTimeFormatPipe ]; @NgModule({ - declarations: DECLARATIONS, + declarations: [DECLARATIONS], imports: [ MODULES, MatRadioModule, @@ -117,7 +119,7 @@ const DECLARATIONS = [ ReactiveFormsModule, MatProgressSpinnerModule ], - exports: DECLARATIONS, + exports: [DECLARATIONS, GermanTimeFormatPipe], providers: [ { provide: HTTP_INTERCEPTORS, diff --git a/web/src/app/workplace/components/task-list/task-list.component.html b/web/src/app/workplace/components/task-list/task-list.component.html index 84419e58b..6866e372f 100644 --- a/web/src/app/workplace/components/task-list/task-list.component.html +++ b/web/src/app/workplace/components/task-list/task-list.component.html @@ -18,7 +18,7 @@

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

State: {{task.state}}

-

Due: {{task.due | dateTimeZone }}

+

Due: {{task.due | germanTimeFormat }}

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 13a8e884d..969aa832b 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 @@ -7,7 +7,7 @@ Modification Date - @@ -16,7 +16,7 @@ Completion Date - @@ -56,7 +56,7 @@ Claim Date - @@ -64,7 +64,7 @@ Planned Date - @@ -72,7 +72,7 @@ Creation Date -