-
Notifications
You must be signed in to change notification settings - Fork 57
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
frontend: make url for vdk ui lib configurable (#3421)
VDK UI lib to consume pipelines control service url from app configuration dependency injection. --------- Signed-off-by: Goran Kokinovski <[email protected]>
- Loading branch information
1 parent
73d6576
commit faa6e3d
Showing
24 changed files
with
392 additions
and
115 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
18.12.0 | ||
16.15.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
101 changes: 101 additions & 0 deletions
101
...es/executions/data-job-executions-grid/comparators/date/execution-date.comparator.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,101 @@ | ||
/* | ||
* Copyright 2023-2024 Broadcom | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
import { DatePipe } from '@angular/common'; | ||
|
||
import { TestBed } from '@angular/core/testing'; | ||
|
||
import { DATA_PIPELINES_DATE_TIME_FORMAT } from '../../../../../../../model'; | ||
|
||
import { GridDataJobExecution } from '../../../model'; | ||
|
||
import { ExecutionDateComparator } from './execution-date.comparator'; | ||
|
||
describe('ExecutionDateComparator', () => { | ||
let datePipe: DatePipe; | ||
let dataJobExecutions: GridDataJobExecution[]; | ||
|
||
beforeEach(() => { | ||
TestBed.configureTestingModule({ | ||
providers: [DatePipe] | ||
}); | ||
|
||
datePipe = TestBed.inject(DatePipe); | ||
|
||
const aStartTime = new Date(); | ||
const bStartTime = new Date(aStartTime.getTime() + 100); | ||
const aEndTime = new Date(); | ||
const bEndTime = new Date(aEndTime.getTime() + 110); | ||
|
||
dataJobExecutions = [ | ||
{ | ||
id: 'aJob', | ||
startTimeFormatted: datePipe.transform(aStartTime, DATA_PIPELINES_DATE_TIME_FORMAT), | ||
startTime: aStartTime.toISOString(), | ||
endTimeFormatted: datePipe.transform(aEndTime, DATA_PIPELINES_DATE_TIME_FORMAT), | ||
endTime: aEndTime.toISOString(), | ||
duration: '100', | ||
jobVersion: '' | ||
}, | ||
{ | ||
id: 'bJob', | ||
startTimeFormatted: datePipe.transform(bStartTime, DATA_PIPELINES_DATE_TIME_FORMAT), | ||
startTime: bStartTime.toISOString(), | ||
endTimeFormatted: datePipe.transform(bEndTime, DATA_PIPELINES_DATE_TIME_FORMAT), | ||
endTime: bEndTime.toISOString(), | ||
duration: '110', | ||
jobVersion: '' | ||
} | ||
]; | ||
}); | ||
|
||
describe('Properties::', () => { | ||
describe('|property|', () => { | ||
it('should verify value', () => { | ||
// Given | ||
const instance = new ExecutionDateComparator('endTime', 'ASC'); | ||
|
||
// Then | ||
expect(instance.property).toEqual('endTime'); | ||
}); | ||
}); | ||
|
||
describe('|direction|', () => { | ||
it('should verify value', () => { | ||
// Given | ||
const instance = new ExecutionDateComparator('startTime', 'ASC'); | ||
|
||
// Then | ||
expect(instance.direction).toEqual('ASC'); | ||
}); | ||
}); | ||
}); | ||
|
||
describe('Methods::', () => { | ||
describe('|compare|', () => { | ||
it('should verify will return -100 because of ascending sort', () => { | ||
// Given | ||
const instance = new ExecutionDateComparator('startTime', 'ASC'); | ||
|
||
// When | ||
const res = instance.compare(dataJobExecutions[0], dataJobExecutions[1]); | ||
|
||
// Then | ||
expect(res).toEqual(-100); | ||
}); | ||
|
||
it('should verify will return 110 because of descending sort', () => { | ||
// Given | ||
const instance = new ExecutionDateComparator('endTime', 'DESC'); | ||
|
||
// When | ||
const res = instance.compare(dataJobExecutions[0], dataJobExecutions[1]); | ||
|
||
// Then | ||
expect(res).toEqual(110); | ||
}); | ||
}); | ||
}); | ||
}); |
43 changes: 43 additions & 0 deletions
43
...b/pages/executions/data-job-executions-grid/comparators/date/execution-date.comparator.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
/* | ||
* Copyright 2023-2024 Broadcom | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
import { get } from 'lodash'; | ||
|
||
import { Comparator } from '@versatiledatakit/shared'; | ||
|
||
import { GridDataJobExecution } from '../../../model/data-job-execution'; | ||
|
||
export class ExecutionDateComparator implements Comparator<GridDataJobExecution> { | ||
/** | ||
* ** Property path to value from GridDataJobExecution object. | ||
*/ | ||
public readonly property: keyof GridDataJobExecution; | ||
|
||
/** | ||
* ** Sort direction. | ||
*/ | ||
public readonly direction: 'ASC' | 'DESC'; | ||
|
||
/** | ||
* ** Constructor. | ||
*/ | ||
constructor(property: keyof GridDataJobExecution, direction: 'ASC' | 'DESC') { | ||
this.property = property; | ||
this.direction = direction; | ||
} | ||
|
||
/** | ||
* @inheritDoc | ||
*/ | ||
compare(exec1: GridDataJobExecution, exec2: GridDataJobExecution): number { | ||
const value1 = get<GridDataJobExecution, keyof GridDataJobExecution>(exec1, this.property) as string; | ||
const value2 = get<GridDataJobExecution, keyof GridDataJobExecution>(exec2, this.property) as string; | ||
|
||
const date1 = value1 ? Date.parse(value1) : Date.now(); | ||
const date2 = value2 ? Date.parse(value2) : Date.now(); | ||
|
||
return this.direction === 'ASC' ? date1 - date2 : date2 - date1; | ||
} | ||
} |
6 changes: 6 additions & 0 deletions
6
...b/components/data-job/pages/executions/data-job-executions-grid/comparators/date/index.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
/* | ||
* Copyright 2023-2024 Broadcom | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
export * from './execution-date.comparator'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,4 +4,5 @@ | |
*/ | ||
|
||
export * from './default'; | ||
export * from './date'; | ||
export * from './duration'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.