From 60d1f239f26c9d355da879737696867fdd905e6c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20Adler?= Date: Wed, 15 Jun 2022 12:12:02 +0200 Subject: [PATCH] migrate to angular 14 --- angular.json | 1 - package.json | 30 +++++++++---------- src/ui/src/app/app.module.ts | 3 -- src/ui/src/app/converter/converter.module.ts | 2 -- src/ui/src/app/login/login.component.ts | 6 ++-- src/ui/src/app/plugins/plugins.module.ts | 2 -- .../app/settings/settings.audio.component.ts | 12 ++++---- src/ui/src/app/settings/settings.component.ts | 12 ++++---- .../settings/settings.extended.component.ts | 14 ++++----- src/ui/src/app/settings/settings.module.ts | 2 -- .../app/settings/settings.video.component.ts | 16 +++++----- 11 files changed, 45 insertions(+), 55 deletions(-) diff --git a/angular.json b/angular.json index c37cb5c..fe56159 100644 --- a/angular.json +++ b/angular.json @@ -85,7 +85,6 @@ "projectType": "application" } }, - "defaultProject": "myvidcore-ui", "schematics": { "@schematics/angular:component": { "prefix": "app", diff --git a/package.json b/package.json index f4a8340..8d528b3 100644 --- a/package.json +++ b/package.json @@ -21,15 +21,15 @@ ], "private": true, "dependencies": { - "@angular/animations": "13.3.4", - "@angular/common": "13.3.4", - "@angular/compiler": "13.3.4", - "@angular/core": "13.3.4", - "@angular/forms": "13.3.4", - "@angular/localize": "13.3.4", - "@angular/platform-browser": "13.3.4", - "@angular/platform-browser-dynamic": "13.3.4", - "@angular/router": "13.3.4", + "@angular/animations": "14.0.1", + "@angular/common": "14.0.1", + "@angular/compiler": "14.0.1", + "@angular/core": "14.0.1", + "@angular/forms": "14.0.1", + "@angular/localize": "14.0.1", + "@angular/platform-browser": "14.0.1", + "@angular/platform-browser-dynamic": "14.0.1", + "@angular/router": "14.0.1", "@fortawesome/fontawesome-free": "^6.1.1", "@ng-bootstrap/ng-bootstrap": "^10.0.0", "@ng-select/ng-option-highlight": "0.0.7", @@ -58,11 +58,11 @@ "zone.js": "~0.11.5" }, "devDependencies": { - "@angular-devkit/build-angular": "~13.3.3", - "@angular-devkit/core": "^13.3.3", - "@angular/cli": "13.3.3", - "@angular/compiler-cli": "13.3.4", - "@angular/language-service": "13.3.4", + "@angular-devkit/build-angular": "^14.0.1", + "@angular-devkit/core": "^14.0.1", + "@angular/cli": "14.0.1", + "@angular/compiler-cli": "14.0.1", + "@angular/language-service": "14.0.1", "@types/jquery": "^3.5.14", "@types/node": "^17.0.27", "@types/video.js": "^7.3.33", @@ -82,4 +82,4 @@ "webpack-bundle-analyzer": "^4.5.0", "yargs": "^17.2.1" } -} \ No newline at end of file +} diff --git a/src/ui/src/app/app.module.ts b/src/ui/src/app/app.module.ts index 186a920..7bed94e 100644 --- a/src/ui/src/app/app.module.ts +++ b/src/ui/src/app/app.module.ts @@ -63,9 +63,6 @@ export class InjectableTranslateMessageFormatCompiler extends TranslateMessageFo DashboardComponent, ConfirmComponent ], - entryComponents: [ - ConfirmComponent - ], imports: [ BreadcrumbModule, BrowserModule, diff --git a/src/ui/src/app/converter/converter.module.ts b/src/ui/src/app/converter/converter.module.ts index 7760a13..dc9d2ec 100644 --- a/src/ui/src/app/converter/converter.module.ts +++ b/src/ui/src/app/converter/converter.module.ts @@ -35,8 +35,6 @@ import { FileUploadComponent, FileDropZoneDirective } from "./fileUpload.compone ], }) ], - entryComponents: [ - ], declarations: [ ConverterComponent, FileUploadComponent, diff --git a/src/ui/src/app/login/login.component.ts b/src/ui/src/app/login/login.component.ts index 6944a6d..2b20396 100644 --- a/src/ui/src/app/login/login.component.ts +++ b/src/ui/src/app/login/login.component.ts @@ -2,7 +2,7 @@ import { Component, OnInit } from "@angular/core"; import { ToastrService } from "ngx-toastr"; import { TranslateService } from "@ngx-translate/core"; import { TargetState, StateService, UIRouterGlobals } from "@uirouter/core"; -import { FormBuilder, FormGroup, Validators } from "@angular/forms"; +import { UntypedFormBuilder, UntypedFormGroup, Validators } from "@angular/forms"; import { AuthService } from "../_services/auth.service"; import { SpinnerService } from "../spinner/spinner.service"; @@ -12,11 +12,11 @@ import { SpinnerService } from "../spinner/spinner.service"; templateUrl: "./login.component.html" }) class LoginComponent implements OnInit { - form: FormGroup; + form: UntypedFormGroup; returnTo: TargetState; invalidCredentials = false; - constructor(public $fb: FormBuilder, private $state: StateService, private $spinner: SpinnerService, + constructor(public $fb: UntypedFormBuilder, private $state: StateService, private $spinner: SpinnerService, private $auth: AuthService, private toastr: ToastrService, private translate: TranslateService, private globals: UIRouterGlobals) { } diff --git a/src/ui/src/app/plugins/plugins.module.ts b/src/ui/src/app/plugins/plugins.module.ts index 24704ed..35fc98b 100644 --- a/src/ui/src/app/plugins/plugins.module.ts +++ b/src/ui/src/app/plugins/plugins.module.ts @@ -16,8 +16,6 @@ import { SystemMonitorComponent, SystemMonitorContentDirective } from "./sysmoni GaugeModule.forRoot(), TranslateModule ], - entryComponents: [ - ], declarations: [ GaugeComponent, NVMonitorComponent, diff --git a/src/ui/src/app/settings/settings.audio.component.ts b/src/ui/src/app/settings/settings.audio.component.ts index 9922aaa..884fcf7 100644 --- a/src/ui/src/app/settings/settings.audio.component.ts +++ b/src/ui/src/app/settings/settings.audio.component.ts @@ -1,5 +1,5 @@ import { Component, OnInit, Input, OnChanges, SimpleChanges } from "@angular/core"; -import { FormBuilder, FormGroup, Validators, ControlContainer, FormGroupDirective } from "@angular/forms"; +import { UntypedFormBuilder, UntypedFormGroup, Validators, ControlContainer, FormGroupDirective } from "@angular/forms"; import { Settings, Audio, AllowedFormat } from "./definitions"; import { @@ -31,9 +31,9 @@ export class SettingsAudioComponent implements OnInit, OnChanges { audioBitrates = DEFAULT_BITRATES; - output: FormGroup; + output: UntypedFormGroup; - static createAudio($fb: FormBuilder, audio: Audio = null): FormGroup { + static createAudio($fb: UntypedFormBuilder, audio: Audio = null): UntypedFormGroup { const fg = $fb.group({ codec: [null, [Validators.required]], bitrate: [], @@ -48,7 +48,7 @@ export class SettingsAudioComponent implements OnInit, OnChanges { return fg; } - constructor(private parent: FormGroupDirective, public $fb: FormBuilder) { + constructor(private parent: FormGroupDirective, public $fb: UntypedFormBuilder) { } ngOnInit() { @@ -58,7 +58,7 @@ export class SettingsAudioComponent implements OnInit, OnChanges { if (changes.selectedFormat.previousValue !== changes.selectedFormat.currentValue) { this.selectedFormat = changes.selectedFormat.currentValue; - const form = this.parent.form.get("output." + this.index); + const form = this.parent.form.get("output." + this.index); if (form.contains(this.type)) { const output = this.settings && this.settings.output[this.index] && this.settings.output[this.index][this.type]; @@ -69,7 +69,7 @@ export class SettingsAudioComponent implements OnInit, OnChanges { ); } - this.output = this.parent.form.get("output." + this.index + "." + this.type); + this.output = this.parent.form.get("output." + this.index + "." + this.type); this.onCodecChange(); } } diff --git a/src/ui/src/app/settings/settings.component.ts b/src/ui/src/app/settings/settings.component.ts index 2bf00a6..6eecfdd 100644 --- a/src/ui/src/app/settings/settings.component.ts +++ b/src/ui/src/app/settings/settings.component.ts @@ -1,5 +1,5 @@ import { Component, OnInit, Input } from "@angular/core"; -import { FormBuilder, FormArray, FormGroup, Validators } from "@angular/forms"; +import { UntypedFormBuilder, UntypedFormArray, UntypedFormGroup, Validators } from "@angular/forms"; import { of, forkJoin } from "rxjs"; import { mergeMap, map, mergeAll, take, delay, retryWhen } from "rxjs/operators"; @@ -44,14 +44,14 @@ export class SettingsComponent implements OnInit { activeTab: string; - form: FormGroup; + form: UntypedFormGroup; - hwAccelsForm: FormArray; + hwAccelsForm: UntypedFormArray; - output: FormArray; + output: UntypedFormArray; constructor(private $api: SettingsApiService, private $capi: ConverterApiService, - private $error: ErrorService, private $spinner: SpinnerService, public $fb: FormBuilder) { + private $error: ErrorService, private $spinner: SpinnerService, public $fb: UntypedFormBuilder) { } ngOnInit() { @@ -209,7 +209,7 @@ export class SettingsComponent implements OnInit { return params.find(p => p.name === name); } - createOutput(output: Output = null): FormGroup { + createOutput(output: Output = null): UntypedFormGroup { const fg = this.$fb.group({ format: ["", [Validators.required]], filenameAppendix: [""], diff --git a/src/ui/src/app/settings/settings.extended.component.ts b/src/ui/src/app/settings/settings.extended.component.ts index 8b25b92..25ef6a8 100644 --- a/src/ui/src/app/settings/settings.extended.component.ts +++ b/src/ui/src/app/settings/settings.extended.component.ts @@ -1,5 +1,5 @@ import { Component, OnInit, Input, OnChanges, SimpleChanges } from "@angular/core"; -import { FormBuilder, FormGroup, ControlContainer, FormGroupDirective, Validators } from "@angular/forms"; +import { UntypedFormBuilder, UntypedFormGroup, ControlContainer, FormGroupDirective, Validators } from "@angular/forms"; import { Settings } from "./definitions"; @@ -24,9 +24,9 @@ export class SettingsExtendedComponent implements OnInit, OnChanges { @Input() selectedEncoder: any; - parameter: FormGroup; + parameter: UntypedFormGroup; - static createParameter($fb: FormBuilder, param: any) { + static createParameter($fb: UntypedFormBuilder, param: any) { if (param.type === "int") { const vals = []; @@ -84,7 +84,7 @@ export class SettingsExtendedComponent implements OnInit, OnChanges { return value; } - static patchValues(fg: FormGroup, encParams: Array<(key: string) => any>, params: (key: string) => string) { + static patchValues(fg: UntypedFormGroup, encParams: Array<(key: string) => any>, params: (key: string) => string) { encParams.forEach((p: any) => { if (params && params[p.name] && fg.contains(p.name)) { fg.get(p.name).patchValue( @@ -119,7 +119,7 @@ export class SettingsExtendedComponent implements OnInit, OnChanges { return res; } - constructor(private parent: FormGroupDirective, public $fb: FormBuilder) { + constructor(private parent: FormGroupDirective, public $fb: UntypedFormBuilder) { } ngOnInit() { @@ -133,7 +133,7 @@ export class SettingsExtendedComponent implements OnInit, OnChanges { } createParameters() { - const params = this.parent.form.get("parameter"); + const params = this.parent.form.get("parameter"); if (params && Object.keys(params.controls).length !== 0) { const ctrKeys = Object.keys(params.controls); ctrKeys.forEach(n => { @@ -159,6 +159,6 @@ export class SettingsExtendedComponent implements OnInit, OnChanges { ); } - this.parameter = this.parent.form.get("parameter"); + this.parameter = this.parent.form.get("parameter"); } } diff --git a/src/ui/src/app/settings/settings.module.ts b/src/ui/src/app/settings/settings.module.ts index fa26b51..c8790d4 100644 --- a/src/ui/src/app/settings/settings.module.ts +++ b/src/ui/src/app/settings/settings.module.ts @@ -36,8 +36,6 @@ import { SettingsVideoComponent } from "./settings.video.component"; ], }) ], - entryComponents: [ - ], declarations: [ SettingsComponent, SettingsExtendedComponent, diff --git a/src/ui/src/app/settings/settings.video.component.ts b/src/ui/src/app/settings/settings.video.component.ts index 83bad71..266b4b8 100644 --- a/src/ui/src/app/settings/settings.video.component.ts +++ b/src/ui/src/app/settings/settings.video.component.ts @@ -1,5 +1,5 @@ import { Component, OnInit, Input, OnChanges, SimpleChanges } from "@angular/core"; -import { FormBuilder, FormGroup, Validators, ControlContainer, FormGroupDirective } from "@angular/forms"; +import { UntypedFormBuilder, UntypedFormGroup, Validators, ControlContainer, FormGroupDirective } from "@angular/forms"; import { Settings, Video, AllowedFormat } from "./definitions"; import { @@ -43,9 +43,9 @@ export class SettingsVideoComponent implements OnInit, OnChanges { tunes = DEFAULT_TUNES; - output: FormGroup; + output: UntypedFormGroup; - static createVideo($fb: FormBuilder, video: Video = null): FormGroup { + static createVideo($fb: UntypedFormBuilder, video: Video = null): UntypedFormGroup { const fg = $fb.group({ codec: [null, [Validators.required]], forceKeyFrames: [], @@ -73,7 +73,7 @@ export class SettingsVideoComponent implements OnInit, OnChanges { return fg; } - constructor(private parent: FormGroupDirective, public $fb: FormBuilder) { + constructor(private parent: FormGroupDirective, public $fb: UntypedFormBuilder) { } ngOnInit() { @@ -83,7 +83,7 @@ export class SettingsVideoComponent implements OnInit, OnChanges { if (changes.selectedFormat.previousValue !== changes.selectedFormat.currentValue) { this.selectedFormat = changes.selectedFormat.currentValue; - const form = this.parent.form.get("output." + this.index); + const form = this.parent.form.get("output." + this.index); if (form.contains(this.type)) { const output = this.settings && this.settings.output[this.index] && this.settings.output[this.index][this.type]; @@ -94,7 +94,7 @@ export class SettingsVideoComponent implements OnInit, OnChanges { ); } - this.output = this.parent.form.get("output." + this.index + "." + this.type); + this.output = this.parent.form.get("output." + this.index + "." + this.type); this.onCodecChange(); this.onQualityTypeChange(); } @@ -105,7 +105,7 @@ export class SettingsVideoComponent implements OnInit, OnChanges { } createParameters() { - const params = this.output.get("parameter"); + const params = this.output.get("parameter"); if (params && Object.keys(params.controls).length !== 0) { const ctrKeys = Object.keys(params.controls); ctrKeys.forEach(n => { @@ -125,7 +125,7 @@ export class SettingsVideoComponent implements OnInit, OnChanges { ); SettingsExtendedComponent.patchValues( - this.output.get("parameter"), + this.output.get("parameter"), this.selectedEncoder.parameters, this.settings && this.settings.output[this.index] && this.settings.output[this.index][this.type].parameter );