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) => {
datasource.dataKeys.forEach((dataKey) => {
if (datasource.generated || datasource.isAdditional) {
dataKey._hash = Math.random();
dataKey.color = this.ctx.utils.getMaterialColor(index);
}
index++;
});
if (datasource.latestDataKeys) {
datasource.latestDataKeys.forEach((dataKey) => {
if (datasource.generated || datasource.isAdditional) {
dataKey._hash = Math.random();
// dataKey.color = this.ctx.utils.getMaterialColor(index);
}
// index++;
});
}
// if (datasource.latestDataKeys) {
// datasource.latestDataKeys.forEach((dataKey) => {
// if (datasource.generated || datasource.isAdditional) {
// // dataKey.color = this.ctx.utils.getMaterialColor(index);
// }
// // index++;
// });
// }
});
if (this.comparisonEnabled) {
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),
funcBody: this.getPredefinedFunctionBody('Sin'),
settings: {},
_hash: Math.random()
};
defaultDatasource: Datasource = {
@ -153,8 +152,7 @@ export class UtilsService {
type: DataKeyType.alarm,
label: this.translate.instant(alarmFields[name].name),
color: this.getMaterialColor(i),
settings: {},
_hash: Math.random()
settings: {}
};
this.defaultAlarmDataKeys.push(dataKey);
}
@ -267,8 +265,7 @@ export class UtilsService {
type,
label,
funcBody: keyInfo.funcBody,
settings: {},
_hash: Math.random()
settings: {}
};
if (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,
color: this.utils.getMaterialColor(i),
settings: {},
_hash: Math.random()
};
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,
color: threshold.color
} as TbFlotThresholdKeySettings,
_hash: Math.random()
};
if (datasource) {
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,
label: imageUrlAttribute,
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[],
isLatestDataKey: boolean, dataKeySettingsFunction: DataKeySettingsFunction): DataKey {
if (isObject(chip)) {
(chip as DataKey)._hash = Math.random();
return chip;
} else {
let label: string = chip;
@ -780,7 +779,6 @@ export class WidgetConfigComponent extends PageComponent implements OnInit, OnDe
label,
color: this.genNextColor(),
settings: {},
_hash: Math.random()
};
if (type === DataKeyType.function) {
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;
isAdditional?: boolean;
origDataKeyIndex?: number;
_hash?: number;
}
export type CellClickColumnInfo = Pick<DataKey, 'name' | 'label'>;

Loading…
Cancel
Save