Skip to content

Commit

Permalink
migrate to angular 14
Browse files Browse the repository at this point in the history
  • Loading branch information
adlerre committed Jun 15, 2022
1 parent 35f4b16 commit 60d1f23
Show file tree
Hide file tree
Showing 11 changed files with 45 additions and 55 deletions.
1 change: 0 additions & 1 deletion angular.json
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,6 @@
"projectType": "application"
}
},
"defaultProject": "myvidcore-ui",
"schematics": {
"@schematics/angular:component": {
"prefix": "app",
Expand Down
30 changes: 15 additions & 15 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand All @@ -82,4 +82,4 @@
"webpack-bundle-analyzer": "^4.5.0",
"yargs": "^17.2.1"
}
}
}
3 changes: 0 additions & 3 deletions src/ui/src/app/app.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,6 @@ export class InjectableTranslateMessageFormatCompiler extends TranslateMessageFo
DashboardComponent,
ConfirmComponent
],
entryComponents: [
ConfirmComponent
],
imports: [
BreadcrumbModule,
BrowserModule,
Expand Down
2 changes: 0 additions & 2 deletions src/ui/src/app/converter/converter.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,6 @@ import { FileUploadComponent, FileDropZoneDirective } from "./fileUpload.compone
],
})
],
entryComponents: [
],
declarations: [
ConverterComponent,
FileUploadComponent,
Expand Down
6 changes: 3 additions & 3 deletions src/ui/src/app/login/login.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand All @@ -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) { }

Expand Down
2 changes: 0 additions & 2 deletions src/ui/src/app/plugins/plugins.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@ import { SystemMonitorComponent, SystemMonitorContentDirective } from "./sysmoni
GaugeModule.forRoot(),
TranslateModule
],
entryComponents: [
],
declarations: [
GaugeComponent,
NVMonitorComponent,
Expand Down
12 changes: 6 additions & 6 deletions src/ui/src/app/settings/settings.audio.component.ts
Original file line number Diff line number Diff line change
@@ -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 {
Expand Down Expand Up @@ -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: [],
Expand All @@ -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() {
Expand All @@ -58,7 +58,7 @@ export class SettingsAudioComponent implements OnInit, OnChanges {
if (changes.selectedFormat.previousValue !== changes.selectedFormat.currentValue) {
this.selectedFormat = changes.selectedFormat.currentValue;

const form = <FormGroup>this.parent.form.get("output." + this.index);
const form = <UntypedFormGroup>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];
Expand All @@ -69,7 +69,7 @@ export class SettingsAudioComponent implements OnInit, OnChanges {
);
}

this.output = <FormGroup>this.parent.form.get("output." + this.index + "." + this.type);
this.output = <UntypedFormGroup>this.parent.form.get("output." + this.index + "." + this.type);
this.onCodecChange();
}
}
Expand Down
12 changes: 6 additions & 6 deletions src/ui/src/app/settings/settings.component.ts
Original file line number Diff line number Diff line change
@@ -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";
Expand Down Expand Up @@ -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() {
Expand Down Expand Up @@ -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: [""],
Expand Down
14 changes: 7 additions & 7 deletions src/ui/src/app/settings/settings.extended.component.ts
Original file line number Diff line number Diff line change
@@ -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";

Expand All @@ -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 = [];

Expand Down Expand Up @@ -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(
Expand Down Expand Up @@ -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() {
Expand All @@ -133,7 +133,7 @@ export class SettingsExtendedComponent implements OnInit, OnChanges {
}

createParameters() {
const params = <FormGroup>this.parent.form.get("parameter");
const params = <UntypedFormGroup>this.parent.form.get("parameter");
if (params && Object.keys(params.controls).length !== 0) {
const ctrKeys = Object.keys(params.controls);
ctrKeys.forEach(n => {
Expand All @@ -159,6 +159,6 @@ export class SettingsExtendedComponent implements OnInit, OnChanges {
);
}

this.parameter = <FormGroup>this.parent.form.get("parameter");
this.parameter = <UntypedFormGroup>this.parent.form.get("parameter");
}
}
2 changes: 0 additions & 2 deletions src/ui/src/app/settings/settings.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,6 @@ import { SettingsVideoComponent } from "./settings.video.component";
],
})
],
entryComponents: [
],
declarations: [
SettingsComponent,
SettingsExtendedComponent,
Expand Down
16 changes: 8 additions & 8 deletions src/ui/src/app/settings/settings.video.component.ts
Original file line number Diff line number Diff line change
@@ -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 {
Expand Down Expand Up @@ -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: [],
Expand Down Expand Up @@ -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() {
Expand All @@ -83,7 +83,7 @@ export class SettingsVideoComponent implements OnInit, OnChanges {
if (changes.selectedFormat.previousValue !== changes.selectedFormat.currentValue) {
this.selectedFormat = changes.selectedFormat.currentValue;

const form = <FormGroup>this.parent.form.get("output." + this.index);
const form = <UntypedFormGroup>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];
Expand All @@ -94,7 +94,7 @@ export class SettingsVideoComponent implements OnInit, OnChanges {
);
}

this.output = <FormGroup>this.parent.form.get("output." + this.index + "." + this.type);
this.output = <UntypedFormGroup>this.parent.form.get("output." + this.index + "." + this.type);
this.onCodecChange();
this.onQualityTypeChange();
}
Expand All @@ -105,7 +105,7 @@ export class SettingsVideoComponent implements OnInit, OnChanges {
}

createParameters() {
const params = <FormGroup>this.output.get("parameter");
const params = <UntypedFormGroup>this.output.get("parameter");
if (params && Object.keys(params.controls).length !== 0) {
const ctrKeys = Object.keys(params.controls);
ctrKeys.forEach(n => {
Expand All @@ -125,7 +125,7 @@ export class SettingsVideoComponent implements OnInit, OnChanges {
);

SettingsExtendedComponent.patchValues(
<FormGroup>this.output.get("parameter"),
<UntypedFormGroup>this.output.get("parameter"),
this.selectedEncoder.parameters,
this.settings && this.settings.output[this.index] && this.settings.output[this.index][this.type].parameter
);
Expand Down

0 comments on commit 60d1f23

Please sign in to comment.