Browse Source

Merge remote-tracking branch 'refs/remotes/origin/feature/alarm-rules-api' into feature/alarm-rules-api

pull/15326/head
Viacheslav Klimov 6 months ago
parent
commit
572d2b5019
Failed to extract signature
  1. 20
      ui-ngx/src/app/core/http/alarm-rules.service.ts
  2. 18
      ui-ngx/src/app/modules/home/components/alarm-rules/alarm-rule-dialog.component.ts
  3. 23
      ui-ngx/src/app/modules/home/components/alarm-rules/alarm-rules-table-config.ts
  4. 35
      ui-ngx/src/app/modules/home/components/alarm-rules/alarm-rules.component.ts
  5. 13
      ui-ngx/src/app/modules/home/pages/alarm/alarm-rules-tabs.component.ts
  6. 6
      ui-ngx/src/app/shared/models/calculated-field.models.ts

20
ui-ngx/src/app/core/http/alarm-rules.service.ts

@ -20,8 +20,8 @@ import { Observable } from 'rxjs';
import { HttpClient } from '@angular/common/http'; import { HttpClient } from '@angular/common/http';
import { PageData } from '@shared/models/page/page-data'; import { PageData } from '@shared/models/page/page-data';
import { import {
CalculatedField, CalculatedFieldAlarmRule,
CalculatedFieldInfo, CalculatedFieldAlarmRuleInfo,
CalculatedFieldsQuery, CalculatedFieldsQuery,
CalculatedFieldTestScriptInputParams CalculatedFieldTestScriptInputParams
} from '@shared/models/calculated-field.models'; } from '@shared/models/calculated-field.models';
@ -39,24 +39,24 @@ export class AlarmRulesService {
private http: HttpClient private http: HttpClient
) { } ) { }
public getAlarmRuleById(alarmRuleId: string, config?: RequestConfig): Observable<CalculatedField> { public getAlarmRuleById(alarmRuleId: string, config?: RequestConfig): Observable<CalculatedFieldAlarmRule> {
return this.http.get<CalculatedField>(`/api/alarm/rule/${alarmRuleId}`, defaultHttpOptionsFromConfig(config)); return this.http.get<CalculatedFieldAlarmRule>(`/api/alarm/rule/${alarmRuleId}`, defaultHttpOptionsFromConfig(config));
} }
public saveAlarmRule(alarmRule: CalculatedField, config?: RequestConfig): Observable<CalculatedField> { public saveAlarmRule(alarmRule: CalculatedFieldAlarmRule, config?: RequestConfig): Observable<CalculatedFieldAlarmRule> {
return this.http.post<CalculatedField>('/api/alarm/rule', alarmRule, defaultHttpOptionsFromConfig(config)); return this.http.post<CalculatedFieldAlarmRule>('/api/alarm/rule', alarmRule, defaultHttpOptionsFromConfig(config));
} }
public deleteAlarmRule(alarmRuleId: string, config?: RequestConfig): Observable<boolean> { public deleteAlarmRule(alarmRuleId: string, config?: RequestConfig): Observable<boolean> {
return this.http.delete<boolean>(`/api/alarm/rule/${alarmRuleId}`, defaultHttpOptionsFromConfig(config)); return this.http.delete<boolean>(`/api/alarm/rule/${alarmRuleId}`, defaultHttpOptionsFromConfig(config));
} }
public getAlarmRules(pageLink: PageLink, query: CalculatedFieldsQuery, config?: RequestConfig): Observable<PageData<CalculatedFieldInfo>> { public getAlarmRules(pageLink: PageLink, query: CalculatedFieldsQuery, config?: RequestConfig): Observable<PageData<CalculatedFieldAlarmRuleInfo>> {
return this.http.get<PageData<CalculatedFieldInfo>>(`/api/alarm/rules${pageLink.toQuery()}`, defaultHttpOptionsFromParams(query, config)); return this.http.get<PageData<CalculatedFieldAlarmRuleInfo>>(`/api/alarm/rules${pageLink.toQuery()}`, defaultHttpOptionsFromParams(query, config));
} }
public getAlarmRulesByEntityId({ entityType, id }: EntityId, pageLink: PageLink, config?: RequestConfig): Observable<PageData<CalculatedField>> { public getAlarmRulesByEntityId({ entityType, id }: EntityId, pageLink: PageLink, config?: RequestConfig): Observable<PageData<CalculatedFieldAlarmRule>> {
return this.http.get<PageData<CalculatedField>>(`/api/alarm/rules/${entityType}/${id}${pageLink.toQuery()}`, defaultHttpOptionsFromConfig(config)); return this.http.get<PageData<CalculatedFieldAlarmRule>>(`/api/alarm/rules/${entityType}/${id}${pageLink.toQuery()}`, defaultHttpOptionsFromConfig(config));
} }
public testScript(inputParams: CalculatedFieldTestScriptInputParams, config?: RequestConfig): Observable<EntityTestScriptResult> { public testScript(inputParams: CalculatedFieldTestScriptInputParams, config?: RequestConfig): Observable<EntityTestScriptResult> {

18
ui-ngx/src/app/modules/home/components/alarm-rules/alarm-rule-dialog.component.ts

@ -21,7 +21,11 @@ import { AppState } from '@core/core.state';
import { FormGroup } from '@angular/forms'; import { FormGroup } from '@angular/forms';
import { Router } from '@angular/router'; import { Router } from '@angular/router';
import { DialogComponent } from '@shared/components/dialog.component'; import { DialogComponent } from '@shared/components/dialog.component';
import { CalculatedField, CalculatedFieldArgument, CalculatedFieldType } from '@shared/models/calculated-field.models'; import {
CalculatedFieldAlarmRule,
CalculatedFieldArgument,
CalculatedFieldType
} from '@shared/models/calculated-field.models';
import { EntityType, entityTypeTranslations } from '@shared/models/entity-type.models'; import { EntityType, entityTypeTranslations } from '@shared/models/entity-type.models';
import { takeUntilDestroyed } from '@angular/core/rxjs-interop'; import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
import { ScriptLanguage } from '@shared/models/rule-node.models'; import { ScriptLanguage } from '@shared/models/rule-node.models';
@ -49,13 +53,13 @@ import { AssetInfo } from '@shared/models/asset.models';
import { DeviceInfo } from '@shared/models/device.models'; import { DeviceInfo } from '@shared/models/device.models';
export interface AlarmRuleDialogData { export interface AlarmRuleDialogData {
value?: CalculatedField; value?: CalculatedFieldAlarmRule;
buttonTitle: string; buttonTitle: string;
entityId: EntityId; entityId: EntityId;
tenantId: string; tenantId: string;
entityName?: string; entityName?: string;
ownerId: EntityId; ownerId: EntityId;
additionalDebugActionConfig: AdditionalDebugActionConfig<(calculatedField: CalculatedField) => void>; additionalDebugActionConfig: AdditionalDebugActionConfig<(calculatedField: CalculatedFieldAlarmRule) => void>;
isDirty?: boolean; isDirty?: boolean;
getTestScriptDialogFn: AlarmRuleTestScriptFn, getTestScriptDialogFn: AlarmRuleTestScriptFn,
} }
@ -67,7 +71,7 @@ export interface AlarmRuleDialogData {
encapsulation: ViewEncapsulation.None, encapsulation: ViewEncapsulation.None,
standalone: false standalone: false
}) })
export class AlarmRuleDialogComponent extends DialogComponent<AlarmRuleDialogComponent, CalculatedField> { export class AlarmRuleDialogComponent extends DialogComponent<AlarmRuleDialogComponent, CalculatedFieldAlarmRule> {
@ViewChild('entitySelect') entitySelect!: EntitySelectComponent; @ViewChild('entitySelect') entitySelect!: EntitySelectComponent;
@ -96,7 +100,7 @@ export class AlarmRuleDialogComponent extends DialogComponent<AlarmRuleDialogCom
constructor(protected store: Store<AppState>, constructor(protected store: Store<AppState>,
protected router: Router, protected router: Router,
@Inject(MAT_DIALOG_DATA) public data: AlarmRuleDialogData, @Inject(MAT_DIALOG_DATA) public data: AlarmRuleDialogData,
protected dialogRef: MatDialogRef<AlarmRuleDialogComponent, CalculatedField>, protected dialogRef: MatDialogRef<AlarmRuleDialogComponent, CalculatedFieldAlarmRule>,
private alarmRulesService: AlarmRulesService, private alarmRulesService: AlarmRulesService,
private destroyRef: DestroyRef, private destroyRef: DestroyRef,
private cfFormService: CalculatedFieldFormService) { private cfFormService: CalculatedFieldFormService) {
@ -159,8 +163,8 @@ export class AlarmRuleDialogComponent extends DialogComponent<AlarmRuleDialogCom
this.configFormGroup.patchValue({clearRule: clearAlarmRule}); this.configFormGroup.patchValue({clearRule: clearAlarmRule});
} }
get fromGroupValue(): CalculatedField { get fromGroupValue(): CalculatedFieldAlarmRule {
return deepTrim(this.fieldFormGroup.value as CalculatedField); return deepTrim(this.fieldFormGroup.value as CalculatedFieldAlarmRule);
} }
cancel(): void { cancel(): void {

23
ui-ngx/src/app/modules/home/components/alarm-rules/alarm-rules-table-config.ts

@ -21,7 +21,7 @@ import {
EntityTableColumn, EntityTableColumn,
EntityTableConfig EntityTableConfig
} from '@home/models/entity/entities-table-config.models'; } from '@home/models/entity/entities-table-config.models';
import { EntityType, entityTypeResources, entityTypeTranslations } from '@shared/models/entity-type.models'; import { EntityType, entityTypeTranslations } from '@shared/models/entity-type.models';
import { TranslateService } from '@ngx-translate/core'; import { TranslateService } from '@ngx-translate/core';
import { Direction } from '@shared/models/page/sort-order'; import { Direction } from '@shared/models/page/sort-order';
import { MatDialog } from '@angular/material/dialog'; import { MatDialog } from '@angular/material/dialog';
@ -40,10 +40,9 @@ import { catchError, filter, first, switchMap, tap } from 'rxjs/operators';
import { import {
ArgumentEntityType, ArgumentEntityType,
ArgumentType, ArgumentType,
CalculatedField,
CalculatedFieldAlarmRule, CalculatedFieldAlarmRule,
CalculatedFieldAlarmRuleInfo,
CalculatedFieldEventArguments, CalculatedFieldEventArguments,
CalculatedFieldInfo,
CalculatedFieldsQuery, CalculatedFieldsQuery,
CalculatedFieldType, CalculatedFieldType,
getCalculatedFieldArgumentsEditorCompleter, getCalculatedFieldArgumentsEditorCompleter,
@ -72,7 +71,7 @@ import { Router } from '@angular/router';
import { EntityAction } from '@home/models/entity/entity-component.models'; import { EntityAction } from '@home/models/entity/entity-component.models';
import { AlarmRulesComponent } from '@home/components/alarm-rules/alarm-rules.component'; import { AlarmRulesComponent } from '@home/components/alarm-rules/alarm-rules.component';
type AlarmRuleTableEntity = CalculatedField | CalculatedFieldInfo; export type AlarmRuleTableEntity = CalculatedFieldAlarmRule | CalculatedFieldAlarmRuleInfo;
export class AlarmRulesTableConfig extends EntityTableConfig<AlarmRuleTableEntity> { export class AlarmRulesTableConfig extends EntityTableConfig<AlarmRuleTableEntity> {
@ -159,9 +158,9 @@ export class AlarmRulesTableConfig extends EntityTableConfig<AlarmRuleTableEntit
this.columns.push(new EntityTableColumn<CalculatedFieldAlarmRule>('name', 'alarm-rule.alarm-type', '33%', this.columns.push(new EntityTableColumn<CalculatedFieldAlarmRule>('name', 'alarm-rule.alarm-type', '33%',
entity => this.utilsService.customTranslation(entity.name, entity.name))); entity => this.utilsService.customTranslation(entity.name, entity.name)));
if (this.pageMode) { if (this.pageMode) {
this.columns.push(new EntityTableColumn<CalculatedFieldInfo>('entityType', 'entity.entity-type', '10%', this.columns.push(new EntityTableColumn<CalculatedFieldAlarmRuleInfo>('entityType', 'entity.entity-type', '10%',
entity => this.translate.instant(entityTypeTranslations.get(entity.entityId.entityType).type))); entity => this.translate.instant(entityTypeTranslations.get(entity.entityId.entityType).type)));
this.columns.push(new EntityLinkTableColumn<CalculatedFieldInfo>('entityName', 'entity.entity', '33%', this.columns.push(new EntityLinkTableColumn<CalculatedFieldAlarmRuleInfo>('entityName', 'entity.entity', '33%',
entity => this.utilsService.customTranslation(entity.entityName, entity.entityName), entity => this.utilsService.customTranslation(entity.entityName, entity.entityName),
entity => getEntityDetailsPageURL(entity.entityId?.id, entity.entityId?.entityType as EntityType), false)); entity => getEntityDetailsPageURL(entity.entityId?.id, entity.entityId?.entityType as EntityType), false));
} }
@ -260,7 +259,7 @@ export class AlarmRulesTableConfig extends EntityTableConfig<AlarmRuleTableEntit
const copyCalculatedAlarmRule = deepClone(calculatedField); const copyCalculatedAlarmRule = deepClone(calculatedField);
if (this.pageMode) { if (this.pageMode) {
copyCalculatedAlarmRule.entityId = null; copyCalculatedAlarmRule.entityId = null;
delete (copyCalculatedAlarmRule as CalculatedFieldInfo).entityName; delete (copyCalculatedAlarmRule as CalculatedFieldAlarmRuleInfo).entityName;
} }
delete copyCalculatedAlarmRule.id; delete copyCalculatedAlarmRule.id;
this.getCalculatedAlarmDialog(copyCalculatedAlarmRule, 'action.apply', isDirty) this.getCalculatedAlarmDialog(copyCalculatedAlarmRule, 'action.apply', isDirty)
@ -271,10 +270,10 @@ export class AlarmRulesTableConfig extends EntityTableConfig<AlarmRuleTableEntit
}); });
} }
private getCalculatedAlarmDialog(value?: AlarmRuleTableEntity, buttonTitle = 'action.add', isDirty = false): Observable<CalculatedField> { private getCalculatedAlarmDialog(value?: AlarmRuleTableEntity, buttonTitle = 'action.add', isDirty = false): Observable<CalculatedFieldAlarmRule> {
const entityId = this.entityId || value?.entityId; const entityId = this.entityId || value?.entityId;
const entityName = this.entityName || (value as CalculatedFieldInfo)?.entityName; const entityName = this.entityName || (value as CalculatedFieldAlarmRuleInfo)?.entityName;
return this.dialog.open<AlarmRuleDialogComponent, AlarmRuleDialogData, CalculatedField>(AlarmRuleDialogComponent, { return this.dialog.open<AlarmRuleDialogComponent, AlarmRuleDialogData, CalculatedFieldAlarmRule>(AlarmRuleDialogComponent, {
disableClose: true, disableClose: true,
panelClass: ['tb-dialog', 'tb-fullscreen-dialog'], panelClass: ['tb-dialog', 'tb-fullscreen-dialog'],
data: { data: {
@ -360,7 +359,7 @@ export class AlarmRulesTableConfig extends EntityTableConfig<AlarmRuleTableEntit
.subscribe(() => this.updateData()); .subscribe(() => this.updateData());
} }
private updateImportedCalculatedField(calculatedField: CalculatedField): CalculatedField { private updateImportedCalculatedField(calculatedField: CalculatedFieldAlarmRule): CalculatedFieldAlarmRule {
if (calculatedField.type === CalculatedFieldType.ALARM) { if (calculatedField.type === CalculatedFieldType.ALARM) {
calculatedField.configuration.arguments = Object.keys(calculatedField.configuration.arguments).reduce((acc, key) => { calculatedField.configuration.arguments = Object.keys(calculatedField.configuration.arguments).reduce((acc, key) => {
const arg = calculatedField.configuration.arguments[key]; const arg = calculatedField.configuration.arguments[key];
@ -382,7 +381,7 @@ export class AlarmRulesTableConfig extends EntityTableConfig<AlarmRuleTableEntit
).subscribe(() => this.updateData()); ).subscribe(() => this.updateData());
} }
private getTestScriptDialog(calculatedField: AlarmRuleTableEntity, argumentsObj?: CalculatedFieldEventArguments, openCalculatedFieldEdit = true, expression?: string): Observable<string> { getTestScriptDialog(calculatedField: AlarmRuleTableEntity, argumentsObj?: CalculatedFieldEventArguments, openCalculatedFieldEdit = true, expression?: string): Observable<string> {
if (calculatedField.type === CalculatedFieldType.ALARM) { if (calculatedField.type === CalculatedFieldType.ALARM) {
const resultArguments = Object.keys(calculatedField.configuration.arguments).reduce((acc, key) => { const resultArguments = Object.keys(calculatedField.configuration.arguments).reduce((acc, key) => {
const type = calculatedField.configuration.arguments[key].refEntityKey.type; const type = calculatedField.configuration.arguments[key].refEntityKey.type;

35
ui-ngx/src/app/modules/home/components/alarm-rules/alarm-rules.component.ts

@ -22,19 +22,19 @@ import { FormBuilder, FormGroup } from '@angular/forms';
import { EntityType } from '@shared/models/entity-type.models'; import { EntityType } from '@shared/models/entity-type.models';
import { TranslateService } from '@ngx-translate/core'; import { TranslateService } from '@ngx-translate/core';
import { import {
CalculatedFieldAlarmRuleConfiguration,
CalculatedFieldAlarmRuleInfo,
CalculatedFieldArgument, CalculatedFieldArgument,
CalculatedFieldConfiguration,
CalculatedFieldInfo,
CalculatedFieldType CalculatedFieldType
} from '@shared/models/calculated-field.models'; } from '@shared/models/calculated-field.models';
import { EntityId } from '@shared/models/id/entity-id'; import { EntityId } from '@shared/models/id/entity-id';
import { BaseData } from '@shared/models/base-data'; import { BaseData } from '@shared/models/base-data';
import { Observable } from 'rxjs'; import { Observable } from 'rxjs';
import { getCurrentAuthUser } from '@core/auth/auth.selectors'; import { getCurrentAuthUser } from '@core/auth/auth.selectors';
import { import type {
CalculatedFieldsTableConfig, AlarmRulesTableConfig,
CalculatedFieldsTableEntity AlarmRuleTableEntity
} from '@home/components/calculated-fields/calculated-fields-table-config'; } from '@home/components/alarm-rules/alarm-rules-table-config';
import { TenantId } from '@shared/models/id/tenant-id'; import { TenantId } from '@shared/models/id/tenant-id';
import { StringItemsOption } from '@shared/components/string-items-list.component'; import { StringItemsOption } from '@shared/components/string-items-list.component';
import { RelationTypes } from '@shared/models/relation.models'; import { RelationTypes } from '@shared/models/relation.models';
@ -56,7 +56,7 @@ import { EntityService } from '@core/http/entity.service';
styleUrls: ['./alarm-rule-dialog.component.scss'], styleUrls: ['./alarm-rule-dialog.component.scss'],
standalone: false standalone: false
}) })
export class AlarmRulesComponent extends EntityComponent<CalculatedFieldsTableEntity> { export class AlarmRulesComponent extends EntityComponent<AlarmRuleTableEntity> {
@Input() @Input()
standalone = false; standalone = false;
@ -75,8 +75,8 @@ export class AlarmRulesComponent extends EntityComponent<CalculatedFieldsTableEn
constructor(protected store: Store<AppState>, constructor(protected store: Store<AppState>,
protected translate: TranslateService, protected translate: TranslateService,
@Inject('entity') protected entityValue: CalculatedFieldInfo, @Inject('entity') protected entityValue: CalculatedFieldAlarmRuleInfo,
@Inject('entitiesTableConfig') protected entitiesTableConfigValue: CalculatedFieldsTableConfig, @Inject('entitiesTableConfig') protected entitiesTableConfigValue: AlarmRulesTableConfig,
protected fb: FormBuilder, protected fb: FormBuilder,
protected cd: ChangeDetectorRef, protected cd: ChangeDetectorRef,
private entityService: EntityService) { private entityService: EntityService) {
@ -93,21 +93,14 @@ export class AlarmRulesComponent extends EntityComponent<CalculatedFieldsTableEn
additionalDebugActionConfig = { additionalDebugActionConfig = {
...this.entitiesTableConfig.additionalDebugActionConfig, ...this.entitiesTableConfig.additionalDebugActionConfig,
action: () => this.entitiesTableConfig.additionalDebugActionConfig.action( action: () => this.entitiesTableConfig.additionalDebugActionConfig.action({id: this.entity.id, ...this.entityFormValue()})
{ id: this.entity.id, ...this.entityFormValue() }, false,
(expression) => {
if (expression) {
this.entityForm.get('configuration').setValue({...this.entityFormValue().configuration, expression});
this.entityForm.get('configuration').markAsDirty();
}
}),
}; };
get entityId(): EntityId { get entityId(): EntityId {
return this.entityForm.get('entityId').value; return this.entityForm.get('entityId').value;
} }
get entitiesTableConfig(): CalculatedFieldsTableConfig { get entitiesTableConfig(): AlarmRulesTableConfig {
return this.entitiesTableConfigValue; return this.entitiesTableConfigValue;
} }
@ -115,12 +108,12 @@ export class AlarmRulesComponent extends EntityComponent<CalculatedFieldsTableEn
this.entityName = entity?.name; this.entityName = entity?.name;
} }
buildForm(_entity?: CalculatedFieldInfo): FormGroup { buildForm(_entity?: CalculatedFieldAlarmRuleInfo): FormGroup {
return inject(CalculatedFieldFormService).buildAlarmRuleForm(); return inject(CalculatedFieldFormService).buildAlarmRuleForm();
} }
updateForm(entity: CalculatedFieldInfo) { updateForm(entity: CalculatedFieldAlarmRuleInfo) {
const { configuration = {} as CalculatedFieldConfiguration, type = CalculatedFieldType.ALARM, debugSettings = { failuresEnabled: true, allEnabled: true }, entityId = this.entityId, ...value } = entity ?? {}; const { configuration = {} as CalculatedFieldAlarmRuleConfiguration, type = CalculatedFieldType.ALARM, debugSettings = { failuresEnabled: true, allEnabled: true }, entityId = this.entityId, ...value } = entity ?? {};
this.entityForm.patchValue({ configuration, debugSettings, entityId, ...value }, {emitEvent: false}); this.entityForm.patchValue({ configuration, debugSettings, entityId, ...value }, {emitEvent: false});
if (!entityId) { if (!entityId) {
this.entityForm.get('configuration').disable({emitEvent: false}); this.entityForm.get('configuration').disable({emitEvent: false});

13
ui-ngx/src/app/modules/home/pages/alarm/alarm-rules-tabs.component.ts

@ -18,9 +18,9 @@ import { Component } from '@angular/core';
import { EntityTabsComponent } from '../../components/entity/entity-tabs.component'; import { EntityTabsComponent } from '../../components/entity/entity-tabs.component';
import { CalculatedFieldEventBody, DebugEventType, EventType } from '@shared/models/event.models'; import { CalculatedFieldEventBody, DebugEventType, EventType } from '@shared/models/event.models';
import type { import type {
CalculatedFieldsTableConfig, AlarmRulesTableConfig,
CalculatedFieldsTableEntity AlarmRuleTableEntity
} from '@home/components/calculated-fields/calculated-fields-table-config'; } from '@home/components/alarm-rules/alarm-rules-table-config';
import { debugCfActionEnabled } from '@shared/models/calculated-field.models'; import { debugCfActionEnabled } from '@shared/models/calculated-field.models';
@Component({ @Component({
@ -29,7 +29,7 @@ import { debugCfActionEnabled } from '@shared/models/calculated-field.models';
styleUrls: [], styleUrls: [],
standalone: false standalone: false
}) })
export class AlarmRulesTabsComponent extends EntityTabsComponent<CalculatedFieldsTableEntity> { export class AlarmRulesTabsComponent extends EntityTabsComponent<AlarmRuleTableEntity> {
readonly DebugEventType = DebugEventType; readonly DebugEventType = DebugEventType;
readonly EventType = EventType; readonly EventType = EventType;
@ -43,8 +43,7 @@ export class AlarmRulesTabsComponent extends EntityTabsComponent<CalculatedField
}; };
onDebugEventSelected(event: CalculatedFieldEventBody) { onDebugEventSelected(event: CalculatedFieldEventBody) {
(this.entitiesTableConfig as CalculatedFieldsTableConfig).getTestScriptDialog(this.entity, JSON.parse(event.arguments)) (this.entitiesTableConfig as AlarmRulesTableConfig).getTestScriptDialog(this.entity, JSON.parse(event.arguments))
.subscribe((expression) => { .subscribe((_expression) => { });
});
}; };
} }

6
ui-ngx/src/app/shared/models/calculated-field.models.ts

@ -80,7 +80,9 @@ export type CalculatedField =
| CalculatedFieldRelatedEntityAggregation | CalculatedFieldRelatedEntityAggregation
| CalculatedFieldAlarmRule; | CalculatedFieldAlarmRule;
export type CalculatedFieldInfo = CalculatedField & {entityName: string}; export type WithCalculatedFieldInfo<T> = T & {entityName: string};
export type CalculatedFieldInfo = WithCalculatedFieldInfo<CalculatedField>;
export type CalculatedFieldAlarmRuleInfo = WithCalculatedFieldInfo<CalculatedFieldAlarmRule>;
export enum CalculatedFieldType { export enum CalculatedFieldType {
SIMPLE = 'SIMPLE', SIMPLE = 'SIMPLE',
@ -192,7 +194,7 @@ interface BasePropagationConfiguration {
output: CalculatedFieldOutput; output: CalculatedFieldOutput;
} }
interface CalculatedFieldAlarmRuleConfiguration { export interface CalculatedFieldAlarmRuleConfiguration {
type: CalculatedFieldType.ALARM; type: CalculatedFieldType.ALARM;
arguments: Record<string, CalculatedFieldArgument>; arguments: Record<string, CalculatedFieldArgument>;
createRules: Record<AlarmSeverity, AlarmRule>; createRules: Record<AlarmSeverity, AlarmRule>;

Loading…
Cancel
Save