Commit 7a4493887a5077fd87baece8c99aa765566f72ae
1 parent
27081898
UI: Change default datasource type in alarm widget to created widget
Showing
3 changed files
with
5 additions
and
10 deletions
@@ -62,6 +62,7 @@ import { MediaBreakpoints } from '@shared/models/constants'; | @@ -62,6 +62,7 @@ import { MediaBreakpoints } from '@shared/models/constants'; | ||
62 | import { AuthUser } from '@shared/models/user.model'; | 62 | import { AuthUser } from '@shared/models/user.model'; |
63 | import { getCurrentAuthState } from '@core/auth/auth.selectors'; | 63 | import { getCurrentAuthState } from '@core/auth/auth.selectors'; |
64 | import { | 64 | import { |
65 | + DatasourceType, | ||
65 | Widget, | 66 | Widget, |
66 | WidgetConfig, | 67 | WidgetConfig, |
67 | WidgetInfo, | 68 | WidgetInfo, |
@@ -891,6 +892,10 @@ export class DashboardPageComponent extends PageComponent implements IDashboardC | @@ -891,6 +892,10 @@ export class DashboardPageComponent extends PageComponent implements IDashboardC | ||
891 | const config: WidgetConfig = JSON.parse(widgetTypeInfo.defaultConfig); | 892 | const config: WidgetConfig = JSON.parse(widgetTypeInfo.defaultConfig); |
892 | config.title = 'New ' + widgetTypeInfo.widgetName; | 893 | config.title = 'New ' + widgetTypeInfo.widgetName; |
893 | config.datasources = []; | 894 | config.datasources = []; |
895 | + config.alarmSource = { | ||
896 | + type: DatasourceType.entity, | ||
897 | + dataKeys: config.alarmSource.dataKeys | ||
898 | + }; | ||
894 | const newWidget: Widget = { | 899 | const newWidget: Widget = { |
895 | isSystemType: widget.isSystemType, | 900 | isSystemType: widget.isSystemType, |
896 | bundleAlias: widget.bundleAlias, | 901 | bundleAlias: widget.bundleAlias, |
@@ -263,15 +263,6 @@ | @@ -263,15 +263,6 @@ | ||
263 | </mat-select> | 263 | </mat-select> |
264 | </mat-form-field> | 264 | </mat-form-field> |
265 | <section class="tb-datasource" [ngSwitch]="alarmSourceSettings.get('type').value"> | 265 | <section class="tb-datasource" [ngSwitch]="alarmSourceSettings.get('type').value"> |
266 | - <ng-template [ngSwitchCase]="datasourceType.function"> | ||
267 | - <mat-form-field floatLabel="always" [fxShow]="widgetType !== widgetTypes.alarm" | ||
268 | - class="tb-datasource-name" style="min-width: 200px;"> | ||
269 | - <mat-label></mat-label> | ||
270 | - <input matInput | ||
271 | - placeholder="{{ 'datasource.name' | translate }}" | ||
272 | - formControlName="name"> | ||
273 | - </mat-form-field> | ||
274 | - </ng-template> | ||
275 | <ng-template [ngSwitchCase]="datasourceType.entity"> | 266 | <ng-template [ngSwitchCase]="datasourceType.entity"> |
276 | <tb-entity-alias-select | 267 | <tb-entity-alias-select |
277 | [showLabel]="true" | 268 | [showLabel]="true" |
@@ -526,7 +526,6 @@ export class WidgetConfigComponent extends PageComponent implements OnInit, Cont | @@ -526,7 +526,6 @@ export class WidgetConfigComponent extends PageComponent implements OnInit, Cont | ||
526 | const datasourceFormGroup = this.fb.group( | 526 | const datasourceFormGroup = this.fb.group( |
527 | { | 527 | { |
528 | type: [datasource ? datasource.type : null, [Validators.required]], | 528 | type: [datasource ? datasource.type : null, [Validators.required]], |
529 | - name: [datasource ? datasource.name : null, []], | ||
530 | entityAliasId: [datasource ? datasource.entityAliasId : null, | 529 | entityAliasId: [datasource ? datasource.entityAliasId : null, |
531 | datasource && (datasource.type === DatasourceType.entity || | 530 | datasource && (datasource.type === DatasourceType.entity || |
532 | datasource.type === DatasourceType.entityCount) ? [Validators.required] : []], | 531 | datasource.type === DatasourceType.entityCount) ? [Validators.required] : []], |