Browse Source

UI: Fixed liquid level widgets settings form validation

pull/9456/head
Vladyslav_Prykhodko 3 years ago
parent
commit
20fe062468
  1. 4
      application/src/main/data/json/system/widget_types/horizontal_2_1_elliptical.json
  2. 2
      application/src/main/data/json/system/widget_types/horizontal_capsule.json
  3. 2
      application/src/main/data/json/system/widget_types/horizontal_cylinder.json
  4. 2
      application/src/main/data/json/system/widget_types/horizontal_dish_ends.json
  5. 2
      application/src/main/data/json/system/widget_types/horizontal_ellipse.json
  6. 2
      application/src/main/data/json/system/widget_types/horizontal_oval.json
  7. 2
      application/src/main/data/json/system/widget_types/rectangle.json
  8. 2
      application/src/main/data/json/system/widget_types/vertical_capsule.json
  9. 2
      application/src/main/data/json/system/widget_types/vertical_cylinder.json
  10. 2
      application/src/main/data/json/system/widget_types/vertical_oval.json
  11. 115
      ui-ngx/src/app/modules/home/components/widget/config/basic/indicator/liquid-level-card-basic-config.component.html
  12. 290
      ui-ngx/src/app/modules/home/components/widget/config/basic/indicator/liquid-level-card-basic-config.component.ts
  13. 15
      ui-ngx/src/app/modules/home/components/widget/lib/indicator/liquid-level-widget.component.ts
  14. 190
      ui-ngx/src/app/modules/home/components/widget/lib/indicator/liquid-level-widget.models.ts
  15. 119
      ui-ngx/src/app/modules/home/components/widget/lib/settings/indicator/liquid-level-card-widget-settings.component.html
  16. 233
      ui-ngx/src/app/modules/home/components/widget/lib/settings/indicator/liquid-level-card-widget-settings.component.ts

4
application/src/main/data/json/system/widget_types/horizontal_2_1_elliptical.json

File diff suppressed because one or more lines are too long

2
application/src/main/data/json/system/widget_types/horizontal_capsule.json

@ -17,7 +17,7 @@
"settingsDirective": "tb-liquid-level-card-widget-settings", "settingsDirective": "tb-liquid-level-card-widget-settings",
"hasBasicMode": true, "hasBasicMode": true,
"basicModeDirective": "tb-liquid-level-card-basic-config", "basicModeDirective": "tb-liquid-level-card-basic-config",
"defaultConfig": "{\"datasources\":[{\"type\":\"function\",\"name\":\"function\",\"dataKeys\":[{\"name\":\"f(x)\",\"type\":\"function\",\"label\":\"Random\",\"color\":\"#2196f3\",\"settings\":{},\"_hash\":0.15479322438769105,\"funcBody\":\"return Math.floor(Math.random() * 101);\",\"aggregationType\":null,\"units\":null,\"decimals\":null,\"usePostProcessing\":null,\"postFuncBody\":null}],\"alarmFilterConfig\":{\"statusList\":[\"ACTIVE\"]}}],\"timewindow\":{\"realtime\":{\"timewindowMs\":60000}},\"showTitle\":true,\"backgroundColor\":\"#fff\",\"color\":\"rgba(0, 0, 0, 0.87)\",\"padding\":\"8px\",\"settings\":{\"tankSelectionType\":\"Static\",\"selectedShape\":\"Horizontal Capsule\",\"shapeAttributeName\":\"tankShape\",\"tankColor\":{\"type\":\"range\",\"color\":\"#242770\",\"rangeList\":[{\"from\":null,\"to\":20,\"color\":\"#E73535DE\"},{\"from\":20,\"to\":null,\"color\":\"#242770\"}],\"colorFunction\":\"var percent = value;\\nif (typeof percent !== undefined) {\\n if (percent < 20) {\\n return '#E73535DE';\\n }\\n}\\nreturn '#242770';\"},\"datasourceUnits\":\"%\",\"layout\":\"percentage\",\"volumeSource\":\"Static\",\"volumeConstant\":500,\"volumeAttributeName\":\"volume\",\"volumeUnits\":\"L\",\"volumeFont\":{\"family\":\"Roboto\",\"size\":14,\"sizeUnit\":\"px\",\"style\":\"normal\",\"weight\":\"500\",\"lineHeight\":\"100%\"},\"volumeColor\":{\"type\":\"constant\",\"color\":\"rgba(0, 0, 0, 0.18)\",\"colorFunction\":\"var temperature = value;\\nif (typeof temperature !== undefined) {\\n var percent = (temperature + 60)/120 * 100;\\n return tinycolor.mix('blue', 'red', percent).toHexString();\\n}\\nreturn 'blue';\"},\"units\":\"%\",\"widgetUnitsSource\":\"Static\",\"widgetUnitsAttributeName\":\"units\",\"liquidColor\":{\"type\":\"range\",\"color\":\"#7A8BFF\",\"rangeList\":[{\"from\":null,\"to\":20,\"color\":\"#E27C7CDE\"},{\"from\":20,\"to\":null,\"color\":\"#7A8BFF\"}],\"colorFunction\":\"var percent = value;\\nif (typeof percent !== undefined) {\\n if (percent < 20) {\\n return '#E27C7CDE';\\n }\\n}\\nreturn '#7A8BFF';\"},\"valueFont\":{\"family\":\"Roboto\",\"size\":24,\"sizeUnit\":\"px\",\"style\":\"normal\",\"weight\":\"500\",\"lineHeight\":\"100%\"},\"valueColor\":{\"type\":\"range\",\"color\":\"#000000DE\",\"rangeList\":[{\"from\":null,\"to\":20,\"color\":\"#FF0000DE\"},{\"from\":20,\"to\":null,\"color\":\"rgba(0,0,0,0.87)\"}],\"colorFunction\":\"var percent = value;\\nif (typeof percent !== undefined) {\\n if (percent < 20) {\\n return '#FF0000DE';\\n }\\n}\\nreturn '#000000DE';\"},\"showBackgroundOverlay\":true,\"backgroundOverlayColor\":{\"type\":\"range\",\"color\":\"#FFFFFFC2\",\"rangeList\":[{\"from\":null,\"to\":20,\"color\":\"#FFEFEFDE\"},{\"from\":20,\"to\":null,\"color\":\"#FFFFFFC2\"}],\"colorFunction\":\"var percent = value;\\nif (typeof percent !== undefined) {\\n if (percent < 20) {\\n return '#FFEFEFDE';\\n }\\n}\\nreturn '#FFFFFFC2';\"},\"showTooltip\":true,\"showTooltipLevel\":true,\"tooltipUnits\":\"%\",\"tooltipLevelDecimals\":0,\"tooltipLevelFont\":{\"family\":\"Roboto\",\"size\":13,\"sizeUnit\":\"px\",\"style\":\"normal\",\"weight\":\"500\",\"lineHeight\":\"100%\"},\"tooltipLevelColor\":{\"type\":\"constant\",\"color\":\"rgba(0, 0, 0, 0.76)\",\"rangeList\":[],\"colorFunction\":\"var percent = value;\\nif (typeof percent !== undefined) {\\n if (percent < 20) {\\n return '#E27C7CDE';\\n }\\n}\\nreturn '#7A8BFF';\"},\"showTooltipDate\":true,\"tooltipDateFormat\":{\"format\":null,\"lastUpdateAgo\":true,\"custom\":false},\"tooltipDateFont\":{\"family\":\"Roboto\",\"size\":13,\"sizeUnit\":\"px\",\"style\":\"normal\",\"weight\":\"500\",\"lineHeight\":\"100%\"},\"tooltipDateColor\":\"#000000C2\",\"tooltipBackgroundColor\":\"#FFFFFFC2\",\"tooltipBackgroundBlur\":3},\"title\":\"Liquid level\",\"useDashboardTimewindow\":true,\"displayTimewindow\":true,\"configMode\":\"basic\",\"titleFont\":{\"family\":\"Roboto\",\"size\":16,\"sizeUnit\":\"px\",\"style\":\"normal\",\"weight\":\"500\",\"lineHeight\":\"1.5\"},\"titleColor\":\"rgba(0, 0, 0, 0.87)\",\"showTitleIcon\":false,\"titleIcon\":\"water_drop\",\"iconColor\":\"#5469FF\",\"decimals\":0,\"enableDataExport\":false,\"enableFullscreen\":true,\"borderRadius\":null,\"actions\":{},\"iconSize\":\"24px\"}" "defaultConfig": "{\"datasources\":[{\"type\":\"function\",\"name\":\"function\",\"dataKeys\":[{\"name\":\"f(x)\",\"type\":\"function\",\"label\":\"Random\",\"color\":\"#2196f3\",\"settings\":{},\"_hash\":0.15479322438769105,\"funcBody\":\"return Math.floor(Math.random() * 101);\",\"aggregationType\":null,\"units\":null,\"decimals\":null,\"usePostProcessing\":null,\"postFuncBody\":null}],\"alarmFilterConfig\":{\"statusList\":[\"ACTIVE\"]}}],\"timewindow\":{\"realtime\":{\"timewindowMs\":60000}},\"showTitle\":true,\"backgroundColor\":\"#fff\",\"color\":\"rgba(0, 0, 0, 0.87)\",\"padding\":\"8px\",\"settings\":{\"tankSelectionType\":\"static\",\"selectedShape\":\"Horizontal Capsule\",\"shapeAttributeName\":\"tankShape\",\"tankColor\":{\"type\":\"range\",\"color\":\"#242770\",\"rangeList\":[{\"from\":null,\"to\":20,\"color\":\"#E73535DE\"},{\"from\":20,\"to\":null,\"color\":\"#242770\"}],\"colorFunction\":\"var percent = value;\\nif (typeof percent !== undefined) {\\n if (percent < 20) {\\n return '#E73535DE';\\n }\\n}\\nreturn '#242770';\"},\"datasourceUnits\":\"%\",\"layout\":\"percentage\",\"volumeSource\":\"static\",\"volumeConstant\":500,\"volumeAttributeName\":\"volume\",\"volumeUnits\":\"L\",\"volumeFont\":{\"family\":\"Roboto\",\"size\":14,\"sizeUnit\":\"px\",\"style\":\"normal\",\"weight\":\"500\",\"lineHeight\":\"100%\"},\"volumeColor\":\"rgba(0, 0, 0, 0.18)\",\"units\":\"%\",\"widgetUnitsSource\":\"static\",\"widgetUnitsAttributeName\":\"units\",\"liquidColor\":{\"type\":\"range\",\"color\":\"#7A8BFF\",\"rangeList\":[{\"from\":null,\"to\":20,\"color\":\"#E27C7CDE\"},{\"from\":20,\"to\":null,\"color\":\"#7A8BFF\"}],\"colorFunction\":\"var percent = value;\\nif (typeof percent !== undefined) {\\n if (percent < 20) {\\n return '#E27C7CDE';\\n }\\n}\\nreturn '#7A8BFF';\"},\"valueFont\":{\"family\":\"Roboto\",\"size\":24,\"sizeUnit\":\"px\",\"style\":\"normal\",\"weight\":\"500\",\"lineHeight\":\"100%\"},\"valueColor\":{\"type\":\"range\",\"color\":\"#000000DE\",\"rangeList\":[{\"from\":null,\"to\":20,\"color\":\"#FF0000DE\"},{\"from\":20,\"to\":null,\"color\":\"rgba(0,0,0,0.87)\"}],\"colorFunction\":\"var percent = value;\\nif (typeof percent !== undefined) {\\n if (percent < 20) {\\n return '#FF0000DE';\\n }\\n}\\nreturn '#000000DE';\"},\"showBackgroundOverlay\":true,\"backgroundOverlayColor\":{\"type\":\"range\",\"color\":\"#FFFFFFC2\",\"rangeList\":[{\"from\":null,\"to\":20,\"color\":\"#FFEFEFDE\"},{\"from\":20,\"to\":null,\"color\":\"#FFFFFFC2\"}],\"colorFunction\":\"var percent = value;\\nif (typeof percent !== undefined) {\\n if (percent < 20) {\\n return '#FFEFEFDE';\\n }\\n}\\nreturn '#FFFFFFC2';\"},\"showTooltip\":true,\"showTooltipLevel\":true,\"tooltipUnits\":\"%\",\"tooltipLevelDecimals\":0,\"tooltipLevelFont\":{\"family\":\"Roboto\",\"size\":13,\"sizeUnit\":\"px\",\"style\":\"normal\",\"weight\":\"500\",\"lineHeight\":\"100%\"},\"tooltipLevelColor\":{\"type\":\"constant\",\"color\":\"rgba(0, 0, 0, 0.76)\",\"rangeList\":[],\"colorFunction\":\"var percent = value;\\nif (typeof percent !== undefined) {\\n if (percent < 20) {\\n return '#E27C7CDE';\\n }\\n}\\nreturn '#7A8BFF';\"},\"showTooltipDate\":true,\"tooltipDateFormat\":{\"format\":null,\"lastUpdateAgo\":true,\"custom\":false},\"tooltipDateFont\":{\"family\":\"Roboto\",\"size\":13,\"sizeUnit\":\"px\",\"style\":\"normal\",\"weight\":\"500\",\"lineHeight\":\"100%\"},\"tooltipDateColor\":\"rgba(0, 0, 0, 0.76)\",\"tooltipBackgroundColor\":\"rgba(255, 255, 255, 0.76)\",\"tooltipBackgroundBlur\":3,\"background\":{\"type\":\"color\",\"color\":\"#fff\",\"overlay\":{\"enabled\":false,\"color\":\"rgba(255,255,255,0.72)\",\"blur\":3}}},\"title\":\"Liquid level\",\"useDashboardTimewindow\":true,\"displayTimewindow\":true,\"configMode\":\"basic\",\"titleFont\":{\"family\":\"Roboto\",\"size\":16,\"sizeUnit\":\"px\",\"style\":\"normal\",\"weight\":\"500\",\"lineHeight\":\"1.5\"},\"titleColor\":\"rgba(0, 0, 0, 0.87)\",\"showTitleIcon\":false,\"titleIcon\":\"water_drop\",\"iconColor\":\"#5469FF\",\"decimals\":0,\"enableDataExport\":false,\"enableFullscreen\":true,\"borderRadius\":null,\"actions\":{},\"iconSize\":\"24px\"}"
}, },
"externalId": null, "externalId": null,
"tags": null "tags": null

2
application/src/main/data/json/system/widget_types/horizontal_cylinder.json

@ -17,7 +17,7 @@
"settingsDirective": "tb-liquid-level-card-widget-settings", "settingsDirective": "tb-liquid-level-card-widget-settings",
"hasBasicMode": true, "hasBasicMode": true,
"basicModeDirective": "tb-liquid-level-card-basic-config", "basicModeDirective": "tb-liquid-level-card-basic-config",
"defaultConfig": "{\"datasources\":[{\"type\":\"function\",\"name\":\"function\",\"dataKeys\":[{\"name\":\"f(x)\",\"type\":\"function\",\"label\":\"Random\",\"color\":\"#2196f3\",\"settings\":{},\"_hash\":0.15479322438769105,\"funcBody\":\"return Math.floor(Math.random() * 101);\",\"aggregationType\":null,\"units\":null,\"decimals\":null,\"usePostProcessing\":null,\"postFuncBody\":null}],\"alarmFilterConfig\":{\"statusList\":[\"ACTIVE\"]}}],\"timewindow\":{\"realtime\":{\"timewindowMs\":60000}},\"showTitle\":true,\"backgroundColor\":\"#fff\",\"color\":\"rgba(0, 0, 0, 0.87)\",\"padding\":\"8px\",\"settings\":{\"tankSelectionType\":\"Static\",\"selectedShape\":\"Horizontal Cylinder\",\"shapeAttributeName\":\"tankShape\",\"tankColor\":{\"type\":\"range\",\"color\":\"#242770\",\"rangeList\":[{\"from\":null,\"to\":20,\"color\":\"#E73535DE\"},{\"from\":20,\"to\":null,\"color\":\"#242770\"}],\"colorFunction\":\"var percent = value;\\nif (typeof percent !== undefined) {\\n if (percent < 20) {\\n return '#E73535DE';\\n }\\n}\\nreturn '#242770';\"},\"datasourceUnits\":\"%\",\"layout\":\"percentage\",\"volumeSource\":\"Static\",\"volumeConstant\":500,\"volumeAttributeName\":\"volume\",\"volumeUnits\":\"L\",\"volumeFont\":{\"family\":\"Roboto\",\"size\":14,\"sizeUnit\":\"px\",\"style\":\"normal\",\"weight\":\"500\",\"lineHeight\":\"100%\"},\"volumeColor\":{\"type\":\"constant\",\"color\":\"rgba(0, 0, 0, 0.18)\",\"colorFunction\":\"var temperature = value;\\nif (typeof temperature !== undefined) {\\n var percent = (temperature + 60)/120 * 100;\\n return tinycolor.mix('blue', 'red', percent).toHexString();\\n}\\nreturn 'blue';\"},\"units\":\"%\",\"widgetUnitsSource\":\"Static\",\"widgetUnitsAttributeName\":\"units\",\"liquidColor\":{\"type\":\"range\",\"color\":\"#7A8BFF\",\"rangeList\":[{\"from\":null,\"to\":20,\"color\":\"#E27C7CDE\"},{\"from\":20,\"to\":null,\"color\":\"#7A8BFF\"}],\"colorFunction\":\"var percent = value;\\nif (typeof percent !== undefined) {\\n if (percent < 20) {\\n return '#E27C7CDE';\\n }\\n}\\nreturn '#7A8BFF';\"},\"valueFont\":{\"family\":\"Roboto\",\"size\":24,\"sizeUnit\":\"px\",\"style\":\"normal\",\"weight\":\"500\",\"lineHeight\":\"100%\"},\"valueColor\":{\"type\":\"range\",\"color\":\"#000000DE\",\"rangeList\":[{\"from\":null,\"to\":20,\"color\":\"#FF0000DE\"},{\"from\":20,\"to\":null,\"color\":\"rgba(0,0,0,0.87)\"}],\"colorFunction\":\"var percent = value;\\nif (typeof percent !== undefined) {\\n if (percent < 20) {\\n return '#FF0000DE';\\n }\\n}\\nreturn '#000000DE';\"},\"showBackgroundOverlay\":true,\"backgroundOverlayColor\":{\"type\":\"range\",\"color\":\"#FFFFFFC2\",\"rangeList\":[{\"from\":null,\"to\":20,\"color\":\"#FFEFEFDE\"},{\"from\":20,\"to\":null,\"color\":\"#FFFFFFC2\"}],\"colorFunction\":\"var percent = value;\\nif (typeof percent !== undefined) {\\n if (percent < 20) {\\n return '#FFEFEFDE';\\n }\\n}\\nreturn '#FFFFFFC2';\"},\"showTooltip\":true,\"showTooltipLevel\":true,\"tooltipUnits\":\"%\",\"tooltipLevelDecimals\":0,\"tooltipLevelFont\":{\"family\":\"Roboto\",\"size\":13,\"sizeUnit\":\"px\",\"style\":\"normal\",\"weight\":\"500\",\"lineHeight\":\"100%\"},\"tooltipLevelColor\":{\"type\":\"constant\",\"color\":\"rgba(0, 0, 0, 0.76)\",\"rangeList\":[],\"colorFunction\":\"var percent = value;\\nif (typeof percent !== undefined) {\\n if (percent < 20) {\\n return '#E27C7CDE';\\n }\\n}\\nreturn '#7A8BFF';\"},\"showTooltipDate\":true,\"tooltipDateFormat\":{\"format\":null,\"lastUpdateAgo\":true,\"custom\":false},\"tooltipDateFont\":{\"family\":\"Roboto\",\"size\":13,\"sizeUnit\":\"px\",\"style\":\"normal\",\"weight\":\"500\",\"lineHeight\":\"100%\"},\"tooltipDateColor\":\"#000000C2\",\"tooltipBackgroundColor\":\"#FFFFFFC2\",\"tooltipBackgroundBlur\":3},\"title\":\"Liquid level\",\"useDashboardTimewindow\":true,\"displayTimewindow\":true,\"configMode\":\"basic\",\"titleFont\":{\"family\":\"Roboto\",\"size\":16,\"sizeUnit\":\"px\",\"style\":\"normal\",\"weight\":\"500\",\"lineHeight\":\"1.5\"},\"titleColor\":\"rgba(0, 0, 0, 0.87)\",\"showTitleIcon\":false,\"titleIcon\":\"water_drop\",\"iconColor\":\"#5469FF\",\"decimals\":0,\"enableDataExport\":false,\"enableFullscreen\":true,\"borderRadius\":null,\"actions\":{},\"iconSize\":\"24px\"}" "defaultConfig": "{\"datasources\":[{\"type\":\"function\",\"name\":\"function\",\"dataKeys\":[{\"name\":\"f(x)\",\"type\":\"function\",\"label\":\"Random\",\"color\":\"#2196f3\",\"settings\":{},\"_hash\":0.15479322438769105,\"funcBody\":\"return Math.floor(Math.random() * 101);\",\"aggregationType\":null,\"units\":null,\"decimals\":null,\"usePostProcessing\":null,\"postFuncBody\":null}],\"alarmFilterConfig\":{\"statusList\":[\"ACTIVE\"]}}],\"timewindow\":{\"realtime\":{\"timewindowMs\":60000}},\"showTitle\":true,\"backgroundColor\":\"#fff\",\"color\":\"rgba(0, 0, 0, 0.87)\",\"padding\":\"8px\",\"settings\":{\"tankSelectionType\":\"static\",\"selectedShape\":\"Horizontal Cylinder\",\"shapeAttributeName\":\"tankShape\",\"tankColor\":{\"type\":\"range\",\"color\":\"#242770\",\"rangeList\":[{\"from\":null,\"to\":20,\"color\":\"#E73535DE\"},{\"from\":20,\"to\":null,\"color\":\"#242770\"}],\"colorFunction\":\"var percent = value;\\nif (typeof percent !== undefined) {\\n if (percent < 20) {\\n return '#E73535DE';\\n }\\n}\\nreturn '#242770';\"},\"datasourceUnits\":\"%\",\"layout\":\"percentage\",\"volumeSource\":\"static\",\"volumeConstant\":500,\"volumeAttributeName\":\"volume\",\"volumeUnits\":\"L\",\"volumeFont\":{\"family\":\"Roboto\",\"size\":14,\"sizeUnit\":\"px\",\"style\":\"normal\",\"weight\":\"500\",\"lineHeight\":\"100%\"},\"volumeColor\":\"rgba(0, 0, 0, 0.18)\",\"units\":\"%\",\"widgetUnitsSource\":\"static\",\"widgetUnitsAttributeName\":\"units\",\"liquidColor\":{\"type\":\"range\",\"color\":\"#7A8BFF\",\"rangeList\":[{\"from\":null,\"to\":20,\"color\":\"#E27C7CDE\"},{\"from\":20,\"to\":null,\"color\":\"#7A8BFF\"}],\"colorFunction\":\"var percent = value;\\nif (typeof percent !== undefined) {\\n if (percent < 20) {\\n return '#E27C7CDE';\\n }\\n}\\nreturn '#7A8BFF';\"},\"valueFont\":{\"family\":\"Roboto\",\"size\":24,\"sizeUnit\":\"px\",\"style\":\"normal\",\"weight\":\"500\",\"lineHeight\":\"100%\"},\"valueColor\":{\"type\":\"range\",\"color\":\"#000000DE\",\"rangeList\":[{\"from\":null,\"to\":20,\"color\":\"#FF0000DE\"},{\"from\":20,\"to\":null,\"color\":\"rgba(0,0,0,0.87)\"}],\"colorFunction\":\"var percent = value;\\nif (typeof percent !== undefined) {\\n if (percent < 20) {\\n return '#FF0000DE';\\n }\\n}\\nreturn '#000000DE';\"},\"showBackgroundOverlay\":true,\"backgroundOverlayColor\":{\"type\":\"range\",\"color\":\"#FFFFFFC2\",\"rangeList\":[{\"from\":null,\"to\":20,\"color\":\"#FFEFEFDE\"},{\"from\":20,\"to\":null,\"color\":\"#FFFFFFC2\"}],\"colorFunction\":\"var percent = value;\\nif (typeof percent !== undefined) {\\n if (percent < 20) {\\n return '#FFEFEFDE';\\n }\\n}\\nreturn '#FFFFFFC2';\"},\"showTooltip\":true,\"showTooltipLevel\":true,\"tooltipUnits\":\"%\",\"tooltipLevelDecimals\":0,\"tooltipLevelFont\":{\"family\":\"Roboto\",\"size\":13,\"sizeUnit\":\"px\",\"style\":\"normal\",\"weight\":\"500\",\"lineHeight\":\"100%\"},\"tooltipLevelColor\":{\"type\":\"constant\",\"color\":\"rgba(0, 0, 0, 0.76)\",\"rangeList\":[],\"colorFunction\":\"var percent = value;\\nif (typeof percent !== undefined) {\\n if (percent < 20) {\\n return '#E27C7CDE';\\n }\\n}\\nreturn '#7A8BFF';\"},\"showTooltipDate\":true,\"tooltipDateFormat\":{\"format\":null,\"lastUpdateAgo\":true,\"custom\":false},\"tooltipDateFont\":{\"family\":\"Roboto\",\"size\":13,\"sizeUnit\":\"px\",\"style\":\"normal\",\"weight\":\"500\",\"lineHeight\":\"100%\"},\"tooltipDateColor\":\"rgba(0, 0, 0, 0.76)\",\"tooltipBackgroundColor\":\"rgba(255, 255, 255, 0.76)\",\"tooltipBackgroundBlur\":3,\"background\":{\"type\":\"color\",\"color\":\"#fff\",\"overlay\":{\"enabled\":false,\"color\":\"rgba(255,255,255,0.72)\",\"blur\":3}}},\"title\":\"Liquid level\",\"useDashboardTimewindow\":true,\"displayTimewindow\":true,\"configMode\":\"basic\",\"titleFont\":{\"family\":\"Roboto\",\"size\":16,\"sizeUnit\":\"px\",\"style\":\"normal\",\"weight\":\"500\",\"lineHeight\":\"1.5\"},\"titleColor\":\"rgba(0, 0, 0, 0.87)\",\"showTitleIcon\":false,\"titleIcon\":\"water_drop\",\"iconColor\":\"#5469FF\",\"decimals\":0,\"enableDataExport\":false,\"enableFullscreen\":true,\"borderRadius\":null,\"actions\":{},\"iconSize\":\"24px\"}"
}, },
"externalId": null, "externalId": null,
"tags": null "tags": null

2
application/src/main/data/json/system/widget_types/horizontal_dish_ends.json

@ -17,7 +17,7 @@
"settingsDirective": "tb-liquid-level-card-widget-settings", "settingsDirective": "tb-liquid-level-card-widget-settings",
"hasBasicMode": true, "hasBasicMode": true,
"basicModeDirective": "tb-liquid-level-card-basic-config", "basicModeDirective": "tb-liquid-level-card-basic-config",
"defaultConfig": "{\"datasources\":[{\"type\":\"function\",\"name\":\"function\",\"dataKeys\":[{\"name\":\"f(x)\",\"type\":\"function\",\"label\":\"Random\",\"color\":\"#2196f3\",\"settings\":{},\"_hash\":0.15479322438769105,\"funcBody\":\"return Math.floor(Math.random() * 101);\",\"aggregationType\":null,\"units\":null,\"decimals\":null,\"usePostProcessing\":null,\"postFuncBody\":null}],\"alarmFilterConfig\":{\"statusList\":[\"ACTIVE\"]}}],\"timewindow\":{\"realtime\":{\"timewindowMs\":60000}},\"showTitle\":true,\"backgroundColor\":\"#fff\",\"color\":\"rgba(0, 0, 0, 0.87)\",\"padding\":\"8px\",\"settings\":{\"tankSelectionType\":\"Static\",\"selectedShape\":\"Horizontal Dish Ends\",\"shapeAttributeName\":\"tankShape\",\"tankColor\":{\"type\":\"range\",\"color\":\"#242770\",\"rangeList\":[{\"from\":null,\"to\":20,\"color\":\"#E73535DE\"},{\"from\":20,\"to\":null,\"color\":\"#242770\"}],\"colorFunction\":\"var percent = value;\\nif (typeof percent !== undefined) {\\n if (percent < 20) {\\n return '#E73535DE';\\n }\\n}\\nreturn '#242770';\"},\"datasourceUnits\":\"%\",\"layout\":\"percentage\",\"volumeSource\":\"Static\",\"volumeConstant\":500,\"volumeAttributeName\":\"volume\",\"volumeUnits\":\"L\",\"volumeFont\":{\"family\":\"Roboto\",\"size\":14,\"sizeUnit\":\"px\",\"style\":\"normal\",\"weight\":\"500\",\"lineHeight\":\"100%\"},\"volumeColor\":{\"type\":\"constant\",\"color\":\"rgba(0, 0, 0, 0.18)\",\"colorFunction\":\"var temperature = value;\\nif (typeof temperature !== undefined) {\\n var percent = (temperature + 60)/120 * 100;\\n return tinycolor.mix('blue', 'red', percent).toHexString();\\n}\\nreturn 'blue';\"},\"units\":\"%\",\"widgetUnitsSource\":\"Static\",\"widgetUnitsAttributeName\":\"units\",\"liquidColor\":{\"type\":\"range\",\"color\":\"#7A8BFF\",\"rangeList\":[{\"from\":null,\"to\":20,\"color\":\"#E27C7CDE\"},{\"from\":20,\"to\":null,\"color\":\"#7A8BFF\"}],\"colorFunction\":\"var percent = value;\\nif (typeof percent !== undefined) {\\n if (percent < 20) {\\n return '#E27C7CDE';\\n }\\n}\\nreturn '#7A8BFF';\"},\"valueFont\":{\"family\":\"Roboto\",\"size\":24,\"sizeUnit\":\"px\",\"style\":\"normal\",\"weight\":\"500\",\"lineHeight\":\"100%\"},\"valueColor\":{\"type\":\"range\",\"color\":\"#000000DE\",\"rangeList\":[{\"from\":null,\"to\":20,\"color\":\"#FF0000DE\"},{\"from\":20,\"to\":null,\"color\":\"rgba(0,0,0,0.87)\"}],\"colorFunction\":\"var percent = value;\\nif (typeof percent !== undefined) {\\n if (percent < 20) {\\n return '#FF0000DE';\\n }\\n}\\nreturn '#000000DE';\"},\"showBackgroundOverlay\":true,\"backgroundOverlayColor\":{\"type\":\"range\",\"color\":\"rgba(255, 255, 255, 0.76)\",\"rangeList\":[{\"from\":null,\"to\":20,\"color\":\"#FFEFEFDE\"},{\"from\":20,\"to\":null,\"color\":\"#FFFFFFC2\"}],\"colorFunction\":\"var percent = value;\\nif (typeof percent !== undefined) {\\n if (percent < 20) {\\n return '#FFEFEFDE';\\n }\\n}\\nreturn '#FFFFFFC2';\"},\"showTooltip\":true,\"showTooltipLevel\":true,\"tooltipUnits\":\"%\",\"tooltipLevelDecimals\":0,\"tooltipLevelFont\":{\"family\":\"Roboto\",\"size\":13,\"sizeUnit\":\"px\",\"style\":\"normal\",\"weight\":\"500\",\"lineHeight\":\"100%\"},\"tooltipLevelColor\":{\"type\":\"constant\",\"color\":\"rgba(0, 0, 0, 0.76)\",\"rangeList\":[],\"colorFunction\":\"var percent = value;\\nif (typeof percent !== undefined) {\\n if (percent < 20) {\\n return '#E27C7CDE';\\n }\\n}\\nreturn '#7A8BFF';\"},\"showTooltipDate\":true,\"tooltipDateFormat\":{\"format\":null,\"lastUpdateAgo\":true,\"custom\":false},\"tooltipDateFont\":{\"family\":\"Roboto\",\"size\":13,\"sizeUnit\":\"px\",\"style\":\"normal\",\"weight\":\"500\",\"lineHeight\":\"100%\"},\"tooltipDateColor\":\"#000000C2\",\"tooltipBackgroundColor\":\"#FFFFFFC2\",\"tooltipBackgroundBlur\":3},\"title\":\"Liquid level\",\"useDashboardTimewindow\":true,\"displayTimewindow\":true,\"configMode\":\"basic\",\"titleFont\":{\"family\":\"Roboto\",\"size\":16,\"sizeUnit\":\"px\",\"style\":\"normal\",\"weight\":\"500\",\"lineHeight\":\"1.5\"},\"titleColor\":\"rgba(0, 0, 0, 0.87)\",\"showTitleIcon\":false,\"titleIcon\":\"water_drop\",\"iconColor\":\"#5469FF\",\"decimals\":0,\"enableDataExport\":false,\"enableFullscreen\":true,\"borderRadius\":null,\"actions\":{},\"iconSize\":\"24px\"}" "defaultConfig": "{\"datasources\":[{\"type\":\"function\",\"name\":\"function\",\"dataKeys\":[{\"name\":\"f(x)\",\"type\":\"function\",\"label\":\"Random\",\"color\":\"#2196f3\",\"settings\":{},\"_hash\":0.15479322438769105,\"funcBody\":\"return Math.floor(Math.random() * 101);\",\"aggregationType\":null,\"units\":null,\"decimals\":null,\"usePostProcessing\":null,\"postFuncBody\":null}],\"alarmFilterConfig\":{\"statusList\":[\"ACTIVE\"]}}],\"timewindow\":{\"realtime\":{\"timewindowMs\":60000}},\"showTitle\":true,\"backgroundColor\":\"#fff\",\"color\":\"rgba(0, 0, 0, 0.87)\",\"padding\":\"8px\",\"settings\":{\"tankSelectionType\":\"static\",\"selectedShape\":\"Horizontal Dish Ends\",\"shapeAttributeName\":\"tankShape\",\"tankColor\":{\"type\":\"range\",\"color\":\"#242770\",\"rangeList\":[{\"from\":null,\"to\":20,\"color\":\"#E73535DE\"},{\"from\":20,\"to\":null,\"color\":\"#242770\"}],\"colorFunction\":\"var percent = value;\\nif (typeof percent !== undefined) {\\n if (percent < 20) {\\n return '#E73535DE';\\n }\\n}\\nreturn '#242770';\"},\"datasourceUnits\":\"%\",\"layout\":\"percentage\",\"volumeSource\":\"static\",\"volumeConstant\":500,\"volumeAttributeName\":\"volume\",\"volumeUnits\":\"L\",\"volumeFont\":{\"family\":\"Roboto\",\"size\":14,\"sizeUnit\":\"px\",\"style\":\"normal\",\"weight\":\"500\",\"lineHeight\":\"100%\"},\"volumeColor\":\"rgba(0, 0, 0, 0.18)\",\"units\":\"%\",\"widgetUnitsSource\":\"static\",\"widgetUnitsAttributeName\":\"units\",\"liquidColor\":{\"type\":\"range\",\"color\":\"#7A8BFF\",\"rangeList\":[{\"from\":null,\"to\":20,\"color\":\"#E27C7CDE\"},{\"from\":20,\"to\":null,\"color\":\"#7A8BFF\"}],\"colorFunction\":\"var percent = value;\\nif (typeof percent !== undefined) {\\n if (percent < 20) {\\n return '#E27C7CDE';\\n }\\n}\\nreturn '#7A8BFF';\"},\"valueFont\":{\"family\":\"Roboto\",\"size\":24,\"sizeUnit\":\"px\",\"style\":\"normal\",\"weight\":\"500\",\"lineHeight\":\"100%\"},\"valueColor\":{\"type\":\"range\",\"color\":\"#000000DE\",\"rangeList\":[{\"from\":null,\"to\":20,\"color\":\"#FF0000DE\"},{\"from\":20,\"to\":null,\"color\":\"rgba(0,0,0,0.87)\"}],\"colorFunction\":\"var percent = value;\\nif (typeof percent !== undefined) {\\n if (percent < 20) {\\n return '#FF0000DE';\\n }\\n}\\nreturn '#000000DE';\"},\"showBackgroundOverlay\":true,\"backgroundOverlayColor\":{\"type\":\"range\",\"color\":\"rgba(255, 255, 255, 0.76)\",\"rangeList\":[{\"from\":null,\"to\":20,\"color\":\"#FFEFEFDE\"},{\"from\":20,\"to\":null,\"color\":\"#FFFFFFC2\"}],\"colorFunction\":\"var percent = value;\\nif (typeof percent !== undefined) {\\n if (percent < 20) {\\n return '#FFEFEFDE';\\n }\\n}\\nreturn '#FFFFFFC2';\"},\"showTooltip\":true,\"showTooltipLevel\":true,\"tooltipUnits\":\"%\",\"tooltipLevelDecimals\":0,\"tooltipLevelFont\":{\"family\":\"Roboto\",\"size\":13,\"sizeUnit\":\"px\",\"style\":\"normal\",\"weight\":\"500\",\"lineHeight\":\"100%\"},\"tooltipLevelColor\":{\"type\":\"constant\",\"color\":\"rgba(0, 0, 0, 0.76)\",\"rangeList\":[],\"colorFunction\":\"var percent = value;\\nif (typeof percent !== undefined) {\\n if (percent < 20) {\\n return '#E27C7CDE';\\n }\\n}\\nreturn '#7A8BFF';\"},\"showTooltipDate\":true,\"tooltipDateFormat\":{\"format\":null,\"lastUpdateAgo\":true,\"custom\":false},\"tooltipDateFont\":{\"family\":\"Roboto\",\"size\":13,\"sizeUnit\":\"px\",\"style\":\"normal\",\"weight\":\"500\",\"lineHeight\":\"100%\"},\"tooltipDateColor\":\"rgba(0, 0, 0, 0.76)\",\"tooltipBackgroundColor\":\"rgba(255, 255, 255, 0.76)\",\"tooltipBackgroundBlur\":3,\"background\":{\"type\":\"color\",\"color\":\"#fff\",\"overlay\":{\"enabled\":false,\"color\":\"rgba(255,255,255,0.72)\",\"blur\":3}}},\"title\":\"Liquid level\",\"useDashboardTimewindow\":true,\"displayTimewindow\":true,\"configMode\":\"basic\",\"titleFont\":{\"family\":\"Roboto\",\"size\":16,\"sizeUnit\":\"px\",\"style\":\"normal\",\"weight\":\"500\",\"lineHeight\":\"1.5\"},\"titleColor\":\"rgba(0, 0, 0, 0.87)\",\"showTitleIcon\":false,\"titleIcon\":\"water_drop\",\"iconColor\":\"#5469FF\",\"decimals\":0,\"enableDataExport\":false,\"enableFullscreen\":true,\"borderRadius\":null,\"actions\":{},\"iconSize\":\"24px\"}"
}, },
"externalId": null, "externalId": null,
"tags": null "tags": null

2
application/src/main/data/json/system/widget_types/horizontal_ellipse.json

@ -17,7 +17,7 @@
"settingsDirective": "tb-liquid-level-card-widget-settings", "settingsDirective": "tb-liquid-level-card-widget-settings",
"hasBasicMode": true, "hasBasicMode": true,
"basicModeDirective": "tb-liquid-level-card-basic-config", "basicModeDirective": "tb-liquid-level-card-basic-config",
"defaultConfig": "{\"datasources\":[{\"type\":\"function\",\"name\":\"function\",\"dataKeys\":[{\"name\":\"f(x)\",\"type\":\"function\",\"label\":\"Random\",\"color\":\"#2196f3\",\"settings\":{},\"_hash\":0.15479322438769105,\"funcBody\":\"return Math.floor(Math.random() * 101);\",\"aggregationType\":null,\"units\":null,\"decimals\":null,\"usePostProcessing\":null,\"postFuncBody\":null}],\"alarmFilterConfig\":{\"statusList\":[\"ACTIVE\"]}}],\"timewindow\":{\"realtime\":{\"timewindowMs\":60000}},\"showTitle\":true,\"backgroundColor\":\"#fff\",\"color\":\"rgba(0, 0, 0, 0.87)\",\"padding\":\"8px\",\"settings\":{\"tankSelectionType\":\"Static\",\"selectedShape\":\"Horizontal Ellipse\",\"shapeAttributeName\":\"tankShape\",\"tankColor\":{\"type\":\"range\",\"color\":\"#242770\",\"rangeList\":[{\"from\":null,\"to\":20,\"color\":\"#E73535DE\"},{\"from\":20,\"to\":null,\"color\":\"#242770\"}],\"colorFunction\":\"var percent = value;\\nif (typeof percent !== undefined) {\\n if (percent < 20) {\\n return '#E73535DE';\\n }\\n}\\nreturn '#242770';\"},\"datasourceUnits\":\"%\",\"layout\":\"percentage\",\"volumeSource\":\"Static\",\"volumeConstant\":500,\"volumeAttributeName\":\"volume\",\"volumeUnits\":\"L\",\"volumeFont\":{\"family\":\"Roboto\",\"size\":14,\"sizeUnit\":\"px\",\"style\":\"normal\",\"weight\":\"500\",\"lineHeight\":\"100%\"},\"volumeColor\":{\"type\":\"constant\",\"color\":\"rgba(0, 0, 0, 0.18)\",\"colorFunction\":\"var temperature = value;\\nif (typeof temperature !== undefined) {\\n var percent = (temperature + 60)/120 * 100;\\n return tinycolor.mix('blue', 'red', percent).toHexString();\\n}\\nreturn 'blue';\"},\"units\":\"%\",\"widgetUnitsSource\":\"Static\",\"widgetUnitsAttributeName\":\"units\",\"liquidColor\":{\"type\":\"range\",\"color\":\"#7A8BFF\",\"rangeList\":[{\"from\":null,\"to\":20,\"color\":\"#E27C7CDE\"},{\"from\":20,\"to\":null,\"color\":\"#7A8BFF\"}],\"colorFunction\":\"var percent = value;\\nif (typeof percent !== undefined) {\\n if (percent < 20) {\\n return '#E27C7CDE';\\n }\\n}\\nreturn '#7A8BFF';\"},\"valueFont\":{\"family\":\"Roboto\",\"size\":24,\"sizeUnit\":\"px\",\"style\":\"normal\",\"weight\":\"500\",\"lineHeight\":\"100%\"},\"valueColor\":{\"type\":\"range\",\"color\":\"#000000DE\",\"rangeList\":[{\"from\":null,\"to\":20,\"color\":\"#FF0000DE\"},{\"from\":20,\"to\":null,\"color\":\"rgba(0,0,0,0.87)\"}],\"colorFunction\":\"var percent = value;\\nif (typeof percent !== undefined) {\\n if (percent < 20) {\\n return '#FF0000DE';\\n }\\n}\\nreturn '#000000DE';\"},\"showBackgroundOverlay\":true,\"backgroundOverlayColor\":{\"type\":\"range\",\"color\":\"#FFFFFFC2\",\"rangeList\":[{\"from\":0,\"to\":20,\"color\":\"#FFEFEFDE\"},{\"from\":20,\"to\":null,\"color\":\"#FFFFFFC2\"}],\"colorFunction\":\"var percent = value;\\nif (typeof percent !== undefined) {\\n if (percent < 20) {\\n return '#FFEFEFDE';\\n }\\n}\\nreturn '#FFFFFFC2';\"},\"showTooltip\":true,\"showTooltipLevel\":true,\"tooltipUnits\":\"%\",\"tooltipLevelDecimals\":0,\"tooltipLevelFont\":{\"family\":\"Roboto\",\"size\":13,\"sizeUnit\":\"px\",\"style\":\"normal\",\"weight\":\"500\",\"lineHeight\":\"100%\"},\"tooltipLevelColor\":{\"type\":\"constant\",\"color\":\"rgba(0, 0, 0, 0.76)\",\"rangeList\":[],\"colorFunction\":\"var percent = value;\\nif (typeof percent !== undefined) {\\n if (percent < 20) {\\n return '#E27C7CDE';\\n }\\n}\\nreturn '#7A8BFF';\"},\"showTooltipDate\":true,\"tooltipDateFormat\":{\"format\":null,\"lastUpdateAgo\":true,\"custom\":false},\"tooltipDateFont\":{\"family\":\"Roboto\",\"size\":13,\"sizeUnit\":\"px\",\"style\":\"normal\",\"weight\":\"500\",\"lineHeight\":\"100%\"},\"tooltipDateColor\":\"#000000C2\",\"tooltipBackgroundColor\":\"#FFFFFFC2\",\"tooltipBackgroundBlur\":3},\"title\":\"Liquid level\",\"useDashboardTimewindow\":true,\"displayTimewindow\":true,\"configMode\":\"basic\",\"titleFont\":{\"family\":\"Roboto\",\"size\":16,\"sizeUnit\":\"px\",\"style\":\"normal\",\"weight\":\"500\",\"lineHeight\":\"1.5\"},\"titleColor\":\"rgba(0, 0, 0, 0.87)\",\"showTitleIcon\":false,\"titleIcon\":\"water_drop\",\"iconColor\":\"#5469FF\",\"decimals\":0,\"enableDataExport\":false,\"enableFullscreen\":true,\"borderRadius\":null,\"actions\":{},\"iconSize\":\"24px\"}" "defaultConfig": "{\"datasources\":[{\"type\":\"function\",\"name\":\"function\",\"dataKeys\":[{\"name\":\"f(x)\",\"type\":\"function\",\"label\":\"Random\",\"color\":\"#2196f3\",\"settings\":{},\"_hash\":0.15479322438769105,\"funcBody\":\"return Math.floor(Math.random() * 101);\",\"aggregationType\":null,\"units\":null,\"decimals\":null,\"usePostProcessing\":null,\"postFuncBody\":null}],\"alarmFilterConfig\":{\"statusList\":[\"ACTIVE\"]}}],\"timewindow\":{\"realtime\":{\"timewindowMs\":60000}},\"showTitle\":true,\"backgroundColor\":\"#fff\",\"color\":\"rgba(0, 0, 0, 0.87)\",\"padding\":\"8px\",\"settings\":{\"tankSelectionType\":\"Static\",\"selectedShape\":\"Horizontal Ellipse\",\"shapeAttributeName\":\"tankShape\",\"tankColor\":{\"type\":\"range\",\"color\":\"#242770\",\"rangeList\":[{\"from\":null,\"to\":20,\"color\":\"#E73535DE\"},{\"from\":20,\"to\":null,\"color\":\"#242770\"}],\"colorFunction\":\"var percent = value;\\nif (typeof percent !== undefined) {\\n if (percent < 20) {\\n return '#E73535DE';\\n }\\n}\\nreturn '#242770';\"},\"datasourceUnits\":\"%\",\"layout\":\"percentage\",\"volumeSource\":\"static\",\"volumeConstant\":500,\"volumeAttributeName\":\"volume\",\"volumeUnits\":\"L\",\"volumeFont\":{\"family\":\"Roboto\",\"size\":14,\"sizeUnit\":\"px\",\"style\":\"normal\",\"weight\":\"500\",\"lineHeight\":\"100%\"},\"volumeColor\":\"rgba(0, 0, 0, 0.18)\",\"units\":\"%\",\"widgetUnitsSource\":\"static\",\"widgetUnitsAttributeName\":\"units\",\"liquidColor\":{\"type\":\"range\",\"color\":\"#7A8BFF\",\"rangeList\":[{\"from\":null,\"to\":20,\"color\":\"#E27C7CDE\"},{\"from\":20,\"to\":null,\"color\":\"#7A8BFF\"}],\"colorFunction\":\"var percent = value;\\nif (typeof percent !== undefined) {\\n if (percent < 20) {\\n return '#E27C7CDE';\\n }\\n}\\nreturn '#7A8BFF';\"},\"valueFont\":{\"family\":\"Roboto\",\"size\":24,\"sizeUnit\":\"px\",\"style\":\"normal\",\"weight\":\"500\",\"lineHeight\":\"100%\"},\"valueColor\":{\"type\":\"range\",\"color\":\"#000000DE\",\"rangeList\":[{\"from\":null,\"to\":20,\"color\":\"#FF0000DE\"},{\"from\":20,\"to\":null,\"color\":\"rgba(0,0,0,0.87)\"}],\"colorFunction\":\"var percent = value;\\nif (typeof percent !== undefined) {\\n if (percent < 20) {\\n return '#FF0000DE';\\n }\\n}\\nreturn '#000000DE';\"},\"showBackgroundOverlay\":true,\"backgroundOverlayColor\":{\"type\":\"range\",\"color\":\"#FFFFFFC2\",\"rangeList\":[{\"from\":0,\"to\":20,\"color\":\"#FFEFEFDE\"},{\"from\":20,\"to\":null,\"color\":\"#FFFFFFC2\"}],\"colorFunction\":\"var percent = value;\\nif (typeof percent !== undefined) {\\n if (percent < 20) {\\n return '#FFEFEFDE';\\n }\\n}\\nreturn '#FFFFFFC2';\"},\"showTooltip\":true,\"showTooltipLevel\":true,\"tooltipUnits\":\"%\",\"tooltipLevelDecimals\":0,\"tooltipLevelFont\":{\"family\":\"Roboto\",\"size\":13,\"sizeUnit\":\"px\",\"style\":\"normal\",\"weight\":\"500\",\"lineHeight\":\"100%\"},\"tooltipLevelColor\":{\"type\":\"constant\",\"color\":\"rgba(0, 0, 0, 0.76)\",\"rangeList\":[],\"colorFunction\":\"var percent = value;\\nif (typeof percent !== undefined) {\\n if (percent < 20) {\\n return '#E27C7CDE';\\n }\\n}\\nreturn '#7A8BFF';\"},\"showTooltipDate\":true,\"tooltipDateFormat\":{\"format\":null,\"lastUpdateAgo\":true,\"custom\":false},\"tooltipDateFont\":{\"family\":\"Roboto\",\"size\":13,\"sizeUnit\":\"px\",\"style\":\"normal\",\"weight\":\"500\",\"lineHeight\":\"100%\"},\"tooltipDateColor\":\"rgba(0, 0, 0, 0.76)\",\"tooltipBackgroundColor\":\"rgba(255, 255, 255, 0.76)\",\"tooltipBackgroundBlur\":3,\"background\":{\"type\":\"color\",\"color\":\"#fff\",\"overlay\":{\"enabled\":false,\"color\":\"rgba(255,255,255,0.72)\",\"blur\":3}}},\"title\":\"Liquid level\",\"useDashboardTimewindow\":true,\"displayTimewindow\":true,\"configMode\":\"basic\",\"titleFont\":{\"family\":\"Roboto\",\"size\":16,\"sizeUnit\":\"px\",\"style\":\"normal\",\"weight\":\"500\",\"lineHeight\":\"1.5\"},\"titleColor\":\"rgba(0, 0, 0, 0.87)\",\"showTitleIcon\":false,\"titleIcon\":\"water_drop\",\"iconColor\":\"#5469FF\",\"decimals\":0,\"enableDataExport\":false,\"enableFullscreen\":true,\"borderRadius\":null,\"actions\":{},\"iconSize\":\"24px\"}"
}, },
"externalId": null, "externalId": null,
"tags": null "tags": null

2
application/src/main/data/json/system/widget_types/horizontal_oval.json

@ -17,7 +17,7 @@
"settingsDirective": "tb-liquid-level-card-widget-settings", "settingsDirective": "tb-liquid-level-card-widget-settings",
"hasBasicMode": true, "hasBasicMode": true,
"basicModeDirective": "tb-liquid-level-card-basic-config", "basicModeDirective": "tb-liquid-level-card-basic-config",
"defaultConfig": "{\"datasources\":[{\"type\":\"function\",\"name\":\"function\",\"dataKeys\":[{\"name\":\"f(x)\",\"type\":\"function\",\"label\":\"Random\",\"color\":\"#2196f3\",\"settings\":{},\"_hash\":0.15479322438769105,\"funcBody\":\"return Math.floor(Math.random() * 101);\",\"aggregationType\":null,\"units\":null,\"decimals\":null,\"usePostProcessing\":null,\"postFuncBody\":null}],\"alarmFilterConfig\":{\"statusList\":[\"ACTIVE\"]}}],\"timewindow\":{\"realtime\":{\"timewindowMs\":60000}},\"showTitle\":true,\"backgroundColor\":\"#fff\",\"color\":\"rgba(0, 0, 0, 0.87)\",\"padding\":\"8px\",\"settings\":{\"tankSelectionType\":\"Static\",\"selectedShape\":\"Horizontal Oval\",\"shapeAttributeName\":\"tankShape\",\"tankColor\":{\"type\":\"range\",\"color\":\"#242770\",\"rangeList\":[{\"from\":null,\"to\":20,\"color\":\"#E73535DE\"},{\"from\":20,\"to\":null,\"color\":\"#242770\"}],\"colorFunction\":\"var percent = value;\\nif (typeof percent !== undefined) {\\n if (percent < 20) {\\n return '#E73535DE';\\n }\\n}\\nreturn '#242770';\"},\"datasourceUnits\":\"%\",\"layout\":\"percentage\",\"volumeSource\":\"Static\",\"volumeConstant\":500,\"volumeAttributeName\":\"volume\",\"volumeUnits\":\"L\",\"volumeFont\":{\"family\":\"Roboto\",\"size\":14,\"sizeUnit\":\"px\",\"style\":\"normal\",\"weight\":\"500\",\"lineHeight\":\"100%\"},\"volumeColor\":{\"type\":\"constant\",\"color\":\"rgba(0, 0, 0, 0.18)\",\"colorFunction\":\"var temperature = value;\\nif (typeof temperature !== undefined) {\\n var percent = (temperature + 60)/120 * 100;\\n return tinycolor.mix('blue', 'red', percent).toHexString();\\n}\\nreturn 'blue';\"},\"units\":\"%\",\"widgetUnitsSource\":\"Static\",\"widgetUnitsAttributeName\":\"units\",\"liquidColor\":{\"type\":\"range\",\"color\":\"#7A8BFF\",\"rangeList\":[{\"from\":null,\"to\":20,\"color\":\"#E27C7CDE\"},{\"from\":20,\"to\":null,\"color\":\"#7A8BFF\"}],\"colorFunction\":\"var percent = value;\\nif (typeof percent !== undefined) {\\n if (percent < 20) {\\n return '#E27C7CDE';\\n }\\n}\\nreturn '#7A8BFF';\"},\"valueFont\":{\"family\":\"Roboto\",\"size\":24,\"sizeUnit\":\"px\",\"style\":\"normal\",\"weight\":\"500\",\"lineHeight\":\"100%\"},\"valueColor\":{\"type\":\"range\",\"color\":\"#000000DE\",\"rangeList\":[{\"from\":null,\"to\":20,\"color\":\"#FF0000DE\"},{\"from\":20,\"to\":null,\"color\":\"rgba(0,0,0,0.87)\"}],\"colorFunction\":\"var percent = value;\\nif (typeof percent !== undefined) {\\n if (percent < 20) {\\n return '#FF0000DE';\\n }\\n}\\nreturn '#000000DE';\"},\"showBackgroundOverlay\":true,\"backgroundOverlayColor\":{\"type\":\"range\",\"color\":\"rgba(255, 255, 255, 0.76)\",\"rangeList\":[{\"from\":null,\"to\":20,\"color\":\"#FFEFEFDE\"},{\"from\":20,\"to\":null,\"color\":\"#FFFFFFC2\"}],\"colorFunction\":\"var percent = value;\\nif (typeof percent !== undefined) {\\n if (percent < 20) {\\n return '#FFEFEFDE';\\n }\\n}\\nreturn '#FFFFFFC2';\"},\"showTooltip\":true,\"showTooltipLevel\":true,\"tooltipUnits\":\"%\",\"tooltipLevelDecimals\":0,\"tooltipLevelFont\":{\"family\":\"Roboto\",\"size\":13,\"sizeUnit\":\"px\",\"style\":\"normal\",\"weight\":\"500\",\"lineHeight\":\"100%\"},\"tooltipLevelColor\":{\"type\":\"constant\",\"color\":\"rgba(0, 0, 0, 0.76)\",\"rangeList\":[],\"colorFunction\":\"var percent = value;\\nif (typeof percent !== undefined) {\\n if (percent < 20) {\\n return '#E27C7CDE';\\n }\\n}\\nreturn '#7A8BFF';\"},\"showTooltipDate\":true,\"tooltipDateFormat\":{\"format\":null,\"lastUpdateAgo\":true,\"custom\":false},\"tooltipDateFont\":{\"family\":\"Roboto\",\"size\":13,\"sizeUnit\":\"px\",\"style\":\"normal\",\"weight\":\"500\",\"lineHeight\":\"100%\"},\"tooltipDateColor\":\"#000000C2\",\"tooltipBackgroundColor\":\"#FFFFFFC2\",\"tooltipBackgroundBlur\":3},\"title\":\"Liquid level\",\"useDashboardTimewindow\":true,\"displayTimewindow\":true,\"configMode\":\"basic\",\"titleFont\":{\"family\":\"Roboto\",\"size\":16,\"sizeUnit\":\"px\",\"style\":\"normal\",\"weight\":\"500\",\"lineHeight\":\"1.5\"},\"titleColor\":\"rgba(0, 0, 0, 0.87)\",\"showTitleIcon\":false,\"titleIcon\":\"water_drop\",\"iconColor\":\"#5469FF\",\"decimals\":0,\"enableDataExport\":false,\"enableFullscreen\":true,\"borderRadius\":null,\"actions\":{},\"iconSize\":\"24px\"}" "defaultConfig": "{\"datasources\":[{\"type\":\"function\",\"name\":\"function\",\"dataKeys\":[{\"name\":\"f(x)\",\"type\":\"function\",\"label\":\"Random\",\"color\":\"#2196f3\",\"settings\":{},\"_hash\":0.15479322438769105,\"funcBody\":\"return Math.floor(Math.random() * 101);\",\"aggregationType\":null,\"units\":null,\"decimals\":null,\"usePostProcessing\":null,\"postFuncBody\":null}],\"alarmFilterConfig\":{\"statusList\":[\"ACTIVE\"]}}],\"timewindow\":{\"realtime\":{\"timewindowMs\":60000}},\"showTitle\":true,\"backgroundColor\":\"#fff\",\"color\":\"rgba(0, 0, 0, 0.87)\",\"padding\":\"8px\",\"settings\":{\"tankSelectionType\":\"static\",\"selectedShape\":\"Horizontal Oval\",\"shapeAttributeName\":\"tankShape\",\"tankColor\":{\"type\":\"range\",\"color\":\"#242770\",\"rangeList\":[{\"from\":null,\"to\":20,\"color\":\"#E73535DE\"},{\"from\":20,\"to\":null,\"color\":\"#242770\"}],\"colorFunction\":\"var percent = value;\\nif (typeof percent !== undefined) {\\n if (percent < 20) {\\n return '#E73535DE';\\n }\\n}\\nreturn '#242770';\"},\"datasourceUnits\":\"%\",\"layout\":\"percentage\",\"volumeSource\":\"static\",\"volumeConstant\":500,\"volumeAttributeName\":\"volume\",\"volumeUnits\":\"L\",\"volumeFont\":{\"family\":\"Roboto\",\"size\":14,\"sizeUnit\":\"px\",\"style\":\"normal\",\"weight\":\"500\",\"lineHeight\":\"100%\"},\"volumeColor\":\"rgba(0, 0, 0, 0.18)\",\"units\":\"%\",\"widgetUnitsSource\":\"static\",\"widgetUnitsAttributeName\":\"units\",\"liquidColor\":{\"type\":\"range\",\"color\":\"#7A8BFF\",\"rangeList\":[{\"from\":null,\"to\":20,\"color\":\"#E27C7CDE\"},{\"from\":20,\"to\":null,\"color\":\"#7A8BFF\"}],\"colorFunction\":\"var percent = value;\\nif (typeof percent !== undefined) {\\n if (percent < 20) {\\n return '#E27C7CDE';\\n }\\n}\\nreturn '#7A8BFF';\"},\"valueFont\":{\"family\":\"Roboto\",\"size\":24,\"sizeUnit\":\"px\",\"style\":\"normal\",\"weight\":\"500\",\"lineHeight\":\"100%\"},\"valueColor\":{\"type\":\"range\",\"color\":\"#000000DE\",\"rangeList\":[{\"from\":null,\"to\":20,\"color\":\"#FF0000DE\"},{\"from\":20,\"to\":null,\"color\":\"rgba(0,0,0,0.87)\"}],\"colorFunction\":\"var percent = value;\\nif (typeof percent !== undefined) {\\n if (percent < 20) {\\n return '#FF0000DE';\\n }\\n}\\nreturn '#000000DE';\"},\"showBackgroundOverlay\":true,\"backgroundOverlayColor\":{\"type\":\"range\",\"color\":\"rgba(255, 255, 255, 0.76)\",\"rangeList\":[{\"from\":null,\"to\":20,\"color\":\"#FFEFEFDE\"},{\"from\":20,\"to\":null,\"color\":\"#FFFFFFC2\"}],\"colorFunction\":\"var percent = value;\\nif (typeof percent !== undefined) {\\n if (percent < 20) {\\n return '#FFEFEFDE';\\n }\\n}\\nreturn '#FFFFFFC2';\"},\"showTooltip\":true,\"showTooltipLevel\":true,\"tooltipUnits\":\"%\",\"tooltipLevelDecimals\":0,\"tooltipLevelFont\":{\"family\":\"Roboto\",\"size\":13,\"sizeUnit\":\"px\",\"style\":\"normal\",\"weight\":\"500\",\"lineHeight\":\"100%\"},\"tooltipLevelColor\":{\"type\":\"constant\",\"color\":\"rgba(0, 0, 0, 0.76)\",\"rangeList\":[],\"colorFunction\":\"var percent = value;\\nif (typeof percent !== undefined) {\\n if (percent < 20) {\\n return '#E27C7CDE';\\n }\\n}\\nreturn '#7A8BFF';\"},\"showTooltipDate\":true,\"tooltipDateFormat\":{\"format\":null,\"lastUpdateAgo\":true,\"custom\":false},\"tooltipDateFont\":{\"family\":\"Roboto\",\"size\":13,\"sizeUnit\":\"px\",\"style\":\"normal\",\"weight\":\"500\",\"lineHeight\":\"100%\"},\"tooltipDateColor\":\"rgba(0, 0, 0, 0.76)\",\"tooltipBackgroundColor\":\"rgba(255, 255, 255, 0.76)\",\"tooltipBackgroundBlur\":3,\"background\":{\"type\":\"color\",\"color\":\"#fff\",\"overlay\":{\"enabled\":false,\"color\":\"rgba(255,255,255,0.72)\",\"blur\":3}}},\"title\":\"Liquid level\",\"useDashboardTimewindow\":true,\"displayTimewindow\":true,\"configMode\":\"basic\",\"titleFont\":{\"family\":\"Roboto\",\"size\":16,\"sizeUnit\":\"px\",\"style\":\"normal\",\"weight\":\"500\",\"lineHeight\":\"1.5\"},\"titleColor\":\"rgba(0, 0, 0, 0.87)\",\"showTitleIcon\":false,\"titleIcon\":\"water_drop\",\"iconColor\":\"#5469FF\",\"decimals\":0,\"enableDataExport\":false,\"enableFullscreen\":true,\"borderRadius\":null,\"actions\":{},\"iconSize\":\"24px\"}"
}, },
"externalId": null, "externalId": null,
"tags": null "tags": null

2
application/src/main/data/json/system/widget_types/rectangle.json

@ -17,7 +17,7 @@
"settingsDirective": "tb-liquid-level-card-widget-settings", "settingsDirective": "tb-liquid-level-card-widget-settings",
"hasBasicMode": true, "hasBasicMode": true,
"basicModeDirective": "tb-liquid-level-card-basic-config", "basicModeDirective": "tb-liquid-level-card-basic-config",
"defaultConfig": "{\"datasources\":[{\"type\":\"function\",\"name\":\"function\",\"dataKeys\":[{\"name\":\"f(x)\",\"type\":\"function\",\"label\":\"Random\",\"color\":\"#2196f3\",\"settings\":{},\"_hash\":0.15479322438769105,\"funcBody\":\"return Math.floor(Math.random() * 101);\",\"aggregationType\":null,\"units\":null,\"decimals\":null,\"usePostProcessing\":null,\"postFuncBody\":null}],\"alarmFilterConfig\":{\"statusList\":[\"ACTIVE\"]}}],\"timewindow\":{\"realtime\":{\"timewindowMs\":60000}},\"showTitle\":true,\"backgroundColor\":\"#fff\",\"color\":\"rgba(0, 0, 0, 0.87)\",\"padding\":\"8px\",\"settings\":{\"tankSelectionType\":\"Static\",\"selectedShape\":\"Rectangle\",\"shapeAttributeName\":\"tankShape\",\"tankColor\":{\"type\":\"range\",\"color\":\"#242770\",\"rangeList\":[{\"from\":null,\"to\":20,\"color\":\"#E73535DE\"},{\"from\":20,\"to\":null,\"color\":\"#242770\"}],\"colorFunction\":\"var percent = value;\\nif (typeof percent !== undefined) {\\n if (percent < 20) {\\n return '#E73535DE';\\n }\\n}\\nreturn '#242770';\"},\"datasourceUnits\":\"%\",\"layout\":\"percentage\",\"volumeSource\":\"Static\",\"volumeConstant\":500,\"volumeAttributeName\":\"volume\",\"volumeUnits\":\"L\",\"volumeFont\":{\"family\":\"Roboto\",\"size\":14,\"sizeUnit\":\"px\",\"style\":\"normal\",\"weight\":\"500\",\"lineHeight\":\"100%\"},\"volumeColor\":{\"type\":\"constant\",\"color\":\"rgba(0, 0, 0, 0.18)\",\"colorFunction\":\"var temperature = value;\\nif (typeof temperature !== undefined) {\\n var percent = (temperature + 60)/120 * 100;\\n return tinycolor.mix('blue', 'red', percent).toHexString();\\n}\\nreturn 'blue';\"},\"units\":\"%\",\"widgetUnitsSource\":\"Static\",\"widgetUnitsAttributeName\":\"units\",\"liquidColor\":{\"type\":\"range\",\"color\":\"#7A8BFF\",\"rangeList\":[{\"from\":null,\"to\":20,\"color\":\"#E27C7CDE\"},{\"from\":20,\"to\":null,\"color\":\"#7A8BFF\"}],\"colorFunction\":\"var percent = value;\\nif (typeof percent !== undefined) {\\n if (percent < 20) {\\n return '#E27C7CDE';\\n }\\n}\\nreturn '#7A8BFF';\"},\"valueFont\":{\"family\":\"Roboto\",\"size\":24,\"sizeUnit\":\"px\",\"style\":\"normal\",\"weight\":\"500\",\"lineHeight\":\"100%\"},\"valueColor\":{\"type\":\"range\",\"color\":\"#000000DE\",\"rangeList\":[{\"from\":null,\"to\":20,\"color\":\"#FF0000DE\"},{\"from\":20,\"to\":null,\"color\":\"rgba(0,0,0,0.87)\"}],\"colorFunction\":\"var percent = value;\\nif (typeof percent !== undefined) {\\n if (percent < 20) {\\n return '#FF0000DE';\\n }\\n}\\nreturn '#000000DE';\"},\"showBackgroundOverlay\":true,\"backgroundOverlayColor\":{\"type\":\"range\",\"color\":\"#FFFFFFC2\",\"rangeList\":[{\"from\":null,\"to\":20,\"color\":\"#FFEFEFDE\"},{\"from\":20,\"to\":null,\"color\":\"#FFFFFFC2\"}],\"colorFunction\":\"var percent = value;\\nif (typeof percent !== undefined) {\\n if (percent < 20) {\\n return '#FFEFEFDE';\\n }\\n}\\nreturn '#FFFFFFC2';\"},\"showTooltip\":true,\"showTooltipLevel\":true,\"tooltipUnits\":\"%\",\"tooltipLevelDecimals\":0,\"tooltipLevelFont\":{\"family\":\"Roboto\",\"size\":13,\"sizeUnit\":\"px\",\"style\":\"normal\",\"weight\":\"500\",\"lineHeight\":\"100%\"},\"tooltipLevelColor\":{\"type\":\"constant\",\"color\":\"rgba(0, 0, 0, 0.76)\",\"rangeList\":[],\"colorFunction\":\"var percent = value;\\nif (typeof percent !== undefined) {\\n if (percent < 20) {\\n return '#E27C7CDE';\\n }\\n}\\nreturn '#7A8BFF';\"},\"showTooltipDate\":true,\"tooltipDateFormat\":{\"format\":null,\"lastUpdateAgo\":true,\"custom\":false},\"tooltipDateFont\":{\"family\":\"Roboto\",\"size\":13,\"sizeUnit\":\"px\",\"style\":\"normal\",\"weight\":\"500\",\"lineHeight\":\"100%\"},\"tooltipDateColor\":\"#000000C2\",\"tooltipBackgroundColor\":\"rgba(255, 255, 255, 0.76)\",\"tooltipBackgroundBlur\":3},\"title\":\"Liquid level\",\"useDashboardTimewindow\":true,\"displayTimewindow\":true,\"configMode\":\"advanced\",\"titleFont\":{\"family\":\"Roboto\",\"size\":16,\"sizeUnit\":\"px\",\"style\":\"normal\",\"weight\":\"500\",\"lineHeight\":\"1.5\"},\"titleColor\":\"rgba(0, 0, 0, 0.87)\",\"showTitleIcon\":false,\"titleIcon\":\"water_drop\",\"iconColor\":\"#5469FF\",\"decimals\":0,\"enableDataExport\":false,\"enableFullscreen\":true,\"borderRadius\":null,\"actions\":{},\"iconSize\":\"24px\"}" "defaultConfig": "{\"datasources\":[{\"type\":\"function\",\"name\":\"function\",\"dataKeys\":[{\"name\":\"f(x)\",\"type\":\"function\",\"label\":\"Random\",\"color\":\"#2196f3\",\"settings\":{},\"_hash\":0.15479322438769105,\"funcBody\":\"return Math.floor(Math.random() * 101);\",\"aggregationType\":null,\"units\":null,\"decimals\":null,\"usePostProcessing\":null,\"postFuncBody\":null}],\"alarmFilterConfig\":{\"statusList\":[\"ACTIVE\"]}}],\"timewindow\":{\"realtime\":{\"timewindowMs\":60000}},\"showTitle\":true,\"backgroundColor\":\"#fff\",\"color\":\"rgba(0, 0, 0, 0.87)\",\"padding\":\"8px\",\"settings\":{\"tankSelectionType\":\"static\",\"selectedShape\":\"Rectangle\",\"shapeAttributeName\":\"tankShape\",\"tankColor\":{\"type\":\"range\",\"color\":\"#242770\",\"rangeList\":[{\"from\":null,\"to\":20,\"color\":\"#E73535DE\"},{\"from\":20,\"to\":null,\"color\":\"#242770\"}],\"colorFunction\":\"var percent = value;\\nif (typeof percent !== undefined) {\\n if (percent < 20) {\\n return '#E73535DE';\\n }\\n}\\nreturn '#242770';\"},\"datasourceUnits\":\"%\",\"layout\":\"percentage\",\"volumeSource\":\"static\",\"volumeConstant\":500,\"volumeAttributeName\":\"volume\",\"volumeUnits\":\"L\",\"volumeFont\":{\"family\":\"Roboto\",\"size\":14,\"sizeUnit\":\"px\",\"style\":\"normal\",\"weight\":\"500\",\"lineHeight\":\"100%\"},\"volumeColor\":\"rgba(0, 0, 0, 0.18)\",\"units\":\"%\",\"widgetUnitsSource\":\"static\",\"widgetUnitsAttributeName\":\"units\",\"liquidColor\":{\"type\":\"range\",\"color\":\"#7A8BFF\",\"rangeList\":[{\"from\":null,\"to\":20,\"color\":\"#E27C7CDE\"},{\"from\":20,\"to\":null,\"color\":\"#7A8BFF\"}],\"colorFunction\":\"var percent = value;\\nif (typeof percent !== undefined) {\\n if (percent < 20) {\\n return '#E27C7CDE';\\n }\\n}\\nreturn '#7A8BFF';\"},\"valueFont\":{\"family\":\"Roboto\",\"size\":24,\"sizeUnit\":\"px\",\"style\":\"normal\",\"weight\":\"500\",\"lineHeight\":\"100%\"},\"valueColor\":{\"type\":\"range\",\"color\":\"#000000DE\",\"rangeList\":[{\"from\":null,\"to\":20,\"color\":\"#FF0000DE\"},{\"from\":20,\"to\":null,\"color\":\"rgba(0,0,0,0.87)\"}],\"colorFunction\":\"var percent = value;\\nif (typeof percent !== undefined) {\\n if (percent < 20) {\\n return '#FF0000DE';\\n }\\n}\\nreturn '#000000DE';\"},\"showBackgroundOverlay\":true,\"backgroundOverlayColor\":{\"type\":\"range\",\"color\":\"#FFFFFFC2\",\"rangeList\":[{\"from\":null,\"to\":20,\"color\":\"#FFEFEFDE\"},{\"from\":20,\"to\":null,\"color\":\"#FFFFFFC2\"}],\"colorFunction\":\"var percent = value;\\nif (typeof percent !== undefined) {\\n if (percent < 20) {\\n return '#FFEFEFDE';\\n }\\n}\\nreturn '#FFFFFFC2';\"},\"showTooltip\":true,\"showTooltipLevel\":true,\"tooltipUnits\":\"%\",\"tooltipLevelDecimals\":0,\"tooltipLevelFont\":{\"family\":\"Roboto\",\"size\":13,\"sizeUnit\":\"px\",\"style\":\"normal\",\"weight\":\"500\",\"lineHeight\":\"100%\"},\"tooltipLevelColor\":{\"type\":\"constant\",\"color\":\"rgba(0, 0, 0, 0.76)\",\"rangeList\":[],\"colorFunction\":\"var percent = value;\\nif (typeof percent !== undefined) {\\n if (percent < 20) {\\n return '#E27C7CDE';\\n }\\n}\\nreturn '#7A8BFF';\"},\"showTooltipDate\":true,\"tooltipDateFormat\":{\"format\":null,\"lastUpdateAgo\":true,\"custom\":false},\"tooltipDateFont\":{\"family\":\"Roboto\",\"size\":13,\"sizeUnit\":\"px\",\"style\":\"normal\",\"weight\":\"500\",\"lineHeight\":\"100%\"},\"tooltipDateColor\":\"rgba(0, 0, 0, 0.76)\",\"tooltipBackgroundColor\":\"rgba(255, 255, 255, 0.76)\",\"tooltipBackgroundBlur\":3,\"background\":{\"type\":\"color\",\"color\":\"#fff\",\"overlay\":{\"enabled\":false,\"color\":\"rgba(255,255,255,0.72)\",\"blur\":3}}},\"title\":\"Liquid level\",\"useDashboardTimewindow\":true,\"displayTimewindow\":true,\"configMode\":\"basic\",\"titleFont\":{\"family\":\"Roboto\",\"size\":16,\"sizeUnit\":\"px\",\"style\":\"normal\",\"weight\":\"500\",\"lineHeight\":\"1.5\"},\"titleColor\":\"rgba(0, 0, 0, 0.87)\",\"showTitleIcon\":false,\"titleIcon\":\"water_drop\",\"iconColor\":\"#5469FF\",\"decimals\":0,\"enableDataExport\":false,\"enableFullscreen\":true,\"borderRadius\":null,\"actions\":{},\"iconSize\":\"24px\"}"
}, },
"externalId": null, "externalId": null,
"tags": null "tags": null

2
application/src/main/data/json/system/widget_types/vertical_capsule.json

@ -17,7 +17,7 @@
"settingsDirective": "tb-liquid-level-card-widget-settings", "settingsDirective": "tb-liquid-level-card-widget-settings",
"hasBasicMode": true, "hasBasicMode": true,
"basicModeDirective": "tb-liquid-level-card-basic-config", "basicModeDirective": "tb-liquid-level-card-basic-config",
"defaultConfig": "{\"datasources\":[{\"type\":\"function\",\"name\":\"function\",\"dataKeys\":[{\"name\":\"f(x)\",\"type\":\"function\",\"label\":\"Random\",\"color\":\"#2196f3\",\"settings\":{},\"_hash\":0.15479322438769105,\"funcBody\":\"return Math.floor(Math.random() * 101);\",\"aggregationType\":null,\"units\":null,\"decimals\":null,\"usePostProcessing\":null,\"postFuncBody\":null}],\"alarmFilterConfig\":{\"statusList\":[\"ACTIVE\"]}}],\"timewindow\":{\"realtime\":{\"timewindowMs\":60000}},\"showTitle\":true,\"backgroundColor\":\"#fff\",\"color\":\"rgba(0, 0, 0, 0.87)\",\"padding\":\"8px\",\"settings\":{\"tankSelectionType\":\"Static\",\"selectedShape\":\"Vertical Capsule\",\"shapeAttributeName\":\"tankShape\",\"tankColor\":{\"type\":\"range\",\"color\":\"#242770\",\"rangeList\":[{\"from\":null,\"to\":20,\"color\":\"#E73535DE\"},{\"from\":20,\"to\":null,\"color\":\"#242770\"}],\"colorFunction\":\"var percent = value;\\nif (typeof percent !== undefined) {\\n if (percent < 20) {\\n return '#E73535DE';\\n }\\n}\\nreturn '#242770';\"},\"datasourceUnits\":\"%\",\"layout\":\"percentage\",\"volumeSource\":\"Static\",\"volumeConstant\":500,\"volumeAttributeName\":\"volume\",\"volumeUnits\":\"L\",\"volumeFont\":{\"family\":\"Roboto\",\"size\":14,\"sizeUnit\":\"px\",\"style\":\"normal\",\"weight\":\"500\",\"lineHeight\":\"100%\"},\"volumeColor\":{\"type\":\"constant\",\"color\":\"rgba(0, 0, 0, 0.18)\",\"colorFunction\":\"var temperature = value;\\nif (typeof temperature !== undefined) {\\n var percent = (temperature + 60)/120 * 100;\\n return tinycolor.mix('blue', 'red', percent).toHexString();\\n}\\nreturn 'blue';\"},\"units\":\"%\",\"widgetUnitsSource\":\"Static\",\"widgetUnitsAttributeName\":\"units\",\"liquidColor\":{\"type\":\"range\",\"color\":\"#7A8BFF\",\"rangeList\":[{\"from\":null,\"to\":20,\"color\":\"#E27C7CDE\"},{\"from\":20,\"to\":null,\"color\":\"#7A8BFF\"}],\"colorFunction\":\"var percent = value;\\nif (typeof percent !== undefined) {\\n if (percent < 20) {\\n return '#E27C7CDE';\\n }\\n}\\nreturn '#7A8BFF';\"},\"valueFont\":{\"family\":\"Roboto\",\"size\":24,\"sizeUnit\":\"px\",\"style\":\"normal\",\"weight\":\"500\",\"lineHeight\":\"100%\"},\"valueColor\":{\"type\":\"range\",\"color\":\"#000000DE\",\"rangeList\":[{\"from\":null,\"to\":20,\"color\":\"#FF0000DE\"},{\"from\":20,\"to\":null,\"color\":\"rgba(0,0,0,0.87)\"}],\"colorFunction\":\"var percent = value;\\nif (typeof percent !== undefined) {\\n if (percent < 20) {\\n return '#FF0000DE';\\n }\\n}\\nreturn '#000000DE';\"},\"showBackgroundOverlay\":true,\"backgroundOverlayColor\":{\"type\":\"range\",\"color\":\"#FFFFFFC2\",\"rangeList\":[{\"from\":null,\"to\":20,\"color\":\"#FFEFEFDE\"},{\"from\":20,\"to\":null,\"color\":\"#FFFFFFC2\"}],\"colorFunction\":\"var percent = value;\\nif (typeof percent !== undefined) {\\n if (percent < 20) {\\n return '#FFEFEFDE';\\n }\\n}\\nreturn '#FFFFFFC2';\"},\"showTooltip\":true,\"showTooltipLevel\":true,\"tooltipUnits\":\"%\",\"tooltipLevelDecimals\":0,\"tooltipLevelFont\":{\"family\":\"Roboto\",\"size\":13,\"sizeUnit\":\"px\",\"style\":\"normal\",\"weight\":\"500\",\"lineHeight\":\"100%\"},\"tooltipLevelColor\":{\"type\":\"constant\",\"color\":\"rgba(0, 0, 0, 0.76)\",\"rangeList\":[],\"colorFunction\":\"var percent = value;\\nif (typeof percent !== undefined) {\\n if (percent < 20) {\\n return '#E27C7CDE';\\n }\\n}\\nreturn '#7A8BFF';\"},\"showTooltipDate\":true,\"tooltipDateFormat\":{\"format\":null,\"lastUpdateAgo\":true,\"custom\":false},\"tooltipDateFont\":{\"family\":\"Roboto\",\"size\":13,\"sizeUnit\":\"px\",\"style\":\"normal\",\"weight\":\"500\",\"lineHeight\":\"100%\"},\"tooltipDateColor\":\"#000000C2\",\"tooltipBackgroundColor\":\"#FFFFFFC2\",\"tooltipBackgroundBlur\":3},\"title\":\"Liquid level\",\"useDashboardTimewindow\":true,\"displayTimewindow\":true,\"configMode\":\"basic\",\"titleFont\":{\"family\":\"Roboto\",\"size\":16,\"sizeUnit\":\"px\",\"style\":\"normal\",\"weight\":\"500\",\"lineHeight\":\"1.5\"},\"titleColor\":\"rgba(0, 0, 0, 0.87)\",\"showTitleIcon\":false,\"titleIcon\":\"water_drop\",\"iconColor\":\"#5469FF\",\"decimals\":0,\"enableDataExport\":false,\"enableFullscreen\":true,\"borderRadius\":null,\"actions\":{},\"iconSize\":\"24px\"}" "defaultConfig": "{\"datasources\":[{\"type\":\"function\",\"name\":\"function\",\"dataKeys\":[{\"name\":\"f(x)\",\"type\":\"function\",\"label\":\"Random\",\"color\":\"#2196f3\",\"settings\":{},\"_hash\":0.15479322438769105,\"funcBody\":\"return Math.floor(Math.random() * 101);\",\"aggregationType\":null,\"units\":null,\"decimals\":null,\"usePostProcessing\":null,\"postFuncBody\":null}],\"alarmFilterConfig\":{\"statusList\":[\"ACTIVE\"]}}],\"timewindow\":{\"realtime\":{\"timewindowMs\":60000}},\"showTitle\":true,\"backgroundColor\":\"#fff\",\"color\":\"rgba(0, 0, 0, 0.87)\",\"padding\":\"8px\",\"settings\":{\"tankSelectionType\":\"static\",\"selectedShape\":\"Vertical Capsule\",\"shapeAttributeName\":\"tankShape\",\"tankColor\":{\"type\":\"range\",\"color\":\"#242770\",\"rangeList\":[{\"from\":null,\"to\":20,\"color\":\"#E73535DE\"},{\"from\":20,\"to\":null,\"color\":\"#242770\"}],\"colorFunction\":\"var percent = value;\\nif (typeof percent !== undefined) {\\n if (percent < 20) {\\n return '#E73535DE';\\n }\\n}\\nreturn '#242770';\"},\"datasourceUnits\":\"%\",\"layout\":\"percentage\",\"volumeSource\":\"static\",\"volumeConstant\":500,\"volumeAttributeName\":\"volume\",\"volumeUnits\":\"L\",\"volumeFont\":{\"family\":\"Roboto\",\"size\":14,\"sizeUnit\":\"px\",\"style\":\"normal\",\"weight\":\"500\",\"lineHeight\":\"100%\"},\"volumeColor\":\"rgba(0, 0, 0, 0.18)\",\"units\":\"%\",\"widgetUnitsSource\":\"static\",\"widgetUnitsAttributeName\":\"units\",\"liquidColor\":{\"type\":\"range\",\"color\":\"#7A8BFF\",\"rangeList\":[{\"from\":null,\"to\":20,\"color\":\"#E27C7CDE\"},{\"from\":20,\"to\":null,\"color\":\"#7A8BFF\"}],\"colorFunction\":\"var percent = value;\\nif (typeof percent !== undefined) {\\n if (percent < 20) {\\n return '#E27C7CDE';\\n }\\n}\\nreturn '#7A8BFF';\"},\"valueFont\":{\"family\":\"Roboto\",\"size\":24,\"sizeUnit\":\"px\",\"style\":\"normal\",\"weight\":\"500\",\"lineHeight\":\"100%\"},\"valueColor\":{\"type\":\"range\",\"color\":\"#000000DE\",\"rangeList\":[{\"from\":null,\"to\":20,\"color\":\"#FF0000DE\"},{\"from\":20,\"to\":null,\"color\":\"rgba(0,0,0,0.87)\"}],\"colorFunction\":\"var percent = value;\\nif (typeof percent !== undefined) {\\n if (percent < 20) {\\n return '#FF0000DE';\\n }\\n}\\nreturn '#000000DE';\"},\"showBackgroundOverlay\":true,\"backgroundOverlayColor\":{\"type\":\"range\",\"color\":\"#FFFFFFC2\",\"rangeList\":[{\"from\":null,\"to\":20,\"color\":\"#FFEFEFDE\"},{\"from\":20,\"to\":null,\"color\":\"#FFFFFFC2\"}],\"colorFunction\":\"var percent = value;\\nif (typeof percent !== undefined) {\\n if (percent < 20) {\\n return '#FFEFEFDE';\\n }\\n}\\nreturn '#FFFFFFC2';\"},\"showTooltip\":true,\"showTooltipLevel\":true,\"tooltipUnits\":\"%\",\"tooltipLevelDecimals\":0,\"tooltipLevelFont\":{\"family\":\"Roboto\",\"size\":13,\"sizeUnit\":\"px\",\"style\":\"normal\",\"weight\":\"500\",\"lineHeight\":\"100%\"},\"tooltipLevelColor\":{\"type\":\"constant\",\"color\":\"rgba(0, 0, 0, 0.76)\",\"rangeList\":[],\"colorFunction\":\"var percent = value;\\nif (typeof percent !== undefined) {\\n if (percent < 20) {\\n return '#E27C7CDE';\\n }\\n}\\nreturn '#7A8BFF';\"},\"showTooltipDate\":true,\"tooltipDateFormat\":{\"format\":null,\"lastUpdateAgo\":true,\"custom\":false},\"tooltipDateFont\":{\"family\":\"Roboto\",\"size\":13,\"sizeUnit\":\"px\",\"style\":\"normal\",\"weight\":\"500\",\"lineHeight\":\"100%\"},\"tooltipDateColor\":\"rgba(0, 0, 0, 0.76)\",\"tooltipBackgroundColor\":\"rgba(255, 255, 255, 0.76)\",\"tooltipBackgroundBlur\":3,\"background\":{\"type\":\"color\",\"color\":\"#fff\",\"overlay\":{\"enabled\":false,\"color\":\"rgba(255,255,255,0.72)\",\"blur\":3}}},\"title\":\"Liquid level\",\"useDashboardTimewindow\":true,\"displayTimewindow\":true,\"configMode\":\"basic\",\"titleFont\":{\"family\":\"Roboto\",\"size\":16,\"sizeUnit\":\"px\",\"style\":\"normal\",\"weight\":\"500\",\"lineHeight\":\"1.5\"},\"titleColor\":\"rgba(0, 0, 0, 0.87)\",\"showTitleIcon\":false,\"titleIcon\":\"water_drop\",\"iconColor\":\"#5469FF\",\"decimals\":0,\"enableDataExport\":false,\"enableFullscreen\":true,\"borderRadius\":null,\"actions\":{},\"iconSize\":\"24px\"}"
}, },
"externalId": null, "externalId": null,
"tags": null "tags": null

2
application/src/main/data/json/system/widget_types/vertical_cylinder.json

@ -17,7 +17,7 @@
"settingsDirective": "tb-liquid-level-card-widget-settings", "settingsDirective": "tb-liquid-level-card-widget-settings",
"hasBasicMode": true, "hasBasicMode": true,
"basicModeDirective": "tb-liquid-level-card-basic-config", "basicModeDirective": "tb-liquid-level-card-basic-config",
"defaultConfig": "{\"datasources\":[{\"type\":\"function\",\"name\":\"function\",\"dataKeys\":[{\"name\":\"f(x)\",\"type\":\"function\",\"label\":\"Random\",\"color\":\"#2196f3\",\"settings\":{},\"_hash\":0.15479322438769105,\"funcBody\":\"return Math.floor(Math.random() * 101);\",\"aggregationType\":null,\"units\":null,\"decimals\":null,\"usePostProcessing\":null,\"postFuncBody\":null}],\"alarmFilterConfig\":{\"statusList\":[\"ACTIVE\"]}}],\"timewindow\":{\"realtime\":{\"timewindowMs\":60000}},\"showTitle\":true,\"backgroundColor\":\"#fff\",\"color\":\"rgba(0, 0, 0, 0.87)\",\"padding\":\"8px\",\"settings\":{\"tankSelectionType\":\"Static\",\"selectedShape\":\"Vertical Cylinder\",\"shapeAttributeName\":\"tankShape\",\"tankColor\":{\"type\":\"range\",\"color\":\"#242770\",\"rangeList\":[{\"from\":null,\"to\":20,\"color\":\"#E73535DE\"},{\"from\":20,\"to\":null,\"color\":\"#242770\"}],\"colorFunction\":\"var percent = value;\\nif (typeof percent !== undefined) {\\n if (percent < 20) {\\n return '#E73535DE';\\n }\\n}\\nreturn '#242770';\"},\"datasourceUnits\":\"%\",\"layout\":\"percentage\",\"volumeSource\":\"Static\",\"volumeConstant\":500,\"volumeAttributeName\":\"volume\",\"volumeUnits\":\"L\",\"volumeFont\":{\"family\":\"Roboto\",\"size\":14,\"sizeUnit\":\"px\",\"style\":\"normal\",\"weight\":\"500\",\"lineHeight\":\"100%\"},\"volumeColor\":{\"type\":\"constant\",\"color\":\"rgba(0, 0, 0, 0.18)\",\"colorFunction\":\"var temperature = value;\\nif (typeof temperature !== undefined) {\\n var percent = (temperature + 60)/120 * 100;\\n return tinycolor.mix('blue', 'red', percent).toHexString();\\n}\\nreturn 'blue';\"},\"units\":\"%\",\"widgetUnitsSource\":\"Static\",\"widgetUnitsAttributeName\":\"units\",\"liquidColor\":{\"type\":\"range\",\"color\":\"#7A8BFF\",\"rangeList\":[{\"from\":null,\"to\":20,\"color\":\"#E27C7CDE\"},{\"from\":20,\"to\":null,\"color\":\"#7A8BFF\"}],\"colorFunction\":\"var percent = value;\\nif (typeof percent !== undefined) {\\n if (percent < 20) {\\n return '#E27C7CDE';\\n }\\n}\\nreturn '#7A8BFF';\"},\"valueFont\":{\"family\":\"Roboto\",\"size\":24,\"sizeUnit\":\"px\",\"style\":\"normal\",\"weight\":\"500\",\"lineHeight\":\"100%\"},\"valueColor\":{\"type\":\"range\",\"color\":\"#000000DE\",\"rangeList\":[{\"from\":null,\"to\":20,\"color\":\"#FF0000DE\"},{\"from\":20,\"to\":null,\"color\":\"rgba(0,0,0,0.87)\"}],\"colorFunction\":\"var percent = value;\\nif (typeof percent !== undefined) {\\n if (percent < 20) {\\n return '#FF0000DE';\\n }\\n}\\nreturn '#000000DE';\"},\"showBackgroundOverlay\":true,\"backgroundOverlayColor\":{\"type\":\"range\",\"color\":\"rgba(255, 255, 255, 0.76)\",\"rangeList\":[{\"from\":null,\"to\":20,\"color\":\"#FFEFEFDE\"},{\"from\":20,\"to\":null,\"color\":\"#FFFFFFC2\"}],\"colorFunction\":\"var percent = value;\\nif (typeof percent !== undefined) {\\n if (percent < 20) {\\n return '#FFEFEFDE';\\n }\\n}\\nreturn '#FFFFFFC2';\"},\"showTooltip\":true,\"showTooltipLevel\":true,\"tooltipUnits\":\"%\",\"tooltipLevelDecimals\":0,\"tooltipLevelFont\":{\"family\":\"Roboto\",\"size\":13,\"sizeUnit\":\"px\",\"style\":\"normal\",\"weight\":\"500\",\"lineHeight\":\"100%\"},\"tooltipLevelColor\":{\"type\":\"constant\",\"color\":\"rgba(0, 0, 0, 0.76)\",\"rangeList\":[],\"colorFunction\":\"var percent = value;\\nif (typeof percent !== undefined) {\\n if (percent < 20) {\\n return '#E27C7CDE';\\n }\\n}\\nreturn '#7A8BFF';\"},\"showTooltipDate\":true,\"tooltipDateFormat\":{\"format\":null,\"lastUpdateAgo\":true,\"custom\":false},\"tooltipDateFont\":{\"family\":\"Roboto\",\"size\":13,\"sizeUnit\":\"px\",\"style\":\"normal\",\"weight\":\"500\",\"lineHeight\":\"100%\"},\"tooltipDateColor\":\"#000000C2\",\"tooltipBackgroundColor\":\"#FFFFFFC2\",\"tooltipBackgroundBlur\":3},\"title\":\"Liquid level\",\"useDashboardTimewindow\":true,\"displayTimewindow\":true,\"configMode\":\"basic\",\"titleFont\":{\"family\":\"Roboto\",\"size\":16,\"sizeUnit\":\"px\",\"style\":\"normal\",\"weight\":\"500\",\"lineHeight\":\"1.5\"},\"titleColor\":\"rgba(0, 0, 0, 0.87)\",\"showTitleIcon\":false,\"titleIcon\":\"water_drop\",\"iconColor\":\"#5469FF\",\"decimals\":0,\"enableDataExport\":false,\"enableFullscreen\":true,\"borderRadius\":null,\"actions\":{},\"iconSize\":\"24px\"}" "defaultConfig": "{\"datasources\":[{\"type\":\"function\",\"name\":\"function\",\"dataKeys\":[{\"name\":\"f(x)\",\"type\":\"function\",\"label\":\"Random\",\"color\":\"#2196f3\",\"settings\":{},\"_hash\":0.15479322438769105,\"funcBody\":\"return Math.floor(Math.random() * 101);\",\"aggregationType\":null,\"units\":null,\"decimals\":null,\"usePostProcessing\":null,\"postFuncBody\":null}],\"alarmFilterConfig\":{\"statusList\":[\"ACTIVE\"]}}],\"timewindow\":{\"realtime\":{\"timewindowMs\":60000}},\"showTitle\":true,\"backgroundColor\":\"#fff\",\"color\":\"rgba(0, 0, 0, 0.87)\",\"padding\":\"8px\",\"settings\":{\"tankSelectionType\":\"static\",\"selectedShape\":\"Vertical Cylinder\",\"shapeAttributeName\":\"tankShape\",\"tankColor\":{\"type\":\"range\",\"color\":\"#242770\",\"rangeList\":[{\"from\":null,\"to\":20,\"color\":\"#E73535DE\"},{\"from\":20,\"to\":null,\"color\":\"#242770\"}],\"colorFunction\":\"var percent = value;\\nif (typeof percent !== undefined) {\\n if (percent < 20) {\\n return '#E73535DE';\\n }\\n}\\nreturn '#242770';\"},\"datasourceUnits\":\"%\",\"layout\":\"percentage\",\"volumeSource\":\"static\",\"volumeConstant\":500,\"volumeAttributeName\":\"volume\",\"volumeUnits\":\"L\",\"volumeFont\":{\"family\":\"Roboto\",\"size\":14,\"sizeUnit\":\"px\",\"style\":\"normal\",\"weight\":\"500\",\"lineHeight\":\"100%\"},\"volumeColor\":\"rgba(255, 255, 255, 0.18)\",\"units\":\"%\",\"widgetUnitsSource\":\"static\",\"widgetUnitsAttributeName\":\"units\",\"liquidColor\":{\"type\":\"range\",\"color\":\"#7A8BFF\",\"rangeList\":[{\"from\":null,\"to\":20,\"color\":\"#E27C7CDE\"},{\"from\":20,\"to\":null,\"color\":\"#7A8BFF\"}],\"colorFunction\":\"var percent = value;\\nif (typeof percent !== undefined) {\\n if (percent < 20) {\\n return '#E27C7CDE';\\n }\\n}\\nreturn '#7A8BFF';\"},\"valueFont\":{\"family\":\"Roboto\",\"size\":24,\"sizeUnit\":\"px\",\"style\":\"normal\",\"weight\":\"500\",\"lineHeight\":\"100%\"},\"valueColor\":{\"type\":\"range\",\"color\":\"#000000DE\",\"rangeList\":[{\"from\":null,\"to\":20,\"color\":\"#FF0000DE\"},{\"from\":20,\"to\":null,\"color\":\"rgba(0,0,0,0.87)\"}],\"colorFunction\":\"var percent = value;\\nif (typeof percent !== undefined) {\\n if (percent < 20) {\\n return '#FF0000DE';\\n }\\n}\\nreturn '#000000DE';\"},\"showBackgroundOverlay\":true,\"backgroundOverlayColor\":{\"type\":\"range\",\"color\":\"rgba(255, 255, 255, 0.76)\",\"rangeList\":[{\"from\":null,\"to\":20,\"color\":\"#FFEFEFDE\"},{\"from\":20,\"to\":null,\"color\":\"#FFFFFFC2\"}],\"colorFunction\":\"var percent = value;\\nif (typeof percent !== undefined) {\\n if (percent < 20) {\\n return '#FFEFEFDE';\\n }\\n}\\nreturn '#FFFFFFC2';\"},\"showTooltip\":true,\"showTooltipLevel\":true,\"tooltipUnits\":\"%\",\"tooltipLevelDecimals\":0,\"tooltipLevelFont\":{\"family\":\"Roboto\",\"size\":13,\"sizeUnit\":\"px\",\"style\":\"normal\",\"weight\":\"500\",\"lineHeight\":\"100%\"},\"tooltipLevelColor\":{\"type\":\"constant\",\"color\":\"rgba(0, 0, 0, 0.76)\",\"rangeList\":[],\"colorFunction\":\"var percent = value;\\nif (typeof percent !== undefined) {\\n if (percent < 20) {\\n return '#E27C7CDE';\\n }\\n}\\nreturn '#7A8BFF';\"},\"showTooltipDate\":true,\"tooltipDateFormat\":{\"format\":null,\"lastUpdateAgo\":true,\"custom\":false},\"tooltipDateFont\":{\"family\":\"Roboto\",\"size\":13,\"sizeUnit\":\"px\",\"style\":\"normal\",\"weight\":\"500\",\"lineHeight\":\"100%\"},\"tooltipDateColor\":\"rgba(0, 0, 0, 0.76)\",\"tooltipBackgroundColor\":\"rgba(255, 255, 255, 0.76)\",\"tooltipBackgroundBlur\":3,\"background\":{\"type\":\"color\",\"color\":\"#fff\",\"overlay\":{\"enabled\":false,\"color\":\"rgba(255,255,255,0.72)\",\"blur\":3}}},\"title\":\"Liquid level\",\"useDashboardTimewindow\":true,\"displayTimewindow\":true,\"configMode\":\"basic\",\"titleFont\":{\"family\":\"Roboto\",\"size\":16,\"sizeUnit\":\"px\",\"style\":\"normal\",\"weight\":\"500\",\"lineHeight\":\"1.5\"},\"titleColor\":\"rgba(0, 0, 0, 0.87)\",\"showTitleIcon\":false,\"titleIcon\":\"water_drop\",\"iconColor\":\"#5469FF\",\"decimals\":0,\"enableDataExport\":false,\"enableFullscreen\":true,\"borderRadius\":null,\"actions\":{},\"iconSize\":\"24px\"}"
}, },
"externalId": null, "externalId": null,
"tags": null "tags": null

2
application/src/main/data/json/system/widget_types/vertical_oval.json

@ -17,7 +17,7 @@
"settingsDirective": "tb-liquid-level-card-widget-settings", "settingsDirective": "tb-liquid-level-card-widget-settings",
"hasBasicMode": true, "hasBasicMode": true,
"basicModeDirective": "tb-liquid-level-card-basic-config", "basicModeDirective": "tb-liquid-level-card-basic-config",
"defaultConfig": "{\"datasources\":[{\"type\":\"function\",\"name\":\"function\",\"dataKeys\":[{\"name\":\"f(x)\",\"type\":\"function\",\"label\":\"Random\",\"color\":\"#2196f3\",\"settings\":{},\"_hash\":0.15479322438769105,\"funcBody\":\"return Math.floor(Math.random() * 101);\",\"aggregationType\":null,\"units\":null,\"decimals\":null,\"usePostProcessing\":null,\"postFuncBody\":null}],\"alarmFilterConfig\":{\"statusList\":[\"ACTIVE\"]}}],\"timewindow\":{\"realtime\":{\"timewindowMs\":60000}},\"showTitle\":true,\"backgroundColor\":\"#fff\",\"color\":\"rgba(0, 0, 0, 0.87)\",\"padding\":\"8px\",\"settings\":{\"tankSelectionType\":\"Static\",\"selectedShape\":\"Vertical Oval\",\"shapeAttributeName\":\"tankShape\",\"tankColor\":{\"type\":\"range\",\"color\":\"#242770\",\"rangeList\":[{\"from\":null,\"to\":20,\"color\":\"#E73535DE\"},{\"from\":20,\"to\":null,\"color\":\"#242770\"}],\"colorFunction\":\"var percent = value;\\nif (typeof percent !== undefined) {\\n if (percent < 20) {\\n return '#E73535DE';\\n }\\n}\\nreturn '#242770';\"},\"datasourceUnits\":\"%\",\"layout\":\"percentage\",\"volumeSource\":\"Static\",\"volumeConstant\":500,\"volumeAttributeName\":\"volume\",\"volumeUnits\":\"L\",\"volumeFont\":{\"family\":\"Roboto\",\"size\":14,\"sizeUnit\":\"px\",\"style\":\"normal\",\"weight\":\"500\",\"lineHeight\":\"100%\"},\"volumeColor\":{\"type\":\"constant\",\"color\":\"rgba(0, 0, 0, 0.18)\",\"colorFunction\":\"var temperature = value;\\nif (typeof temperature !== undefined) {\\n var percent = (temperature + 60)/120 * 100;\\n return tinycolor.mix('blue', 'red', percent).toHexString();\\n}\\nreturn 'blue';\"},\"units\":\"%\",\"widgetUnitsSource\":\"Static\",\"widgetUnitsAttributeName\":\"units\",\"liquidColor\":{\"type\":\"range\",\"color\":\"#7A8BFF\",\"rangeList\":[{\"from\":null,\"to\":20,\"color\":\"#E27C7CDE\"},{\"from\":20,\"to\":null,\"color\":\"#7A8BFF\"}],\"colorFunction\":\"var percent = value;\\nif (typeof percent !== undefined) {\\n if (percent < 20) {\\n return '#E27C7CDE';\\n }\\n}\\nreturn '#7A8BFF';\"},\"valueFont\":{\"family\":\"Roboto\",\"size\":24,\"sizeUnit\":\"px\",\"style\":\"normal\",\"weight\":\"500\",\"lineHeight\":\"100%\"},\"valueColor\":{\"type\":\"range\",\"color\":\"#000000DE\",\"rangeList\":[{\"from\":null,\"to\":20,\"color\":\"#FF0000DE\"},{\"from\":20,\"to\":null,\"color\":\"rgba(0,0,0,0.87)\"}],\"colorFunction\":\"var percent = value;\\nif (typeof percent !== undefined) {\\n if (percent < 20) {\\n return '#FF0000DE';\\n }\\n}\\nreturn '#000000DE';\"},\"showBackgroundOverlay\":true,\"backgroundOverlayColor\":{\"type\":\"range\",\"color\":\"rgba(255, 255, 255, 0.76)\",\"rangeList\":[{\"from\":null,\"to\":20,\"color\":\"#FFEFEFDE\"},{\"from\":20,\"to\":null,\"color\":\"#FFFFFFC2\"}],\"colorFunction\":\"var percent = value;\\nif (typeof percent !== undefined) {\\n if (percent < 20) {\\n return '#FFEFEFDE';\\n }\\n}\\nreturn '#FFFFFFC2';\"},\"showTooltip\":true,\"showTooltipLevel\":true,\"tooltipUnits\":\"%\",\"tooltipLevelDecimals\":0,\"tooltipLevelFont\":{\"family\":\"Roboto\",\"size\":13,\"sizeUnit\":\"px\",\"style\":\"normal\",\"weight\":\"500\",\"lineHeight\":\"100%\"},\"tooltipLevelColor\":{\"type\":\"constant\",\"color\":\"rgba(0, 0, 0, 0.76)\",\"rangeList\":[],\"colorFunction\":\"var percent = value;\\nif (typeof percent !== undefined) {\\n if (percent < 20) {\\n return '#E27C7CDE';\\n }\\n}\\nreturn '#7A8BFF';\"},\"showTooltipDate\":true,\"tooltipDateFormat\":{\"format\":null,\"lastUpdateAgo\":true,\"custom\":false},\"tooltipDateFont\":{\"family\":\"Roboto\",\"size\":13,\"sizeUnit\":\"px\",\"style\":\"normal\",\"weight\":\"500\",\"lineHeight\":\"100%\"},\"tooltipDateColor\":\"#000000C2\",\"tooltipBackgroundColor\":\"#FFFFFFC2\",\"tooltipBackgroundBlur\":3},\"title\":\"Liquid level\",\"useDashboardTimewindow\":true,\"displayTimewindow\":true,\"configMode\":\"basic\",\"titleFont\":{\"family\":\"Roboto\",\"size\":16,\"sizeUnit\":\"px\",\"style\":\"normal\",\"weight\":\"500\",\"lineHeight\":\"1.5\"},\"titleColor\":\"rgba(0, 0, 0, 0.87)\",\"showTitleIcon\":false,\"titleIcon\":\"water_drop\",\"iconColor\":\"#5469FF\",\"decimals\":0,\"enableDataExport\":false,\"enableFullscreen\":true,\"borderRadius\":null,\"actions\":{},\"iconSize\":\"24px\"}" "defaultConfig": "{\"datasources\":[{\"type\":\"function\",\"name\":\"function\",\"dataKeys\":[{\"name\":\"f(x)\",\"type\":\"function\",\"label\":\"Random\",\"color\":\"#2196f3\",\"settings\":{},\"_hash\":0.15479322438769105,\"funcBody\":\"return Math.floor(Math.random() * 101);\",\"aggregationType\":null,\"units\":null,\"decimals\":null,\"usePostProcessing\":null,\"postFuncBody\":null}],\"alarmFilterConfig\":{\"statusList\":[\"ACTIVE\"]}}],\"timewindow\":{\"realtime\":{\"timewindowMs\":60000}},\"showTitle\":true,\"backgroundColor\":\"#fff\",\"color\":\"rgba(0, 0, 0, 0.87)\",\"padding\":\"8px\",\"settings\":{\"tankSelectionType\":\"static\",\"selectedShape\":\"Vertical Oval\",\"shapeAttributeName\":\"tankShape\",\"tankColor\":{\"type\":\"range\",\"color\":\"#242770\",\"rangeList\":[{\"from\":null,\"to\":20,\"color\":\"#E73535DE\"},{\"from\":20,\"to\":null,\"color\":\"#242770\"}],\"colorFunction\":\"var percent = value;\\nif (typeof percent !== undefined) {\\n if (percent < 20) {\\n return '#E73535DE';\\n }\\n}\\nreturn '#242770';\"},\"datasourceUnits\":\"%\",\"layout\":\"percentage\",\"volumeSource\":\"static\",\"volumeConstant\":500,\"volumeAttributeName\":\"volume\",\"volumeUnits\":\"L\",\"volumeFont\":{\"family\":\"Roboto\",\"size\":14,\"sizeUnit\":\"px\",\"style\":\"normal\",\"weight\":\"500\",\"lineHeight\":\"100%\"},\"volumeColor\":\"rgba(0, 0, 0, 0.18)\",\"units\":\"%\",\"widgetUnitsSource\":\"static\",\"widgetUnitsAttributeName\":\"units\",\"liquidColor\":{\"type\":\"range\",\"color\":\"#7A8BFF\",\"rangeList\":[{\"from\":null,\"to\":20,\"color\":\"#E27C7CDE\"},{\"from\":20,\"to\":null,\"color\":\"#7A8BFF\"}],\"colorFunction\":\"var percent = value;\\nif (typeof percent !== undefined) {\\n if (percent < 20) {\\n return '#E27C7CDE';\\n }\\n}\\nreturn '#7A8BFF';\"},\"valueFont\":{\"family\":\"Roboto\",\"size\":24,\"sizeUnit\":\"px\",\"style\":\"normal\",\"weight\":\"500\",\"lineHeight\":\"100%\"},\"valueColor\":{\"type\":\"range\",\"color\":\"#000000DE\",\"rangeList\":[{\"from\":null,\"to\":20,\"color\":\"#FF0000DE\"},{\"from\":20,\"to\":null,\"color\":\"rgba(0,0,0,0.87)\"}],\"colorFunction\":\"var percent = value;\\nif (typeof percent !== undefined) {\\n if (percent < 20) {\\n return '#FF0000DE';\\n }\\n}\\nreturn '#000000DE';\"},\"showBackgroundOverlay\":true,\"backgroundOverlayColor\":{\"type\":\"range\",\"color\":\"rgba(255, 255, 255, 0.76)\",\"rangeList\":[{\"from\":null,\"to\":20,\"color\":\"#FFEFEFDE\"},{\"from\":20,\"to\":null,\"color\":\"#FFFFFFC2\"}],\"colorFunction\":\"var percent = value;\\nif (typeof percent !== undefined) {\\n if (percent < 20) {\\n return '#FFEFEFDE';\\n }\\n}\\nreturn '#FFFFFFC2';\"},\"showTooltip\":true,\"showTooltipLevel\":true,\"tooltipUnits\":\"%\",\"tooltipLevelDecimals\":0,\"tooltipLevelFont\":{\"family\":\"Roboto\",\"size\":13,\"sizeUnit\":\"px\",\"style\":\"normal\",\"weight\":\"500\",\"lineHeight\":\"100%\"},\"tooltipLevelColor\":{\"type\":\"constant\",\"color\":\"rgba(0, 0, 0, 0.76)\",\"rangeList\":[],\"colorFunction\":\"var percent = value;\\nif (typeof percent !== undefined) {\\n if (percent < 20) {\\n return '#E27C7CDE';\\n }\\n}\\nreturn '#7A8BFF';\"},\"showTooltipDate\":true,\"tooltipDateFormat\":{\"format\":null,\"lastUpdateAgo\":true,\"custom\":false},\"tooltipDateFont\":{\"family\":\"Roboto\",\"size\":13,\"sizeUnit\":\"px\",\"style\":\"normal\",\"weight\":\"500\",\"lineHeight\":\"100%\"},\"tooltipDateColor\":\"rgba(0, 0, 0, 0.76)\",\"tooltipBackgroundColor\":\"rgba(255, 255, 255, 0.76)\",\"tooltipBackgroundBlur\":3,\"background\":{\"type\":\"color\",\"color\":\"#fff\",\"overlay\":{\"enabled\":false,\"color\":\"rgba(255,255,255,0.72)\",\"blur\":3}}},\"title\":\"Liquid level\",\"useDashboardTimewindow\":true,\"displayTimewindow\":true,\"configMode\":\"basic\",\"titleFont\":{\"family\":\"Roboto\",\"size\":16,\"sizeUnit\":\"px\",\"style\":\"normal\",\"weight\":\"500\",\"lineHeight\":\"1.5\"},\"titleColor\":\"rgba(0, 0, 0, 0.87)\",\"showTitleIcon\":false,\"titleIcon\":\"water_drop\",\"iconColor\":\"#5469FF\",\"decimals\":0,\"enableDataExport\":false,\"enableFullscreen\":true,\"borderRadius\":null,\"actions\":{},\"iconSize\":\"24px\"}"
}, },
"externalId": null, "externalId": null,
"tags": null "tags": null

115
ui-ngx/src/app/modules/home/components/widget/config/basic/indicator/liquid-level-card-basic-config.component.html

@ -67,16 +67,13 @@
<div fxFlex fxLayout="row" style="width: 100%;" fxLayoutAlign="space-between center"> <div fxFlex fxLayout="row" style="width: 100%;" fxLayoutAlign="space-between center">
<div class="fixed-title-width" translate>widgets.liquid-level-card.shape</div> <div class="fixed-title-width" translate>widgets.liquid-level-card.shape</div>
<tb-toggle-select formControlName="tankSelectionType"> <tb-toggle-select formControlName="tankSelectionType">
<tb-toggle-option [value]="shapeSelectOptions.static"> <tb-toggle-option *ngFor="let type of DataSourceTypes" [value]="type">
{{ 'widgets.liquid-level-card.static' | translate }} {{ DataSourceTypeTranslations.get(type) | translate }}
</tb-toggle-option>
<tb-toggle-option [value]="shapeSelectOptions.attribute">
{{ 'widgets.liquid-level-card.attribute' | translate }}
</tb-toggle-option> </tb-toggle-option>
</tb-toggle-select> </tb-toggle-select>
</div> </div>
<tb-image-cards-select #shapesImageCardsSelect <tb-image-cards-select #shapesImageCardsSelect
[fxShow]="levelCardWidgetConfigForm.get('tankSelectionType').value === shapeSelectOptions.static" [fxShow]="levelCardWidgetConfigForm.get('tankSelectionType').value === DataSourceType.static"
rowHeight="{{ '1:1' }}" rowHeight="{{ '1:1' }}"
[cols]="5" [cols]="5"
[colsLtMd]="2" [colsLtMd]="2"
@ -84,41 +81,41 @@
label="{{ 'widgets.liquid-level-card.shape-type' | translate }}" formControlName="selectedShape"> label="{{ 'widgets.liquid-level-card.shape-type' | translate }}" formControlName="selectedShape">
<tb-image-cards-select-option *ngFor="let shape of shapes" <tb-image-cards-select-option *ngFor="let shape of shapes"
[value]="shape" [value]="shape"
[image]="createShape(shapesImageMap.get(shape), this.levelCardLayouts.simple)"> [image]="createShape(shapesImageMap.get(shape), LevelCardLayout.simple)">
{{ shapesTranslationMap.get(shape) | translate }} {{ ShapesTranslationMap.get(shape) | translate }}
</tb-image-cards-select-option> </tb-image-cards-select-option>
</tb-image-cards-select> </tb-image-cards-select>
<div class="tb-form-row space-between" style="width: 100%;" <ng-container *ngIf="levelCardWidgetConfigForm.get('tankSelectionType').value === DataSourceType.attribute">
*ngIf="levelCardWidgetConfigForm.get('tankSelectionType').value === shapeSelectOptions.attribute"> <div class="tb-form-row space-between" style="width: 100%;">
<div class="fixed-title-width tb-required" translate>widgets.liquid-level-card.shape-attribute-name</div> <div class="fixed-title-width tb-required" translate>widgets.liquid-level-card.shape-attribute-name</div>
<tb-string-autocomplete [fetchOptionsFn]="fetchOptions.bind(this)" <tb-string-autocomplete [fetchOptionsFn]="fetchOptions.bind(this)"
[required]="isRequired('shapeAttributeName')" [required]="isRequired('shapeAttributeName')"
[errorText]="'widgets.liquid-level-card.attribute-name-required' | translate" [errorText]="'widgets.liquid-level-card.attribute-name-required' | translate"
style="flex: 1" style="flex: 1"
formControlName="shapeAttributeName"> formControlName="shapeAttributeName">
</tb-string-autocomplete> </tb-string-autocomplete>
</div>
<div fxFlex fxLayout="row" fxLayoutAlign="space-between center" style="width: 100%;"
*ngIf="levelCardWidgetConfigForm.get('tankSelectionType').value === shapeSelectOptions.attribute">
<div class="tb-hint" style="padding: 0;" translate>widgets.liquid-level-card.shape-by-attribute</div>
<div class="see-example"
[tb-help-popup]="'widget/lib/indicator/shape_attribute_fn'"
tb-help-popup-placement="left"
trigger-style="font-size: 12px"
[tb-help-popup-style]="{maxWidth: '820px'}"
trigger-text="{{ 'widgets.liquid-level-card.see-examples' | translate }}">
</div> </div>
</div> <div fxFlex fxLayout="row" fxLayoutAlign="space-between center" style="width: 100%;">
<div class="tb-hint" style="padding: 0;" translate>widgets.liquid-level-card.shape-by-attribute</div>
<div class="see-example"
[tb-help-popup]="'widget/lib/indicator/shape_attribute_fn'"
tb-help-popup-placement="left"
trigger-style="font-size: 12px"
[tb-help-popup-style]="{maxWidth: '820px'}"
trigger-text="{{ 'widgets.liquid-level-card.see-examples' | translate }}">
</div>
</div>
</ng-container>
</div> </div>
<tb-image-cards-select #layoutsImageCardsSelect rowHeight="{{ '1:1' }}" <tb-image-cards-select #layoutsImageCardsSelect rowHeight="{{ '1:1' }}"
[cols]="3" [cols]="3"
[colsLtMd]="3" [colsLtMd]="3"
label="{{ 'widgets.liquid-level-card.layout' | translate }}" formControlName="layout"> label="{{ 'widgets.liquid-level-card.layout' | translate }}" formControlName="layout">
<tb-image-cards-select-option <tb-image-cards-select-option
*ngFor="let layout of [levelCardLayouts.simple, levelCardLayouts.percentage, levelCardLayouts.absolute]" *ngFor="let layout of LevelCardLayouts"
[value]="layout" [value]="layout"
[image]="createShape(shapesImageMap.get(levelCardWidgetConfigForm.get('selectedShape').value), layout)"> [image]="createShape(shapesImageMap.get(levelCardWidgetConfigForm.get('selectedShape').value), layout)">
{{ levelCardLayoutTranslationMap.get(layout) | translate }} {{ LevelCardLayoutTranslationMap.get(layout) | translate }}
</tb-image-cards-select-option> </tb-image-cards-select-option>
</tb-image-cards-select> </tb-image-cards-select>
</div> </div>
@ -134,29 +131,30 @@
</tb-unit-input> </tb-unit-input>
</div> </div>
</div> </div>
<div class="tb-form-row space-between" [fxShow]="widgetUnitsInput"> <div class="tb-form-row space-between" *ngIf="levelCardWidgetConfigForm.get('layout').value === LevelCardLayout.absolute">
<div class="fixed-title-width tb-required" translate>widgets.liquid-level-card.widget-units</div> <div class="fixed-title-width tb-required" translate>widgets.liquid-level-card.widget-units</div>
<div fxFlex fxLayout="row" fxLayoutAlign="start center" fxLayoutGap="8px"> <div fxFlex fxLayout="row" fxLayoutAlign="start center" fxLayoutGap="8px">
<mat-form-field class="flex" appearance="outline" subscriptSizing="dynamic" style="max-width: 25%"> <mat-form-field class="flex" appearance="outline" subscriptSizing="dynamic" style="max-width: 25%">
<mat-select formControlName="widgetUnitsSource" placeholder="{{ 'widget-config.set' | translate }}"> <mat-select formControlName="widgetUnitsSource" placeholder="{{ 'widget-config.set' | translate }}">
<mat-option *ngFor="let option of [levelOptions.static, levelOptions.attribute]" [value]="option"> <mat-option *ngFor="let type of DataSourceTypes" [value]="type">
{{ option }} {{ DataSourceTypeTranslations.get(type) | translate }}
</mat-option> </mat-option>
</mat-select> </mat-select>
</mat-form-field> </mat-form-field>
<tb-unit-input [fxShow]="levelCardWidgetConfigForm.get('widgetUnitsSource').value !== levelOptions.attribute" <tb-unit-input *ngIf="levelCardWidgetConfigForm.get('widgetUnitsSource').value === DataSourceType.static; else selectUnitsAttributes"
class="flex" class="flex" required
[tagFilter]="unitsType.capacity" [tagFilter]="unitsType.capacity"
[required]="isRequired('units')" [required]="isRequired('units')"
formControlName="units"> formControlName="units">
</tb-unit-input> </tb-unit-input>
<tb-string-autocomplete [fxShow]="levelCardWidgetConfigForm.get('widgetUnitsSource').value === levelOptions.attribute" <ng-template #selectUnitsAttributes>
[fetchOptionsFn]="fetchOptions.bind(this)" <tb-string-autocomplete [fetchOptionsFn]="fetchOptions.bind(this)"
[required]="isRequired('widgetUnitsAttributeName')" [required]="isRequired('widgetUnitsAttributeName')"
[errorText]="'widgets.liquid-level-card.attribute-name-required' | translate" [errorText]="'widgets.liquid-level-card.attribute-name-required' | translate"
style="flex: 1" style="flex: 1"
formControlName="widgetUnitsAttributeName"> formControlName="widgetUnitsAttributeName">
</tb-string-autocomplete> </tb-string-autocomplete>
</ng-template>
</div> </div>
</div> </div>
<div class="tb-form-row" [fxShow]="volumeInput"> <div class="tb-form-row" [fxShow]="volumeInput">
@ -164,12 +162,12 @@
<div fxFlex fxLayout="row" fxLayoutAlign="start center" fxLayoutGap="8px"> <div fxFlex fxLayout="row" fxLayoutAlign="start center" fxLayoutGap="8px">
<mat-form-field class="flex" appearance="outline" subscriptSizing="dynamic" style="max-width: 25%"> <mat-form-field class="flex" appearance="outline" subscriptSizing="dynamic" style="max-width: 25%">
<mat-select formControlName="volumeSource" placeholder="{{ 'widget-config.set' | translate }}"> <mat-select formControlName="volumeSource" placeholder="{{ 'widget-config.set' | translate }}">
<mat-option *ngFor="let option of [levelOptions.static, levelOptions.attribute]" [value]="option"> <mat-option *ngFor="let type of DataSourceTypes" [value]="type">
{{ option }} {{ DataSourceTypeTranslations.get(type) | translate }}
</mat-option> </mat-option>
</mat-select> </mat-select>
</mat-form-field> </mat-form-field>
<mat-form-field [fxShow]="levelCardWidgetConfigForm.get('volumeSource').value === levelOptions.static" <mat-form-field *ngIf="levelCardWidgetConfigForm.get('volumeSource').value === DataSourceType.static; else volumeAttributes"
appearance="outline" class="flex number" subscriptSizing="dynamic"> appearance="outline" class="flex number" subscriptSizing="dynamic">
<input matInput formControlName="volumeConstant" type="number" <input matInput formControlName="volumeConstant" type="number"
min="0" step="1" placeholder="{{ 'widget-config.set' | translate }}"> min="0" step="1" placeholder="{{ 'widget-config.set' | translate }}">
@ -182,13 +180,14 @@
warning warning
</mat-icon> </mat-icon>
</mat-form-field> </mat-form-field>
<tb-string-autocomplete [fxShow]="levelCardWidgetConfigForm.get('volumeSource').value === levelOptions.attribute" <ng-template #volumeAttributes>
[fetchOptionsFn]="fetchOptions.bind(this)" <tb-string-autocomplete [fetchOptionsFn]="fetchOptions.bind(this)"
[errorText]="'widgets.liquid-level-card.attribute-name-required' | translate" [errorText]="'widgets.liquid-level-card.attribute-name-required' | translate"
[required]="isRequired('volumeAttributeName')" [required]="isRequired('volumeAttributeName')"
style="flex: 1" style="flex: 1"
formControlName="volumeAttributeName"> formControlName="volumeAttributeName">
</tb-string-autocomplete> </tb-string-autocomplete>
</ng-template>
<tb-unit-input [tagFilter]="unitsType.capacity" <tb-unit-input [tagFilter]="unitsType.capacity"
[required]="isRequired('volumeUnits')" [required]="isRequired('volumeUnits')"
style="max-width: 25%" class="flex" style="max-width: 25%" class="flex"
@ -210,7 +209,7 @@
</tb-color-settings> </tb-color-settings>
</div> </div>
<div class="tb-form-row space-between" <div class="tb-form-row space-between"
*ngIf="levelCardWidgetConfigForm.get('layout').value !== this.levelCardLayouts.simple"> *ngIf="levelCardWidgetConfigForm.get('layout').value !== LevelCardLayout.simple">
<div class="fixed-title-width" translate>widgets.liquid-level-card.value</div> <div class="fixed-title-width" translate>widgets.liquid-level-card.value</div>
<div fxFlex fxLayout="row" fxLayoutAlign="end center" fxLayoutGap="8px"> <div fxFlex fxLayout="row" fxLayoutAlign="end center" fxLayoutGap="8px">
<mat-form-field style="max-width: 40%;" appearance="outline" class="flex number" subscriptSizing="dynamic"> <mat-form-field style="max-width: 40%;" appearance="outline" class="flex number" subscriptSizing="dynamic">
@ -225,14 +224,14 @@
</tb-color-settings> </tb-color-settings>
</div> </div>
</div> </div>
<div class="tb-form-row" [fxShow]="volumeInput"> <div class="tb-form-row" *ngIf="levelCardWidgetConfigForm.get('layout').value === LevelCardLayout.absolute">
<div class="fixed-title-width" translate>widgets.liquid-level-card.total-volume</div> <div class="fixed-title-width" translate>widgets.liquid-level-card.total-volume</div>
<div fxFlex fxLayout="row" fxLayoutAlign="end center" fxLayoutGap="8px"> <div fxFlex fxLayout="row" fxLayoutAlign="end center" fxLayoutGap="8px">
<tb-font-settings formControlName="volumeFont" <tb-font-settings formControlName="volumeFont"
[previewText]="totalVolumeValuePreviewFn"> [previewText]="totalVolumeValuePreviewFn">
</tb-font-settings> </tb-font-settings>
<tb-color-settings formControlName="volumeColor" settingsKey="{{'widgets.liquid-level-card.total-volume' | translate }}"> <tb-color-input asBoxInput colorClearButton formControlName="volumeColor">
</tb-color-settings> </tb-color-input>
</div> </div>
</div> </div>
</div> </div>
@ -303,8 +302,8 @@
<div class="tb-form-panel-title" translate>widget-config.card-appearance</div> <div class="tb-form-panel-title" translate>widget-config.card-appearance</div>
<div class="tb-form-row space-between"> <div class="tb-form-row space-between">
<div>{{ 'widgets.background.background' | translate }}</div> <div>{{ 'widgets.background.background' | translate }}</div>
<tb-color-input asBoxInput colorClearButton formControlName="backgroundColor"> <tb-background-settings formControlName="background">
</tb-color-input> </tb-background-settings>
</div> </div>
<div class="tb-form-row space-between column-lt-md"> <div class="tb-form-row space-between column-lt-md">
<div translate>widget-config.show-card-buttons</div> <div translate>widget-config.show-card-buttons</div>

290
ui-ngx/src/app/modules/home/components/widget/config/basic/indicator/liquid-level-card-basic-config.component.ts

@ -15,7 +15,7 @@
/// ///
import { ChangeDetectorRef, Component, Injector, ViewChild } from '@angular/core'; import { ChangeDetectorRef, Component, Injector, ViewChild } from '@angular/core';
import { AbstractControl, UntypedFormBuilder, UntypedFormGroup, Validators } from '@angular/forms'; import { FormBuilder, FormGroup, Validators } from '@angular/forms';
import { Store } from '@ngrx/store'; import { Store } from '@ngrx/store';
import { AppState } from '@core/core.state'; import { AppState } from '@core/core.state';
import { BasicWidgetConfigComponent } from '@home/components/widget/config/widget-config.component.models'; import { BasicWidgetConfigComponent } from '@home/components/widget/config/widget-config.component.models';
@ -48,11 +48,13 @@ import {
LevelCardLayout, LevelCardLayout,
levelCardLayoutTranslations, levelCardLayoutTranslations,
LevelCardWidgetSettings, LevelCardWidgetSettings,
LevelSelectOptions, LiquidWidgetDataSourceType,
LiquidWidgetDataSourceTypeTranslations,
loadSvgShapesMapping, loadSvgShapesMapping,
optionsFilter, optionsFilter,
Shapes, Shapes,
shapesTranslations ShapesTranslations,
updatedFormSettingsValidators
} from '@home/components/widget/lib/indicator/liquid-level-widget.models'; } from '@home/components/widget/lib/indicator/liquid-level-widget.models';
import { UnitsType } from '@shared/models/unit.models'; import { UnitsType } from '@shared/models/unit.models';
import { DomSanitizer, SafeUrl } from '@angular/platform-browser'; import { DomSanitizer, SafeUrl } from '@angular/platform-browser';
@ -73,7 +75,7 @@ export class LiquidLevelCardBasicConfigComponent extends BasicWidgetConfigCompon
@ViewChild('shapesImageCardsSelect', { static: false }) shapesImageCardsSelect: ImageCardsSelectComponent; @ViewChild('shapesImageCardsSelect', { static: false }) shapesImageCardsSelect: ImageCardsSelectComponent;
public get datasource(): Datasource { private get datasource(): Datasource {
if (this.widgetConfig.config.datasources && this.widgetConfig.config.datasources) { if (this.widgetConfig.config.datasources && this.widgetConfig.config.datasources) {
return this.widgetConfig.config.datasources[0]; return this.widgetConfig.config.datasources[0];
} else { } else {
@ -93,12 +95,6 @@ export class LiquidLevelCardBasicConfigComponent extends BasicWidgetConfigCompon
return !(datasourceUnits === CapacityUnits.percent && units === CapacityUnits.percent); return !(datasourceUnits === CapacityUnits.percent && units === CapacityUnits.percent);
} }
public get widgetUnitsInput(): boolean {
const layout: LevelCardLayout = this.levelCardWidgetConfigForm.get('layout').value;
return layout === LevelCardLayout.absolute;
}
public get displayTimewindowConfig(): boolean { public get displayTimewindowConfig(): boolean {
const datasources = this.levelCardWidgetConfigForm.get('datasources').value; const datasources = this.levelCardWidgetConfigForm.get('datasources').value;
return datasourcesHasAggregation(datasources); return datasourcesHasAggregation(datasources);
@ -109,22 +105,21 @@ export class LiquidLevelCardBasicConfigComponent extends BasicWidgetConfigCompon
return datasourcesHasOnlyComparisonAggregation(datasources); return datasourcesHasOnlyComparisonAggregation(datasources);
} }
levelCardLayouts = LevelCardLayout; LevelCardLayout = LevelCardLayout;
LevelCardLayouts = Object.values(LevelCardLayout) as LevelCardLayout[];
shapes: Shapes[] = []; LevelCardLayoutTranslationMap = levelCardLayoutTranslations;
levelOptions = LevelSelectOptions; DataSourceType = LiquidWidgetDataSourceType;
DataSourceTypes = Object.values(LiquidWidgetDataSourceType) as LiquidWidgetDataSourceType[];
DataSourceTypeTranslations = LiquidWidgetDataSourceTypeTranslations;
shapeSelectOptions = LevelSelectOptions; shapes = Object.values(Shapes) as Shapes[];
levelCardLayoutTranslationMap = levelCardLayoutTranslations;
shapesTranslationMap = shapesTranslations;
shapesImageMap: Map<Shapes, string> = new Map(); shapesImageMap: Map<Shapes, string> = new Map();
ShapesTranslationMap = ShapesTranslations;
unitsType = UnitsType; unitsType = UnitsType;
levelCardWidgetConfigForm: UntypedFormGroup; levelCardWidgetConfigForm: FormGroup;
valuePreviewFn = this._valuePreviewFn.bind(this); valuePreviewFn = this._valuePreviewFn.bind(this);
@ -134,35 +129,30 @@ export class LiquidLevelCardBasicConfigComponent extends BasicWidgetConfigCompon
datePreviewFn = this._datePreviewFn.bind(this); datePreviewFn = this._datePreviewFn.bind(this);
keySearchText: string; private keySearchText: string;
private latestKeySearchTextResult: Array<string>;
latestKeySearchTextResult: Array<string>;
datasources: Array<Datasource>;
functionTypeKeys: Array<DataKey> = [];
lastKeysId: string; private functionTypeKeys: Array<DataKey> = [];
lastFetchedKeys: Array<DataKey>; private lastKeysId: string;
private lastFetchedKeys: Array<DataKey>;
constructor(protected store: Store<AppState>, constructor(protected store: Store<AppState>,
protected widgetConfigComponent: WidgetConfigComponent, protected widgetConfigComponent: WidgetConfigComponent,
private cd: ChangeDetectorRef, private cd: ChangeDetectorRef,
private $injector: Injector, private $injector: Injector,
private fb: UntypedFormBuilder, private fb: FormBuilder,
private resourcesService: ResourcesService, private resourcesService: ResourcesService,
private sanitizer: DomSanitizer, private sanitizer: DomSanitizer,
private utils: UtilsService) { private utils: UtilsService) {
super(store, widgetConfigComponent); super(store, widgetConfigComponent);
} }
protected configForm(): UntypedFormGroup { protected configForm(): FormGroup {
return this.levelCardWidgetConfigForm; return this.levelCardWidgetConfigForm;
} }
protected setupConfig(widgetConfig: WidgetConfigComponentData) { protected setupConfig(widgetConfig: WidgetConfigComponentData) {
this.shapes = Object.values(Shapes);
this.createSvgShapesMapping(); this.createSvgShapesMapping();
for (const type of this.utils.getPredefinedFunctionsList()) { for (const type of this.utils.getPredefinedFunctionsList()) {
@ -179,29 +169,30 @@ export class LiquidLevelCardBasicConfigComponent extends BasicWidgetConfigCompon
} }
protected onConfigSet(configData: WidgetConfigComponentData) { protected onConfigSet(configData: WidgetConfigComponentData) {
const settings: LevelCardWidgetSettings = {...configData.config, ...levelCardDefaultSettings(), ...(configData.config.settings || {})}; const settings: LevelCardWidgetSettings = {...levelCardDefaultSettings, ...(configData.config.settings || {})};
const iconSize = resolveCssSize(configData.config.iconSize); const iconSize = resolveCssSize(configData.config.iconSize);
this.levelCardWidgetConfigForm = this.fb.group({ this.levelCardWidgetConfigForm = this.fb.group({
timewindowConfig: [getTimewindowConfig(configData.config), []], timewindowConfig: [getTimewindowConfig(configData.config), []],
datasources: [configData.config.datasources, []], datasources: [configData.config.datasources, []],
layout: [settings.layout, []],
tankSelectionType: [settings.tankSelectionType, []], tankSelectionType: [settings.tankSelectionType, []],
selectedShape: [settings.selectedShape, [Validators.required]], selectedShape: [settings.selectedShape, [Validators.required]],
shapeAttributeName: [settings.shapeAttributeName, [Validators.required]], shapeAttributeName: [settings.shapeAttributeName, [Validators.required]],
tankColor: [settings.tankColor, []], tankColor: [settings.tankColor, []],
datasourceUnits: [settings.datasourceUnits, [Validators.required]], datasourceUnits: [settings.datasourceUnits, [Validators.required]],
layout: [settings.layout, []],
showTitle: [configData.config.showTitle, []], showTitle: [configData.config.showTitle, []],
title: [settings.title, []], title: [configData.config.title, []],
titleFont: [settings.titleFont, []], titleFont: [configData.config.titleFont, []],
titleColor: [settings.titleColor, []], titleColor: [configData.config.titleColor, []],
showTitleIcon: [configData.config.showTitleIcon, []], showTitleIcon: [configData.config.showTitleIcon, []],
iconSize: [iconSize[0], [Validators.min(0)]], iconSize: [iconSize[0], [Validators.min(0)]],
iconSizeUnit: [iconSize[1], []], iconSizeUnit: [iconSize[1], []],
titleIcon: [settings.titleIcon, []], titleIcon: [configData.config.titleIcon, []],
iconColor: [settings.iconColor, []], iconColor: [configData.config.iconColor, []],
volumeSource: [settings.volumeSource, []], volumeSource: [settings.volumeSource, []],
volumeConstant: [settings.volumeConstant, [Validators.required]], volumeConstant: [settings.volumeConstant, [Validators.required]],
volumeAttributeName: [settings.volumeAttributeName, [Validators.required]], volumeAttributeName: [settings.volumeAttributeName, [Validators.required]],
@ -211,7 +202,7 @@ export class LiquidLevelCardBasicConfigComponent extends BasicWidgetConfigCompon
units: [settings.units, [Validators.required]], units: [settings.units, [Validators.required]],
widgetUnitsSource: [settings.widgetUnitsSource, [Validators.required]], widgetUnitsSource: [settings.widgetUnitsSource, [Validators.required]],
widgetUnitsAttributeName: [settings.widgetUnitsAttributeName, [Validators.required]], widgetUnitsAttributeName: [settings.widgetUnitsAttributeName, [Validators.required]],
decimals: [settings.decimals, []], decimals: [configData.config.decimals, []],
liquidColor: [settings.liquidColor, []], liquidColor: [settings.liquidColor, []],
valueFont: [settings.valueFont, []], valueFont: [settings.valueFont, []],
valueColor: [settings.valueColor, []], valueColor: [settings.valueColor, []],
@ -229,7 +220,7 @@ export class LiquidLevelCardBasicConfigComponent extends BasicWidgetConfigCompon
tooltipBackgroundColor: [settings.tooltipBackgroundColor, []], tooltipBackgroundColor: [settings.tooltipBackgroundColor, []],
tooltipBackgroundBlur: [settings.tooltipBackgroundBlur, []], tooltipBackgroundBlur: [settings.tooltipBackgroundBlur, []],
backgroundColor: [settings.backgroundColor, []], background: [settings.background],
cardButtons: [this.getCardButtons(configData.config), []], cardButtons: [this.getCardButtons(configData.config), []],
borderRadius: [configData.config.borderRadius, []], borderRadius: [configData.config.borderRadius, []],
@ -246,23 +237,28 @@ export class LiquidLevelCardBasicConfigComponent extends BasicWidgetConfigCompon
setTimewindowConfig(this.widgetConfig.config, config.timewindowConfig); setTimewindowConfig(this.widgetConfig.config, config.timewindowConfig);
this.widgetConfig.config.datasources = config.datasources; this.widgetConfig.config.datasources = config.datasources;
this.widgetConfig.config.settings = this.widgetConfig.config.settings || {};
this.widgetConfig.config.settings.tankSelectionType = config.tankSelectionType;
this.widgetConfig.config.settings.selectedShape = config.selectedShape;
this.widgetConfig.config.settings.shapeAttributeName = config.shapeAttributeName;
this.widgetConfig.config.settings.tankColor = config.tankColor;
this.widgetConfig.config.settings.datasourceUnits = config.datasourceUnits;
this.widgetConfig.config.settings.layout = config.layout;
this.widgetConfig.config.showTitle = config.showTitle; this.widgetConfig.config.showTitle = config.showTitle;
this.widgetConfig.config.title = config.title; this.widgetConfig.config.title = config.title;
this.widgetConfig.config.titleFont = config.titleFont; this.widgetConfig.config.titleFont = config.titleFont;
this.widgetConfig.config.titleColor = config.titleColor; this.widgetConfig.config.titleColor = config.titleColor;
this.widgetConfig.config.showTitleIcon = config.showTitleIcon; this.widgetConfig.config.showTitleIcon = config.showTitleIcon;
this.widgetConfig.config.iconSize = cssSizeToStrSize(config.iconSize, config.iconSizeUnit); this.widgetConfig.config.iconSize = cssSizeToStrSize(config.iconSize, config.iconSizeUnit);
this.widgetConfig.config.titleIcon = config.titleIcon; this.widgetConfig.config.titleIcon = config.titleIcon;
this.widgetConfig.config.iconColor = config.iconColor; this.widgetConfig.config.iconColor = config.iconColor;
this.widgetConfig.config.decimals = config.decimals;
this.widgetConfig.config.settings = this.widgetConfig.config.settings || {};
this.widgetConfig.config.settings.layout = config.layout;
this.widgetConfig.config.settings.tankSelectionType = config.tankSelectionType;
this.widgetConfig.config.settings.selectedShape = config.selectedShape;
this.widgetConfig.config.settings.shapeAttributeName = config.shapeAttributeName;
this.widgetConfig.config.settings.tankColor = config.tankColor;
this.widgetConfig.config.settings.datasourceUnits = config.datasourceUnits;
this.widgetConfig.config.settings.volumeSource = config.volumeSource; this.widgetConfig.config.settings.volumeSource = config.volumeSource;
this.widgetConfig.config.settings.volumeConstant = config.volumeConstant; this.widgetConfig.config.settings.volumeConstant = config.volumeConstant;
this.widgetConfig.config.settings.volumeAttributeName = config.volumeAttributeName; this.widgetConfig.config.settings.volumeAttributeName = config.volumeAttributeName;
@ -272,7 +268,6 @@ export class LiquidLevelCardBasicConfigComponent extends BasicWidgetConfigCompon
this.widgetConfig.config.settings.units = config.units; this.widgetConfig.config.settings.units = config.units;
this.widgetConfig.config.settings.widgetUnitsSource = config.widgetUnitsSource; this.widgetConfig.config.settings.widgetUnitsSource = config.widgetUnitsSource;
this.widgetConfig.config.settings.widgetUnitsAttributeName = config.widgetUnitsAttributeName; this.widgetConfig.config.settings.widgetUnitsAttributeName = config.widgetUnitsAttributeName;
this.widgetConfig.config.decimals = config.decimals;
this.widgetConfig.config.settings.liquidColor = config.liquidColor; this.widgetConfig.config.settings.liquidColor = config.liquidColor;
this.widgetConfig.config.settings.valueFont = config.valueFont; this.widgetConfig.config.settings.valueFont = config.valueFont;
this.widgetConfig.config.settings.valueColor = config.valueColor; this.widgetConfig.config.settings.valueColor = config.valueColor;
@ -290,7 +285,7 @@ export class LiquidLevelCardBasicConfigComponent extends BasicWidgetConfigCompon
this.widgetConfig.config.settings.tooltipBackgroundColor = config.tooltipBackgroundColor; this.widgetConfig.config.settings.tooltipBackgroundColor = config.tooltipBackgroundColor;
this.widgetConfig.config.settings.tooltipBackgroundBlur = config.tooltipBackgroundBlur; this.widgetConfig.config.settings.tooltipBackgroundBlur = config.tooltipBackgroundBlur;
this.widgetConfig.config.backgroundColor = config.backgroundColor; this.widgetConfig.config.settings.background = config.background;
this.setCardButtons(config.cardButtons, this.widgetConfig.config); this.setCardButtons(config.cardButtons, this.widgetConfig.config);
this.widgetConfig.config.borderRadius = config.borderRadius; this.widgetConfig.config.borderRadius = config.borderRadius;
@ -310,84 +305,16 @@ export class LiquidLevelCardBasicConfigComponent extends BasicWidgetConfigCompon
} }
protected updateValidators(emitEvent: boolean, trigger?: string) { protected updateValidators(emitEvent: boolean, trigger?: string) {
const emitEventFields = []; updatedFormSettingsValidators(this.levelCardWidgetConfigForm);
const datasourceUnits: string = this.levelCardWidgetConfigForm.get('datasourceUnits').value; const showTitleIcon: boolean = this.levelCardWidgetConfigForm.get('showTitleIcon').value;
const layout: LevelCardLayout = this.levelCardWidgetConfigForm.get('layout').value;
const showTitleIcon: AbstractControl<boolean> = this.levelCardWidgetConfigForm.get('showTitleIcon');
const showTitle: boolean = this.levelCardWidgetConfigForm.get('showTitle').value; const showTitle: boolean = this.levelCardWidgetConfigForm.get('showTitle').value;
const volumeSource: AbstractControl<LevelSelectOptions> = this.levelCardWidgetConfigForm.get('volumeSource'); if (showTitle) {
const units: AbstractControl<string> = this.levelCardWidgetConfigForm.get('units'); this.levelCardWidgetConfigForm.get('title').enable({emitEvent: false});
const tooltipUnits: AbstractControl<string> = this.levelCardWidgetConfigForm.get('tooltipUnits'); this.levelCardWidgetConfigForm.get('titleFont').enable({emitEvent: false});
const widgetUnitsSource: AbstractControl<LevelSelectOptions> = this.levelCardWidgetConfigForm.get('widgetUnitsSource'); this.levelCardWidgetConfigForm.get('titleColor').enable({emitEvent: false});
const showTooltipLevel: AbstractControl<boolean> = this.levelCardWidgetConfigForm.get('showTooltipLevel'); this.levelCardWidgetConfigForm.get('showTitleIcon').enable({emitEvent: false});
const showTooltipDate: AbstractControl<boolean> = this.levelCardWidgetConfigForm.get('showTooltipDate'); if (showTitleIcon) {
const showTooltip: boolean = this.levelCardWidgetConfigForm.get('showTooltip').value;
if (trigger === 'tankSelectionType') {
const tankSelectionType: LevelSelectOptions = this.levelCardWidgetConfigForm.get('tankSelectionType').value;
if (tankSelectionType === LevelSelectOptions.static) {
this.levelCardWidgetConfigForm.get('selectedShape').enable({emitEvent: false});
this.levelCardWidgetConfigForm.get('shapeAttributeName').disable({emitEvent: false});
} else {
this.levelCardWidgetConfigForm.get('selectedShape').disable({emitEvent: false});
this.levelCardWidgetConfigForm.get('shapeAttributeName').enable({emitEvent: false});
}
emitEventFields.push('selectedShape', 'shapeAttributeName');
}
if (trigger === 'datasourceUnits' || trigger === 'layout' || trigger === 'units') {
if (
datasourceUnits === CapacityUnits.percent &&
layout !== LevelCardLayout.absolute &&
(!units?.value || units?.value === CapacityUnits.percent)
) {
volumeSource.disable({emitEvent: false});
this.levelCardWidgetConfigForm.get('volumeConstant').disable({emitEvent: false});
this.levelCardWidgetConfigForm.get('volumeAttributeName').disable({emitEvent: false});
this.levelCardWidgetConfigForm.get('volumeUnits').disable({emitEvent: false});
this.levelCardWidgetConfigForm.get('volumeFont').disable({emitEvent: false});
this.levelCardWidgetConfigForm.get('volumeColor').disable({emitEvent: false});
} else {
volumeSource.enable({emitEvent: false});
this.levelCardWidgetConfigForm.get('volumeConstant').enable({emitEvent: false});
this.levelCardWidgetConfigForm.get('volumeAttributeName').enable({emitEvent: false});
this.levelCardWidgetConfigForm.get('volumeUnits').enable({emitEvent: false});
this.levelCardWidgetConfigForm.get('volumeFont').enable({emitEvent: false});
this.levelCardWidgetConfigForm.get('volumeColor').enable({emitEvent: false});
}
emitEventFields.push('volumeSource', 'volumeConstant', 'volumeAttributeName', 'volumeFont', 'volumeColor', 'volumeUnits');
} else if (trigger === 'volumeSource') {
if((datasourceUnits !== CapacityUnits.percent) ||
(layout === LevelCardLayout.absolute && units?.value !== CapacityUnits.percent)) {
if (volumeSource.value === LevelSelectOptions.static) {
this.levelCardWidgetConfigForm.get('volumeConstant').enable({emitEvent: false});
this.levelCardWidgetConfigForm.get('volumeAttributeName').disable({emitEvent: false});
} else {
this.levelCardWidgetConfigForm.get('volumeConstant').disable({emitEvent: false});
this.levelCardWidgetConfigForm.get('volumeAttributeName').enable({emitEvent: false});
}
emitEventFields.push('volumeConstant', 'volumeAttributeName');
}
}
if (trigger === 'showTitle' || !trigger) {
if (showTitle) {
this.levelCardWidgetConfigForm.get('title').enable({emitEvent: false});
this.levelCardWidgetConfigForm.get('titleFont').enable({emitEvent: false});
this.levelCardWidgetConfigForm.get('titleColor').enable({emitEvent: false});
showTitleIcon.enable({emitEvent: false});
} else {
this.levelCardWidgetConfigForm.get('title').disable({emitEvent: false});
this.levelCardWidgetConfigForm.get('titleFont').disable({emitEvent: false});
this.levelCardWidgetConfigForm.get('titleColor').disable({emitEvent: false});
showTitleIcon.disable({emitEvent: false});
}
emitEventFields.push('title', 'titleFont', 'titleColor', 'showTitleIcon');
}
if (trigger === 'showTitleIcon' || !trigger) {
if (showTitleIcon?.value && !showTitleIcon.disabled && showTitle) {
this.levelCardWidgetConfigForm.get('titleIcon').enable({emitEvent: false}); this.levelCardWidgetConfigForm.get('titleIcon').enable({emitEvent: false});
this.levelCardWidgetConfigForm.get('iconColor').enable({emitEvent: false}); this.levelCardWidgetConfigForm.get('iconColor').enable({emitEvent: false});
this.levelCardWidgetConfigForm.get('iconSize').enable({emitEvent: false}); this.levelCardWidgetConfigForm.get('iconSize').enable({emitEvent: false});
@ -398,104 +325,15 @@ export class LiquidLevelCardBasicConfigComponent extends BasicWidgetConfigCompon
this.levelCardWidgetConfigForm.get('iconSize').disable({emitEvent: false}); this.levelCardWidgetConfigForm.get('iconSize').disable({emitEvent: false});
this.levelCardWidgetConfigForm.get('iconSizeUnit').disable({emitEvent: false}); this.levelCardWidgetConfigForm.get('iconSizeUnit').disable({emitEvent: false});
} }
emitEventFields.push('titleIcon', 'iconColor', 'iconSize', 'iconSizeUnit'); } else {
} this.levelCardWidgetConfigForm.get('title').disable({emitEvent: false});
this.levelCardWidgetConfigForm.get('titleFont').disable({emitEvent: false});
if (trigger === 'showTooltip') { this.levelCardWidgetConfigForm.get('titleColor').disable({emitEvent: false});
if (showTooltip) { this.levelCardWidgetConfigForm.get('showTitleIcon').disable({emitEvent: false});
showTooltipLevel.enable({emitEvent: false}); this.levelCardWidgetConfigForm.get('titleIcon').disable({emitEvent: false});
showTooltipDate.enable({emitEvent: false}); this.levelCardWidgetConfigForm.get('iconColor').disable({emitEvent: false});
this.levelCardWidgetConfigForm.get('tooltipBackgroundColor').enable(); this.levelCardWidgetConfigForm.get('iconSize').disable({emitEvent: false});
this.levelCardWidgetConfigForm.get('tooltipBackgroundBlur').enable(); this.levelCardWidgetConfigForm.get('iconSizeUnit').disable({emitEvent: false});
} else {
showTooltipLevel.disable({emitEvent: false});
showTooltipDate.disable({emitEvent: false});
this.levelCardWidgetConfigForm.get('tooltipBackgroundColor').disable({emitEvent: false});
this.levelCardWidgetConfigForm.get('tooltipBackgroundBlur').disable({emitEvent: false});
}
emitEventFields.push('showTooltipLevel', 'showTooltipDate', 'tooltipBackgroundColor', 'tooltipBackgroundBlur');
}
if (trigger === 'showTooltipLevel') {
if (showTooltipLevel?.value && !showTooltipLevel.disabled) {
tooltipUnits.enable({emitEvent: false});
this.levelCardWidgetConfigForm.get('tooltipLevelDecimals').enable({emitEvent: false});
this.levelCardWidgetConfigForm.get('tooltipLevelFont').enable({emitEvent: false});
this.levelCardWidgetConfigForm.get('tooltipLevelColor').enable({emitEvent: false});
} else {
tooltipUnits.disable({emitEvent: false});
this.levelCardWidgetConfigForm.get('tooltipLevelDecimals').disable({emitEvent: false});
this.levelCardWidgetConfigForm.get('tooltipLevelFont').disable({emitEvent: false});
this.levelCardWidgetConfigForm.get('tooltipLevelColor').disable({emitEvent: false});
}
emitEventFields.push('tooltipUnits', 'tooltipLevelDecimals', 'tooltipLevelFont', 'tooltipLevelColor');
}
if (trigger === 'showTooltipDate') {
if (showTooltipDate?.value && !showTooltipDate.disabled) {
this.levelCardWidgetConfigForm.get('tooltipDateFormat').enable({emitEvent: false});
this.levelCardWidgetConfigForm.get('tooltipDateFont').enable({emitEvent: false});
this.levelCardWidgetConfigForm.get('tooltipDateColor').enable({emitEvent: false});
} else {
this.levelCardWidgetConfigForm.get('tooltipDateFormat').disable({emitEvent: false});
this.levelCardWidgetConfigForm.get('tooltipDateFont').disable({emitEvent: false});
this.levelCardWidgetConfigForm.get('tooltipDateColor').disable({emitEvent: false});
}
emitEventFields.push('tooltipDateFormat', 'tooltipDateFont', 'tooltipDateColor');
}
if (trigger === 'layout' || trigger === 'datasourceUnits') {
if (layout === LevelCardLayout.simple) {
units.disable({emitEvent: false});
tooltipUnits.disable({emitEvent: false});
widgetUnitsSource.setValue(LevelSelectOptions.static, {emitEvent: false});
widgetUnitsSource.disable({emitEvent: false});
this.levelCardWidgetConfigForm.get('decimals').disable({emitEvent: false});
this.levelCardWidgetConfigForm.get('valueFont').disable({emitEvent: false});
this.levelCardWidgetConfigForm.get('valueColor').disable({emitEvent: false});
this.levelCardWidgetConfigForm.get('widgetUnitsAttributeName').disable({emitEvent: false});
} else if (layout === LevelCardLayout.percentage) {
if (units.value !== CapacityUnits.percent) {
units.setValue(CapacityUnits.percent, {emitEvent: false});
}
widgetUnitsSource.setValue(LevelSelectOptions.static, {emitEvent: false});
units.disable({emitEvent: false});
widgetUnitsSource.disable({emitEvent: false});
this.levelCardWidgetConfigForm.get('widgetUnitsAttributeName').disable({emitEvent: false});
if (tooltipUnits.value !== CapacityUnits.percent) {
tooltipUnits.setValue(CapacityUnits.percent, {emitEvent: false});
}
tooltipUnits.disable({emitEvent: false});
} else {
units.enable({emitEvent: false});
tooltipUnits.enable({emitEvent: false});
widgetUnitsSource.enable({emitEvent: false});
this.levelCardWidgetConfigForm.get('decimals').enable({emitEvent: false});
this.levelCardWidgetConfigForm.get('valueFont').enable({emitEvent: false});
this.levelCardWidgetConfigForm.get('valueColor').enable({emitEvent: false});
this.levelCardWidgetConfigForm.get('widgetUnitsAttributeName').enable({emitEvent: false});
}
emitEventFields.push('units', 'tooltipUnits', 'decimals', 'valueFont', 'valueColor', 'widgetUnitsSource', 'widgetUnitsAttributeName');
} else if (trigger === 'widgetUnitsSource') {
if (layout !== LevelCardLayout.percentage) {
if (widgetUnitsSource.value === LevelSelectOptions.static) {
units.enable({emitEvent: false});
this.levelCardWidgetConfigForm.get('widgetUnitsAttributeName').disable({emitEvent: false});
} else {
units.disable({emitEvent: false});
this.levelCardWidgetConfigForm.get('widgetUnitsAttributeName').enable({emitEvent: false});
}
emitEventFields.push('units', 'widgetUnitsAttributeName');
}
}
for (const controlKey in this.levelCardWidgetConfigForm.controls) {
if (emitEventFields.includes(controlKey)) {
this.levelCardWidgetConfigForm.controls[controlKey].updateValueAndValidity({emitEvent});
}
} }
} }

15
ui-ngx/src/app/modules/home/components/widget/lib/indicator/liquid-level-widget.component.ts

@ -27,7 +27,7 @@ import {
levelCardDefaultSettings, levelCardDefaultSettings,
LevelCardLayout, LevelCardLayout,
LevelCardWidgetSettings, LevelCardWidgetSettings,
LevelSelectOptions, LiquidWidgetDataSourceType,
Shapes, Shapes,
SvgInfo, SvgInfo,
SvgLimits, SvgLimits,
@ -66,7 +66,6 @@ export class LiquidLevelWidgetComponent implements OnInit {
private settings: LevelCardWidgetSettings; private settings: LevelCardWidgetSettings;
private tankColor: ColorProcessor; private tankColor: ColorProcessor;
private volumeColor: ColorProcessor;
private valueColor: ColorProcessor; private valueColor: ColorProcessor;
private liquidColor: ColorProcessor; private liquidColor: ColorProcessor;
private backgroundOverlayColor: ColorProcessor; private backgroundOverlayColor: ColorProcessor;
@ -83,7 +82,7 @@ export class LiquidLevelWidgetComponent implements OnInit {
ngOnInit(): void { ngOnInit(): void {
this.ctx.$scope.liquidLevelWidget = this; this.ctx.$scope.liquidLevelWidget = this;
this.settings = {...levelCardDefaultSettings(), ...this.ctx.widgetConfig, ...this.ctx.settings}; this.settings = {...levelCardDefaultSettings, ...this.ctx.settings};
this.declareStyles(); this.declareStyles();
this.getData().subscribe(data => { this.getData().subscribe(data => {
@ -117,7 +116,6 @@ export class LiquidLevelWidgetComponent implements OnInit {
private declareStyles(): void { private declareStyles(): void {
this.tankColor = ColorProcessor.fromSettings(this.settings.tankColor); this.tankColor = ColorProcessor.fromSettings(this.settings.tankColor);
this.volumeColor = ColorProcessor.fromSettings(this.settings.volumeColor);
this.valueColor = ColorProcessor.fromSettings(this.settings.valueColor); this.valueColor = ColorProcessor.fromSettings(this.settings.valueColor);
this.liquidColor = ColorProcessor.fromSettings(this.settings.liquidColor); this.liquidColor = ColorProcessor.fromSettings(this.settings.liquidColor);
this.backgroundOverlayColor = ColorProcessor.fromSettings(this.settings.backgroundOverlayColor); this.backgroundOverlayColor = ColorProcessor.fromSettings(this.settings.backgroundOverlayColor);
@ -264,7 +262,7 @@ export class LiquidLevelWidgetComponent implements OnInit {
} }
private getShape(entityId: EntityId): Observable<Shapes> { private getShape(entityId: EntityId): Observable<Shapes> {
if (this.settings.tankSelectionType === LevelSelectOptions.attribute && entityId.id !== NULL_UUID) { if (this.settings.tankSelectionType === LiquidWidgetDataSourceType.attribute && entityId.id !== NULL_UUID) {
return this.ctx.attributeService.getEntityAttributes(entityId, null, return this.ctx.attributeService.getEntityAttributes(entityId, null,
[this.settings.shapeAttributeName]).pipe( [this.settings.shapeAttributeName]).pipe(
map(attributes => map(attributes =>
@ -296,10 +294,10 @@ export class LiquidLevelWidgetComponent implements OnInit {
private prepareAttributeNames(): string[] { private prepareAttributeNames(): string[] {
const names = []; const names = [];
if (this.settings.volumeSource !== LevelSelectOptions.static) { if (this.settings.volumeSource !== LiquidWidgetDataSourceType.static) {
names.push(this.settings.volumeAttributeName); names.push(this.settings.volumeAttributeName);
} }
if (this.settings.widgetUnitsSource !== LevelSelectOptions.static) { if (this.settings.widgetUnitsSource !== LiquidWidgetDataSourceType.static) {
names.push(this.settings.widgetUnitsAttributeName); names.push(this.settings.widgetUnitsAttributeName);
} }
return names; return names;
@ -398,10 +396,9 @@ export class LiquidLevelWidgetComponent implements OnInit {
const volumeInLiters: number = convertLiters(this.volume, this.settings.volumeUnits as CapacityUnits, ConversionType.to); const volumeInLiters: number = convertLiters(this.volume, this.settings.volumeUnits as CapacityUnits, ConversionType.to);
const volume = convertLiters(volumeInLiters, this.widgetUnits as CapacityUnits, ConversionType.from) const volume = convertLiters(volumeInLiters, this.widgetUnits as CapacityUnits, ConversionType.from)
.toFixed(this.settings.decimals || 0); .toFixed(this.settings.decimals || 0);
this.volumeColor.update(volume);
const volumeTextStyle = cssTextFromInlineStyle({...inlineTextStyle(this.settings.volumeFont), const volumeTextStyle = cssTextFromInlineStyle({...inlineTextStyle(this.settings.volumeFont),
color: this.volumeColor.color}); color: this.settings.volumeColor});
container = jQueryContainerElement.find('.absolute-value-container'); container = jQueryContainerElement.find('.absolute-value-container');
content = createAbsoluteLayout({inputValue: value, volume}, content = createAbsoluteLayout({inputValue: value, volume},

190
ui-ngx/src/app/modules/home/components/widget/lib/indicator/liquid-level-widget.models.ts

@ -15,6 +15,8 @@
/// ///
import { import {
BackgroundSettings,
BackgroundType,
ColorSettings, ColorSettings,
constantColor, constantColor,
cssTextFromInlineStyle, cssTextFromInlineStyle,
@ -32,6 +34,7 @@ import { EntityService } from '@core/http/entity.service';
import { IAliasController } from '@core/api/widget-api.models'; import { IAliasController } from '@core/api/widget-api.models';
import { DomSanitizer, SafeUrl } from '@angular/platform-browser'; import { DomSanitizer, SafeUrl } from '@angular/platform-browser';
import { ResourcesService } from '@core/services/resources.service'; import { ResourcesService } from '@core/services/resources.service';
import { FormGroup } from '@angular/forms';
export interface SvgInfo { export interface SvgInfo {
svg: string; svg: string;
@ -44,21 +47,21 @@ export interface SvgLimits {
} }
export interface LevelCardWidgetSettings extends WidgetConfig { export interface LevelCardWidgetSettings extends WidgetConfig {
tankSelectionType: LevelSelectOptions; tankSelectionType: LiquidWidgetDataSourceType;
selectedShape: Shapes; selectedShape: Shapes;
shapeAttributeName: string; shapeAttributeName: string;
tankColor: ColorSettings; tankColor: ColorSettings;
datasourceUnits: CapacityUnits; datasourceUnits: CapacityUnits;
layout: LevelCardLayout; layout: LevelCardLayout;
volumeSource: LevelSelectOptions; volumeSource: LiquidWidgetDataSourceType;
volumeConstant: number; volumeConstant: number;
volumeAttributeName: string; volumeAttributeName: string;
volumeUnits: CapacityUnits; volumeUnits: CapacityUnits;
volumeFont: Font; volumeFont: Font;
volumeColor: ColorSettings; volumeColor: string;
liquidColor: ColorSettings; liquidColor: ColorSettings;
valueFont: Font; valueFont: Font;
widgetUnitsSource: LevelSelectOptions; widgetUnitsSource: LiquidWidgetDataSourceType;
widgetUnitsAttributeName: string; widgetUnitsAttributeName: string;
valueColor: ColorSettings; valueColor: ColorSettings;
showBackgroundOverlay: boolean; showBackgroundOverlay: boolean;
@ -75,6 +78,7 @@ export interface LevelCardWidgetSettings extends WidgetConfig {
tooltipDateColor: string; tooltipDateColor: string;
tooltipBackgroundColor: string; tooltipBackgroundColor: string;
tooltipBackgroundBlur: number; tooltipBackgroundBlur: number;
background: BackgroundSettings;
} }
export enum Shapes { export enum Shapes {
@ -115,9 +119,9 @@ export enum LevelCardLayout {
absolute = 'absolute' absolute = 'absolute'
} }
export enum LevelSelectOptions { export enum LiquidWidgetDataSourceType {
attribute = 'Attribute', static = 'static',
static = 'Static' attribute = 'attribute'
} }
export enum ConversionType { export enum ConversionType {
@ -208,7 +212,14 @@ export const levelCardLayoutTranslations = new Map<LevelCardLayout, string>(
] ]
); );
export const shapesTranslations = new Map<Shapes, string>( export const LiquidWidgetDataSourceTypeTranslations = new Map<LiquidWidgetDataSourceType, string>(
[
[LiquidWidgetDataSourceType.static, 'widgets.liquid-level-card.static'],
[LiquidWidgetDataSourceType.attribute, 'widgets.liquid-level-card.attribute']
]
);
export const ShapesTranslations = new Map<Shapes, string>(
[ [
[Shapes.vOval, 'widgets.liquid-level-card.v-oval'], [Shapes.vOval, 'widgets.liquid-level-card.v-oval'],
[Shapes.vCylinder, 'widgets.liquid-level-card.v-cylinder'], [Shapes.vCylinder, 'widgets.liquid-level-card.v-cylinder'],
@ -223,8 +234,8 @@ export const shapesTranslations = new Map<Shapes, string>(
] ]
); );
export const levelCardDefaultSettings = (): LevelCardWidgetSettings => ({ export const levelCardDefaultSettings: LevelCardWidgetSettings = {
tankSelectionType: LevelSelectOptions.static, tankSelectionType: LiquidWidgetDataSourceType.static,
selectedShape: Shapes.vCylinder, selectedShape: Shapes.vCylinder,
shapeAttributeName: 'tankShape', shapeAttributeName: 'tankShape',
tankColor: constantColor('#242770'), tankColor: constantColor('#242770'),
@ -244,7 +255,7 @@ export const levelCardDefaultSettings = (): LevelCardWidgetSettings => ({
showTitleIcon: false, showTitleIcon: false,
titleIcon: 'water_drop', titleIcon: 'water_drop',
iconColor: '#5469FF', iconColor: '#5469FF',
volumeSource: LevelSelectOptions.static, volumeSource: LiquidWidgetDataSourceType.static,
volumeConstant: 500, volumeConstant: 500,
volumeUnits: CapacityUnits.liters, volumeUnits: CapacityUnits.liters,
volumeAttributeName: 'volume', volumeAttributeName: 'volume',
@ -256,9 +267,9 @@ export const levelCardDefaultSettings = (): LevelCardWidgetSettings => ({
weight: '500', weight: '500',
lineHeight: '100%' lineHeight: '100%'
}, },
volumeColor: constantColor('rgba(0, 0, 0, 0.18)'), volumeColor: 'rgba(0, 0, 0, 0.18)',
units: CapacityUnits.percent as string, units: CapacityUnits.percent as string,
widgetUnitsSource: LevelSelectOptions.static, widgetUnitsSource: LiquidWidgetDataSourceType.static,
widgetUnitsAttributeName: 'units', widgetUnitsAttributeName: 'units',
decimals: 0, decimals: 0,
liquidColor: constantColor('#7A8BFF'), liquidColor: constantColor('#7A8BFF'),
@ -298,8 +309,17 @@ export const levelCardDefaultSettings = (): LevelCardWidgetSettings => ({
}, },
tooltipDateColor: 'rgba(0, 0, 0, 0.76)', tooltipDateColor: 'rgba(0, 0, 0, 0.76)',
tooltipBackgroundColor: 'rgba(255, 255, 255, 0.76)', tooltipBackgroundColor: 'rgba(255, 255, 255, 0.76)',
tooltipBackgroundBlur: 3 tooltipBackgroundBlur: 3,
}); background: {
type: BackgroundType.color,
color: '#fff',
overlay: {
enabled: false,
color: 'rgba(255,255,255,0.72)',
blur: 3
}
}
};
export const convertLiters = (value: number, units: CapacityUnits, conversionType: ConversionType): number => { export const convertLiters = (value: number, units: CapacityUnits, conversionType: ConversionType): number => {
let factor: number; let factor: number;
@ -470,3 +490,143 @@ export const loadSvgShapesMapping = (resourcesService: ResourcesService): Observ
}) })
); );
}; };
export const updatedFormSettingsValidators = (formGroup: FormGroup) => {
const datasourceUnits: string = formGroup.get('datasourceUnits').value;
const layout: LevelCardLayout = formGroup.get('layout').value;
const volumeSource: LiquidWidgetDataSourceType = formGroup.get('volumeSource').value;
const widgetUnitsSource: LiquidWidgetDataSourceType = formGroup.get('widgetUnitsSource').value;
const showTooltipLevel: boolean = formGroup.get('showTooltipLevel').value;
const showTooltipDate: boolean = formGroup.get('showTooltipDate').value;
const showTooltip: boolean = formGroup.get('showTooltip').value;
const tankSelectionType: LiquidWidgetDataSourceType = formGroup.get('tankSelectionType').value;
if (tankSelectionType === LiquidWidgetDataSourceType.static) {
formGroup.get('selectedShape').enable({emitEvent: false});
formGroup.get('shapeAttributeName').disable({emitEvent: false});
} else {
formGroup.get('selectedShape').disable({emitEvent: false});
formGroup.get('shapeAttributeName').enable({emitEvent: false});
}
switch (layout) {
case LevelCardLayout.simple:
case LevelCardLayout.percentage:
formGroup.get('widgetUnitsSource').disable({emitEvent: false});
formGroup.get('units').disable({emitEvent: false});
formGroup.get('widgetUnitsAttributeName').disable({emitEvent: false});
if (datasourceUnits !== CapacityUnits.percent) {
formGroup.get('volumeSource').enable({emitEvent: false});
formGroup.get('volumeUnits').enable({emitEvent: false});
if (volumeSource === LiquidWidgetDataSourceType.static) {
formGroup.get('volumeConstant').enable({emitEvent: false});
formGroup.get('volumeAttributeName').disable({emitEvent: false});
} else {
formGroup.get('volumeConstant').disable({emitEvent: false});
formGroup.get('volumeAttributeName').enable({emitEvent: false});
}
} else {
formGroup.get('volumeSource').disable({emitEvent: false});
formGroup.get('volumeConstant').disable({emitEvent: false});
formGroup.get('volumeAttributeName').disable({emitEvent: false});
formGroup.get('volumeUnits').disable({emitEvent: false});
}
if (layout === LevelCardLayout.simple) {
if (formGroup.get('decimals')) {
formGroup.get('decimals').disable({emitEvent: false});
}
formGroup.get('valueFont').disable({emitEvent: false});
formGroup.get('valueColor').disable({emitEvent: false});
} else {
if (formGroup.get('decimals')) {
formGroup.get('decimals').enable({emitEvent: false});
}
formGroup.get('valueFont').enable({emitEvent: false});
formGroup.get('valueColor').enable({emitEvent: false});
}
formGroup.get('volumeFont').disable({emitEvent: false});
formGroup.get('volumeColor').disable({emitEvent: false});
break;
case LevelCardLayout.absolute:
formGroup.get('widgetUnitsSource').enable({emitEvent: false});
if (widgetUnitsSource === LiquidWidgetDataSourceType.static) {
formGroup.get('units').enable({emitEvent: false});
formGroup.get('widgetUnitsAttributeName').disable({emitEvent: false});
} else {
formGroup.get('units').disable({emitEvent: false});
formGroup.get('widgetUnitsAttributeName').enable({emitEvent: false});
}
formGroup.get('volumeSource').enable({emitEvent: false});
formGroup.get('volumeUnits').enable({emitEvent: false});
if (volumeSource === LiquidWidgetDataSourceType.static) {
formGroup.get('volumeConstant').enable({emitEvent: false});
formGroup.get('volumeAttributeName').disable({emitEvent: false});
} else {
formGroup.get('volumeConstant').disable({emitEvent: false});
formGroup.get('volumeAttributeName').enable({emitEvent: false});
}
if (formGroup.get('decimals')) {
formGroup.get('decimals').enable({emitEvent: false});
}
formGroup.get('valueFont').enable({emitEvent: false});
formGroup.get('valueColor').enable({emitEvent: false});
formGroup.get('volumeFont').enable({emitEvent: false});
formGroup.get('volumeColor').enable({emitEvent: false});
break;
}
if (showTooltip) {
formGroup.get('showTooltipLevel').enable({emitEvent: false});
formGroup.get('showTooltipDate').enable({emitEvent: false});
formGroup.get('tooltipBackgroundColor').enable({emitEvent: false});
formGroup.get('tooltipBackgroundBlur').enable({emitEvent: false});
if (showTooltipLevel) {
formGroup.get('tooltipLevelDecimals').enable({emitEvent: false});
formGroup.get('tooltipLevelFont').enable({emitEvent: false});
formGroup.get('tooltipLevelColor').enable({emitEvent: false});
if (layout === LevelCardLayout.simple) {
formGroup.get('tooltipUnits').disable({emitEvent: false});
} else {
formGroup.get('tooltipUnits').enable({emitEvent: false});
}
} else {
formGroup.get('tooltipUnits').disable({emitEvent: false});
formGroup.get('tooltipLevelDecimals').disable({emitEvent: false});
formGroup.get('tooltipLevelFont').disable({emitEvent: false});
formGroup.get('tooltipLevelColor').disable({emitEvent: false});
}
if (showTooltipDate) {
formGroup.get('tooltipDateFormat').enable({emitEvent: false});
formGroup.get('tooltipDateFont').enable({emitEvent: false});
formGroup.get('tooltipDateColor').enable({emitEvent: false});
} else {
formGroup.get('tooltipDateFormat').disable({emitEvent: false});
formGroup.get('tooltipDateFont').disable({emitEvent: false});
formGroup.get('tooltipDateColor').disable({emitEvent: false});
}
} else {
formGroup.get('showTooltipLevel').disable({emitEvent: false});
formGroup.get('showTooltipDate').disable({emitEvent: false});
formGroup.get('tooltipBackgroundColor').disable({emitEvent: false});
formGroup.get('tooltipBackgroundBlur').disable({emitEvent: false});
formGroup.get('tooltipUnits').disable({emitEvent: false});
formGroup.get('tooltipLevelDecimals').disable({emitEvent: false});
formGroup.get('tooltipLevelFont').disable({emitEvent: false});
formGroup.get('tooltipLevelColor').disable({emitEvent: false});
formGroup.get('tooltipDateFormat').disable({emitEvent: false});
formGroup.get('tooltipDateFont').disable({emitEvent: false});
formGroup.get('tooltipDateColor').disable({emitEvent: false});
}
};

119
ui-ngx/src/app/modules/home/components/widget/lib/settings/indicator/liquid-level-card-widget-settings.component.html

@ -22,16 +22,13 @@
<div fxFlex fxLayout="row" style="width: 100%;" fxLayoutAlign="space-between center"> <div fxFlex fxLayout="row" style="width: 100%;" fxLayoutAlign="space-between center">
<div class="fixed-title-width" translate>widgets.liquid-level-card.shape</div> <div class="fixed-title-width" translate>widgets.liquid-level-card.shape</div>
<tb-toggle-select formControlName="tankSelectionType"> <tb-toggle-select formControlName="tankSelectionType">
<tb-toggle-option [value]="shapeSelectOptions.static"> <tb-toggle-option *ngFor="let type of DataSourceTypes" [value]="type">
{{ 'widgets.liquid-level-card.static' | translate }} {{ DataSourceTypeTranslations.get(type) | translate }}
</tb-toggle-option>
<tb-toggle-option [value]="shapeSelectOptions.attribute">
{{ 'widgets.liquid-level-card.attribute' | translate }}
</tb-toggle-option> </tb-toggle-option>
</tb-toggle-select> </tb-toggle-select>
</div> </div>
<tb-image-cards-select #shapesImageCardsSelect <tb-image-cards-select #shapesImageCardsSelect
[fxShow]="levelCardWidgetSettingsForm.get('tankSelectionType').value === shapeSelectOptions.static" [fxShow]="levelCardWidgetSettingsForm.get('tankSelectionType').value === DataSourceType.static"
rowHeight="{{ '1:1' }}" rowHeight="{{ '1:1' }}"
[cols]="5" [cols]="5"
[colsLtMd]="2" [colsLtMd]="2"
@ -39,31 +36,31 @@
label="{{ 'widgets.liquid-level-card.shape-type' | translate }}" formControlName="selectedShape"> label="{{ 'widgets.liquid-level-card.shape-type' | translate }}" formControlName="selectedShape">
<tb-image-cards-select-option *ngFor="let shape of shapes" <tb-image-cards-select-option *ngFor="let shape of shapes"
[value]="shape" [value]="shape"
[image]="createShape(shapesImageMap.get(shape), this.levelCardLayouts.simple)"> [image]="createShape(shapesImageMap.get(shape), LevelCardLayout.simple)">
{{ shapesTranslationMap.get(shape) | translate }} {{ ShapesTranslationMap.get(shape) | translate }}
</tb-image-cards-select-option> </tb-image-cards-select-option>
</tb-image-cards-select> </tb-image-cards-select>
<div class="tb-form-row space-between" style="width: 100%;" <ng-container *ngIf="levelCardWidgetSettingsForm.get('tankSelectionType').value === DataSourceType.attribute">
*ngIf="levelCardWidgetSettingsForm.get('tankSelectionType').value === shapeSelectOptions.attribute"> <div class="tb-form-row space-between" style="width: 100%;">
<div class="fixed-title-width" translate>widgets.liquid-level-card.shape-attribute-name</div> <div class="fixed-title-width" translate>widgets.liquid-level-card.shape-attribute-name</div>
<tb-string-autocomplete [fetchOptionsFn]="fetchOptions.bind(this)" <tb-string-autocomplete [fetchOptionsFn]="fetchOptions.bind(this)"
[required]="isRequired('shapeAttributeName')" [required]="isRequired('shapeAttributeName')"
[errorText]="'widgets.liquid-level-card.attribute-name-required' | translate" [errorText]="'widgets.liquid-level-card.attribute-name-required' | translate"
style="flex: 1" style="flex: 1"
formControlName="shapeAttributeName"> formControlName="shapeAttributeName">
</tb-string-autocomplete> </tb-string-autocomplete>
</div>
<div fxFlex fxLayout="row" fxLayoutAlign="space-between center" style="width: 100%;"
*ngIf="levelCardWidgetSettingsForm.get('tankSelectionType').value === shapeSelectOptions.attribute">
<div class="tb-hint" style="padding: 0;" translate>widgets.liquid-level-card.shape-by-attribute</div>
<div class="see-example"
[tb-help-popup]="'widget/lib/indicator/shape_attribute_fn'"
tb-help-popup-placement="left"
trigger-style="font-size: 12px"
[tb-help-popup-style]="{maxWidth: '820px'}"
trigger-text="{{ 'widgets.liquid-level-card.see-examples' | translate }}">
</div> </div>
</div> <div fxFlex fxLayout="row" fxLayoutAlign="space-between center" style="width: 100%;">
<div class="tb-hint" style="padding: 0;" translate>widgets.liquid-level-card.shape-by-attribute</div>
<div class="see-example"
[tb-help-popup]="'widget/lib/indicator/shape_attribute_fn'"
tb-help-popup-placement="left"
trigger-style="font-size: 12px"
[tb-help-popup-style]="{maxWidth: '820px'}"
trigger-text="{{ 'widgets.liquid-level-card.see-examples' | translate }}">
</div>
</div>
</ng-container>
</div> </div>
</div> </div>
<div class="tb-form-panel"> <div class="tb-form-panel">
@ -74,10 +71,10 @@
[colsLtMd]="3" [colsLtMd]="3"
label="{{ 'widgets.liquid-level-card.layout' | translate }}" formControlName="layout"> label="{{ 'widgets.liquid-level-card.layout' | translate }}" formControlName="layout">
<tb-image-cards-select-option <tb-image-cards-select-option
*ngFor="let layout of [levelCardLayouts.simple, levelCardLayouts.percentage, levelCardLayouts.absolute]" *ngFor="let layout of LevelCardLayouts"
[value]="layout" [value]="layout"
[image]="createShape(shapesImageMap.get(levelCardWidgetSettingsForm.get('selectedShape').value), layout)"> [image]="createShape(shapesImageMap.get(levelCardWidgetSettingsForm.get('selectedShape').value), layout)">
{{ levelCardLayoutTranslationMap.get(layout) | translate }} {{ LevelCardLayoutTranslationMap.get(layout) | translate }}
</tb-image-cards-select-option> </tb-image-cards-select-option>
</tb-image-cards-select> </tb-image-cards-select>
</div> </div>
@ -91,42 +88,43 @@
formControlName="datasourceUnits"> formControlName="datasourceUnits">
</tb-unit-input> </tb-unit-input>
</div> </div>
<div class="tb-form-row space-between" [fxShow]="widgetUnitsInput"> <div class="tb-form-row space-between" *ngIf="levelCardWidgetSettingsForm.get('layout').value === LevelCardLayout.absolute">
<div class="fixed-title-width tb-required" translate>widgets.liquid-level-card.widget-units</div> <div class="fixed-title-width tb-required" translate>widgets.liquid-level-card.widget-units</div>
<div fxFlex fxLayout="row" fxLayoutAlign="start center" fxLayoutGap="8px"> <div fxFlex fxLayout="row" fxLayoutAlign="start center" fxLayoutGap="8px">
<mat-form-field class="flex" appearance="outline" subscriptSizing="dynamic" style="max-width: 25%"> <mat-form-field class="flex" appearance="outline" subscriptSizing="dynamic" style="max-width: 25%">
<mat-select formControlName="widgetUnitsSource" placeholder="{{ 'widget-config.set' | translate }}"> <mat-select formControlName="widgetUnitsSource" placeholder="{{ 'widget-config.set' | translate }}">
<mat-option *ngFor="let option of [volumeOptions.static, volumeOptions.attribute]" [value]="option"> <mat-option *ngFor="let type of DataSourceTypes" [value]="type">
{{ option }} {{ DataSourceTypeTranslations.get(type) | translate }}
</mat-option> </mat-option>
</mat-select> </mat-select>
</mat-form-field> </mat-form-field>
<tb-unit-input *ngIf="levelCardWidgetSettingsForm.get('widgetUnitsSource').value !== volumeOptions.attribute" <tb-unit-input *ngIf="levelCardWidgetSettingsForm.get('widgetUnitsSource').value !== DataSourceType.attribute; else selectUnitsAttributes"
class="flex" class="flex"
[tagFilter]="unitsType.capacity" [tagFilter]="unitsType.capacity"
[required]="isRequired('units')" [required]="isRequired('units')"
formControlName="units"> formControlName="units">
</tb-unit-input> </tb-unit-input>
<tb-string-autocomplete *ngIf="levelCardWidgetSettingsForm.get('widgetUnitsSource').value === volumeOptions.attribute" <ng-template #selectUnitsAttributes>
[fetchOptionsFn]="fetchOptions.bind(this)" <tb-string-autocomplete [fetchOptionsFn]="fetchOptions.bind(this)"
[required]="isRequired('widgetUnitsAttributeName')" [required]="isRequired('widgetUnitsAttributeName')"
[errorText]="'widgets.liquid-level-card.attribute-name-required' | translate" [errorText]="'widgets.liquid-level-card.attribute-name-required' | translate"
style="flex: 1" style="flex: 1"
formControlName="widgetUnitsAttributeName"> formControlName="widgetUnitsAttributeName">
</tb-string-autocomplete> </tb-string-autocomplete>
</ng-template>
</div> </div>
</div> </div>
<div class="tb-form-row" [fxShow]="volumeInput"> <div class="tb-form-row" *ngIf="volumeInput">
<div class="fixed-title-width tb-required" translate>widgets.liquid-level-card.total-volume</div> <div class="fixed-title-width tb-required" translate>widgets.liquid-level-card.total-volume</div>
<div fxFlex fxLayout="row" fxLayoutAlign="start center" fxLayoutGap="8px"> <div fxFlex fxLayout="row" fxLayoutAlign="start center" fxLayoutGap="8px">
<mat-form-field class="flex" appearance="outline" subscriptSizing="dynamic" style="max-width: 25%"> <mat-form-field class="flex" appearance="outline" subscriptSizing="dynamic" style="max-width: 25%">
<mat-select formControlName="volumeSource" placeholder="{{ 'widget-config.set' | translate }}"> <mat-select formControlName="volumeSource" placeholder="{{ 'widget-config.set' | translate }}">
<mat-option *ngFor="let option of [volumeOptions.static, volumeOptions.attribute]" [value]="option"> <mat-option *ngFor="let type of DataSourceTypes" [value]="type">
{{ option }} {{ DataSourceTypeTranslations.get(type) | translate }}
</mat-option> </mat-option>
</mat-select> </mat-select>
</mat-form-field> </mat-form-field>
<mat-form-field *ngIf="levelCardWidgetSettingsForm.get('volumeSource').value === volumeOptions.static" <mat-form-field *ngIf="levelCardWidgetSettingsForm.get('volumeSource').value === DataSourceType.static; else volumeAttributes"
appearance="outline" class="flex number" subscriptSizing="dynamic"> appearance="outline" class="flex number" subscriptSizing="dynamic">
<input matInput formControlName="volumeConstant" type="number" <input matInput formControlName="volumeConstant" type="number"
min="0" step="1" placeholder="{{ 'widget-config.set' | translate }}"> min="0" step="1" placeholder="{{ 'widget-config.set' | translate }}">
@ -139,13 +137,14 @@
warning warning
</mat-icon> </mat-icon>
</mat-form-field> </mat-form-field>
<tb-string-autocomplete *ngIf="levelCardWidgetSettingsForm.get('volumeSource').value === volumeOptions.attribute" <ng-template #volumeAttributes>
[fetchOptionsFn]="fetchOptions.bind(this)" <tb-string-autocomplete [fetchOptionsFn]="fetchOptions.bind(this)"
[required]="isRequired('volumeAttributeName')" [required]="isRequired('volumeAttributeName')"
[errorText]="'widgets.liquid-level-card.attribute-name-required' | translate" [errorText]="'widgets.liquid-level-card.attribute-name-required' | translate"
style="flex: 1" style="flex: 1"
formControlName="volumeAttributeName"> formControlName="volumeAttributeName">
</tb-string-autocomplete> </tb-string-autocomplete>
</ng-template>
<tb-unit-input [tagFilter]="unitsType.capacity" <tb-unit-input [tagFilter]="unitsType.capacity"
[required]="isRequired('volumeUnits')" [required]="isRequired('volumeUnits')"
style="max-width: 25%" class="flex" style="max-width: 25%" class="flex"
@ -166,8 +165,13 @@
<tb-color-settings formControlName="liquidColor" settingsKey="{{'widgets.liquid-level-card.liquid-color' | translate }}"> <tb-color-settings formControlName="liquidColor" settingsKey="{{'widgets.liquid-level-card.liquid-color' | translate }}">
</tb-color-settings> </tb-color-settings>
</div> </div>
<div class="tb-form-row space-between">
<div>{{ 'widgets.background.background' | translate }}</div>
<tb-background-settings formControlName="background">
</tb-background-settings>
</div>
<div class="tb-form-row space-between" <div class="tb-form-row space-between"
*ngIf="levelCardWidgetSettingsForm.get('layout').value !== this.levelCardLayouts.simple"> *ngIf="levelCardWidgetSettingsForm.get('layout').value !== LevelCardLayout.simple">
<div class="fixed-title-width" translate>widgets.liquid-level-card.value</div> <div class="fixed-title-width" translate>widgets.liquid-level-card.value</div>
<div fxFlex fxLayout="row" fxLayoutAlign="end center" fxLayoutGap="8px"> <div fxFlex fxLayout="row" fxLayoutAlign="end center" fxLayoutGap="8px">
<tb-font-settings formControlName="valueFont" <tb-font-settings formControlName="valueFont"
@ -177,17 +181,18 @@
</tb-color-settings> </tb-color-settings>
</div> </div>
</div> </div>
<div class="tb-form-row" [fxShow]="volumeInput"> <div class="tb-form-row" *ngIf="levelCardWidgetSettingsForm.get('layout').value === LevelCardLayout.absolute">
<div class="fixed-title-width" translate>widgets.liquid-level-card.total-volume</div> <div class="fixed-title-width" translate>widgets.liquid-level-card.total-volume</div>
<div fxFlex fxLayout="row" fxLayoutAlign="end center" fxLayoutGap="8px"> <div fxFlex fxLayout="row" fxLayoutAlign="end center" fxLayoutGap="8px">
<tb-font-settings formControlName="volumeFont" <tb-font-settings formControlName="volumeFont"
[previewText]="totalVolumeValuePreviewFn"> [previewText]="totalVolumeValuePreviewFn">
</tb-font-settings> </tb-font-settings>
<tb-color-settings formControlName="volumeColor" settingsKey="{{'widgets.liquid-level-card.total-volume' | translate }}"> <tb-color-input asBoxInput colorClearButton formControlName="volumeColor">
</tb-color-settings> </tb-color-input>
</div> </div>
</div> </div>
<div class="tb-form-row space-between"> <div class="tb-form-row space-between"
*ngIf="levelCardWidgetSettingsForm.get('layout').value !== LevelCardLayout.simple">
<mat-slide-toggle class="mat-slide fixed-title-width" formControlName="showBackgroundOverlay"> <mat-slide-toggle class="mat-slide fixed-title-width" formControlName="showBackgroundOverlay">
{{ 'widgets.liquid-level-card.background-overlay' | translate }} {{ 'widgets.liquid-level-card.background-overlay' | translate }}
</mat-slide-toggle> </mat-slide-toggle>

233
ui-ngx/src/app/modules/home/components/widget/lib/settings/indicator/liquid-level-card-widget-settings.component.ts

@ -22,7 +22,7 @@ import {
WidgetSettings, WidgetSettings,
WidgetSettingsComponent WidgetSettingsComponent
} from '@shared/models/widget.models'; } from '@shared/models/widget.models';
import { AbstractControl, UntypedFormBuilder, UntypedFormGroup, Validators } from '@angular/forms'; import { FormBuilder, FormGroup, Validators } from '@angular/forms';
import { Store } from '@ngrx/store'; import { Store } from '@ngrx/store';
import { AppState } from '@core/core.state'; import { AppState } from '@core/core.state';
import { formatValue, isDefined } from '@core/utils'; import { formatValue, isDefined } from '@core/utils';
@ -36,11 +36,13 @@ import {
levelCardDefaultSettings, levelCardDefaultSettings,
LevelCardLayout, LevelCardLayout,
levelCardLayoutTranslations, levelCardLayoutTranslations,
LevelSelectOptions, LiquidWidgetDataSourceType,
LiquidWidgetDataSourceTypeTranslations,
loadSvgShapesMapping, loadSvgShapesMapping,
optionsFilter, optionsFilter,
Shapes, Shapes,
shapesTranslations ShapesTranslations,
updatedFormSettingsValidators
} from '@home/components/widget/lib/indicator/liquid-level-widget.models'; } from '@home/components/widget/lib/indicator/liquid-level-widget.models';
import { UnitsType } from '@shared/models/unit.models'; import { UnitsType } from '@shared/models/unit.models';
import { ImageCardsSelectComponent } from '@home/components/widget/lib/settings/common/image-cards-select.component'; import { ImageCardsSelectComponent } from '@home/components/widget/lib/settings/common/image-cards-select.component';
@ -75,13 +77,7 @@ export class LiquidLevelCardWidgetSettingsComponent extends WidgetSettingsCompon
return !(datasourceUnits === CapacityUnits.percent && widgetUnits === CapacityUnits.percent); return !(datasourceUnits === CapacityUnits.percent && widgetUnits === CapacityUnits.percent);
} }
public get widgetUnitsInput(): boolean { private get datasource(): Datasource {
const layout: LevelCardLayout = this.levelCardWidgetSettingsForm.get('layout').value;
return layout === LevelCardLayout.absolute;
}
public get datasource(): Datasource {
if (this.widgetConfig.config.datasources && this.widgetConfig.config.datasources) { if (this.widgetConfig.config.datasources && this.widgetConfig.config.datasources) {
return this.widgetConfig.config.datasources[0]; return this.widgetConfig.config.datasources[0];
} else { } else {
@ -89,22 +85,21 @@ export class LiquidLevelCardWidgetSettingsComponent extends WidgetSettingsCompon
} }
} }
shapeSelectOptions = LevelSelectOptions; LevelCardLayout = LevelCardLayout;
LevelCardLayouts = Object.values(LevelCardLayout) as LevelCardLayout[];
shapes: Shapes[] = []; LevelCardLayoutTranslationMap = levelCardLayoutTranslations;
shapesTranslationMap = shapesTranslations;
unitsType = UnitsType;
levelCardLayouts = LevelCardLayout; DataSourceType = LiquidWidgetDataSourceType;
DataSourceTypes = Object.values(LiquidWidgetDataSourceType) as LiquidWidgetDataSourceType[];
DataSourceTypeTranslations = LiquidWidgetDataSourceTypeTranslations;
levelCardLayoutTranslationMap = levelCardLayoutTranslations; shapes = Object.values(Shapes) as Shapes[];
shapesImageMap: Map<Shapes, string> = new Map(); shapesImageMap: Map<Shapes, string> = new Map();
ShapesTranslationMap = ShapesTranslations;
volumeOptions = LevelSelectOptions; unitsType = UnitsType;
levelCardWidgetSettingsForm: UntypedFormGroup; levelCardWidgetSettingsForm: FormGroup;
valuePreviewFn = this._valuePreviewFn.bind(this); valuePreviewFn = this._valuePreviewFn.bind(this);
@ -114,21 +109,17 @@ export class LiquidLevelCardWidgetSettingsComponent extends WidgetSettingsCompon
datePreviewFn = this._datePreviewFn.bind(this); datePreviewFn = this._datePreviewFn.bind(this);
keySearchText: string; private keySearchText: string;
private latestKeySearchTextResult: Array<string>;
latestKeySearchTextResult: Array<string>;
datasources: Array<Datasource>;
functionTypeKeys: Array<DataKey> = []; private functionTypeKeys: Array<DataKey> = [];
lastKeysId: string; private lastKeysId: string;
private lastFetchedKeys: Array<DataKey>;
lastFetchedKeys: Array<DataKey>;
constructor(protected store: Store<AppState>, constructor(protected store: Store<AppState>,
private $injector: Injector, private $injector: Injector,
private fb: UntypedFormBuilder, private fb: FormBuilder,
private resourcesService: ResourcesService, private resourcesService: ResourcesService,
private sanitizer: DomSanitizer, private sanitizer: DomSanitizer,
private cd: ChangeDetectorRef, private cd: ChangeDetectorRef,
@ -137,12 +128,11 @@ export class LiquidLevelCardWidgetSettingsComponent extends WidgetSettingsCompon
super(store); super(store);
} }
protected settingsForm(): UntypedFormGroup { protected settingsForm(): FormGroup {
return this.levelCardWidgetSettingsForm; return this.levelCardWidgetSettingsForm;
} }
protected onWidgetConfigSet(widgetConfig: WidgetConfigComponentData) { protected onWidgetConfigSet(widgetConfig: WidgetConfigComponentData) {
this.shapes = Object.values(Shapes);
this.createSvgShapesMapping(); this.createSvgShapesMapping();
for (const type of this.utils.getPredefinedFunctionsList()) { for (const type of this.utils.getPredefinedFunctionsList()) {
@ -154,7 +144,7 @@ export class LiquidLevelCardWidgetSettingsComponent extends WidgetSettingsCompon
} }
protected defaultSettings(): WidgetSettings { protected defaultSettings(): WidgetSettings {
return levelCardDefaultSettings(); return levelCardDefaultSettings;
} }
protected onSettingsSet(settings: WidgetSettings) { protected onSettingsSet(settings: WidgetSettings) {
@ -182,6 +172,7 @@ export class LiquidLevelCardWidgetSettingsComponent extends WidgetSettingsCompon
backgroundOverlayColor: [settings.backgroundOverlayColor, []], backgroundOverlayColor: [settings.backgroundOverlayColor, []],
liquidColor: [settings.liquidColor, []], liquidColor: [settings.liquidColor, []],
background: [settings.background],
showTooltip: [settings.showTooltip, []], showTooltip: [settings.showTooltip, []],
showTooltipLevel: [settings.showTooltipLevel, []], showTooltipLevel: [settings.showTooltipLevel, []],
@ -214,176 +205,12 @@ export class LiquidLevelCardWidgetSettingsComponent extends WidgetSettingsCompon
} }
protected updateValidators(emitEvent: boolean, trigger?: string) { protected updateValidators(emitEvent: boolean, trigger?: string) {
const emitEventFields = []; updatedFormSettingsValidators(this.levelCardWidgetSettingsForm);
const datasourceUnits: string = this.levelCardWidgetSettingsForm.get('datasourceUnits').value;
const layout: LevelCardLayout = this.levelCardWidgetSettingsForm.get('layout').value;
const volumeSource: AbstractControl<LevelSelectOptions> = this.levelCardWidgetSettingsForm.get('volumeSource');
const widgetUnits: AbstractControl<string> = this.levelCardWidgetSettingsForm.get('units');
const tooltipUnits: AbstractControl<string> = this.levelCardWidgetSettingsForm.get('tooltipUnits');
const widgetUnitsSource: AbstractControl<LevelSelectOptions> = this.levelCardWidgetSettingsForm.get('widgetUnitsSource');
const showTooltipLevel: AbstractControl<boolean> = this.levelCardWidgetSettingsForm.get('showTooltipLevel');
const showTooltipDate: AbstractControl<boolean> = this.levelCardWidgetSettingsForm.get('showTooltipDate');
const showTooltip: boolean = this.levelCardWidgetSettingsForm.get('showTooltip').value;
if (trigger === 'tankSelectionType') {
const tankSelectionType: LevelSelectOptions = this.levelCardWidgetSettingsForm.get('tankSelectionType').value;
if (tankSelectionType === LevelSelectOptions.static) {
this.levelCardWidgetSettingsForm.get('selectedShape').enable({emitEvent: false});
this.levelCardWidgetSettingsForm.get('shapeAttributeName').disable({emitEvent: false});
} else {
this.levelCardWidgetSettingsForm.get('selectedShape').disable({emitEvent: false});
this.levelCardWidgetSettingsForm.get('shapeAttributeName').enable({emitEvent: false});
}
emitEventFields.push('selectedShape', 'shapeAttributeName');
}
if (trigger === 'datasourceUnits' || trigger === 'layout' || trigger === 'units') {
if (
datasourceUnits === CapacityUnits.percent &&
layout !== LevelCardLayout.absolute &&
(!widgetUnits?.value || widgetUnits?.value === CapacityUnits.percent)
) {
volumeSource.disable({emitEvent: false});
this.levelCardWidgetSettingsForm.get('volumeConstant').disable({emitEvent: false});
this.levelCardWidgetSettingsForm.get('volumeAttributeName').disable({emitEvent: false});
this.levelCardWidgetSettingsForm.get('volumeUnits').disable({emitEvent: false});
this.levelCardWidgetSettingsForm.get('volumeFont').disable({emitEvent: false});
this.levelCardWidgetSettingsForm.get('volumeColor').disable({emitEvent: false});
} else {
volumeSource.enable({emitEvent: false});
this.levelCardWidgetSettingsForm.get('volumeConstant').enable({emitEvent: false});
this.levelCardWidgetSettingsForm.get('volumeAttributeName').enable({emitEvent: false});
this.levelCardWidgetSettingsForm.get('volumeUnits').enable({emitEvent: false});
this.levelCardWidgetSettingsForm.get('volumeFont').enable({emitEvent: false});
this.levelCardWidgetSettingsForm.get('volumeColor').enable({emitEvent: false});
}
if (layout === LevelCardLayout.simple && datasourceUnits === CapacityUnits.percent) {
this.levelCardWidgetSettingsForm.get('valueFont').disable();
this.levelCardWidgetSettingsForm.get('valueColor').disable();
} else {
this.levelCardWidgetSettingsForm.get('valueFont').enable();
this.levelCardWidgetSettingsForm.get('valueColor').enable();
}
emitEventFields.push('volumeSource', 'volumeConstant', 'volumeAttributeName', 'volumeFont', 'volumeColor', 'volumeUnits');
} else if (trigger === 'volumeSource') {
if((datasourceUnits !== CapacityUnits.percent) ||
(layout === LevelCardLayout.absolute && widgetUnits?.value !== CapacityUnits.percent)) {
if (volumeSource.value === LevelSelectOptions.static) {
this.levelCardWidgetSettingsForm.get('volumeConstant').enable({emitEvent: false});
this.levelCardWidgetSettingsForm.get('volumeAttributeName').disable({emitEvent: false});
} else {
this.levelCardWidgetSettingsForm.get('volumeConstant').disable({emitEvent: false});
this.levelCardWidgetSettingsForm.get('volumeAttributeName').enable({emitEvent: false});
}
emitEventFields.push('volumeConstant', 'volumeAttributeName');
}
}
if (trigger === 'showBackgroundOverlay') {
const showBackgroundOverlay: boolean = this.levelCardWidgetSettingsForm.get('showBackgroundOverlay').value;
if (showBackgroundOverlay) {
this.levelCardWidgetSettingsForm.get('backgroundOverlayColor').enable({emitEvent: false});
} else {
this.levelCardWidgetSettingsForm.get('backgroundOverlayColor').disable({emitEvent: false});
}
emitEventFields.push('backgroundOverlayColor');
}
if (trigger === 'showTooltip') {
if (showTooltip) {
showTooltipLevel.enable({emitEvent: false});
showTooltipDate.enable({emitEvent: false});
this.levelCardWidgetSettingsForm.get('tooltipBackgroundColor').enable();
this.levelCardWidgetSettingsForm.get('tooltipBackgroundBlur').enable();
} else {
showTooltipLevel.disable({emitEvent: false});
showTooltipDate.disable({emitEvent: false});
this.levelCardWidgetSettingsForm.get('tooltipBackgroundColor').disable({emitEvent: false});
this.levelCardWidgetSettingsForm.get('tooltipBackgroundBlur').disable({emitEvent: false});
}
emitEventFields.push('showTooltipLevel', 'showTooltipDate', 'tooltipBackgroundColor', 'tooltipBackgroundBlur');
}
if (trigger === 'showTooltipLevel') {
if (showTooltipLevel?.value && !showTooltipLevel.disabled) {
this.levelCardWidgetSettingsForm.get('tooltipUnits').enable();
this.levelCardWidgetSettingsForm.get('tooltipLevelDecimals').enable({emitEvent: false});
this.levelCardWidgetSettingsForm.get('tooltipLevelFont').enable({emitEvent: false});
this.levelCardWidgetSettingsForm.get('tooltipLevelColor').enable({emitEvent: false});
} else {
this.levelCardWidgetSettingsForm.get('tooltipUnits').disable();
this.levelCardWidgetSettingsForm.get('tooltipLevelDecimals').disable({emitEvent: false});
this.levelCardWidgetSettingsForm.get('tooltipLevelFont').disable({emitEvent: false});
this.levelCardWidgetSettingsForm.get('tooltipLevelColor').disable({emitEvent: false});
}
emitEventFields.push('tooltipUnits', 'tooltipLevelDecimals', 'tooltipLevelFont', 'tooltipLevelColor');
}
if (trigger === 'showTooltipDate') {
if (showTooltipDate?.value && !showTooltipDate.disabled) {
this.levelCardWidgetSettingsForm.get('tooltipDateFormat').enable({emitEvent: false});
this.levelCardWidgetSettingsForm.get('tooltipDateFont').enable({emitEvent: false});
this.levelCardWidgetSettingsForm.get('tooltipDateColor').enable({emitEvent: false});
} else {
this.levelCardWidgetSettingsForm.get('tooltipDateFormat').disable({emitEvent: false});
this.levelCardWidgetSettingsForm.get('tooltipDateFont').disable({emitEvent: false});
this.levelCardWidgetSettingsForm.get('tooltipDateColor').disable({emitEvent: false});
}
emitEventFields.push('tooltipDateFormat', 'tooltipDateFont', 'tooltipDateColor');
}
if (trigger === 'layout' || trigger === 'datasourceUnits') {
if (layout === LevelCardLayout.simple) {
widgetUnits.disable({emitEvent: false});
tooltipUnits.disable({emitEvent: false});
widgetUnitsSource.setValue(LevelSelectOptions.static, {emitEvent: false});
widgetUnitsSource.disable({emitEvent: false});
this.levelCardWidgetSettingsForm.get('valueFont').disable({emitEvent: false});
this.levelCardWidgetSettingsForm.get('valueColor').disable({emitEvent: false});
this.levelCardWidgetSettingsForm.get('widgetUnitsAttributeName').disable({emitEvent: false});
} else if (layout === LevelCardLayout.percentage) {
if (widgetUnits.value !== CapacityUnits.percent) {
widgetUnits.setValue(CapacityUnits.percent, {emitEvent: false});
widgetUnitsSource.setValue(LevelSelectOptions.static, {emitEvent: false});
}
widgetUnits.disable({emitEvent: false});
widgetUnitsSource.disable({emitEvent: false});
this.levelCardWidgetSettingsForm.get('widgetUnitsAttributeName').disable({emitEvent: false});
if (tooltipUnits.value !== CapacityUnits.percent) {
tooltipUnits.setValue(CapacityUnits.percent, {emitEvent: false});
}
tooltipUnits.disable({emitEvent: false});
} else {
widgetUnits.enable({emitEvent: false});
tooltipUnits.enable({emitEvent: false});
widgetUnitsSource.enable({emitEvent: false});
this.levelCardWidgetSettingsForm.get('valueFont').enable({emitEvent: false});
this.levelCardWidgetSettingsForm.get('valueColor').enable({emitEvent: false});
this.levelCardWidgetSettingsForm.get('widgetUnitsAttributeName').enable({emitEvent: false});
}
emitEventFields.push('units', 'tooltipUnits', 'valueFont', 'valueColor', 'widgetUnitsSource', 'widgetUnitsAttributeName');
} else if (trigger === 'widgetUnitsSource') {
if (layout !== LevelCardLayout.percentage) {
if (widgetUnitsSource.value === LevelSelectOptions.static) {
widgetUnits.enable({emitEvent: false});
this.levelCardWidgetSettingsForm.get('widgetUnitsAttributeName').disable({emitEvent: false});
} else {
widgetUnits.disable({emitEvent: false});
this.levelCardWidgetSettingsForm.get('widgetUnitsAttributeName').enable({emitEvent: false});
}
emitEventFields.push('units', 'widgetUnitsAttributeName');
}
}
for (const controlKey in this.levelCardWidgetSettingsForm.controls) { if (this.levelCardWidgetSettingsForm.get('showBackgroundOverlay').value) {
if (emitEventFields.includes(controlKey)) { this.levelCardWidgetSettingsForm.get('backgroundOverlayColor').enable({emitEvent: false});
this.levelCardWidgetSettingsForm.controls[controlKey].updateValueAndValidity({emitEvent}); } else {
} this.levelCardWidgetSettingsForm.get('backgroundOverlayColor').disable({emitEvent: false});
} }
} }

Loading…
Cancel
Save