TSK-718: Add german date time format pipe (#1681)
* TSK-718: Add german date time format pipe * TSK-718: update test to run with yarn
This commit is contained in:
parent
3f124f47db
commit
0f65abb001
|
|
@ -207,12 +207,12 @@ jobs:
|
||||||
run: ./mvnw install -pl :taskana-web
|
run: ./mvnw install -pl :taskana-web
|
||||||
- name: Test
|
- name: Test
|
||||||
working-directory: web
|
working-directory: web
|
||||||
run: npm run test -- --coverageReporters text-summary
|
run: yarn run test -- --coverageReporters text-summary
|
||||||
- name: Cypress tests
|
- name: Cypress tests
|
||||||
working-directory: web
|
working-directory: web
|
||||||
run: |
|
run: |
|
||||||
../mvnw -B spring-boot:run -P history.plugin -f .. -pl :taskana-rest-spring-example-boot &
|
../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
|
- name: Upload Cypress tests
|
||||||
if: failure()
|
if: failure()
|
||||||
uses: actions/upload-artifact@v2
|
uses: actions/upload-artifact@v2
|
||||||
|
|
|
||||||
|
|
@ -24,7 +24,7 @@
|
||||||
|
|
||||||
<ng-container matColumnDef="created">
|
<ng-container matColumnDef="created">
|
||||||
<th mat-header-cell *matHeaderCellDef mat-sort-header disableClear>Created</th>
|
<th mat-header-cell *matHeaderCellDef mat-sort-header disableClear>Created</th>
|
||||||
<td mat-cell *matCellDef="let element">{{convertToTaskHistoryEventData(element).created}}</td>
|
<td mat-cell *matCellDef="let element">{{convertToTaskHistoryEventData(element).created | germanTimeFormat}}</td>
|
||||||
</ng-container>
|
</ng-container>
|
||||||
|
|
||||||
<ng-container matColumnDef="userId">
|
<ng-container matColumnDef="userId">
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
<div *ngIf="reportData" class="panel panel-default">
|
<div *ngIf="reportData" class="panel panel-default">
|
||||||
<div class="panel-heading">
|
<div class="panel-heading">
|
||||||
<h4>{{reportData.meta.name}} ({{reportData.meta.date | dateTimeZone}})</h4>
|
<h4>{{reportData.meta.name}} ({{reportData.meta.date | germanTimeFormat}})</h4>
|
||||||
</div>
|
</div>
|
||||||
<div class="panel-body">
|
<div class="panel-body">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
<div *ngIf= "reportData" class="panel panel-default">
|
<div *ngIf= "reportData" class="panel panel-default">
|
||||||
<div class="panel-heading">
|
<div class="panel-heading">
|
||||||
<h4>{{reportData.meta.name}} ({{reportData.meta.date | dateTimeZone}})</h4>
|
<h4>{{reportData.meta.name}} ({{reportData.meta.date | germanTimeFormat}})</h4>
|
||||||
</div>
|
</div>
|
||||||
<div class="panel-body">
|
<div class="panel-body">
|
||||||
<div style="display: block">
|
<div style="display: block">
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
<div *ngIf="reportData" class="panel panel-default">
|
<div *ngIf="reportData" class="panel panel-default">
|
||||||
<div class="panel-heading">
|
<div class="panel-heading">
|
||||||
<h4>{{reportData.meta.name}} ({{reportData.meta.date | dateTimeZone}})</h4>
|
<h4>{{reportData.meta.name}} ({{reportData.meta.date | germanTimeFormat}})</h4>
|
||||||
</div>
|
</div>
|
||||||
<div class="panel-body blub">
|
<div class="panel-body blub">
|
||||||
<taskana-monitor-report-table [reportData]="reportData"></taskana-monitor-report-table>
|
<taskana-monitor-report-table [reportData]="reportData"></taskana-monitor-report-table>
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
<div class="panel panel-default">
|
<div class="panel panel-default">
|
||||||
<div class="panel-heading">
|
<div class="panel-heading">
|
||||||
<h4 *ngIf="metaInformation">{{getTitle()}} ({{metaInformation?.date | date : 'dd.MM.yyyy HH:mm:ss'}})</h4>
|
<h4 *ngIf="metaInformation">{{getTitle()}} ({{metaInformation?.date | germanTimeFormat}})</h4>
|
||||||
</div>
|
</div>
|
||||||
<mat-tab-group class="panel-body" animationDuration="0ms" (selectedIndexChange)="selectComponent($event)" >
|
<mat-tab-group class="panel-body" animationDuration="0ms" (selectedIndexChange)="selectComponent($event)" >
|
||||||
<mat-tab label="Due Date">
|
<mat-tab label="Due Date">
|
||||||
|
|
|
||||||
|
|
@ -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');
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
@ -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;
|
||||||
|
}
|
||||||
|
|
@ -58,6 +58,7 @@ import { WorkbasketService } from 'app/shared/services/workbasket/workbasket.ser
|
||||||
import { ClassificationsService } from 'app/shared/services/classifications/classifications.service';
|
import { ClassificationsService } from 'app/shared/services/classifications/classifications.service';
|
||||||
import { ObtainMessageService } from './services/obtain-message/obtain-message.service';
|
import { ObtainMessageService } from './services/obtain-message/obtain-message.service';
|
||||||
import { AccessIdsService } from './services/access-ids/access-ids.service';
|
import { AccessIdsService } from './services/access-ids/access-ids.service';
|
||||||
|
import { GermanTimeFormatPipe } from './pipes/german-time-format.pipe';
|
||||||
|
|
||||||
const MODULES = [
|
const MODULES = [
|
||||||
CommonModule,
|
CommonModule,
|
||||||
|
|
@ -99,11 +100,12 @@ const DECLARATIONS = [
|
||||||
ProgressSpinnerComponent,
|
ProgressSpinnerComponent,
|
||||||
DialogPopUpComponent,
|
DialogPopUpComponent,
|
||||||
WorkbasketFilterComponent,
|
WorkbasketFilterComponent,
|
||||||
TaskFilterComponent
|
TaskFilterComponent,
|
||||||
|
GermanTimeFormatPipe
|
||||||
];
|
];
|
||||||
|
|
||||||
@NgModule({
|
@NgModule({
|
||||||
declarations: DECLARATIONS,
|
declarations: [DECLARATIONS],
|
||||||
imports: [
|
imports: [
|
||||||
MODULES,
|
MODULES,
|
||||||
MatRadioModule,
|
MatRadioModule,
|
||||||
|
|
@ -117,7 +119,7 @@ const DECLARATIONS = [
|
||||||
ReactiveFormsModule,
|
ReactiveFormsModule,
|
||||||
MatProgressSpinnerModule
|
MatProgressSpinnerModule
|
||||||
],
|
],
|
||||||
exports: DECLARATIONS,
|
exports: [DECLARATIONS, GermanTimeFormatPipe],
|
||||||
providers: [
|
providers: [
|
||||||
{
|
{
|
||||||
provide: HTTP_INTERCEPTORS,
|
provide: HTTP_INTERCEPTORS,
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,7 @@
|
||||||
<div class="task-list__task-info">
|
<div class="task-list__task-info">
|
||||||
<p> <b>{{task.name}}</b>, <i *ngIf="task.owner">{{task.owner}} </i> </p>
|
<p> <b>{{task.name}}</b>, <i *ngIf="task.owner">{{task.owner}} </i> </p>
|
||||||
<p> State: {{task.state}} </p>
|
<p> State: {{task.state}} </p>
|
||||||
<p> Due: {{task.due | dateTimeZone }} </p>
|
<p> Due: {{task.due | germanTimeFormat }} </p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,7 @@
|
||||||
<mat-form-field appearance="outline">
|
<mat-form-field appearance="outline">
|
||||||
<mat-label>Modification Date</mat-label>
|
<mat-label>Modification Date</mat-label>
|
||||||
<label for="task-modified"></label>
|
<label for="task-modified"></label>
|
||||||
<input matInput type="text" disabled id="task-modified" placeholder="Modified Date" [value]="task.modified | dateTimeZone"
|
<input matInput type="text" disabled id="task-modified" placeholder="Modified Date" [value]="task.modified | germanTimeFormat"
|
||||||
name="task.modified">
|
name="task.modified">
|
||||||
</mat-form-field>
|
</mat-form-field>
|
||||||
|
|
||||||
|
|
@ -16,7 +16,7 @@
|
||||||
<mat-form-field appearance="outline">
|
<mat-form-field appearance="outline">
|
||||||
<mat-label>Completion Date</mat-label>
|
<mat-label>Completion Date</mat-label>
|
||||||
<label for="task-completed"></label>
|
<label for="task-completed"></label>
|
||||||
<input matInput type="text" disabled id="task-completed" placeholder="Complete Date" [value]="task.completed | dateTimeZone"
|
<input matInput type="text" disabled id="task-completed" placeholder="Complete Date" [value]="task.completed | germanTimeFormat"
|
||||||
name="task.completed">
|
name="task.completed">
|
||||||
</mat-form-field>
|
</mat-form-field>
|
||||||
|
|
||||||
|
|
@ -56,7 +56,7 @@
|
||||||
<mat-form-field appearance="outline">
|
<mat-form-field appearance="outline">
|
||||||
<mat-label>Claim Date</mat-label>
|
<mat-label>Claim Date</mat-label>
|
||||||
<label for="task-claimed"></label>
|
<label for="task-claimed"></label>
|
||||||
<input matInput type="text" disabled id="task-claimed" placeholder="Claimed Date" [value]="task.claimed | dateTimeZone"
|
<input matInput type="text" disabled id="task-claimed" placeholder="Claimed Date" [value]="task.claimed | germanTimeFormat"
|
||||||
name="task.claimed">
|
name="task.claimed">
|
||||||
</mat-form-field>
|
</mat-form-field>
|
||||||
|
|
||||||
|
|
@ -64,7 +64,7 @@
|
||||||
<mat-form-field appearance="outline">
|
<mat-form-field appearance="outline">
|
||||||
<mat-label>Planned Date</mat-label>
|
<mat-label>Planned Date</mat-label>
|
||||||
<label for="task-planned"></label>
|
<label for="task-planned"></label>
|
||||||
<input matInput type="text" disabled id="task-planned" placeholder="Planned Date" [value]="task.planned | dateTimeZone"
|
<input matInput type="text" disabled id="task-planned" placeholder="Planned Date" [value]="task.planned | germanTimeFormat"
|
||||||
name="task.planned">
|
name="task.planned">
|
||||||
</mat-form-field>
|
</mat-form-field>
|
||||||
|
|
||||||
|
|
@ -72,7 +72,7 @@
|
||||||
<mat-form-field appearance="outline">
|
<mat-form-field appearance="outline">
|
||||||
<mat-label>Creation Date</mat-label>
|
<mat-label>Creation Date</mat-label>
|
||||||
<label for="task-created"></label>
|
<label for="task-created"></label>
|
||||||
<input matInput type="text" disabled id="task-created" placeholder="Creation Date" [value]="task.created | dateTimeZone"
|
<input matInput type="text" disabled id="task-created" placeholder="Creation Date" [value]="task.created | germanTimeFormat"
|
||||||
name="task.created">
|
name="task.created">
|
||||||
</mat-form-field>
|
</mat-form-field>
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue