Skip to content

Commit faa6e3d

Browse files
authored
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 <gkokinovski@vmware.com>
1 parent 73d6576 commit faa6e3d

File tree

24 files changed

+392
-115
lines changed

24 files changed

+392
-115
lines changed

projects/frontend/cicd/.gitlab-ci.yml

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,8 @@ frontend-data-pipelines-release:
101101
- projects/frontend/data-pipelines/gui/package-lock.json
102102
expire_in: 1 week
103103

104-
frontend_publish_ui_image:
104+
# comment out, not relevant because there is no operational environment
105+
.frontend_publish_ui_image:
105106
extends: .images:dind:docker-push-to-vdk-repos
106107
stage: pre_release_image
107108
script:
@@ -120,7 +121,8 @@ frontend_publish_ui_image:
120121
- if: '$CI_COMMIT_BRANCH == "main"'
121122
changes: *frontend_data_pipelines_locations
122123

123-
frontend_tag_ui_image_stable:
124+
# comment out, not relevant because there is no operational environment
125+
.frontend_tag_ui_image_stable:
124126
stage: release_image
125127
before_script:
126128
- cd projects/frontend
@@ -211,7 +213,8 @@ frontend_tag_ui_image_stable:
211213
# - if: '$CI_COMMIT_BRANCH == "main"'
212214
# changes: *frontend_data_pipelines_locations
213215

214-
frontend_publish_test_image:
216+
# comment out, not relevant because there is no operational environment
217+
.frontend_publish_test_image:
215218
stage: release_image
216219
script:
217220
- docker login --username "${VDK_DOCKER_REGISTRY_USERNAME}" --password "${VDK_DOCKER_REGISTRY_PASSWORD}" "${VDK_DOCKER_REGISTRY_URL}"
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
18.12.0
1+
16.15.0

projects/frontend/data-pipelines/gui/package.json

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
"name": "data-pipelines-wrapper",
33
"version": "0.0.0",
44
"engines": {
5-
"node": "^14.15.0 || >=18.12.0",
6-
"npm": ">=9.7.2"
5+
"node": "^14.15.0 || >=16.10.0",
6+
"npm": ">=8.5.5"
77
},
88
"private": true,
99
"scripts": {
@@ -48,7 +48,7 @@
4848
"@ngrx/store": "13.2.0",
4949
"@swimlane/ngx-charts": "16.0.0",
5050
"@swimlane/ngx-graph": "8.0.0",
51-
"@versatiledatakit/shared": ">=0.0.0",
51+
"@versatiledatakit/shared": "1.1.926473229",
5252
"@webcomponents/custom-elements": "1.5.0",
5353
"@yellowspot/ng-truncate": "2.0.1",
5454
"angular-ng-autocomplete": "2.0.8",
@@ -66,14 +66,14 @@
6666
"dompurify": "2.3.8",
6767
"elasticlunr": "0.9.5",
6868
"file-saver": "2.0.5",
69-
"graphql": "16.8.1",
69+
"graphql": "16.5.0",
7070
"html-element": "2.3.1",
7171
"html-frontmatter": "1.6.1",
7272
"js-sha256": "0.9.0",
7373
"lodash": "4.17.21",
7474
"lottie-web": "5.9.4",
7575
"lz-string": "1.4.4",
76-
"moment": "2.29.4",
76+
"moment": "2.29.3",
7777
"ng2-date-picker": "12.0.4",
7878
"ngx-clipboard": "15.1.0",
7979
"ngx-cookie-service": "13.2.1",
@@ -84,7 +84,7 @@
8484
"striptags": "3.2.0",
8585
"superagent": "5.3.1",
8686
"tslib": "2.3.1",
87-
"ua-parser-js": "1.0.33",
87+
"ua-parser-js": "1.0.2",
8888
"zone.js": "0.11.5"
8989
},
9090
"optionalDependencies": {

projects/frontend/data-pipelines/gui/projects/data-pipelines/package.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
"name": "@versatiledatakit/data-pipelines",
33
"version": "0.0.0",
44
"engines": {
5-
"node": "^14.15.0 || >=18.12.0",
6-
"npm": ">=9.7.2"
5+
"node": "^14.15.0 || >=16.10.0",
6+
"npm": ">=8.5.5"
77
},
88
"license": "Apache-2.0",
99
"peerDependencies": {
@@ -28,7 +28,7 @@
2828
"@ngrx/store": "~13.2.0",
2929
"@swimlane/ngx-charts": "~16.0.0",
3030
"@swimlane/ngx-graph": "~8.0.0",
31-
"@versatiledatakit/shared": ">=0.0.0",
31+
"@versatiledatakit/shared": "~1.1.926473229",
3232
"@webcomponents/custom-elements": "~1.5.0",
3333
"@yellowspot/ng-truncate": "~2.0.1",
3434
"angular-ng-autocomplete": "~2.0.8",
@@ -53,7 +53,7 @@
5353
"lodash": "~4.17.21",
5454
"lottie-web": "~5.9.4",
5555
"lz-string": "~1.4.4",
56-
"moment": "~2.29.4",
56+
"moment": "~2.29.3",
5757
"ng2-date-picker": "~12.0.4",
5858
"ngx-clipboard": "~15.1.0",
5959
"ngx-cookie-service": "~13.2.1",
@@ -63,7 +63,7 @@
6363
"rxjs": "~7.5.5",
6464
"striptags": "~3.2.0",
6565
"superagent": "~5.3.1",
66-
"ua-parser-js": "~1.0.33",
66+
"ua-parser-js": "~1.0.2",
6767
"zone.js": "~0.11.5"
6868
},
6969
"dependencies": {
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
/*
2+
* Copyright 2023-2024 Broadcom
3+
* SPDX-License-Identifier: Apache-2.0
4+
*/
5+
6+
import { DatePipe } from '@angular/common';
7+
8+
import { TestBed } from '@angular/core/testing';
9+
10+
import { DATA_PIPELINES_DATE_TIME_FORMAT } from '../../../../../../../model';
11+
12+
import { GridDataJobExecution } from '../../../model';
13+
14+
import { ExecutionDateComparator } from './execution-date.comparator';
15+
16+
describe('ExecutionDateComparator', () => {
17+
let datePipe: DatePipe;
18+
let dataJobExecutions: GridDataJobExecution[];
19+
20+
beforeEach(() => {
21+
TestBed.configureTestingModule({
22+
providers: [DatePipe]
23+
});
24+
25+
datePipe = TestBed.inject(DatePipe);
26+
27+
const aStartTime = new Date();
28+
const bStartTime = new Date(aStartTime.getTime() + 100);
29+
const aEndTime = new Date();
30+
const bEndTime = new Date(aEndTime.getTime() + 110);
31+
32+
dataJobExecutions = [
33+
{
34+
id: 'aJob',
35+
startTimeFormatted: datePipe.transform(aStartTime, DATA_PIPELINES_DATE_TIME_FORMAT),
36+
startTime: aStartTime.toISOString(),
37+
endTimeFormatted: datePipe.transform(aEndTime, DATA_PIPELINES_DATE_TIME_FORMAT),
38+
endTime: aEndTime.toISOString(),
39+
duration: '100',
40+
jobVersion: ''
41+
},
42+
{
43+
id: 'bJob',
44+
startTimeFormatted: datePipe.transform(bStartTime, DATA_PIPELINES_DATE_TIME_FORMAT),
45+
startTime: bStartTime.toISOString(),
46+
endTimeFormatted: datePipe.transform(bEndTime, DATA_PIPELINES_DATE_TIME_FORMAT),
47+
endTime: bEndTime.toISOString(),
48+
duration: '110',
49+
jobVersion: ''
50+
}
51+
];
52+
});
53+
54+
describe('Properties::', () => {
55+
describe('|property|', () => {
56+
it('should verify value', () => {
57+
// Given
58+
const instance = new ExecutionDateComparator('endTime', 'ASC');
59+
60+
// Then
61+
expect(instance.property).toEqual('endTime');
62+
});
63+
});
64+
65+
describe('|direction|', () => {
66+
it('should verify value', () => {
67+
// Given
68+
const instance = new ExecutionDateComparator('startTime', 'ASC');
69+
70+
// Then
71+
expect(instance.direction).toEqual('ASC');
72+
});
73+
});
74+
});
75+
76+
describe('Methods::', () => {
77+
describe('|compare|', () => {
78+
it('should verify will return -100 because of ascending sort', () => {
79+
// Given
80+
const instance = new ExecutionDateComparator('startTime', 'ASC');
81+
82+
// When
83+
const res = instance.compare(dataJobExecutions[0], dataJobExecutions[1]);
84+
85+
// Then
86+
expect(res).toEqual(-100);
87+
});
88+
89+
it('should verify will return 110 because of descending sort', () => {
90+
// Given
91+
const instance = new ExecutionDateComparator('endTime', 'DESC');
92+
93+
// When
94+
const res = instance.compare(dataJobExecutions[0], dataJobExecutions[1]);
95+
96+
// Then
97+
expect(res).toEqual(110);
98+
});
99+
});
100+
});
101+
});
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
/*
2+
* Copyright 2023-2024 Broadcom
3+
* SPDX-License-Identifier: Apache-2.0
4+
*/
5+
6+
import { get } from 'lodash';
7+
8+
import { Comparator } from '@versatiledatakit/shared';
9+
10+
import { GridDataJobExecution } from '../../../model/data-job-execution';
11+
12+
export class ExecutionDateComparator implements Comparator<GridDataJobExecution> {
13+
/**
14+
* ** Property path to value from GridDataJobExecution object.
15+
*/
16+
public readonly property: keyof GridDataJobExecution;
17+
18+
/**
19+
* ** Sort direction.
20+
*/
21+
public readonly direction: 'ASC' | 'DESC';
22+
23+
/**
24+
* ** Constructor.
25+
*/
26+
constructor(property: keyof GridDataJobExecution, direction: 'ASC' | 'DESC') {
27+
this.property = property;
28+
this.direction = direction;
29+
}
30+
31+
/**
32+
* @inheritDoc
33+
*/
34+
compare(exec1: GridDataJobExecution, exec2: GridDataJobExecution): number {
35+
const value1 = get<GridDataJobExecution, keyof GridDataJobExecution>(exec1, this.property) as string;
36+
const value2 = get<GridDataJobExecution, keyof GridDataJobExecution>(exec2, this.property) as string;
37+
38+
const date1 = value1 ? Date.parse(value1) : Date.now();
39+
const date2 = value2 ? Date.parse(value2) : Date.now();
40+
41+
return this.direction === 'ASC' ? date1 - date2 : date2 - date1;
42+
}
43+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
/*
2+
* Copyright 2023-2024 Broadcom
3+
* SPDX-License-Identifier: Apache-2.0
4+
*/
5+
6+
export * from './execution-date.comparator';

projects/frontend/data-pipelines/gui/projects/data-pipelines/src/lib/components/data-job/pages/executions/data-job-executions-grid/comparators/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,5 @@
44
*/
55

66
export * from './default';
7+
export * from './date';
78
export * from './duration';

projects/frontend/data-pipelines/gui/projects/data-pipelines/src/lib/components/data-job/pages/executions/data-job-executions-grid/data-job-executions-grid.component.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ import {
4949
} from '../model';
5050

5151
import { ExecutionsStatusCriteria, ExecutionsStringCriteria, ExecutionsTypeCriteria } from './criteria';
52-
import { ExecutionDefaultComparator, ExecutionDurationComparator } from './comparators';
52+
import { ExecutionDateComparator, ExecutionDefaultComparator, ExecutionDurationComparator } from './comparators';
5353

5454
/**
5555
* ** Supported filter criteria from Executions grid.
@@ -449,6 +449,10 @@ export class DataJobExecutionsGridComponent implements OnChanges, OnInit, OnDest
449449
return new ExecutionDurationComparator(sortValue === ClrDatagridSortOrder.ASC ? 'ASC' : 'DESC');
450450
}
451451

452+
if (sortCriteria === 'startTime' || sortCriteria === 'endTime') {
453+
return new ExecutionDateComparator(sortCriteria, sortValue === ClrDatagridSortOrder.ASC ? 'ASC' : 'DESC');
454+
}
455+
452456
return new ExecutionDefaultComparator(sortCriteria, sortValue === ClrDatagridSortOrder.ASC ? 'ASC' : 'DESC');
453457
}
454458

0 commit comments

Comments
 (0)