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 | 62 | import { AuthUser } from '@shared/models/user.model'; |
63 | 63 | import { getCurrentAuthState } from '@core/auth/auth.selectors'; |
64 | 64 | import { |
65 | + DatasourceType, | |
65 | 66 | Widget, |
66 | 67 | WidgetConfig, |
67 | 68 | WidgetInfo, |
... | ... | @@ -891,6 +892,10 @@ export class DashboardPageComponent extends PageComponent implements IDashboardC |
891 | 892 | const config: WidgetConfig = JSON.parse(widgetTypeInfo.defaultConfig); |
892 | 893 | config.title = 'New ' + widgetTypeInfo.widgetName; |
893 | 894 | config.datasources = []; |
895 | + config.alarmSource = { | |
896 | + type: DatasourceType.entity, | |
897 | + dataKeys: config.alarmSource.dataKeys | |
898 | + }; | |
894 | 899 | const newWidget: Widget = { |
895 | 900 | isSystemType: widget.isSystemType, |
896 | 901 | bundleAlias: widget.bundleAlias, | ... | ... |
... | ... | @@ -263,15 +263,6 @@ |
263 | 263 | </mat-select> |
264 | 264 | </mat-form-field> |
265 | 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 | 266 | <ng-template [ngSwitchCase]="datasourceType.entity"> |
276 | 267 | <tb-entity-alias-select |
277 | 268 | [showLabel]="true" | ... | ... |
... | ... | @@ -526,7 +526,6 @@ export class WidgetConfigComponent extends PageComponent implements OnInit, Cont |
526 | 526 | const datasourceFormGroup = this.fb.group( |
527 | 527 | { |
528 | 528 | type: [datasource ? datasource.type : null, [Validators.required]], |
529 | - name: [datasource ? datasource.name : null, []], | |
530 | 529 | entityAliasId: [datasource ? datasource.entityAliasId : null, |
531 | 530 | datasource && (datasource.type === DatasourceType.entity || |
532 | 531 | datasource.type === DatasourceType.entityCount) ? [Validators.required] : []], | ... | ... |