|
|
@ -14,7 +14,7 @@ |
|
|
/// limitations under the License.
|
|
|
/// limitations under the License.
|
|
|
///
|
|
|
///
|
|
|
|
|
|
|
|
|
import { Component, DestroyRef, Inject, OnInit, SkipSelf } from '@angular/core'; |
|
|
import { Component, DestroyRef, Inject, SkipSelf } from '@angular/core'; |
|
|
import { ErrorStateMatcher } from '@angular/material/core'; |
|
|
import { ErrorStateMatcher } from '@angular/material/core'; |
|
|
import { MAT_DIALOG_DATA, MatDialog, MatDialogRef } from '@angular/material/dialog'; |
|
|
import { MAT_DIALOG_DATA, MatDialog, MatDialogRef } from '@angular/material/dialog'; |
|
|
import { Store } from '@ngrx/store'; |
|
|
import { Store } from '@ngrx/store'; |
|
|
@ -60,7 +60,7 @@ export interface EntityAliasesDialogData { |
|
|
styleUrls: ['./entity-aliases-dialog.component.scss'] |
|
|
styleUrls: ['./entity-aliases-dialog.component.scss'] |
|
|
}) |
|
|
}) |
|
|
export class EntityAliasesDialogComponent extends DialogComponent<EntityAliasesDialogComponent, EntityAliases> |
|
|
export class EntityAliasesDialogComponent extends DialogComponent<EntityAliasesDialogComponent, EntityAliases> |
|
|
implements OnInit, ErrorStateMatcher { |
|
|
implements ErrorStateMatcher { |
|
|
|
|
|
|
|
|
title: string; |
|
|
title: string; |
|
|
disableAdd: boolean; |
|
|
disableAdd: boolean; |
|
|
@ -107,8 +107,7 @@ export class EntityAliasesDialogComponent extends DialogComponent<EntityAliasesD |
|
|
this.addWidgetTitleToWidgetsMap(widget.config.alarmSource.entityAliasId, widget.config.title); |
|
|
this.addWidgetTitleToWidgetsMap(widget.config.alarmSource.entityAliasId, widget.config.title); |
|
|
} |
|
|
} |
|
|
} else { |
|
|
} else { |
|
|
const datasources = this.dashboardUtils.validateAndUpdateDatasources(widget.config.datasources); |
|
|
this.dashboardUtils.getWidgetDatasources(widget).forEach((datasource) => { |
|
|
datasources.forEach((datasource) => { |
|
|
|
|
|
if ([DatasourceType.entity, DatasourceType.entityCount, DatasourceType.alarmCount].includes(datasource.type) |
|
|
if ([DatasourceType.entity, DatasourceType.entityCount, DatasourceType.alarmCount].includes(datasource.type) |
|
|
&& datasource.entityAliasId) { |
|
|
&& datasource.entityAliasId) { |
|
|
this.addWidgetTitleToWidgetsMap(datasource.entityAliasId, widget.config.title); |
|
|
this.addWidgetTitleToWidgetsMap(datasource.entityAliasId, widget.config.title); |
|
|
@ -143,7 +142,9 @@ export class EntityAliasesDialogComponent extends DialogComponent<EntityAliasesD |
|
|
widgetsTitleList = []; |
|
|
widgetsTitleList = []; |
|
|
this.aliasToWidgetsMap[aliasId] = widgetsTitleList; |
|
|
this.aliasToWidgetsMap[aliasId] = widgetsTitleList; |
|
|
} |
|
|
} |
|
|
widgetsTitleList.push(widgetTitle); |
|
|
if (!widgetsTitleList.includes(widgetTitle)) { |
|
|
|
|
|
widgetsTitleList.push(widgetTitle); |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
private createEntityAliasFormControl(aliasId: string, entityAlias: EntityAlias): AbstractControl { |
|
|
private createEntityAliasFormControl(aliasId: string, entityAlias: EntityAlias): AbstractControl { |
|
|
@ -166,9 +167,6 @@ export class EntityAliasesDialogComponent extends DialogComponent<EntityAliasesD |
|
|
return this.entityAliasesFormGroup.get('entityAliases') as UntypedFormArray; |
|
|
return this.entityAliasesFormGroup.get('entityAliases') as UntypedFormArray; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
ngOnInit(): void { |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
isErrorState(control: UntypedFormControl | null, form: FormGroupDirective | NgForm | null): boolean { |
|
|
isErrorState(control: UntypedFormControl | null, form: FormGroupDirective | NgForm | null): boolean { |
|
|
const originalErrorState = this.errorStateMatcher.isErrorState(control, form); |
|
|
const originalErrorState = this.errorStateMatcher.isErrorState(control, form); |
|
|
const customErrorState = !!(control && control.invalid && this.submitted); |
|
|
const customErrorState = !!(control && control.invalid && this.submitted); |
|
|
|