From e3b63f9f36bf5cb8fd05017fd163f632350dd587 Mon Sep 17 00:00:00 2001 From: Artem Dzhereleiko Date: Fri, 6 Sep 2024 15:43:10 +0300 Subject: [PATCH] UI: Refactoring --- .../widget/widgets-bundle-dialog.component.ts | 21 ++----------------- 1 file changed, 2 insertions(+), 19 deletions(-) diff --git a/ui-ngx/src/app/modules/home/pages/widget/widgets-bundle-dialog.component.ts b/ui-ngx/src/app/modules/home/pages/widget/widgets-bundle-dialog.component.ts index 1f0c963af5..bb5f93cb66 100644 --- a/ui-ngx/src/app/modules/home/pages/widget/widgets-bundle-dialog.component.ts +++ b/ui-ngx/src/app/modules/home/pages/widget/widgets-bundle-dialog.component.ts @@ -14,15 +14,7 @@ /// limitations under the License. /// -import { - AfterViewInit, - Component, - ComponentFactoryResolver, - Inject, - Injector, - SkipSelf, - ViewChild -} from '@angular/core'; +import { Component, Inject, SkipSelf, ViewChild } from '@angular/core'; import { ErrorStateMatcher } from '@angular/material/core'; import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material/dialog'; import { Store } from '@ngrx/store'; @@ -30,7 +22,6 @@ import { AppState } from '@core/core.state'; import { FormGroupDirective, NgForm, UntypedFormControl } from '@angular/forms'; import { DialogComponent } from '@shared/components/dialog.component'; import { Router } from '@angular/router'; -import { TenantProfileService } from '@core/http/tenant-profile.service'; import { WidgetsBundle } from '@shared/models/widgets-bundle.model'; import { WidgetsBundleComponent } from '@home/pages/widget/widgets-bundle.component'; import { WidgetService } from '@core/http/widget.service'; @@ -46,7 +37,7 @@ export interface WidgetsBundleDialogData { styleUrls: ['widgets-bundle-dialog.component.scss'] }) export class WidgetsBundleDialogComponent extends - DialogComponent implements ErrorStateMatcher, AfterViewInit { + DialogComponent implements ErrorStateMatcher { widgetsBundle: WidgetsBundle; @@ -58,20 +49,12 @@ export class WidgetsBundleDialogComponent extends protected router: Router, @Inject(MAT_DIALOG_DATA) public data: WidgetsBundleDialogData, public dialogRef: MatDialogRef, - private componentFactoryResolver: ComponentFactoryResolver, - private injector: Injector, @SkipSelf() private errorStateMatcher: ErrorStateMatcher, private widgetsService: WidgetService) { super(store, router, dialogRef); this.widgetsBundle = this.data.widgetsBundle; } - ngAfterViewInit(): void { - setTimeout(() => { - this.widgetsBundleComponent.entityForm.markAsDirty(); - }, 0); - } - isErrorState(control: UntypedFormControl | null, form: FormGroupDirective | NgForm | null): boolean { const originalErrorState = this.errorStateMatcher.isErrorState(control, form); const customErrorState = !!(control && control.invalid && this.submitted);