Browse Source

UI: Show legend fieldset only in timeseries and latest widget

pull/5772/head
ArtemDzhereleiko 5 years ago
parent
commit
d7f4bd5436
  1. 12
      ui-ngx/src/app/modules/home/components/widget/legend.component.ts
  2. 2
      ui-ngx/src/app/modules/home/components/widget/widget-config.component.html
  3. 4
      ui-ngx/src/app/modules/home/components/widget/widget-config.component.ts

12
ui-ngx/src/app/modules/home/components/widget/legend.component.ts

@ -60,11 +60,13 @@ export class LegendComponent implements OnInit {
}
legendKeys(): LegendKey[] {
let keys = this.legendData.keys;
if (this.legendConfig.sortDataKeys) {
keys = this.legendData.keys.sort((key1, key2) => key1.dataKey.label.localeCompare(key2.dataKey.label));
}
return keys.filter(legendKey => this.legendData.keys[legendKey.dataIndex].dataKey.inLegend);
try {
let keys = this.legendData.keys;
if (this.legendConfig.sortDataKeys) {
keys = this.legendData.keys.sort((key1, key2) => key1.dataKey.label.localeCompare(key2.dataKey.label));
}
return keys.filter(legendKey => this.legendData.keys[legendKey.dataIndex].dataKey.inLegend);
} catch (e) {}
}
}

2
ui-ngx/src/app/modules/home/components/widget/widget-config.component.html

@ -421,7 +421,7 @@
</ng-template>
</mat-expansion-panel>
</fieldset>
<fieldset class="fields-group fields-group-slider">
<fieldset class="fields-group fields-group-slider" *ngIf="showLegendFieldset">
<legend class="group-title" translate>widget-config.legend</legend>
<mat-expansion-panel class="tb-settings">
<mat-expansion-panel-header fxLayout="row wrap">

4
ui-ngx/src/app/modules/home/components/widget/widget-config.component.ts

@ -159,6 +159,8 @@ export class WidgetConfigComponent extends PageComponent implements OnInit, Cont
modelValue: WidgetConfigComponentData;
showLegendFieldset = true;
private propagateChange = null;
public dataSettings: FormGroup;
@ -322,6 +324,8 @@ export class WidgetConfigComponent extends PageComponent implements OnInit, Cont
this.datasourceTypes.push(DatasourceType.entityCount);
}
}
this.showLegendFieldset = (this.widgetType === widgetType.timeseries || this.widgetType === widgetType.latest);
this.dataSettings = this.fb.group({});
this.targetDeviceSettings = this.fb.group({});
this.alarmSourceSettings = this.fb.group({});

Loading…
Cancel
Save