Merge pull request #5772 from ArtemDzhereleiko/bug-fix/show-hide-legend
[3.3.3] UI: Show legend fieldset only in timeseries and latest widget
This commit is contained in:
commit
4d27a69bce
@ -60,11 +60,13 @@ export class LegendComponent implements OnInit {
|
|||||||
}
|
}
|
||||||
|
|
||||||
legendKeys(): LegendKey[] {
|
legendKeys(): LegendKey[] {
|
||||||
let keys = this.legendData.keys;
|
try {
|
||||||
if (this.legendConfig.sortDataKeys) {
|
let keys = this.legendData.keys;
|
||||||
keys = this.legendData.keys.sort((key1, key2) => key1.dataKey.label.localeCompare(key2.dataKey.label));
|
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);
|
}
|
||||||
|
return keys.filter(legendKey => this.legendData.keys[legendKey.dataIndex].dataKey.inLegend);
|
||||||
|
} catch (e) {}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -425,7 +425,7 @@
|
|||||||
</ng-template>
|
</ng-template>
|
||||||
</mat-expansion-panel>
|
</mat-expansion-panel>
|
||||||
</fieldset>
|
</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>
|
<legend class="group-title" translate>widget-config.legend</legend>
|
||||||
<mat-expansion-panel class="tb-settings">
|
<mat-expansion-panel class="tb-settings">
|
||||||
<mat-expansion-panel-header fxLayout="row wrap">
|
<mat-expansion-panel-header fxLayout="row wrap">
|
||||||
|
|||||||
@ -159,6 +159,8 @@ export class WidgetConfigComponent extends PageComponent implements OnInit, Cont
|
|||||||
|
|
||||||
modelValue: WidgetConfigComponentData;
|
modelValue: WidgetConfigComponentData;
|
||||||
|
|
||||||
|
showLegendFieldset = true;
|
||||||
|
|
||||||
private propagateChange = null;
|
private propagateChange = null;
|
||||||
|
|
||||||
public dataSettings: FormGroup;
|
public dataSettings: FormGroup;
|
||||||
@ -323,6 +325,7 @@ export class WidgetConfigComponent extends PageComponent implements OnInit, Cont
|
|||||||
this.datasourceTypes.push(DatasourceType.entityCount);
|
this.datasourceTypes.push(DatasourceType.entityCount);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
this.dataSettings = this.fb.group({});
|
this.dataSettings = this.fb.group({});
|
||||||
this.targetDeviceSettings = this.fb.group({});
|
this.targetDeviceSettings = this.fb.group({});
|
||||||
this.alarmSourceSettings = this.fb.group({});
|
this.alarmSourceSettings = this.fb.group({});
|
||||||
@ -386,6 +389,7 @@ export class WidgetConfigComponent extends PageComponent implements OnInit, Cont
|
|||||||
if (this.modelValue) {
|
if (this.modelValue) {
|
||||||
if (this.widgetType !== this.modelValue.widgetType) {
|
if (this.widgetType !== this.modelValue.widgetType) {
|
||||||
this.widgetType = this.modelValue.widgetType;
|
this.widgetType = this.modelValue.widgetType;
|
||||||
|
this.showLegendFieldset = (this.widgetType === widgetType.timeseries || this.widgetType === widgetType.latest);
|
||||||
this.buildForms();
|
this.buildForms();
|
||||||
}
|
}
|
||||||
const config = this.modelValue.config;
|
const config = this.modelValue.config;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user