UI: Change default datasource type in alarm widget to created widget
This commit is contained in:
parent
270818989e
commit
7a4493887a
@ -62,6 +62,7 @@ import { MediaBreakpoints } from '@shared/models/constants';
|
|||||||
import { AuthUser } from '@shared/models/user.model';
|
import { AuthUser } from '@shared/models/user.model';
|
||||||
import { getCurrentAuthState } from '@core/auth/auth.selectors';
|
import { getCurrentAuthState } from '@core/auth/auth.selectors';
|
||||||
import {
|
import {
|
||||||
|
DatasourceType,
|
||||||
Widget,
|
Widget,
|
||||||
WidgetConfig,
|
WidgetConfig,
|
||||||
WidgetInfo,
|
WidgetInfo,
|
||||||
@ -891,6 +892,10 @@ export class DashboardPageComponent extends PageComponent implements IDashboardC
|
|||||||
const config: WidgetConfig = JSON.parse(widgetTypeInfo.defaultConfig);
|
const config: WidgetConfig = JSON.parse(widgetTypeInfo.defaultConfig);
|
||||||
config.title = 'New ' + widgetTypeInfo.widgetName;
|
config.title = 'New ' + widgetTypeInfo.widgetName;
|
||||||
config.datasources = [];
|
config.datasources = [];
|
||||||
|
config.alarmSource = {
|
||||||
|
type: DatasourceType.entity,
|
||||||
|
dataKeys: config.alarmSource.dataKeys
|
||||||
|
};
|
||||||
const newWidget: Widget = {
|
const newWidget: Widget = {
|
||||||
isSystemType: widget.isSystemType,
|
isSystemType: widget.isSystemType,
|
||||||
bundleAlias: widget.bundleAlias,
|
bundleAlias: widget.bundleAlias,
|
||||||
|
|||||||
@ -263,15 +263,6 @@
|
|||||||
</mat-select>
|
</mat-select>
|
||||||
</mat-form-field>
|
</mat-form-field>
|
||||||
<section class="tb-datasource" [ngSwitch]="alarmSourceSettings.get('type').value">
|
<section class="tb-datasource" [ngSwitch]="alarmSourceSettings.get('type').value">
|
||||||
<ng-template [ngSwitchCase]="datasourceType.function">
|
|
||||||
<mat-form-field floatLabel="always" [fxShow]="widgetType !== widgetTypes.alarm"
|
|
||||||
class="tb-datasource-name" style="min-width: 200px;">
|
|
||||||
<mat-label></mat-label>
|
|
||||||
<input matInput
|
|
||||||
placeholder="{{ 'datasource.name' | translate }}"
|
|
||||||
formControlName="name">
|
|
||||||
</mat-form-field>
|
|
||||||
</ng-template>
|
|
||||||
<ng-template [ngSwitchCase]="datasourceType.entity">
|
<ng-template [ngSwitchCase]="datasourceType.entity">
|
||||||
<tb-entity-alias-select
|
<tb-entity-alias-select
|
||||||
[showLabel]="true"
|
[showLabel]="true"
|
||||||
|
|||||||
@ -526,7 +526,6 @@ export class WidgetConfigComponent extends PageComponent implements OnInit, Cont
|
|||||||
const datasourceFormGroup = this.fb.group(
|
const datasourceFormGroup = this.fb.group(
|
||||||
{
|
{
|
||||||
type: [datasource ? datasource.type : null, [Validators.required]],
|
type: [datasource ? datasource.type : null, [Validators.required]],
|
||||||
name: [datasource ? datasource.name : null, []],
|
|
||||||
entityAliasId: [datasource ? datasource.entityAliasId : null,
|
entityAliasId: [datasource ? datasource.entityAliasId : null,
|
||||||
datasource && (datasource.type === DatasourceType.entity ||
|
datasource && (datasource.type === DatasourceType.entity ||
|
||||||
datasource.type === DatasourceType.entityCount) ? [Validators.required] : []],
|
datasource.type === DatasourceType.entityCount) ? [Validators.required] : []],
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user