From 5092681d92bfc89e41cd46e82ccaee3e0fc1928a Mon Sep 17 00:00:00 2001 From: gugak <107577102+Salijoghli@users.noreply.github.com> Date: Mon, 19 May 2025 20:29:30 +0400 Subject: [PATCH] made error popup, showing it whenever connection is lost. added database connection status on the header --- .../views/PopUp-Views/ErrorPopup/view.json | 124 ++++++++++++++++++ .../views/Header/Header/view.json | 54 +++++++- 2 files changed, 176 insertions(+), 2 deletions(-) create mode 100644 MTN6_SCADA/com.inductiveautomation.perspective/views/PopUp-Views/ErrorPopup/view.json diff --git a/MTN6_SCADA/com.inductiveautomation.perspective/views/PopUp-Views/ErrorPopup/view.json b/MTN6_SCADA/com.inductiveautomation.perspective/views/PopUp-Views/ErrorPopup/view.json new file mode 100644 index 0000000..5e9aa3e --- /dev/null +++ b/MTN6_SCADA/com.inductiveautomation.perspective/views/PopUp-Views/ErrorPopup/view.json @@ -0,0 +1,124 @@ +{ + "custom": {}, + "params": {}, + "props": { + "defaultSize": { + "height": 208, + "width": 450 + } + }, + "root": { + "children": [ + { + "meta": { + "name": "Label" + }, + "position": { + "height": 40, + "width": 360, + "x": 90 + }, + "props": { + "text": "Database Error", + "textStyle": { + "color": "#FF0000", + "fontFamily": "Arial", + "fontSize": "22px" + } + }, + "type": "ia.display.label" + }, + { + "meta": { + "name": "Icon" + }, + "position": { + "height": 40, + "width": 90 + }, + "props": { + "color": "#FF1D00", + "path": "material/error" + }, + "type": "ia.display.icon" + }, + { + "children": [ + { + "meta": { + "name": "Label" + }, + "position": { + "basis": "32px" + }, + "props": { + "text": "An error occurred while connecting to the database." + }, + "type": "ia.display.label" + }, + { + "meta": { + "name": "Label_0" + }, + "position": { + "basis": "32px" + }, + "props": { + "text": "Network or database connection failed. Check your settings or contact IT support." + }, + "type": "ia.display.label" + } + ], + "meta": { + "name": "FlexContainer" + }, + "position": { + "height": 99, + "width": 450, + "y": 48 + }, + "props": { + "alignItems": "flex-start", + "direction": "column", + "justify": "space-around", + "style": { + "paddingLeft": 5, + "paddingRight": 5 + } + }, + "type": "ia.container.flex" + }, + { + "events": { + "component": { + "onActionPerformed": { + "config": { + "script": "\tsystem.perspective.closePopup(\"\")" + }, + "scope": "G", + "type": "script" + } + } + }, + "meta": { + "name": "Button" + }, + "position": { + "height": 34, + "width": 206, + "x": 106, + "y": 158 + }, + "props": { + "primary": false, + "text": "Dismiss" + }, + "type": "ia.input.button" + } + ], + "meta": { + "name": "root" + }, + "type": "ia.container.coord" + } +} \ No newline at end of file diff --git a/SCADA_PERSPECTIVE_PARENT_PROJECT/com.inductiveautomation.perspective/views/Header/Header/view.json b/SCADA_PERSPECTIVE_PARENT_PROJECT/com.inductiveautomation.perspective/views/Header/Header/view.json index 7981c25..8fc9818 100644 --- a/SCADA_PERSPECTIVE_PARENT_PROJECT/com.inductiveautomation.perspective/views/Header/Header/view.json +++ b/SCADA_PERSPECTIVE_PARENT_PROJECT/com.inductiveautomation.perspective/views/Header/Header/view.json @@ -6,9 +6,9 @@ "$": [ "ts", 192, - 1745914528657 + 1747671282220 ], - "$ts": 1745914528656 + "$ts": 1747671282219 } } }, @@ -442,6 +442,56 @@ }, "type": "ia.container.flex" }, + { + "meta": { + "name": "Icon_1", + "tooltip": { + "enabled": true, + "text": "Database Connection Status" + } + }, + "position": { + "basis": "30px" + }, + "propConfig": { + "props.color": { + "binding": { + "config": { + "expression": "{[System]Gateway/Database/MariaDB/Available}" + }, + "transforms": [ + { + "fallback": "#FF0000", + "inputType": "scalar", + "mappings": [ + { + "input": true, + "output": "#47FF47" + }, + { + "input": false, + "output": "#FF0000" + } + ], + "outputType": "color", + "type": "map" + } + ], + "type": "expr" + }, + "onChange": { + "enabled": null, + "script": " db_tag_path \u003d \"[System]Gateway/Database/MariaDB/Available\"\n\t\n if not (system.tag.readBlocking([db_tag_path])[0].value):\n \tsystem.perspective.openPopup(\"errorPopup\",\u0027PopUp-Views/ErrorPopup\u0027)\n\t" + }, + "persistent": true + } + }, + "props": { + "color": "#47FF47", + "path": "material/table_chart" + }, + "type": "ia.display.icon" + }, { "meta": { "hasDelegate": true,