TSK-1657: Angular 12 update

TSK-1657: Angular 12 preworks

TSK-1657: Updated core and cli to 12

TSK-1657: Updated material to 12

TSK-1657: Updated tests, but huge testfailures

TSK-1657: Huge testfails fixed, now only small ones remain

(A lot of them)

TSK-1657: Beatiful test fixes :)

TSK-1657: Prettiered the files

TSK-1657: fixed cache hash file due to introduction of yarn

TSK-1657: checked all dependencies and reupdated them
This commit is contained in:
Tristan Eisermann 2021-06-26 11:32:06 +02:00 committed by Tristan2357
parent a269c9d2f5
commit 155421216b
21 changed files with 3489 additions and 3683 deletions

View File

@ -92,7 +92,7 @@ jobs:
uses: actions/cache@v2.1.6 uses: actions/cache@v2.1.6
with: with:
path: web/node_modules path: web/node_modules
key: ${{ runner.OS }}-${{ env.CACHE_WEB_NAME }}-${{ hashFiles('**/package-lock.json') }} key: ${{ runner.OS }}-${{ env.CACHE_WEB_NAME }}-${{ hashFiles('**/yarn-lock.json') }}
restore-keys: ${{ runner.OS }}-${{ env.CACHE_WEB_NAME }} restore-keys: ${{ runner.OS }}-${{ env.CACHE_WEB_NAME }}
- name: Cache maven dependencies (for web) - name: Cache maven dependencies (for web)
uses: actions/cache@v2.1.6 uses: actions/cache@v2.1.6
@ -177,7 +177,7 @@ jobs:
uses: actions/cache@v2.1.6 uses: actions/cache@v2.1.6
with: with:
path: web/node_modules path: web/node_modules
key: ${{ runner.OS }}-${{ env.CACHE_WEB_NAME }}-${{ hashFiles('**/package-lock.json') }} key: ${{ runner.OS }}-${{ env.CACHE_WEB_NAME }}-${{ hashFiles('**/yarn-lock.json') }}
restore-keys: ${{ runner.OS }}-${{ env.CACHE_WEB_NAME }} restore-keys: ${{ runner.OS }}-${{ env.CACHE_WEB_NAME }}
# Theoretically this is not necessary because we reuse the cache from the 'compile_frontend' job. # Theoretically this is not necessary because we reuse the cache from the 'compile_frontend' job.
# Sometimes the cache is not created, therefore this is a fallback. # Sometimes the cache is not created, therefore this is a fallback.

1
.gitignore vendored
View File

@ -53,6 +53,7 @@ node_modules/
npm-debug.log npm-debug.log
testem.log testem.log
/typings /typings
/web/package-lock.json
# e2e # e2e
/web/cypress/screenshots/ /web/cypress/screenshots/

View File

@ -1,5 +1,5 @@
module.exports = { module.exports = {
extends: ['prettier/@typescript-eslint', 'plugin:prettier/recommended'], extends: ['prettier', 'plugin:prettier/recommended'],
env: { env: {
browser: true, browser: true,
node: true node: true

View File

@ -11,7 +11,7 @@
"build": { "build": {
"builder": "@angular-builders/custom-webpack:browser", "builder": "@angular-builders/custom-webpack:browser",
"options": { "options": {
"aot": false, "aot": true,
"customWebpackConfig": { "customWebpackConfig": {
"path": "webpack.config.js" "path": "webpack.config.js"
}, },

View File

@ -1,5 +1,6 @@
const { pathsToModuleNameMapper } = require('ts-jest/utils'); const { pathsToModuleNameMapper } = require('ts-jest/utils');
const { compilerOptions } = require('./tsconfig'); const { compilerOptions } = require('./tsconfig');
require('jest-preset-angular/ngcc-jest-processor');
module.exports = { module.exports = {
preset: 'jest-preset-angular', preset: 'jest-preset-angular',

View File

@ -5,6 +5,7 @@
"scripts": { "scripts": {
"ng": "ng", "ng": "ng",
"start": "ng serve", "start": "ng serve",
"start:hmr": "ng serve --hmr --no-live-reload",
"build": "ng build", "build": "ng build",
"build:prod": "ng build --prod=true", "build:prod": "ng build --prod=true",
"build:prod-silent": "ng build --prod=true --no-progress", "build:prod-silent": "ng build --prod=true --no-progress",
@ -20,57 +21,54 @@
"ci": "yarn install --frozen-lockfile" "ci": "yarn install --frozen-lockfile"
}, },
"private": true, "private": true,
"resolutions": {
"webpack": "5.21.2"
},
"dependencies": { "dependencies": {
"@angular/animations": "11.1.0", "@angular/animations": "12.0.5",
"@angular/cdk": "11.1.0", "@angular/cdk": "12.0.5",
"@angular/common": "11.1.0", "@angular/common": "12.0.5",
"@angular/core": "11.1.0", "@angular/core": "12.0.5",
"@angular/forms": "11.1.0", "@angular/forms": "12.0.5",
"@angular/material": "11.1.0", "@angular/material": "12.0.5",
"@angular/platform-browser": "11.1.0", "@angular/platform-browser": "12.0.5",
"@angular/platform-browser-dynamic": "11.1.0", "@angular/platform-browser-dynamic": "12.0.5",
"@angular/router": "11.1.0", "@angular/router": "12.0.5",
"@circlon/angular-tree-component": "10.0.2", "@circlon/angular-tree-component": "11.0.4",
"@ngxs/store": "3.7.1", "@ngxs/store": "3.7.2",
"angular-svg-icon": "11.0.0", "angular-svg-icon": "12.0.0",
"chart.js": "2.9.4", "chart.js": "2.9.4",
"core-js": "3.8.3", "core-js": "3.15.1",
"file-saver": "2.0.5", "file-saver": "2.0.5",
"ng2-charts": "2.4.2", "ng2-charts": "2.4.2",
"ngx-bootstrap": "6.2.0", "ngx-bootstrap": "6.2.0",
"ngx-infinite-scroll": "10.0.1", "ngx-infinite-scroll": "10.0.1",
"rxjs": "6.6.3", "rxjs": "7.1.0",
"tslib": "2.1.0", "tslib": "2.3.0",
"zone.js": "0.11.3" "zone.js": "0.11.4"
}, },
"devDependencies": { "devDependencies": {
"@angular-builders/custom-webpack": "11.0.0", "@angular-builders/custom-webpack": "12.1.0",
"@angular-devkit/build-angular": "0.1101.1", "@angular-devkit/build-angular": "12.0.5",
"@angular/cli": "11.1.1", "@angular/cli": "12.0.5",
"@angular/compiler": "11.1.0", "@angular/compiler": "12.0.5",
"@angular/compiler-cli": "11.1.0", "@angular/compiler-cli": "12.0.5",
"@ngxs/devtools-plugin": "3.7.1", "@ngxs/devtools-plugin": "3.7.2",
"@types/jest": "26.0.20", "@types/jest": "26.0.23",
"@types/node": "14.14.22", "@types/node": "15.12.4",
"@typescript-eslint/eslint-plugin": "4.14.0", "@typescript-eslint/eslint-plugin": "4.28.0",
"@typescript-eslint/eslint-plugin-tslint": "4.14.0", "@typescript-eslint/eslint-plugin-tslint": "4.28.0",
"@typescript-eslint/parser": "4.14.0", "@typescript-eslint/parser": "4.28.0",
"compression-webpack-plugin": "7.1.2", "compression-webpack-plugin": "8.0.0",
"cypress": "6.3.0", "cypress": "7.5.0",
"cypress-intellij-reporter": "0.0.6", "cypress-intellij-reporter": "0.0.6",
"eslint": "7.18.0", "eslint": "7.29.0",
"eslint-config-prettier": "7.2.0", "eslint-config-prettier": "8.3.0",
"eslint-plugin-import": "2.22.1", "eslint-plugin-import": "2.23.4",
"eslint-plugin-prettier": "3.3.1", "eslint-plugin-prettier": "3.4.0",
"jest": "26.6.3", "jest": "27.0.5",
"jest-preset-angular": "8.3.2", "jest-preset-angular": "9.0.4",
"prettier": "2.2.1", "prettier": "2.3.1",
"sass": "1.32.5", "sass": "1.35.1",
"ts-jest": "26.4.4", "ts-jest": "27.0.3",
"tslint": "6.1.3", "tslint": "6.1.3",
"typescript": "4.1.3" "typescript": "4.2.4"
} }
} }

View File

@ -49,10 +49,6 @@ const notificationServiceSpy: Partial<NotificationService> = {
showDialog: showDialogFn showDialog: showDialogFn
}; };
const mockDialogRef = {
close: jasmine.createSpy('close')
};
@Component({ selector: 'svg-icon', template: '' }) @Component({ selector: 'svg-icon', template: '' })
class SvgIconStub {} class SvgIconStub {}
@ -109,7 +105,6 @@ describe('AccessItemsManagementComponent', () => {
providers: [ providers: [
{ provide: FormsValidatorService, useValue: formValidatorServiceSpy }, { provide: FormsValidatorService, useValue: formValidatorServiceSpy },
{ provide: NotificationService, useValue: notificationServiceSpy }, { provide: NotificationService, useValue: notificationServiceSpy },
{ provide: MatDialogRef, useValue: { mockDialogRef } },
RequestInProgressService, RequestInProgressService,
ClassificationCategoriesService, ClassificationCategoriesService,
StartupService, StartupService,

View File

@ -1,5 +1,4 @@
@import '../../../../theme/colors'; @import '../../../../theme/colors';
@import '~@angular/material/theming';
.workbasket-access-items { .workbasket-access-items {
height: calc(100vh - 213px); height: calc(100vh - 213px);

View File

@ -134,7 +134,7 @@ describe('WorkbasketDetailsComponent', () => {
expect(information).toBeTruthy(); expect(information).toBeTruthy();
}); });
it('should render new workbasket when action is CREATE', async (done) => { it('should render new workbasket when action is CREATE', (done) => {
store store
.dispatch(new CreateWorkbasket()) .dispatch(new CreateWorkbasket())
.pipe(take(1)) .pipe(take(1))

View File

@ -5,18 +5,18 @@ import { SelectedRouteService } from '../../services/selected-route/selected-rou
import { SidenavService } from '../../services/sidenav/sidenav.service'; import { SidenavService } from '../../services/sidenav/sidenav.service';
import { HttpClientTestingModule } from '@angular/common/http/testing'; import { HttpClientTestingModule } from '@angular/common/http/testing';
import { By } from '@angular/platform-browser'; import { By } from '@angular/platform-browser';
import { of } from 'rxjs/internal/observable/of';
import { MatIconModule } from '@angular/material/icon'; import { MatIconModule } from '@angular/material/icon';
import { MatToolbarModule } from '@angular/material/toolbar'; import { MatToolbarModule } from '@angular/material/toolbar';
import { EMPTY } from 'rxjs';
jest.mock('angular-svg-icon'); jest.mock('angular-svg-icon');
const SidenavServiceSpy: Partial<SidenavService> = { const SidenavServiceSpy: Partial<SidenavService> = {
toggleSidenav: jest.fn().mockReturnValue(of()) toggleSidenav: jest.fn().mockReturnValue(EMPTY)
}; };
const SelectedRouteServiceSpy: Partial<SelectedRouteService> = { const SelectedRouteServiceSpy: Partial<SelectedRouteService> = {
getSelectedRoute: jest.fn().mockReturnValue(of()) getSelectedRoute: jest.fn().mockReturnValue(EMPTY)
}; };
@Component({ selector: 'svg-icon', template: '' }) @Component({ selector: 'svg-icon', template: '' })

View File

@ -9,21 +9,22 @@ import { RouterModule } from '@angular/router';
import { RouterTestingModule } from '@angular/router/testing'; import { RouterTestingModule } from '@angular/router/testing';
import { TaskanaEngineService } from '../../services/taskana-engine/taskana-engine.service'; import { TaskanaEngineService } from '../../services/taskana-engine/taskana-engine.service';
import { TaskanaEngineServiceMock } from '../../services/taskana-engine/taskana-engine.mock.service'; import { TaskanaEngineServiceMock } from '../../services/taskana-engine/taskana-engine.mock.service';
import { of } from 'rxjs/internal/observable/of';
import { MatButtonModule } from '@angular/material/button'; import { MatButtonModule } from '@angular/material/button';
import { MatSidenavModule } from '@angular/material/sidenav'; import { MatSidenavModule } from '@angular/material/sidenav';
import { MatCheckboxModule } from '@angular/material/checkbox'; import { MatCheckboxModule } from '@angular/material/checkbox';
import { MatGridListModule } from '@angular/material/grid-list'; import { MatGridListModule } from '@angular/material/grid-list';
import { MatListModule } from '@angular/material/list'; import { MatListModule } from '@angular/material/list';
import { MatIconModule } from '@angular/material/icon'; import { MatIconModule } from '@angular/material/icon';
import { EMPTY, of } from 'rxjs';
const SidenavServiceSpy: Partial<SidenavService> = { const SidenavServiceSpy: Partial<SidenavService> = {
toggleSidenav: jest.fn().mockReturnValue(of()) toggleSidenav: jest.fn().mockReturnValue(EMPTY)
}; };
const TaskanaEngineServiceSpy: Partial<TaskanaEngineServiceMock> = { const TaskanaEngineServiceSpy: Partial<TaskanaEngineServiceMock> = {
hasRole: jest.fn().mockReturnValue(of()), hasRole: jest.fn().mockReturnValue(EMPTY),
isHistoryProviderEnabled: jest.fn().mockReturnValue(of()) isHistoryProviderEnabled: jest.fn().mockReturnValue(EMPTY)
}; };
describe('SidenavListComponent', () => { describe('SidenavListComponent', () => {

View File

@ -7,17 +7,17 @@ import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
import { HttpClientTestingModule } from '@angular/common/http/testing'; import { HttpClientTestingModule } from '@angular/common/http/testing';
import { RouterModule } from '@angular/router'; import { RouterModule } from '@angular/router';
import { RouterTestingModule } from '@angular/router/testing'; import { RouterTestingModule } from '@angular/router/testing';
import { of } from 'rxjs/internal/observable/of';
import { MatSelectModule } from '@angular/material/select'; import { MatSelectModule } from '@angular/material/select';
import { MatAutocompleteModule } from '@angular/material/autocomplete'; import { MatAutocompleteModule } from '@angular/material/autocomplete';
import { MatFormFieldModule } from '@angular/material/form-field'; import { MatFormFieldModule } from '@angular/material/form-field';
import { MatInputModule } from '@angular/material/input'; import { MatInputModule } from '@angular/material/input';
import { FormsModule } from '@angular/forms'; import { FormsModule } from '@angular/forms';
import { MatTooltipModule } from '@angular/material/tooltip'; import { MatTooltipModule } from '@angular/material/tooltip';
import { EMPTY } from 'rxjs';
const AccessIdsServiceSpy: Partial<AccessIdsService> = { const AccessIdsServiceSpy: Partial<AccessIdsService> = {
getAccessItems: jest.fn().mockReturnValue(of()), getAccessItems: jest.fn().mockReturnValue(EMPTY),
searchForAccessId: jest.fn().mockReturnValue(of()) searchForAccessId: jest.fn().mockReturnValue(EMPTY)
}; };
describe('TypeAheadComponent', () => { describe('TypeAheadComponent', () => {

View File

@ -47,13 +47,11 @@ export enum WorkbasketAccessItemQuerySortParameter {
ACCESS_ID = 'ACCESS_ID' ACCESS_ID = 'ACCESS_ID'
} }
export const WORKBASKET_ACCESS_ITEM_SORT_PARAMETER_NAMING: Map< export const WORKBASKET_ACCESS_ITEM_SORT_PARAMETER_NAMING: Map<WorkbasketAccessItemQuerySortParameter, string> =
WorkbasketAccessItemQuerySortParameter, new Map([
string [WorkbasketAccessItemQuerySortParameter.ACCESS_ID, 'Access id'],
> = new Map([ [WorkbasketAccessItemQuerySortParameter.WORKBASKET_KEY, 'Workbasket Key']
[WorkbasketAccessItemQuerySortParameter.ACCESS_ID, 'Access id'], ]);
[WorkbasketAccessItemQuerySortParameter.WORKBASKET_KEY, 'Workbasket Key']
]);
export enum ClassificationQuerySortParameter { export enum ClassificationQuerySortParameter {
DOMAIN = 'DOMAIN', DOMAIN = 'DOMAIN',

View File

@ -112,19 +112,16 @@ export const selectedWorkbasketMock: Workbasket = {
href: 'http://localhost:8080/taskana/api/v1/workbaskets/WBI:000000000000000000000000000000000902' href: 'http://localhost:8080/taskana/api/v1/workbaskets/WBI:000000000000000000000000000000000902'
}, },
distributionTargets: { distributionTargets: {
href: href: 'http://localhost:8080/taskana/api/v1/workbaskets/WBI:000000000000000000000000000000000902/distribution-targets'
'http://localhost:8080/taskana/api/v1/workbaskets/WBI:000000000000000000000000000000000902/distribution-targets'
}, },
accessItems: { accessItems: {
href: href: 'http://localhost:8080/taskana/api/v1/workbaskets/WBI:000000000000000000000000000000000902/workbasketAccessItems'
'http://localhost:8080/taskana/api/v1/workbaskets/WBI:000000000000000000000000000000000902/workbasketAccessItems'
}, },
allWorkbaskets: { allWorkbaskets: {
href: 'http://localhost:8080/taskana/api/v1/workbaskets' href: 'http://localhost:8080/taskana/api/v1/workbaskets'
}, },
removeDistributionTargets: { removeDistributionTargets: {
href: href: 'http://localhost:8080/taskana/api/v1/workbaskets/WBI:000000000000000000000000000000000902/distribution-targets'
'http://localhost:8080/taskana/api/v1/workbaskets/WBI:000000000000000000000000000000000902/distribution-targets'
} }
} }
}; };
@ -182,8 +179,7 @@ export const workbasketAccessItemsMock: WorkbasketAccessItemsRepresentation = {
], ],
_links: { _links: {
self: { self: {
href: href: 'http://localhost:8080/taskana/api/v1/workbaskets/WBI:000000000000000000000000000000000901/workbasketAccessItems'
'http://localhost:8080/taskana/api/v1/workbaskets/WBI:000000000000000000000000000000000901/workbasketAccessItems'
}, },
workbasket: { workbasket: {
href: 'http://localhost:8080/taskana/api/v1/workbaskets/WBI:000000000000000000000000000000000901' href: 'http://localhost:8080/taskana/api/v1/workbaskets/WBI:000000000000000000000000000000000901'
@ -196,20 +192,16 @@ export const workbasketReadStateMock = {
paginatedWorkbasketsSummary: { paginatedWorkbasketsSummary: {
_links: { _links: {
self: { self: {
href: href: 'http://localhost:8080/taskana/api/v1/workbaskets/?sort-by=name&order=asc&domain=DOMAIN_A&page=3&page-size=8'
'http://localhost:8080/taskana/api/v1/workbaskets/?sort-by=name&order=asc&domain=DOMAIN_A&page=3&page-size=8'
}, },
first: { first: {
href: href: 'http://localhost:8080/taskana/api/v1/workbaskets/?sort-by=name&order=asc&domain=DOMAIN_A&page-size=8&page=1'
'http://localhost:8080/taskana/api/v1/workbaskets/?sort-by=name&order=asc&domain=DOMAIN_A&page-size=8&page=1'
}, },
last: { last: {
href: href: 'http://localhost:8080/taskana/api/v1/workbaskets/?sort-by=name&order=asc&domain=DOMAIN_A&page-size=8&page=3'
'http://localhost:8080/taskana/api/v1/workbaskets/?sort-by=name&order=asc&domain=DOMAIN_A&page-size=8&page=3'
}, },
prev: { prev: {
href: href: 'http://localhost:8080/taskana/api/v1/workbaskets/?sort-by=name&order=asc&domain=DOMAIN_A&page-size=8&page=2'
'http://localhost:8080/taskana/api/v1/workbaskets/?sort-by=name&order=asc&domain=DOMAIN_A&page-size=8&page=2'
} }
}, },
workbaskets: [ workbaskets: [
@ -315,8 +307,7 @@ export const workbasketReadStateMock = {
workbasketDistributionTargets: { workbasketDistributionTargets: {
_links: { _links: {
self: { self: {
href: href: 'http://localhost:8080/taskana/api/v1/workbaskets/WBI:000000000000000000000000000000000900/distribution-targets'
'http://localhost:8080/taskana/api/v1/workbaskets/WBI:000000000000000000000000000000000900/distribution-targets'
} }
}, },
distributionTargets: [ distributionTargets: [

View File

@ -153,7 +153,7 @@ export class TaskMasterComponent implements OnInit, OnDestroy {
} }
ngOnDestroy(): void { ngOnDestroy(): void {
this.destroy$.next(); this.destroy$.next(null);
this.destroy$.complete(); this.destroy$.complete();
} }
} }

View File

@ -29,7 +29,7 @@ export class TaskService {
} }
publishTaskDeletion() { publishTaskDeletion() {
this.taskDeletedSource.next(); this.taskDeletedSource.next(null);
} }
selectTask(task?: Task) { selectTask(task?: Task) {

View File

@ -33,7 +33,7 @@ import 'core-js/es/reflect';
/** ************************************************************************************************* /** *************************************************************************************************
* Zone JS is required by Angular itself. * Zone JS is required by Angular itself.
*/ */
import 'zone.js/dist/zone'; // Included with Angular CLI. import 'zone.js'; // Included with Angular CLI.
/** ************************************************************************************************* /** *************************************************************************************************
* APPLICATION IMPORTS * APPLICATION IMPORTS

View File

@ -1,4 +1,5 @@
import 'jest-preset-angular'; import 'jest-preset-angular/setup-jest';
import { fakeAsync } from '@angular/core/testing';
Object.defineProperty(window, 'CSS', { value: null }); Object.defineProperty(window, 'CSS', { value: null });
Object.defineProperty(window, 'getComputedStyle', { Object.defineProperty(window, 'getComputedStyle', {

View File

@ -1,8 +1,8 @@
@import '~@angular/material/theming'; @use '~@angular/material' as mat;
@include mat-core(); @include mat.core();
$my-app-primary: mat-palette($mat-blue-grey); $my-app-primary: mat.define-palette(mat.$blue-grey-palette);
$my-app-accent: mat-palette($mat-teal, 500, 900, A100); $my-app-accent: mat.define-palette(mat.$teal-palette, 500, 900, A100);
$my-app-warn: mat-palette($mat-red, 600); $my-app-warn: mat.define-palette(mat.$red-palette, 600);
$my-app-theme: mat-light-theme($my-app-primary, $my-app-accent, $my-app-warn); $my-app-theme: mat.define-light-theme($my-app-primary, $my-app-accent, $my-app-warn);
@include angular-material-theme($my-app-theme); @include mat.all-component-themes($my-app-theme);

View File

@ -3,7 +3,7 @@
"compilerOptions": { "compilerOptions": {
"outDir": "../out-tsc/app", "outDir": "../out-tsc/app",
"baseUrl": "", "baseUrl": "",
"types": [] "types": ["jest"]
}, },
"files": ["main.ts", "polyfills.ts"], "files": ["main.ts", "polyfills.ts"],
"include": ["src/**/*.d.ts"], "include": ["src/**/*.d.ts"],

File diff suppressed because it is too large Load Diff