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[] {
|
||||
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) {}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -425,7 +425,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">
|
||||
|
||||
@ -159,6 +159,8 @@ export class WidgetConfigComponent extends PageComponent implements OnInit, Cont
|
||||
|
||||
modelValue: WidgetConfigComponentData;
|
||||
|
||||
showLegendFieldset = true;
|
||||
|
||||
private propagateChange = null;
|
||||
|
||||
public dataSettings: FormGroup;
|
||||
@ -323,6 +325,7 @@ export class WidgetConfigComponent extends PageComponent implements OnInit, Cont
|
||||
this.datasourceTypes.push(DatasourceType.entityCount);
|
||||
}
|
||||
}
|
||||
|
||||
this.dataSettings = this.fb.group({});
|
||||
this.targetDeviceSettings = 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.widgetType !== this.modelValue.widgetType) {
|
||||
this.widgetType = this.modelValue.widgetType;
|
||||
this.showLegendFieldset = (this.widgetType === widgetType.timeseries || this.widgetType === widgetType.latest);
|
||||
this.buildForms();
|
||||
}
|
||||
const config = this.modelValue.config;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user