Commit 33eec47856f0582c01dfac06a5f1acd496e183ad

Authored by Igor Kulikov
1 parent 61785f55

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

... ... @@ -187,6 +187,9 @@ export class DataKeyConfigComponent extends PageComponent implements OnInit, Con
187 187 if (this.displayAdvanced) {
188 188 this.modelValue.settings = this.dataKeySettingsFormGroup.get('settings').value.model;
189 189 }
  190 + if (this.modelValue.name) {
  191 + this.modelValue.name = this.modelValue.name.trim();
  192 + }
190 193 this.propagateChange(this.modelValue);
191 194 }
192 195
... ...
... ... @@ -139,14 +139,14 @@
139 139 <mat-icon (click)="createKey(searchText, dataKeyTypes.alarm)"
140 140 class="tb-mat-16">notifications</mat-icon>
141 141 </span>
142   - <span *ngIf="widgetType == widgetTypes.latest"
  142 + <span *ngIf="widgetType == widgetTypes.latest || widgetType == widgetTypes.alarm"
143 143 matTooltip="{{'datakey.attributes' | translate }}"
144 144 matTooltipPosition="above">
145 145 <mat-icon (click)="createKey(searchText, dataKeyTypes.attribute)"
146 146 class="tb-mat-16"
147 147 svgIcon="alpha-a-circle-outline"></mat-icon>
148 148 </span>
149   - <span *ngIf="widgetType == widgetTypes.latest"
  149 + <span *ngIf="widgetType == widgetTypes.latest || widgetType == widgetTypes.alarm"
150 150 matTooltip="{{'datakey.entity-field' | translate }}"
151 151 matTooltipPosition="above">
152 152 <mat-icon (click)="createKey(searchText, dataKeyTypes.entityField)"
... ...
... ... @@ -398,7 +398,7 @@ export class DataKeysComponent implements ControlValueAccessor, OnInit, AfterVie
398 398 }
399 399
400 400 createKey(name: string, dataKeyType: DataKeyType = this.dataKeyType) {
401   - this.addFromChipValue({name, type: dataKeyType});
  401 + this.addFromChipValue({name: name ? name.trim() : '', type: dataKeyType});
402 402 }
403 403
404 404 displayKeyFn(key?: DataKey): string | undefined {
... ...