UI: Update flow meter SCADA symbols metadata - remove showValue property.

This commit is contained in:
Igor Kulikov 2024-07-24 13:11:09 +03:00
parent 32d6fed468
commit 042d25e7f0
9 changed files with 46 additions and 130 deletions

View File

@ -53,7 +53,7 @@
}, },
{ {
"tag": "value", "tag": "value",
"stateRenderFunction": "if (!ctx.properties.showValue) {\n element.hide();\n} else {\n var value = ctx.values.value;\n ctx.api.text(element, value.toFixed(0));\n}", "stateRenderFunction": "var value = ctx.values.value;\nctx.api.text(element, value.toFixed(0));\n",
"actions": { "actions": {
"click": { "click": {
"actionFunction": "ctx.api.callAction(event, 'displayClick');" "actionFunction": "ctx.api.callAction(event, 'displayClick');"
@ -62,7 +62,7 @@
}, },
{ {
"tag": "valueUnits", "tag": "valueUnits",
"stateRenderFunction": "if (!ctx.properties.showValue) {\n element.hide();\n} else {\n var units = ctx.properties.valueUnits;\n ctx.api.text(element, units || '');\n}", "stateRenderFunction": "var units = ctx.properties.valueUnits;\nctx.api.text(element, units || '');\n",
"actions": { "actions": {
"click": { "click": {
"actionFunction": "ctx.api.callAction(event, 'displayClick');" "actionFunction": "ctx.api.callAction(event, 'displayClick');"
@ -238,34 +238,18 @@
} }
], ],
"properties": [ "properties": [
{
"id": "showValue",
"name": "{i18n:scada.symbol.value}",
"type": "switch",
"default": true,
"required": null,
"subLabel": null,
"divider": null,
"fieldSuffix": null,
"disableOnProperty": null,
"rowClass": "",
"fieldClass": "",
"min": null,
"max": null,
"step": null
},
{ {
"id": "valueUnits", "id": "valueUnits",
"name": "{i18n:scada.symbol.value}", "name": "{i18n:scada.symbol.units}",
"type": "units", "type": "units",
"default": "m³/hr", "default": "m³/hr",
"required": null, "required": null,
"subLabel": null, "subLabel": null,
"divider": null, "divider": null,
"fieldSuffix": null, "fieldSuffix": null,
"disableOnProperty": "showValue", "disableOnProperty": null,
"rowClass": "", "rowClass": "",
"fieldClass": "", "fieldClass": "medium-width",
"min": null, "min": null,
"max": null, "max": null,
"step": null "step": null

Before

Width:  |  Height:  |  Size: 68 KiB

After

Width:  |  Height:  |  Size: 68 KiB

View File

@ -52,7 +52,7 @@
}, },
{ {
"tag": "value", "tag": "value",
"stateRenderFunction": "if (!ctx.properties.showValue) {\n element.hide();\n} else {\n var value = ctx.values.value;\n ctx.api.text(element, value.toFixed(0));\n}", "stateRenderFunction": "var value = ctx.values.value;\nctx.api.text(element, value.toFixed(0));\n",
"actions": { "actions": {
"click": { "click": {
"actionFunction": "ctx.api.callAction(event, 'displayClick');" "actionFunction": "ctx.api.callAction(event, 'displayClick');"
@ -61,7 +61,7 @@
}, },
{ {
"tag": "valueUnits", "tag": "valueUnits",
"stateRenderFunction": "if (!ctx.properties.showValue) {\n element.hide();\n} else {\n var units = ctx.properties.valueUnits;\n ctx.api.text(element, units || '');\n}", "stateRenderFunction": "var units = ctx.properties.valueUnits;\nctx.api.text(element, units || '');\n",
"actions": { "actions": {
"click": { "click": {
"actionFunction": "ctx.api.callAction(event, 'displayClick');" "actionFunction": "ctx.api.callAction(event, 'displayClick');"
@ -237,34 +237,18 @@
} }
], ],
"properties": [ "properties": [
{
"id": "showValue",
"name": "{i18n:scada.symbol.value}",
"type": "switch",
"default": true,
"required": null,
"subLabel": null,
"divider": null,
"fieldSuffix": null,
"disableOnProperty": null,
"rowClass": "",
"fieldClass": "",
"min": null,
"max": null,
"step": null
},
{ {
"id": "valueUnits", "id": "valueUnits",
"name": "{i18n:scada.symbol.value}", "name": "{i18n:scada.symbol.units}",
"type": "units", "type": "units",
"default": "m³/hr", "default": "m³/hr",
"required": null, "required": null,
"subLabel": null, "subLabel": null,
"divider": null, "divider": null,
"fieldSuffix": null, "fieldSuffix": null,
"disableOnProperty": "showValue", "disableOnProperty": null,
"rowClass": "", "rowClass": "",
"fieldClass": "", "fieldClass": "medium-width",
"min": null, "min": null,
"max": null, "max": null,
"step": null "step": null

Before

Width:  |  Height:  |  Size: 70 KiB

After

Width:  |  Height:  |  Size: 70 KiB

View File

@ -52,7 +52,7 @@
}, },
{ {
"tag": "value", "tag": "value",
"stateRenderFunction": "if (!ctx.properties.showValue) {\n element.hide();\n} else {\n var value = ctx.values.value;\n ctx.api.text(element, value.toFixed(0));\n}", "stateRenderFunction": "var value = ctx.values.value;\nctx.api.text(element, value.toFixed(0));\n",
"actions": { "actions": {
"click": { "click": {
"actionFunction": "ctx.api.callAction(event, 'displayClick');" "actionFunction": "ctx.api.callAction(event, 'displayClick');"
@ -61,7 +61,7 @@
}, },
{ {
"tag": "valueUnits", "tag": "valueUnits",
"stateRenderFunction": "if (!ctx.properties.showValue) {\n element.hide();\n} else {\n var units = ctx.properties.valueUnits;\n ctx.api.text(element, units || '');\n}", "stateRenderFunction": "var units = ctx.properties.valueUnits;\nctx.api.text(element, units || '');\n",
"actions": { "actions": {
"click": { "click": {
"actionFunction": "ctx.api.callAction(event, 'displayClick');" "actionFunction": "ctx.api.callAction(event, 'displayClick');"
@ -237,34 +237,18 @@
} }
], ],
"properties": [ "properties": [
{
"id": "showValue",
"name": "{i18n:scada.symbol.value}",
"type": "switch",
"default": true,
"required": null,
"subLabel": null,
"divider": null,
"fieldSuffix": null,
"disableOnProperty": null,
"rowClass": "",
"fieldClass": "",
"min": null,
"max": null,
"step": null
},
{ {
"id": "valueUnits", "id": "valueUnits",
"name": "{i18n:scada.symbol.value}", "name": "{i18n:scada.symbol.units}",
"type": "units", "type": "units",
"default": "m³/hr", "default": "m³/hr",
"required": null, "required": null,
"subLabel": null, "subLabel": null,
"divider": null, "divider": null,
"fieldSuffix": null, "fieldSuffix": null,
"disableOnProperty": "showValue", "disableOnProperty": null,
"rowClass": "", "rowClass": "",
"fieldClass": "", "fieldClass": "medium-width",
"min": null, "min": null,
"max": null, "max": null,
"step": null "step": null

Before

Width:  |  Height:  |  Size: 67 KiB

After

Width:  |  Height:  |  Size: 67 KiB

View File

@ -53,7 +53,7 @@
}, },
{ {
"tag": "value", "tag": "value",
"stateRenderFunction": "if (!ctx.properties.showValue) {\n element.hide();\n} else {\n var value = ctx.values.value;\n ctx.api.text(element, value.toFixed(0));\n}", "stateRenderFunction": "var value = ctx.values.value;\nctx.api.text(element, value.toFixed(0));\n",
"actions": { "actions": {
"click": { "click": {
"actionFunction": "ctx.api.callAction(event, 'displayClick');" "actionFunction": "ctx.api.callAction(event, 'displayClick');"
@ -62,7 +62,7 @@
}, },
{ {
"tag": "valueUnits", "tag": "valueUnits",
"stateRenderFunction": "if (!ctx.properties.showValue) {\n element.hide();\n} else {\n var units = ctx.properties.valueUnits;\n ctx.api.text(element, units || '');\n}", "stateRenderFunction": "var units = ctx.properties.valueUnits;\nctx.api.text(element, units || '');\n",
"actions": { "actions": {
"click": { "click": {
"actionFunction": "ctx.api.callAction(event, 'displayClick');" "actionFunction": "ctx.api.callAction(event, 'displayClick');"
@ -238,34 +238,18 @@
} }
], ],
"properties": [ "properties": [
{
"id": "showValue",
"name": "{i18n:scada.symbol.value}",
"type": "switch",
"default": true,
"required": null,
"subLabel": null,
"divider": null,
"fieldSuffix": null,
"disableOnProperty": null,
"rowClass": "",
"fieldClass": "",
"min": null,
"max": null,
"step": null
},
{ {
"id": "valueUnits", "id": "valueUnits",
"name": "{i18n:scada.symbol.value}", "name": "{i18n:scada.symbol.units}",
"type": "units", "type": "units",
"default": "m³/hr", "default": "m³/hr",
"required": null, "required": null,
"subLabel": null, "subLabel": null,
"divider": null, "divider": null,
"fieldSuffix": null, "fieldSuffix": null,
"disableOnProperty": "showValue", "disableOnProperty": null,
"rowClass": "", "rowClass": "",
"fieldClass": "", "fieldClass": "medium-width",
"min": null, "min": null,
"max": null, "max": null,
"step": null "step": null

Before

Width:  |  Height:  |  Size: 68 KiB

After

Width:  |  Height:  |  Size: 67 KiB

View File

@ -53,7 +53,7 @@
}, },
{ {
"tag": "value", "tag": "value",
"stateRenderFunction": "if (!ctx.properties.showValue) {\n element.hide();\n} else {\n var value = ctx.values.value;\n ctx.api.text(element, value.toFixed(0));\n}", "stateRenderFunction": "var value = ctx.values.value;\nctx.api.text(element, value.toFixed(0));\n",
"actions": { "actions": {
"click": { "click": {
"actionFunction": "ctx.api.callAction(event, 'displayClick');" "actionFunction": "ctx.api.callAction(event, 'displayClick');"
@ -62,7 +62,7 @@
}, },
{ {
"tag": "valueUnits", "tag": "valueUnits",
"stateRenderFunction": "if (!ctx.properties.showValue) {\n element.hide();\n} else {\n var units = ctx.properties.valueUnits;\n ctx.api.text(element, units || '');\n}", "stateRenderFunction": "var units = ctx.properties.valueUnits;\nctx.api.text(element, units || '');\n",
"actions": { "actions": {
"click": { "click": {
"actionFunction": "ctx.api.callAction(event, 'displayClick');" "actionFunction": "ctx.api.callAction(event, 'displayClick');"
@ -238,34 +238,18 @@
} }
], ],
"properties": [ "properties": [
{
"id": "showValue",
"name": "{i18n:scada.symbol.value}",
"type": "switch",
"default": true,
"required": null,
"subLabel": null,
"divider": null,
"fieldSuffix": null,
"disableOnProperty": null,
"rowClass": "",
"fieldClass": "",
"min": null,
"max": null,
"step": null
},
{ {
"id": "valueUnits", "id": "valueUnits",
"name": "{i18n:scada.symbol.value}", "name": "{i18n:scada.symbol.units}",
"type": "units", "type": "units",
"default": "m³/hr", "default": "m³/hr",
"required": null, "required": null,
"subLabel": null, "subLabel": null,
"divider": null, "divider": null,
"fieldSuffix": null, "fieldSuffix": null,
"disableOnProperty": "showValue", "disableOnProperty": null,
"rowClass": "", "rowClass": "",
"fieldClass": "", "fieldClass": "medium-width",
"min": null, "min": null,
"max": null, "max": null,
"step": null "step": null

Before

Width:  |  Height:  |  Size: 67 KiB

After

Width:  |  Height:  |  Size: 66 KiB

View File

@ -52,7 +52,7 @@
}, },
{ {
"tag": "value", "tag": "value",
"stateRenderFunction": "if (!ctx.properties.showValue) {\n element.hide();\n} else {\n var value = ctx.values.value;\n ctx.api.text(element, value.toFixed(0));\n}", "stateRenderFunction": "var value = ctx.values.value;\nctx.api.text(element, value.toFixed(0));\n",
"actions": { "actions": {
"click": { "click": {
"actionFunction": "ctx.api.callAction(event, 'displayClick');" "actionFunction": "ctx.api.callAction(event, 'displayClick');"
@ -61,7 +61,7 @@
}, },
{ {
"tag": "valueUnits", "tag": "valueUnits",
"stateRenderFunction": "if (!ctx.properties.showValue) {\n element.hide();\n} else {\n var units = ctx.properties.valueUnits;\n ctx.api.text(element, units || '');\n}", "stateRenderFunction": "var units = ctx.properties.valueUnits;\nctx.api.text(element, units || '');\n",
"actions": { "actions": {
"click": { "click": {
"actionFunction": "ctx.api.callAction(event, 'displayClick');" "actionFunction": "ctx.api.callAction(event, 'displayClick');"
@ -237,34 +237,18 @@
} }
], ],
"properties": [ "properties": [
{
"id": "showValue",
"name": "{i18n:scada.symbol.value}",
"type": "switch",
"default": true,
"required": null,
"subLabel": null,
"divider": null,
"fieldSuffix": null,
"disableOnProperty": null,
"rowClass": "",
"fieldClass": "",
"min": null,
"max": null,
"step": null
},
{ {
"id": "valueUnits", "id": "valueUnits",
"name": "{i18n:scada.symbol.value}", "name": "{i18n:scada.symbol.units}",
"type": "units", "type": "units",
"default": "m³/hr", "default": "m³/hr",
"required": null, "required": null,
"subLabel": null, "subLabel": null,
"divider": null, "divider": null,
"fieldSuffix": null, "fieldSuffix": null,
"disableOnProperty": "showValue", "disableOnProperty": null,
"rowClass": "", "rowClass": "",
"fieldClass": "", "fieldClass": "medium-width",
"min": null, "min": null,
"max": null, "max": null,
"step": null "step": null

Before

Width:  |  Height:  |  Size: 71 KiB

After

Width:  |  Height:  |  Size: 70 KiB

View File

@ -231,11 +231,15 @@ export class ScadaSymbolObjectSettingsComponent implements OnInit, OnChanges, Co
if (this.validatorTriggers.length) { if (this.validatorTriggers.length) {
const observables: Observable<any>[] = []; const observables: Observable<any>[] = [];
for (const trigger of this.validatorTriggers) { for (const trigger of this.validatorTriggers) {
observables.push(propertiesFormGroup.get(trigger).valueChanges); if (propertiesFormGroup.get(trigger)) {
observables.push(propertiesFormGroup.get(trigger).valueChanges);
}
}
if (observables.length) {
this.validatorSubscription = merge(...observables).subscribe(() => {
this.updateValidators();
});
} }
this.validatorSubscription = merge(...observables).subscribe(() => {
this.updateValidators();
});
} }
this.setupValue(); this.setupValue();
this.cd.markForCheck(); this.cd.markForCheck();

View File

@ -99,6 +99,13 @@ export class ScadaSymbolPropertiesComponent implements ControlValueAccessor, OnI
properties = properties.filter(p => propertyValid(p)); properties = properties.filter(p => propertyValid(p));
} }
this.booleanPropertyIds = properties.filter(p => p.type === ScadaSymbolPropertyType.switch).map(p => p.id); this.booleanPropertyIds = properties.filter(p => p.type === ScadaSymbolPropertyType.switch).map(p => p.id);
properties.forEach((p, i) => {
if (p.disableOnProperty && !this.booleanPropertyIds.includes(p.disableOnProperty)) {
p.disableOnProperty = null;
const controls = this.propertiesFormArray().controls;
controls[i].patchValue(p, {emitEvent: false});
}
});
this.propagateChange(properties); this.propagateChange(properties);
} }
); );

View File

@ -3623,6 +3623,7 @@
"bottom-fluid-color": "Bottom fluid color", "bottom-fluid-color": "Bottom fluid color",
"display": "Display", "display": "Display",
"value": "Value", "value": "Value",
"units": "Units",
"flow-meter-value-hint": "Double value showing on flow meter display", "flow-meter-value-hint": "Double value showing on flow meter display",
"warning-state": "Warning state", "warning-state": "Warning state",
"warning": "Warning", "warning": "Warning",