From c754792a8db921eca0b1ad9a183d039dc42d0cd8 Mon Sep 17 00:00:00 2001 From: Ihar Date: Wed, 27 Nov 2024 18:58:53 +0500 Subject: [PATCH] feat: migration to angular[4194] --- frontend/angular.json | 20 ++++++----- frontend/package.json | 36 +++++++++---------- frontend/src/app/app.module.ts | 23 +++++------- .../datetime-picker.component.ts | 2 +- .../cron-config-dialog.component.ts | 2 +- .../policy-properties.component.html | 4 +-- .../external-topic-block.component.ts | 2 +- .../messages-report-block.component.ts | 2 +- .../report-block/report-block.component.ts | 2 +- .../token-confirmation-block.component.ts | 2 +- .../policy-engine/services/wizard.service.ts | 2 +- .../project-comparison.module.ts | 22 +++++------- .../schema-configuration.component.ts | 2 +- .../schema-form/schema-form.component.ts | 2 +- .../modules/tag-engine/models/tags-history.ts | 2 +- .../tags-explorer-dialog.component.ts | 2 +- .../admin/logs-view/logs-view.component.ts | 2 +- frontend/tsconfig.json | 3 +- 18 files changed, 60 insertions(+), 72 deletions(-) diff --git a/frontend/angular.json b/frontend/angular.json index e3f47721f..6ed42b33d 100644 --- a/frontend/angular.json +++ b/frontend/angular.json @@ -8,15 +8,13 @@ "guardian": { "architect": { "build": { - "builder": "@angular-devkit/build-angular:browser", + "builder": "@angular-devkit/build-angular:application", "configurations": { "development": { - "buildOptimizer": false, - "extractLicenses": false, + "extractLicenses": false, "namedChunks": true, "optimization": false, - "sourceMap": true, - "vendorChunk": true + "sourceMap": true }, "production": { "budgets": [ @@ -99,9 +97,12 @@ ], "index": "src/index.html", "inlineStyleLanguage": "scss", - "main": "src/main.ts", - "outputPath": "dist/guardian", - "polyfills": "src/polyfills.ts", + "outputPath": { + "base": "dist/guardian" + }, + "polyfills": [ + "src/polyfills.ts" + ], "scripts": [ "./node_modules/leader-line/leader-line.min.js" ], @@ -112,7 +113,8 @@ "./node_modules/primeicons/primeicons.css", "src/styles.scss" ], - "tsConfig": "tsconfig.app.json" + "tsConfig": "tsconfig.app.json", + "browser": "src/main.ts" } }, "extract-i18n": { diff --git a/frontend/package.json b/frontend/package.json index 28b865c8d..a973453aa 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -1,24 +1,24 @@ { "author": "Envision Blockchain Solutions ", "dependencies": { - "@angular/animations": "^17.3.12", - "@angular/cdk": "^17.3.10", - "@angular/common": "^17.3.12", - "@angular/compiler": "^17.3.12", - "@angular/core": "^17.3.12", - "@angular/forms": "^17.3.12", - "@angular/google-maps": "^17.3.10", - "@angular/platform-browser": "^17.3.12", - "@angular/platform-browser-dynamic": "^17.3.12", - "@angular/router": "^17.3.12", + "@angular/animations": "^18.2.12", + "@angular/cdk": "^18.2.14", + "@angular/common": "^18.2.12", + "@angular/compiler": "^18.2.12", + "@angular/core": "^18.2.12", + "@angular/forms": "^18.2.12", + "@angular/google-maps": "^18.2.14", + "@angular/platform-browser": "^18.2.12", + "@angular/platform-browser-dynamic": "^18.2.12", + "@angular/router": "^18.2.12", "@ctrl/ngx-codemirror": "^5.1.1", "@enonic/global-polyfill": "^1.0.0", "@formulajs/formulajs": "^4.4.6", "@guardian/interfaces": "file:../interfaces", "ajv": "^8.17.1", "ajv-formats": "^3.0.1", - "angular-svg-icon": "^16.1.0", - "angularx-qrcode": "^17.0.1", + "angular-svg-icon": "^18.0.2", + "angularx-qrcode": "^18.0.2", "codemirror": "^5.65.0", "cronstrue": "^2.4.0", "crypto-browserify": "^3.12.0", @@ -29,10 +29,10 @@ "moment": "^2.29.2", "moment-timezone": "^0.5.43", "ngx-colors": "3.1.4", - "ngx-drag-drop": "^17.0.0", + "ngx-drag-drop": "^18.0.2", "ngx-file-drop": "^16.0.0", - "ngx-mask": "^17.1.8", - "ngx-toastr": "^17.0.2", + "ngx-mask": "^18.0.4", + "ngx-toastr": "^18.0.0", "primeicons": "^7.0.0", "primeng": "^17.18.12", "process": "^0.11.10", @@ -42,9 +42,9 @@ "zone.js": "~0.14.10" }, "devDependencies": { - "@angular-devkit/build-angular": "^17.3.11", - "@angular/cli": "^17.3.11", - "@angular/compiler-cli": "^17.3.12", + "@angular-devkit/build-angular": "^18.2.12", + "@angular/cli": "^18.2.12", + "@angular/compiler-cli": "^18.2.12", "@types/file-saver": "^2.0.5", "@types/jasmine": "~3.6.0", "@types/js-yaml": "^4.0.5", diff --git a/frontend/src/app/app.module.ts b/frontend/src/app/app.module.ts index 5a56be02d..42d0f7e62 100644 --- a/frontend/src/app/app.module.ts +++ b/frontend/src/app/app.module.ts @@ -2,7 +2,7 @@ import { NgModule } from '@angular/core'; import { FormsModule } from '@angular/forms'; import { BrowserModule } from '@angular/platform-browser'; import { BrowserAnimationsModule } from '@angular/platform-browser/animations'; -import { HTTP_INTERCEPTORS, HttpClientJsonpModule, HttpClientModule } from '@angular/common/http'; +import { HTTP_INTERCEPTORS, provideHttpClient, withInterceptorsFromDi, withJsonpSupport } from '@angular/common/http'; import { CommonModule } from '@angular/common'; import { ToastrModule } from 'ngx-toastr'; import { AppRoutingModule, PermissionsGuard } from './app-routing.module'; @@ -130,8 +130,7 @@ import { OnlyForDemoDirective } from './directives/onlyfordemo.directive'; import { UseWithServiceDirective } from './directives/use-with-service.directive'; import { WorkerTasksComponent } from './views/worker-tasks/worker-tasks.component'; -@NgModule({ - declarations: [ +@NgModule({ declarations: [ AppComponent, UserProfileComponent, LoginComponent, @@ -177,14 +176,13 @@ import { WorkerTasksComponent } from './views/worker-tasks/worker-tasks.componen UsersManagementDetailComponent, WorkerTasksComponent ], - imports: [ - BrowserModule, + exports: [], + bootstrap: [AppComponent], imports: [BrowserModule, CommonModule, CommonComponentsModule, MaterialModule, AppRoutingModule, BrowserAnimationsModule, - HttpClientModule, FormsModule, SchemaEngineModule, PolicyEngineModule, @@ -193,7 +191,6 @@ import { WorkerTasksComponent } from './views/worker-tasks/worker-tasks.componen TagEngineModule, CompareModule, ToastrModule.forRoot(), - HttpClientJsonpModule, QRCodeModule, ButtonModule, InputTextModule, @@ -219,10 +216,7 @@ import { WorkerTasksComponent } from './views/worker-tasks/worker-tasks.componen ProjectComparisonModule, DndModule, CheckboxModule, - AngularSvgIconModule.forRoot() - ], - exports: [], - providers: [ + AngularSvgIconModule.forRoot()], providers: [ WebSocketService, AuthService, ProfileService, @@ -274,8 +268,7 @@ import { WorkerTasksComponent } from './views/worker-tasks/worker-tasks.componen provide: HTTP_INTERCEPTORS, useClass: AuthInterceptor, multi: true, - } - ], - bootstrap: [AppComponent], -}) + }, + provideHttpClient(withInterceptorsFromDi(), withJsonpSupport()) + ] }) export class AppModule { } diff --git a/frontend/src/app/modules/common/datetime-picker/datetime-picker.component.ts b/frontend/src/app/modules/common/datetime-picker/datetime-picker.component.ts index 08186f915..71fe3fbee 100644 --- a/frontend/src/app/modules/common/datetime-picker/datetime-picker.component.ts +++ b/frontend/src/app/modules/common/datetime-picker/datetime-picker.component.ts @@ -1,5 +1,5 @@ import { Component, EventEmitter, Input, Output } from '@angular/core'; -import * as moment from 'moment'; +import moment from 'moment'; // import { NGX_MAT_DATE_FORMATS, NgxMatDateAdapter } from '@angular-material-components/datetime-picker'; // import { NgxMatMomentAdapter } from '@angular-material-components/moment-adapter'; // import { GUARDIAN_DATETIME_FORMAT } from '../../../utils/datetime-format'; diff --git a/frontend/src/app/modules/policy-engine/dialogs/cron-config-dialog/cron-config-dialog.component.ts b/frontend/src/app/modules/policy-engine/dialogs/cron-config-dialog/cron-config-dialog.component.ts index 0ffa04095..4777ce500 100644 --- a/frontend/src/app/modules/policy-engine/dialogs/cron-config-dialog/cron-config-dialog.component.ts +++ b/frontend/src/app/modules/policy-engine/dialogs/cron-config-dialog/cron-config-dialog.component.ts @@ -1,7 +1,7 @@ import {Component, Inject} from '@angular/core'; // import { MatLegacyDialogRef as MatDialogRef, MAT_LEGACY_DIALOG_DATA as MAT_DIALOG_DATA } from '@angular/material/legacy-dialog'; import {UntypedFormBuilder, Validators} from '@angular/forms'; -import * as moment from 'moment'; +import moment from 'moment'; import cronstrue from 'cronstrue'; import {DynamicDialogConfig, DynamicDialogRef} from 'primeng/dynamicdialog'; diff --git a/frontend/src/app/modules/policy-engine/policy-configuration/policy-properties/policy-properties.component.html b/frontend/src/app/modules/policy-engine/policy-configuration/policy-properties/policy-properties.component.html index f8e9aebf5..d2f015c40 100644 --- a/frontend/src/app/modules/policy-engine/policy-configuration/policy-properties/policy-properties.component.html +++ b/frontend/src/app/modules/policy-engine/policy-configuration/policy-properties/policy-properties.component.html @@ -412,7 +412,7 @@