Browse Source

UI: Allow creation of attributes and entity field keys for alarm datasource

pull/3089/head
Igor Kulikov 6 years ago
parent
commit
33eec47856
  1. 3
      ui-ngx/src/app/modules/home/components/widget/data-key-config.component.ts
  2. 4
      ui-ngx/src/app/modules/home/components/widget/data-keys.component.html
  3. 2
      ui-ngx/src/app/modules/home/components/widget/data-keys.component.ts

3
ui-ngx/src/app/modules/home/components/widget/data-key-config.component.ts

@ -187,6 +187,9 @@ export class DataKeyConfigComponent extends PageComponent implements OnInit, Con
if (this.displayAdvanced) {
this.modelValue.settings = this.dataKeySettingsFormGroup.get('settings').value.model;
}
if (this.modelValue.name) {
this.modelValue.name = this.modelValue.name.trim();
}
this.propagateChange(this.modelValue);
}

4
ui-ngx/src/app/modules/home/components/widget/data-keys.component.html

@ -139,14 +139,14 @@
<mat-icon (click)="createKey(searchText, dataKeyTypes.alarm)"
class="tb-mat-16">notifications</mat-icon>
</span>
<span *ngIf="widgetType == widgetTypes.latest"
<span *ngIf="widgetType == widgetTypes.latest || widgetType == widgetTypes.alarm"
matTooltip="{{'datakey.attributes' | translate }}"
matTooltipPosition="above">
<mat-icon (click)="createKey(searchText, dataKeyTypes.attribute)"
class="tb-mat-16"
svgIcon="alpha-a-circle-outline"></mat-icon>
</span>
<span *ngIf="widgetType == widgetTypes.latest"
<span *ngIf="widgetType == widgetTypes.latest || widgetType == widgetTypes.alarm"
matTooltip="{{'datakey.entity-field' | translate }}"
matTooltipPosition="above">
<mat-icon (click)="createKey(searchText, dataKeyTypes.entityField)"

2
ui-ngx/src/app/modules/home/components/widget/data-keys.component.ts

@ -398,7 +398,7 @@ export class DataKeysComponent implements ControlValueAccessor, OnInit, AfterVie
}
createKey(name: string, dataKeyType: DataKeyType = this.dataKeyType) {
this.addFromChipValue({name, type: dataKeyType});
this.addFromChipValue({name: name ? name.trim() : '', type: dataKeyType});
}
displayKeyFn(key?: DataKey): string | undefined {

Loading…
Cancel
Save