Browse Source

UI: Remove _hash from dataKey configs

pull/13690/head
Vladyslav_Prykhodko 1 year ago
parent
commit
6cc83e4c5c
  1. 18
      ui-ngx/src/app/core/api/widget-subscription.ts
  2. 7
      ui-ngx/src/app/core/services/utils.service.ts
  3. 1
      ui-ngx/src/app/modules/home/components/attribute/attribute-table.component.ts
  4. 1
      ui-ngx/src/app/modules/home/components/widget/lib/flot-widget.ts
  5. 1
      ui-ngx/src/app/modules/home/components/widget/lib/maps-legacy/providers/image-map.ts
  6. 2
      ui-ngx/src/app/modules/home/components/widget/widget-config.component.ts
  7. 1
      ui-ngx/src/app/shared/models/widget.models.ts

18
ui-ngx/src/app/core/api/widget-subscription.ts

@ -1456,20 +1456,18 @@ export class WidgetSubscription implements IWidgetSubscription {
this.datasources.forEach((datasource) => { this.datasources.forEach((datasource) => {
datasource.dataKeys.forEach((dataKey) => { datasource.dataKeys.forEach((dataKey) => {
if (datasource.generated || datasource.isAdditional) { if (datasource.generated || datasource.isAdditional) {
dataKey._hash = Math.random();
dataKey.color = this.ctx.utils.getMaterialColor(index); dataKey.color = this.ctx.utils.getMaterialColor(index);
} }
index++; index++;
}); });
if (datasource.latestDataKeys) { // if (datasource.latestDataKeys) {
datasource.latestDataKeys.forEach((dataKey) => { // datasource.latestDataKeys.forEach((dataKey) => {
if (datasource.generated || datasource.isAdditional) { // if (datasource.generated || datasource.isAdditional) {
dataKey._hash = Math.random(); // // dataKey.color = this.ctx.utils.getMaterialColor(index);
// dataKey.color = this.ctx.utils.getMaterialColor(index); // }
} // // index++;
// index++; // });
}); // }
}
}); });
if (this.comparisonEnabled) { if (this.comparisonEnabled) {
this.datasourcePages.forEach(datasourcePage => { this.datasourcePages.forEach(datasourcePage => {

7
ui-ngx/src/app/core/services/utils.service.ts

@ -97,7 +97,6 @@ export class UtilsService {
color: this.getMaterialColor(0), color: this.getMaterialColor(0),
funcBody: this.getPredefinedFunctionBody('Sin'), funcBody: this.getPredefinedFunctionBody('Sin'),
settings: {}, settings: {},
_hash: Math.random()
}; };
defaultDatasource: Datasource = { defaultDatasource: Datasource = {
@ -153,8 +152,7 @@ export class UtilsService {
type: DataKeyType.alarm, type: DataKeyType.alarm,
label: this.translate.instant(alarmFields[name].name), label: this.translate.instant(alarmFields[name].name),
color: this.getMaterialColor(i), color: this.getMaterialColor(i),
settings: {}, settings: {}
_hash: Math.random()
}; };
this.defaultAlarmDataKeys.push(dataKey); this.defaultAlarmDataKeys.push(dataKey);
} }
@ -267,8 +265,7 @@ export class UtilsService {
type, type,
label, label,
funcBody: keyInfo.funcBody, funcBody: keyInfo.funcBody,
settings: {}, settings: {}
_hash: Math.random()
}; };
if (keyInfo.units) { if (keyInfo.units) {
dataKey.units = keyInfo.units; dataKey.units = keyInfo.units;

1
ui-ngx/src/app/modules/home/components/attribute/attribute-table.component.ts

@ -541,7 +541,6 @@ export class AttributeTableComponent extends PageComponent implements AfterViewI
type: dataKeyType, type: dataKeyType,
color: this.utils.getMaterialColor(i), color: this.utils.getMaterialColor(i),
settings: {}, settings: {},
_hash: Math.random()
}; };
this.widgetDatasource.dataKeys.push(dataKey); this.widgetDatasource.dataKeys.push(dataKey);
} }

1
ui-ngx/src/app/modules/home/components/widget/lib/flot-widget.ts

@ -525,7 +525,6 @@ export class TbFlot {
lineWidth: threshold.lineWidth, lineWidth: threshold.lineWidth,
color: threshold.color color: threshold.color
} as TbFlotThresholdKeySettings, } as TbFlotThresholdKeySettings,
_hash: Math.random()
}; };
if (datasource) { if (datasource) {
datasource.dataKeys.push(dataKey); datasource.dataKeys.push(dataKey);

1
ui-ngx/src/app/modules/home/components/widget/lib/maps-legacy/providers/image-map.ts

@ -91,7 +91,6 @@ export class ImageMap extends LeafletMap {
name: imageUrlAttribute, name: imageUrlAttribute,
label: imageUrlAttribute, label: imageUrlAttribute,
settings: {}, settings: {},
_hash: Math.random()
} }
] ]
} }

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

@ -762,7 +762,6 @@ export class WidgetConfigComponent extends PageComponent implements OnInit, OnDe
public generateDataKey(chip: any, type: DataKeyType, dataKeySettingsForm: FormProperty[], public generateDataKey(chip: any, type: DataKeyType, dataKeySettingsForm: FormProperty[],
isLatestDataKey: boolean, dataKeySettingsFunction: DataKeySettingsFunction): DataKey { isLatestDataKey: boolean, dataKeySettingsFunction: DataKeySettingsFunction): DataKey {
if (isObject(chip)) { if (isObject(chip)) {
(chip as DataKey)._hash = Math.random();
return chip; return chip;
} else { } else {
let label: string = chip; let label: string = chip;
@ -780,7 +779,6 @@ export class WidgetConfigComponent extends PageComponent implements OnInit, OnDe
label, label,
color: this.genNextColor(), color: this.genNextColor(),
settings: {}, settings: {},
_hash: Math.random()
}; };
if (type === DataKeyType.function) { if (type === DataKeyType.function) {
result.name = 'f(x)'; result.name = 'f(x)';

1
ui-ngx/src/app/shared/models/widget.models.ts

@ -398,7 +398,6 @@ export interface DataKey extends KeyInfo {
inLegend?: boolean; inLegend?: boolean;
isAdditional?: boolean; isAdditional?: boolean;
origDataKeyIndex?: number; origDataKeyIndex?: number;
_hash?: number;
} }
export type CellClickColumnInfo = Pick<DataKey, 'name' | 'label'>; export type CellClickColumnInfo = Pick<DataKey, 'name' | 'label'>;

Loading…
Cancel
Save