Browse Source
Merge pull request #5772 from ArtemDzhereleiko/bug-fix/show-hide-legend
[3.3.3] UI: Show legend fieldset only in timeseries and latest widget
pull/5872/head
Igor Kulikov
5 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with
12 additions and
6 deletions
-
ui-ngx/src/app/modules/home/components/widget/legend.component.ts
-
ui-ngx/src/app/modules/home/components/widget/widget-config.component.html
-
ui-ngx/src/app/modules/home/components/widget/widget-config.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) {} |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
@ -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; |
|
|
|
|