Skip to content

Commit 88119af

Browse files
authored
chore(ui): upgrade from angular 11 to angular 13 (#6082)
1 parent d49d361 commit 88119af

27 files changed

+137
-403
lines changed

ui/.eslintrc.json

+16-70
Original file line numberDiff line numberDiff line change
@@ -15,49 +15,19 @@
1515
"createDefaultProgram": true
1616
},
1717
"extends": [
18-
"plugin:@angular-eslint/ng-cli-compat",
19-
"plugin:@angular-eslint/ng-cli-compat--formatting-add-on",
18+
"plugin:@angular-eslint/recommended",
2019
"plugin:@angular-eslint/template/process-inline-templates"
2120
],
2221
"rules": {
23-
"@typescript-eslint/ban-types": [
24-
"off"
25-
],
26-
"@angular-eslint/no-output-native": [
27-
"off"
28-
],
29-
"no-shadow": [
22+
"@angular-eslint/no-empty-lifecycle-method": [
3023
"off"
3124
],
3225
"@angular-eslint/no-output-on-prefix": [
3326
"off"
3427
],
35-
"@typescript-eslint/prefer-for-of": [
36-
"off"
37-
],
38-
"max-len": [
39-
"off"
40-
],
41-
"prefer-arrow/prefer-arrow-functions": [
42-
"off"
43-
],
44-
"@typescript-eslint/consistent-type-assertions": [
45-
"off"
46-
],
47-
"@typescript-eslint/naming-convention": [
48-
"off"
49-
],
50-
"@typescript-eslint/member-ordering": [
28+
"@angular-eslint/no-output-native": [
5129
"off"
5230
],
53-
"@angular-eslint/component-selector": [
54-
"error",
55-
{
56-
"type": "element",
57-
"prefix": "app",
58-
"style": "kebab-case"
59-
}
60-
],
6131
"@angular-eslint/directive-selector": [
6232
"error",
6333
{
@@ -66,45 +36,14 @@
6636
"style": "camelCase"
6737
}
6838
],
69-
"@typescript-eslint/consistent-type-definitions": "error",
70-
"@typescript-eslint/dot-notation": "off",
71-
"@typescript-eslint/explicit-member-accessibility": [
72-
"off",
73-
{
74-
"accessibility": "explicit"
75-
}
76-
],
77-
"@typescript-eslint/member-delimiter-style": [
78-
"off",
79-
{
80-
"multiline": {
81-
"delimiter": "none",
82-
"requireLast": true
83-
},
84-
"singleline": {
85-
"delimiter": "semi",
86-
"requireLast": false
87-
}
88-
}
89-
],
90-
"@typescript-eslint/semi": [
91-
"off",
92-
null
93-
],
94-
"brace-style": [
39+
"@angular-eslint/component-selector": [
9540
"error",
96-
"1tbs",
9741
{
98-
"allowSingleLine": true
42+
"type": "element",
43+
"prefix": "app",
44+
"style": "kebab-case"
9945
}
100-
],
101-
"id-blacklist": "off",
102-
"id-match": "off",
103-
"import/order": "error",
104-
"no-redeclare": "error",
105-
"no-underscore-dangle": "off",
106-
"prefer-const": "off",
107-
"semi": [1, "always"]
46+
]
10847
}
10948
},
11049
{
@@ -114,7 +53,14 @@
11453
"extends": [
11554
"plugin:@angular-eslint/template/recommended"
11655
],
117-
"rules": {}
56+
"rules": {
57+
"@angular-eslint/template/eqeqeq": [
58+
"error",
59+
{
60+
"allowNullOrUndefined": true
61+
}
62+
]
63+
}
11864
}
11965
]
12066
}

ui/.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
1+
/.angular/cache
12
ui.tar.gz
23
private.proxy.conf.json

ui/Makefile

+2-2
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,10 @@ $(NG):
1414
npm install
1515

1616
stats: $(NG)
17-
@node --max-old-space-size=2048 node_modules/@angular/cli/bin/ng build --prod --stats-json
17+
@node --max-old-space-size=2048 node_modules/@angular/cli/bin/ng build --configuration production --stats-json
1818

1919
ngbuild: $(NG)
20-
@node --max-old-space-size=2048 node_modules/@angular/cli/bin/ng build --prod
20+
@node --max-old-space-size=2048 node_modules/@angular/cli/bin/ng build --configuration production
2121

2222
INDEX = dist/index.tmpl
2323
$(INDEX):

ui/angular.json

+1
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
"node_modules/font-awesome/css/font-awesome.css",
3434
"node_modules/animate.css/animate.min.css",
3535
"node_modules/prismjs/themes/prism-okaidia.css",
36+
"node_modules/spinkit/spinkit.min.css",
3637
"semantic/dist/semantic.min.css",
3738
"src/styles.scss"
3839
],

ui/package.json

+37-34
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"license": "MIT",
55
"angular-cli": {},
66
"engines": {
7-
"node": ">= 12.0.0",
7+
"node": ">= 14.0.0",
88
"npm": ">= 6.0.0"
99
},
1010
"scripts": {
@@ -15,30 +15,31 @@
1515
"test": "ng test --watch false --code-coverage",
1616
"e2e": "testcafe chromium:headless ./e2e/tests/* -S -s screenshots",
1717
"doc": "./node_modules/.bin/compodoc -p tsconfig.json -s",
18-
"build:prod": "ng build --prod",
19-
"build:stats": "ng build --prod --stats-json",
18+
"build:prod": "ng build --configuration production",
19+
"build:stats": "ng build --configuration production --stats-json",
2020
"build:analyse": "webpack-bundle-analyzer dist/stats.json",
2121
"sentry:release": "sentry-cli releases -o ${SENTRY_ORG} -p ${SENTRY_PROJECT} new ${CDS_VERSION}",
22-
"sentry:sourcemaps": "sentry-cli releases -o ${SENTRY_ORG} -p ${SENTRY_PROJECT} files ${CDS_VERSION} upload-sourcemaps --url-prefix=${SENTRY_CDS_PREFIX_URL}"
22+
"sentry:sourcemaps": "sentry-cli releases -o ${SENTRY_ORG} -p ${SENTRY_PROJECT} files ${CDS_VERSION} upload-sourcemaps --url-prefix=${SENTRY_CDS_PREFIX_URL}",
23+
"lint": "ng lint"
2324
},
2425
"lint-staged": {
25-
"*.{js,scss,ts}": "tslint"
26+
"*.{js,ts}": "eslint"
2627
},
2728
"private": true,
2829
"dependencies": {
29-
"@angular/animations": "11.2.14",
30-
"@angular/cdk": "11.2.13",
31-
"@angular/common": "11.2.14",
32-
"@angular/compiler": "11.2.14",
33-
"@angular/core": "11.2.14",
34-
"@angular/forms": "11.2.14",
35-
"@angular/platform-browser": "11.2.14",
36-
"@angular/platform-browser-dynamic": "11.2.14",
37-
"@angular/router": "11.2.14",
30+
"@angular/animations": "13.2.0",
31+
"@angular/cdk": "13.2.0",
32+
"@angular/common": "13.2.0",
33+
"@angular/compiler": "13.2.0",
34+
"@angular/core": "13.2.0",
35+
"@angular/forms": "13.2.0",
36+
"@angular/platform-browser": "13.2.0",
37+
"@angular/platform-browser-dynamic": "13.2.0",
38+
"@angular/router": "13.2.0",
3839
"@fontsource/lato": "4.5.0",
3940
"@icholy/duration": "5.0.0",
4041
"@ngui/auto-complete": "3.0.0",
41-
"@ngx-translate/core": "12.1.2",
42+
"@ngx-translate/core": "14.0.0",
4243
"@ngx-translate/http-loader": "4.0.0",
4344
"@ngxs/devtools-plugin": "3.7.0",
4445
"@ngxs/logger-plugin": "3.7.0",
@@ -87,23 +88,24 @@
8788
"rxjs": "6.5.4",
8889
"rxjs-compat": "6.3.3",
8990
"sanitize-html": "2.3.2",
90-
"spinkit": "1.2.5",
91+
"spinkit": "2.0.1",
9192
"string-format-obj": "1.1.1",
9293
"ts-helpers": "1.1.2",
9394
"tslib": "2.0.0",
94-
"zone.js": "0.11.3",
95+
"url": "0.11.0",
96+
"zone.js": "0.11.4",
9597
"zxcvbn": "4.4.2"
9698
},
9799
"devDependencies": {
98-
"@angular-builders/custom-webpack": "11.0.0",
99-
"@angular-devkit/build-angular": "0.1102.13",
100-
"@angular-eslint/builder": "0.8.0-beta.3",
101-
"@angular-eslint/eslint-plugin": "0.8.0-beta.3",
102-
"@angular-eslint/eslint-plugin-template": "0.8.0-beta.3",
103-
"@angular-eslint/schematics": "0.8.0-beta.3",
104-
"@angular-eslint/template-parser": "0.8.0-beta.3",
105-
"@angular/cli": "11.2.13",
106-
"@angular/compiler-cli": "11.2.14",
100+
"@angular-builders/custom-webpack": "13.1.0",
101+
"@angular-devkit/build-angular": "13.2.1",
102+
"@angular-eslint/builder": "13.0.1",
103+
"@angular-eslint/eslint-plugin": "13.0.1",
104+
"@angular-eslint/eslint-plugin-template": "13.0.1",
105+
"@angular-eslint/schematics": "13.0.1",
106+
"@angular-eslint/template-parser": "13.0.1",
107+
"@angular/cli": "13.2.1",
108+
"@angular/compiler-cli": "13.2.0",
107109
"@commitlint/cli": "13.0.0",
108110
"@commitlint/config-conventional": "13.0.0",
109111
"@compodoc/compodoc": "1.1.11",
@@ -116,14 +118,15 @@
116118
"@types/lodash-es": "4.17.3",
117119
"@types/node": "12.11.1",
118120
"@types/sanitize-html": "2.3.1",
119-
"@typescript-eslint/eslint-plugin": "4.3.0",
120-
"@typescript-eslint/parser": "4.3.0",
121+
"@typescript-eslint/eslint-plugin": "5.3.0",
122+
"@typescript-eslint/parser": "5.3.0",
123+
"@typescript-eslint/typescript-estree": "5.10.2",
121124
"codelyzer": "6.0.0",
122125
"copy-webpack-plugin": "9.0.0",
123-
"eslint": "7.6.0",
124-
"eslint-plugin-import": "2.22.1",
125-
"eslint-plugin-jsdoc": "30.7.6",
126-
"eslint-plugin-prefer-arrow": "1.2.2",
126+
"eslint": "8.2.0",
127+
"eslint-plugin-import": "2.25.4",
128+
"eslint-plugin-jsdoc": "37.7.1",
129+
"eslint-plugin-prefer-arrow": "1.2.3",
127130
"husky": "3.0.5",
128131
"jasmine-core": "3.6.0",
129132
"jasmine-spec-reporter": "5.0.0",
@@ -135,8 +138,8 @@
135138
"karma-junit-reporter": "1.2.0",
136139
"lint-staged": "^12.0.2",
137140
"ts-node": "8.3.0",
138-
"tslint": "6.1.0",
139-
"typescript": "4.0.2",
141+
"typescript": "4.5.2",
142+
"url": "0.11.0",
140143
"webdriver-manager": "12.1.7",
141144
"webpack-bundle-analyzer": "3.3.2",
142145
"wrench-sui": "0.0.3"

ui/src/app/app.component.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
<ng-container *ngIf="isAPIAvailable && (!isConnected || !maintenance || currentAuthSummary?.user?.ring === 'ADMIN')">
2121
<app-navbar *ngIf="isConnected && !hideNavBar"></app-navbar>
2222

23-
<div class="banner" *ngIf="(maintenance) && (!isConnected || currentAuthSummary?.user?.ring == 'ADMIN')">
23+
<div class="banner" *ngIf="(maintenance) && (!isConnected || currentAuthSummary?.user?.ring === 'ADMIN')">
2424
{{ 'maintenance_title' | translate }}
2525
</div>
2626
<div class="banner update" (click)="refresh()" *ngIf="showUIUpdatedBanner">

ui/src/app/service/application/application.store.ts

+3-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,9 @@ export class ApplicationStore {
2121

2222
loadRecentApplication(): void {
2323
let arrayApp = JSON.parse(localStorage.getItem(ApplicationStore.RECENT_APPLICATIONS_KEY));
24-
this._recentApplications.next(immutable.List.of(...arrayApp));
24+
if (arrayApp) {
25+
this._recentApplications.next(immutable.List.of(...arrayApp));
26+
}
2527
}
2628

2729
/**

ui/src/app/service/project/project.store.ts

+3-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,9 @@ export class ProjectStore {
2828

2929
loadRecentProjects(): void {
3030
let arrayApp = JSON.parse(localStorage.getItem(ProjectStore.RECENT_PROJECTS_KEY));
31-
this._recentProjects.next(List.of(...arrayApp));
31+
if (arrayApp) {
32+
this._recentProjects.next(List.of(...arrayApp));
33+
}
3234
}
3335

3436
getProjectsList(resync: boolean = false): Observable<List<Project>> {

ui/src/app/service/workflow/workflow.helper.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ export class WorkflowHelper {
2323
uiArtifact.name = data.name;
2424
uiArtifact.size = data.size;
2525
uiArtifact.human_size = this.getHumainFileSize(data.size);
26-
uiArtifact.type = r.type == 'artifact' ? 'file': r.type;
26+
uiArtifact.type = r.type === 'artifact' ? 'file' : r.type;
2727
uiArtifact.file_type = uiArtifact.type;
2828
return uiArtifact;
2929
case 'artifact-manager':

ui/src/app/service/workflow/workflow.store.ts

+3-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,9 @@ export class WorkflowStore {
2020

2121
loadRecentWorkflows(): void {
2222
let arrayWorkflows = JSON.parse(localStorage.getItem(WorkflowStore.RECENT_WORKFLOWS_KEY));
23-
this._recentWorkflows.next(List.of(...arrayWorkflows));
23+
if (arrayWorkflows) {
24+
this._recentWorkflows.next(List.of(...arrayWorkflows));
25+
}
2426
}
2527

2628
/**

ui/src/app/shared/keys/form/keys.form.html

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
<div class="KeyForm">
22
<div class="ui form">
3-
<div class="ui info message" *ngIf="newKey.type == 'ssh'">
3+
<div class="ui info message" *ngIf="newKey.type === 'ssh'">
44
{{ 'keys_ssh_key_help' | translate }} <a href="#" [routerLink]="['/docs', 'docs', 'components', 'worker', 'key', 'install']">Worker Install Key</a>
55
</div>
6-
<div class="ui info message" *ngIf="newKey.type == 'pgp'">
6+
<div class="ui info message" *ngIf="newKey.type === 'pgp'">
77
{{ 'keys_pgp_key_help' | translate }} <a href="#" [routerLink]="['/docs', 'docs', 'components', 'worker', 'key', 'install']">Worker Install Key</a>
88
</div>
99
<div class="fields">

ui/src/app/shared/shared.module.ts

-4
Original file line numberDiff line numberDiff line change
@@ -234,10 +234,6 @@ import { ZoneComponent } from './zone/zone.component';
234234
ZoneComponent,
235235
ZoneContentComponent
236236
],
237-
entryComponents: [
238-
NguiAutoCompleteComponent,
239-
ToastHTTPErrorComponent
240-
],
241237
providers: [
242238
PermissionService,
243239
SharedService,

0 commit comments

Comments
 (0)