Upgrade Angular and Clarity to the latest version (#18059)

Upgrade Angular and Clarity
  1.Upgrade related libraries
  2.Fix breaking changes

Signed-off-by: AllForNothing <sshijun@vmware.com>

Signed-off-by: AllForNothing <sshijun@vmware.com>
This commit is contained in:
Shijun Sun 2023-01-05 10:42:59 +08:00 committed by GitHub
parent f7e8420824
commit 2361ae161f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
15 changed files with 4268 additions and 5234 deletions

View File

@ -336,7 +336,7 @@ jobs:
steps:
- uses: actions/setup-node@v3
with:
node-version: '16'
node-version: '18'
- uses: actions/checkout@v3
with:
path: src/github.com/goharbor/harbor

View File

@ -1,6 +1,6 @@
ARG harbor_base_image_version
ARG harbor_base_namespace
FROM node:16.10.0 as nodeportal
FROM node:16.18.0 as nodeportal
WORKDIR /build_dir

View File

@ -1,17 +0,0 @@
# This file is used by the build system to adjust CSS and JS output to support the specified browsers below.
# For additional information regarding the format and rule options, please see:
# https://github.com/browserslist/browserslist#queries
# For the full list of supported browsers by the Angular framework, please see:
# https://angular.io/guide/browser-support
# You can see what browsers were selected by your queries by running:
# npx browserslist
last 1 Chrome version
last 1 Firefox version
last 2 Edge major versions
last 2 Safari major versions
last 2 iOS major versions
Firefox ESR
not IE 11 # Angular supports IE 11 only as an opt-in. To opt-in, remove the 'not' prefix on this line.

View File

@ -1,7 +1,7 @@
```text
{
"name": "harbor",
"version": "2.7.0",
"version": "2.8.0",
"description": "Harbor UI with Clarity",
"angular-cli": {},
"scripts": {
@ -47,28 +47,28 @@
"private": true,
"dependencies": {
// Angular framework. Required
"@angular/animations": "~14.1.0",
"@angular/common": "~14.1.0",
"@angular/compiler": "~14.1.0",
"@angular/core": "~14.1.0",
"@angular/forms": "~14.1.0",
"@angular/localize": "~14.1.0",
"@angular/platform-browser": "~14.1.0",
"@angular/platform-browser-dynamic": "~14.1.0",
"@angular/router": "~14.1.0",
"@angular/animations": "^15.0.4",
"@angular/common": "^15.0.4",
"@angular/compiler": "^15.0.4,
"@angular/core": "^15.0.4",
"@angular/forms": "^15.0.4",
"@angular/localize": "^15.0.4",
"@angular/platform-browser": "^15.0.4",
"@angular/platform-browser-dynamic": "^15.0.4",
"@angular/router": "^15.0.4",
"rxjs": "^7.4.0",
"tslib": "^2.2.0",
"zone.js": "~0.11.4",
// Clarity UI. Required
"@clr/angular": "13.7.0",
"@cds/core": "6.0.0",
"@clr/angular": "15.0.0-beta.3",
"@cds/core": "6.2.3",
"@clr/icons": "13.0.2",
"@clr/ui": "13.7.0",
"@clr/ui": "15.0.0-beta.3",
// For Harbor i18n functionality. Required
"@ngx-translate/core": "^13.0.0",
"@ngx-translate/http-loader": "^6.0.0",
"@ngx-translate/core": "^14.0.0",
"@ngx-translate/http-loader": "^7.0.0",
// For cron string checking. Required
"cron-validator": "^1.2.1",
@ -87,15 +87,15 @@
},
"devDependencies": {
// Angular framework. Required
"@angular-devkit/build-angular": "~14.1.0",
"@angular/cli": "~14.1.0",
"@angular/compiler-cli": "~14.1.0",
"@types/jasmine": "~3.10.1",
"@angular-devkit/build-angular": "^15.0.4",
"@angular/cli": "^15.0.4",
"@angular/compiler-cli": "^15.0.4",
"@types/jasmine": "~4.3.0",
"@types/node": "^16.11.6",
"typescript": "~4.5.4",
"typescript": "~4.8.2",
// For unit test. Required
"jasmine-core": "^4.0.0",
"jasmine-core": "~4.5.0",
"jasmine-spec-reporter": "~7.0.0",
"karma": "^6.3.17",
"karma-chrome-launcher": "~3.1.0",
@ -116,10 +116,10 @@
// For code grammar checking. Optional
"eslint": "^8.12.0",
"@angular-eslint/eslint-plugin": "14.0.2",
"@angular-eslint/eslint-plugin-template": "14.0.2",
"@angular-eslint/schematics": "14.0.2",
"@angular-eslint/template-parser": "14.0.2",
"@angular-eslint/eslint-plugin": "15.1.0",
"@angular-eslint/eslint-plugin-template": "15.1.0",
"@angular-eslint/schematics": "15.1.0",
"@angular-eslint/template-parser": "15.1.0",
"@typescript-eslint/eslint-plugin": "5.29.0",
"@typescript-eslint/parser": "5.29.0",

View File

@ -18,7 +18,7 @@
"outputPath": "dist",
"index": "src/index.html",
"main": "src/main.ts",
"polyfills": "src/polyfills.ts",
"polyfills": "zone.js",
"tsConfig": "tsconfig.app.json",
"assets": [
"src/images",
@ -101,8 +101,10 @@
"builder": "@angular-devkit/build-angular:karma",
"options": {
"tsConfig": "tsconfig.spec.json",
"main": "src/test.ts",
"polyfills": "src/polyfills.ts",
"polyfills": [
"zone.js",
"zone.js/testing"
],
"karmaConfig": "karma.conf.js",
"scripts": [
"node_modules/@clr/icons/clr-icons.min.js"

File diff suppressed because it is too large Load Diff

View File

@ -1,6 +1,6 @@
{
"name": "harbor",
"version": "2.7.0",
"version": "2.8.0",
"description": "Harbor UI with Clarity",
"angular-cli": {},
"scripts": {
@ -28,41 +28,41 @@
},
"private": true,
"dependencies": {
"@angular/animations": "^14.1.0",
"@angular/common": "^14.1.0",
"@angular/compiler": "^14.1.0",
"@angular/core": "^14.1.0",
"@angular/forms": "^14.1.0",
"@angular/localize": "^14.1.0",
"@angular/platform-browser": "^14.1.0",
"@angular/platform-browser-dynamic": "^14.1.0",
"@angular/router": "^14.1.0",
"@cds/core": "6.0.0",
"@clr/angular": "13.7.0",
"@angular/animations": "^15.0.4",
"@angular/common": "^15.0.4",
"@angular/compiler": "^15.0.4",
"@angular/core": "^15.0.4",
"@angular/forms": "^15.0.4",
"@angular/localize": "^15.0.4",
"@angular/platform-browser": "^15.0.4",
"@angular/platform-browser-dynamic": "^15.0.4",
"@angular/router": "^15.0.4",
"@cds/core": "6.2.3",
"@clr/angular": "15.0.0-beta.3",
"@clr/icons": "13.0.2",
"@clr/ui": "13.7.0",
"@ngx-translate/core": "^13.0.0",
"@ngx-translate/http-loader": "^6.0.0",
"@clr/ui": "15.0.0-beta.3",
"@ngx-translate/core": "^14.0.0",
"@ngx-translate/http-loader": "^7.0.0",
"cron-validator": "^1.3.1",
"js-yaml": "^4.1.0",
"ngx-clipboard": "^15.1.0",
"ngx-cookie": "^6.0.1",
"ngx-markdown": "14.0.1",
"ngx-markdown": "15.0.0",
"rxjs": "^7.4.0",
"tslib": "^2.2.0",
"zone.js": "~0.11.4"
},
"devDependencies": {
"@angular-devkit/build-angular": "^14.1.0",
"@angular-eslint/builder": "14.0.2",
"@angular-eslint/eslint-plugin": "14.0.2",
"@angular-eslint/eslint-plugin-template": "14.0.2",
"@angular-eslint/schematics": "14.0.2",
"@angular-eslint/template-parser": "14.0.2",
"@angular/cli": "^14.1.0",
"@angular/compiler-cli": "^14.1.0",
"@angular-devkit/build-angular": "^15.0.4",
"@angular-eslint/builder": "15.1.0",
"@angular-eslint/eslint-plugin": "15.1.0",
"@angular-eslint/eslint-plugin-template": "15.1.0",
"@angular-eslint/schematics": "15.1.0",
"@angular-eslint/template-parser": "15.1.0",
"@angular/cli": "^15.0.4",
"@angular/compiler-cli": "^15.0.4",
"@types/express": "^4.17.12",
"@types/jasmine": "~3.10.1",
"@types/jasmine": "~4.3.1",
"@types/node": "^16.11.6",
"@typescript-eslint/eslint-plugin": "^5.29.0",
"@typescript-eslint/parser": "^5.29.0",
@ -70,9 +70,9 @@
"eslint-config-prettier": "^8.5.0",
"eslint-plugin-prettier": "^4.0.0",
"express": "^4.17.1",
"jasmine-core": "^4.0.0",
"jasmine-spec-reporter": "^7.0.0",
"karma": "^6.3.17",
"jasmine-core": "~4.5.0",
"jasmine-spec-reporter": "~7.0.0",
"karma": "^6.4.0",
"karma-chrome-launcher": "~3.1.0",
"karma-coverage": "^2.2.0",
"karma-jasmine": "~4.0.1",
@ -86,6 +86,6 @@
"stylelint-config-prettier-scss": "^0.0.1",
"stylelint-config-standard": "^25.0.0",
"stylelint-config-standard-scss": "^4.0.0",
"typescript": "~4.7.4"
"typescript": "~4.8.2"
}
}

View File

@ -64,7 +64,6 @@ const harborRoutes: Routes = [
RouterModule.forRoot(harborRoutes, {
onSameUrlNavigation: 'reload',
preloadingStrategy: PreloadAllModules,
relativeLinkResolution: 'legacy',
}),
],
exports: [RouterModule],

View File

@ -2,6 +2,10 @@ body {
overflow-y: hidden;
}
a {
text-decoration: none;
}
.app-loading {
position: absolute !important;
top: 0;

View File

@ -11,8 +11,6 @@
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
import './polyfills.ts';
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
import { enableProdMode } from '@angular/core';
import { environment } from './environments/environment';

View File

@ -1,81 +0,0 @@
/***************************************************************************************************
* Load `$localize` onto the global scope - used if i18n tags appear in Angular templates.
*/
import '@angular/localize/init';
// Copyright Project Harbor Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// This file includes polyfills needed by Angular 2 and is loaded before
// the app. You can add your own extra polyfills to this file.
/**
* This file includes polyfills needed by Angular and is loaded before the app.
* You can add your own extra polyfills to this file.
*
* This file is divided into 2 sections:
* 1. Browser polyfills. These are applied before loading ZoneJS and are sorted by browsers.
* 2. Application imports. Files imported after ZoneJS that should be loaded before your main
* file.
*
* The current setup is for so-called "evergreen" browsers; the last versions of browsers that
* automatically update themselves. This includes Safari >= 10, Chrome >= 55 (including Opera),
* Edge >= 13 on the desktop, and iOS 10 and Chrome on mobile.
*
* Learn more in https://angular.io/guide/browser-support
*/
/***************************************************************************************************
* BROWSER POLYFILLS
*/
/** IE10 and IE11 requires the following for NgClass support on SVG elements */
// import 'classlist.js'; // Run `npm install --save classlist.js`.
/**
* Web Animations `@angular/platform-browser/animations`
* Only required if AnimationBuilder is used within the application and using IE/Edge or Safari.
* Standard animation support in Angular DOES NOT require any polyfills (as of Angular 6.0).
*/
// import 'web-animations-js'; // Run `npm install --save web-animations-js`.
/**
* By default, zone.js will patch all possible macroTask and DomEvents
* user can disable parts of macroTask/DomEvents patch by setting following flags
* because those flags need to be set before `zone.js` being loaded, and webpack
* will put import in the top of bundle, so user need to create a separate file
* in this directory (for example: zone-flags.ts), and put the following flags
* into that file, and then add the following code before importing zone.js.
* import './zone-flags';
*
* The flags allowed in zone-flags.ts are listed here.
*
* The following flags will work for all browsers.
*
* (window as any).__Zone_disable_requestAnimationFrame = true; // disable patch requestAnimationFrame
* (window as any).__Zone_disable_on_property = true; // disable patch onProperty such as onclick
* (window as any).__zone_symbol__UNPATCHED_EVENTS = ['scroll', 'mousemove']; // disable patch specified eventNames
*
* in IE/Edge developer tools, the addEventListener will also be wrapped by zone.js
* with the following flag, it will bypass `zone.js` patch for IE/Edge
*
* (window as any).__Zone_enable_cross_context_check = true;
*
*/
/***************************************************************************************************
* Zone JS is required by default for Angular itself.
*/
import 'zone.js'; // Included with Angular CLI.
/***************************************************************************************************
* APPLICATION IMPORTS
*/

View File

@ -1,45 +0,0 @@
// Copyright Project Harbor Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
import './polyfills.ts';
import 'zone.js/dist/long-stack-trace-zone';
import 'zone.js/dist/proxy.js';
import 'zone.js/dist/sync-test';
import 'zone.js/dist/jasmine-patch';
import 'zone.js/dist/async-test';
import 'zone.js/dist/fake-async-test';
import { getTestBed } from '@angular/core/testing';
import {
BrowserDynamicTestingModule,
platformBrowserDynamicTesting,
} from '@angular/platform-browser-dynamic/testing';
// Unfortunately there's no typing for the `__karma__` variable. Just declare it as any.
declare var __karma__: any;
declare var require: any;
// Prevent Karma from running prematurely.
__karma__.loaded = function () {};
// First, initialize the Angular testing environment.
getTestBed().initTestEnvironment(
BrowserDynamicTestingModule,
platformBrowserDynamicTesting()
);
// Then we find all the tests.
let context = require.context('./', true, /\.spec\.ts/);
// And load the modules.
context.keys().map(context);
// Finally, start Karma to run the tests.
__karma__.start();

View File

@ -3,11 +3,9 @@
"extends": "./tsconfig.json",
"compilerOptions": {
"outDir": "./out-tsc/app",
"types": []
},
"files": [
"src/main.ts",
"src/polyfills.ts"
],
"include": [
"src/**/*.d.ts"

View File

@ -10,11 +10,12 @@
"experimentalDecorators": true,
"moduleResolution": "node",
"importHelpers": true,
"target": "es2020",
"target": "ES2022",
"module": "es2020",
"lib": [
"es2018",
"dom"
]
],
"useDefineForClassFields": false
}
}

View File

@ -4,13 +4,9 @@
"compilerOptions": {
"outDir": "./out-tsc/spec",
"types": [
"jasmine"
"jasmine",
]
},
"files": [
"src/test.ts",
"src/polyfills.ts"
],
"include": [
"src/**/*.spec.ts",
"src/**/*.d.ts"