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