{ "custom": {}, "params": { "params": "value" }, "propConfig": { "params.params": { "paramDirection": "input", "persistent": true } }, "props": { "defaultSize": { "height": 1080, "width": 400 } }, "root": { "children": [ { "meta": { "name": "Label" }, "position": { "basis": "50px", "display": false }, "props": { "text": "Invalid Device List Data . Make sure format is correct E.g [\"\u003cPLCiD\u003e\", \"\u003cPLCiD\u003e\"]" }, "scripts": { "customMethods": [], "extensionFunctions": null, "messageHandlers": [ { "messageType": "device-list-error", "pageScope": true, "script": "\t# implement your handler here\n\tself.position.display \u003d not payload", "sessionScope": false, "viewScope": false } ] }, "type": "ia.display.label" }, { "children": [ { "meta": { "name": "Icon" }, "position": { "basis": "32px" }, "props": { "path": "material/view_list", "style": { "marginLeft": "10px" } }, "type": "ia.display.icon" }, { "meta": { "name": "Label" }, "position": { "basis": "129px", "grow": 1 }, "props": { "style": { "marginLeft": "10px" }, "text": "Add Detailed View", "textStyle": { "fontFamily": "Arial", "fontSize": "20px", "fontWeight": "bolder", "textAlign": "center" } }, "type": "ia.display.label" } ], "meta": { "name": "FlexContainer_1" }, "position": { "basis": "40px" }, "props": { "justify": "space-around", "style": { "marginTop": "10px" } }, "type": "ia.container.flex" }, { "children": [ { "meta": { "name": "Label" }, "position": { "basis": "129px" }, "props": { "style": { "marginLeft": "0px" }, "text": "View", "textStyle": { "fontFamily": "Arial", "fontSize": "16px", "fontWeight": "bold" } }, "type": "ia.display.label" }, { "custom": { "Device": "", "tagPath": "Configuration/FC" }, "meta": { "name": "TextField" }, "position": { "basis": "150px" }, "propConfig": { "props.text": { "onChange": { "enabled": null, "script": "\tsystem.perspective.sendMessage(\"update-view-data\", currentValue.value)" } } }, "props": { "placeholder": "\u003cView Id\u003e" }, "scripts": { "customMethods": [], "extensionFunctions": null, "messageHandlers": [ { "messageType": "multiple_selection", "pageScope": true, "script": "\t# implement your handler here\n\tself.props.enabled \u003d not payload", "sessionScope": false, "viewScope": false }, { "messageType": "missing-data", "pageScope": true, "script": "\t# implement your handler here\n\t", "sessionScope": false, "viewScope": false } ] }, "type": "ia.input.text-field" } ], "meta": { "name": "FlexContainer" }, "position": { "basis": "40px" }, "props": { "justify": "space-around", "style": { "marginTop": "10px" } }, "type": "ia.container.flex" }, { "children": [ { "meta": { "name": "Label_0" }, "position": { "basis": "130px" }, "props": { "style": { "marginLeft": "0px" }, "text": "Device List :", "textStyle": { "fontFamily": "Arial", "fontSize": "16px", "fontWeight": "bold" } }, "type": "ia.display.label" }, { "custom": { "dataToAdd": "[\"PLC01\"]", "key": "prefix", "tagPath": "Configuration/DetailedViews" }, "meta": { "name": "TextField_0" }, "position": { "basis": "150px" }, "propConfig": { "props.text": { "onChange": { "enabled": null, "script": "\timport ast\n\t\t\n\tdef is_valid_list(s):\n\t try:\n\t # Try to evaluate the string\n\t result \u003d ast.literal_eval(s)\n\t # Check if the result is a list\n\t return isinstance(result, list)\n\t except (ValueError, SyntaxError):\n\t # If there is a ValueError or SyntaxError, the string is not a valid list\n\t return False\n\n\t\n\tif is_valid_list(currentValue.value):\n\t\tself.custom.dataToAdd \u003d currentValue.value\n\t\tsystem.perspective.sendMessage(\"update-devicelist-data\", currentValue.value)\n\telse:\n\t\tsystem.perspective.sendMessage(\"update-devicelist-data\", \"\")\n\t\tsystem.perspective.print(\"Not a valid list \")\n\t\n\tsystem.perspective.sendMessage(\"device-list-error\", is_valid_list(currentValue.value))" } } }, "props": { "placeholder": "[\"PLC02\", \"PLC03\"]" }, "scripts": { "customMethods": [], "extensionFunctions": null, "messageHandlers": [ { "messageType": "multiple_selection", "pageScope": true, "script": "\t# implement your handler here\n\tself.props.enabled \u003d not payload", "sessionScope": false, "viewScope": false } ] }, "type": "ia.input.text-field" } ], "meta": { "name": "FlexContainer_0" }, "position": { "basis": "40px" }, "props": { "justify": "space-around", "style": { "marginTop": "10px" } }, "type": "ia.container.flex" }, { "children": [ { "meta": { "name": "Checkbox" }, "position": { "basis": "130px" }, "propConfig": { "props.selected": { "onChange": { "enabled": null, "script": "\tsystem.perspective.sendMessage(\"multiple_selection\", payload\u003dcurrentValue.value)" } } }, "props": { "text": "Upload" }, "type": "ia.input.checkbox" }, { "custom": { "data": { "BOB": [ "THE", "NOB" ], "FSC1": [ "FSC1" ], "FSC2": [ "FSC2" ], "FSC_Cells": [ "FSC_Cells" ], "FSC_Induct_1-4": [ "FSC_Induct_1-4" ], "FSC_Induct_5-8": [ "FSC10" ], "PLC01": [ "PLC01" ], "PLC02": [ "PLC02", "PLC98" ], "PLC03": [ "PLC03" ], "PLC06": [ "PLC06", "PLC07" ], "PLC08": [ "PLC08", "PLC99" ], "PLC09": [ "PLC09" ], "PLC09_Receiving2": [ "PLC09_Receiving2" ], "PLC09_Receiving3": [ "PLC09_Receiving3" ], "PLC1000": [ "PLC1000" ], "PLC1000_Receiving4": [ "PLC1000_Receiving4" ], "PLC1301": [ "ARSAW1301" ], "PLC1302": [ "ARSAW1302" ], "PLC1303": [ "ARSAW1303" ], "PLC1304": [ "ARSAW1304" ], "PLC1305": [ "ARSAW1305" ], "PLC1306": [ "ARSAW1306" ], "PLC1307": [ "ARSAW1307" ], "PLC1308": [ "ARSAW1308" ], "PLC1309": [ "ARSAW1309" ], "PLC1310": [ "ARSAW1310" ], "PLC1311": [ "ARSAW1311" ], "PLC1312": [ "ARSAW1312" ], "PLC13_SC1": [ "PLC13" ], "PLC13_SC2": [ "PLC13_SC2" ], "PLC14": [ "PLC14" ], "PLC1501": [ "ARSAW1501" ], "PLC1502": [ "ARSAW1502" ], "PLC1503": [ "ARSAW1503" ], "PLC1504": [ "ARSAW1504" ], "PLC1505": [ "ARSAW1505" ], "PLC1506": [ "ARSAW1506" ], "PLC1507": [ "ARSAW1507" ], "PLC1508": [ "ARSAW1508" ], "PLC1509": [ "ARSAW1509" ], "PLC1510": [ "ARSAW1510" ], "PLC1511": [ "ARSAW1511" ], "PLC1512": [ "ARSAW1512" ], "PLC15_SC1": [ "PLC15" ], "PLC15_SC2": [ "PLC15_SC2" ], "PLC16": [ "PLC16" ], "PLC20_Tote1-3": [ "PLC20" ], "PLC20_Tote4-8": [ "PLC20_Tote4-8" ], "PLC21_22": [ "PLC21", "PLC22" ], "PLC23": [ "PLC23" ], "PLC24": [ "PLC24", "PLC97" ], "PLC25": [ "PLC25" ], "PLC26": [ "PLC26" ], "PLC27": [ "PLC27" ], "PLC30": [ "PLC30" ], "PLC31": [ "PLC31" ], "PLC32": [ "PLC32" ], "PLC60": [ "PLC60" ], "PLC61": [ "PLC61" ], "PLC69": [ "PLC69" ], "PLC70": [ "PLC70", "PLC71" ], "PLC80_81_82": [ "PLC80", "PLC81", "PLC82" ] }, "fileString": "\"PageId\",\"DeviceList\"\n\"PLC1301\",\"ARSAW1301\"\n\"PLC03\",\"PLC03\"\n\"PLC1302\",\"ARSAW1302\"\n\"PLC01\",\"PLC01\"\n\"PLC02\",\"PLC02#PLC98\"\n\"PLC1305\",\"ARSAW1305\"\n\"PLC1503\",\"ARSAW1503\"\n\"PLC08\",\"PLC08#PLC99\"\n\"PLC1306\",\"ARSAW1306\"\n\"PLC1504\",\"ARSAW1504\"\n\"PLC1501\",\"ARSAW1501\"\n\"PLC1303\",\"ARSAW1303\"\n\"PLC06\",\"PLC06#PLC07\"\n\"PLC1304\",\"ARSAW1304\"\n\"PLC1502\",\"ARSAW1502\"\n\"PLC09_Receiving3\",\"PLC09_Receiving3\"\n\"PLC09_Receiving2\",\"PLC09_Receiving2\"\n\"PLC1309\",\"ARSAW1309\"\n\"PLC1507\",\"ARSAW1507\"\n\"PLC1508\",\"ARSAW1508\"\n\"PLC1505\",\"ARSAW1505\"\n\"PLC1307\",\"ARSAW1307\"\n\"PLC09\",\"PLC09\"\n\"PLC1308\",\"ARSAW1308\"\n\"PLC1506\",\"ARSAW1506\"\n\"PLC20_Tote1-3\",\"PLC20\"\n\"PLC1509\",\"ARSAW1509\"\n\"PLC14\",\"PLC14\"\n\"PLC80_81_82\",\"PLC80#PLC81#PLC82\"\n\"PLC16\",\"PLC16\"\n\"FSC_Induct_1-4\",\"FSC_Induct_1-4\"\n\"FSC_Induct_5-8\",\"FSC10\"\n\"FSC_Cells\",\"FSC_Cells\"\n\"PLC21_22\",\"PLC21#PLC22\"\n\"PLC25\",\"PLC25\"\n\"PLC69\",\"PLC69\"\n\"PLC26\",\"PLC26\"\n\"PLC23\",\"PLC23\"\n\"PLC24\",\"PLC24#PLC97\"\n\"PLC27\",\"PLC27\"\n\"PLC61\",\"PLC61\"\n\"PLC60\",\"PLC60\"\n\"PLC1000\",\"PLC1000\"\n\"PLC20_Tote4-8\",\"PLC20_Tote4-8\"\n\"PLC13_SC2\",\"PLC13_SC2\"\n\"PLC13_SC1\",\"PLC13\"\n\"PLC1312\",\"ARSAW1312\"\n\"PLC1510\",\"ARSAW1510\"\n\"PLC1511\",\"ARSAW1511\"\n\"PLC1310\",\"ARSAW1310\"\n\"PLC1311\",\"ARSAW1311\"\n\"PLC1512\",\"ARSAW1512\"\n\"PLC70\",\"PLC70#PLC71\"\n\"PLC32\",\"PLC32\"\n\"PLC30\",\"PLC30\"\n\"PLC31\",\"PLC31\"\n\"FSC1\",\"FSC1\"\n\"PLC15_SC2\",\"PLC15_SC2\"\n\"FSC2\",\"FSC2\"\n\"PLC1000_Receiving4\",\"PLC1000_Receiving4\"\n\"PLC15_SC1\",\"PLC15\"\n", "list_data": [ "PLC1301", "ARSAW1301\r", "PLC03", "PLC03\r", "PLC1302", "ARSAW1302\r", "PLC01", "PLC01\r", "PLC02", "PLC02#PLC98\r", "PLC1305", "ARSAW1305\r", "PLC1503", "ARSAW1503\r", "PLC08", "PLC08#PLC99\r", "PLC1306", "ARSAW1306\r", "PLC1504", "ARSAW1504\r", "PLC1501", "ARSAW1501\r", "PLC1303", "ARSAW1303\r", "PLC06", "PLC06#PLC07\r", "PLC1304", "ARSAW1304\r", "PLC1502", "ARSAW1502\r", "PLC09_Receiving3", "PLC09_Receiving3\r", "PLC09_Receiving2", "PLC09_Receiving2\r", "PLC1309", "ARSAW1309\r", "PLC1507", "ARSAW1507\r", "PLC1508", "ARSAW1508\r", "PLC1505", "ARSAW1505\r", "PLC1307", "ARSAW1307\r", "PLC09", "PLC09\r", "PLC1308", "ARSAW1308\r", "PLC1506", "ARSAW1506\r", "PLC20_Tote1-3", "PLC20\r", "PLC1509", "ARSAW1509\r", "PLC14", "PLC14\r", "PLC80_81_82", "PLC80#PLC81#PLC82\r", "PLC16", "PLC16\r", "FSC_Induct_1-4", "FSC_Induct_1-4\r", "FSC_Induct_5-8", "FSC10\r", "FSC_Cells", "FSC_Cells\r", "PLC21_22", "PLC21#PLC22\r", "PLC25", "PLC25\r", "PLC69", "PLC69\r", "PLC26", "PLC26\r", "PLC23", "PLC23\r", "PLC24", "PLC24#PLC97\r", "PLC27", "PLC27\r", "PLC61", "PLC61\r", "PLC60", "PLC60\r", "PLC1000", "PLC1000\r", "PLC20_Tote4-8", "PLC20_Tote4-8\r", "PLC13_SC2", "PLC13_SC2\r", "PLC13_SC1", "PLC13\r", "PLC1312", "ARSAW1312\r", "PLC1510", "ARSAW1510\r", "PLC1511", "ARSAW1511\r", "PLC1310", "ARSAW1310\r", "PLC1311", "ARSAW1311\r", "PLC1512", "ARSAW1512\r", "PLC70", "PLC70#PLC71\r", "PLC32", "PLC32\r", "PLC30", "PLC30\r", "PLC31", "PLC31\r", "FSC1", "FSC1\r", "PLC15_SC2", "PLC15_SC2\r", "FSC2", "FSC2\r", "PLC1000_Receiving4", "PLC1000_Receiving4\r", "PLC15_SC1", "PLC15\r", "BOB", "THE#NOB" ], "testParsing": true }, "events": { "component": { "onFileReceived": { "config": { "script": "\t\n#\tdef compare_dicts(dict1, dict2):\n#\t # Check if dictionaries have the same keys\n#\t if set(dict1.keys()) !\u003d set(dict2.keys()):\n#\t return False\n#\t \n#\t # Check if values for each key are equal\n#\t for key in dict1:\n#\t if dict1[key] !\u003d dict2[key]:\n#\t \tsystem.perspective.print(\"Uploaded data Value : %s\"%dict1[key])\n#\t \tsystem.perspective.print(\"Tag data Value : %s\"%dict2[key])\n#\t \treturn False\n#\t \n#\t # If all values are equal, return True\n#\t return True\n#\t\n#\tpayload\u003d{\"fileContent\":event.file.getString(),\"fileName\":event.file.name}\n#\twhid \u003d self.session.custom.fc\n#\tdata \u003d{}\n#\t\n#\tdef convert_csv_string_list(string):\n#\t\t# removes new line chars and \n#\t\treturn string.replace(\"\\n\",\",\").replace(\"\\\"\",\"\").split(\",\")[2:]\n#\t\n#\tdef convert_dict_value_to_list(string):\n#\t\tdevice_list \u003d []\n#\t\tfor i in string.replace(\"#\", \",\").split(\",\"):\n#\t\t\tdevice_list.append(i.strip())\n#\t\treturn device_list\n#\t\n#\tlist_data \u003d convert_csv_string_list(event.file.getString())\n#\n#\tself.custom.list_data \u003d list_data\n#\t\n#\tdata \u003d {}\n#\tfor i in range(0, len(list_data),2):\n#\t\n#\t\tdata[list_data[i]]\u003d convert_dict_value_to_list(list_data[i+1])\n#\n#\tself.custom.data \u003d data\n#\tif self.custom.testParsing:\n#\t\ttag_dict \u003dsystem.util.jsonDecode(system.tag.readBlocking(\"[%s_SCADA_TAG_PROVIDER]Configuration/DetailedViews\"%whid)[0].value)\n#\t\t\n#\t\tsystem.perspective.print(\"TestResult : %s\"%compare_dicts(data, tag_dict))\n#\n#\tsystem.tag.writeBlocking([\"[%s_SCADA_TAG_PROVIDER]Configuration/DetailedViews\"%whid], system.util.jsonEncode(data))\n\n\twhid \u003d self.session.custom.fc\n\tFileHandler.uploader.add_detailed_view_btn_code(whid, event)" }, "scope": "G", "type": "script" } } }, "meta": { "name": "FileUpload" }, "position": { "basis": "150px", "display": false }, "props": { "style": { "classes": "" } }, "scripts": { "customMethods": [], "extensionFunctions": null, "messageHandlers": [ { "messageType": "multiple_selection", "pageScope": true, "script": "\t# implement your handler here\n\tself.position.display \u003d payload ", "sessionScope": false, "viewScope": false } ] }, "type": "ia.input.fileupload" }, { "custom": { "rowToAdd": { "deviceList": "", "view": "" } }, "events": { "component": { "onActionPerformed": { "config": { "script": "\twhid \u003d self.session.custom.fc\n\ttagPath \u003d \"[%s_SCADA_TAG_PROVIDER]Configuration/DetailedViews\"%(whid)\n\t\n\ttagData \u003d system.util.jsonDecode(system.tag.readBlocking(tagPath)[0].value)\n\tself.custom.tagData.append(self.custom.rowToAdd)\n\t\n\tdata \u003d []\n\tfor i in system.util.jsonDecode(self.custom.rowToAdd[\"deviceList\"]):\n\t\tdata.append(i)\n\t\n\ttagData[self.custom.rowToAdd[\"view\"]] \u003d data\n\t\t\t\n\t\n\tsystem.tag.writeBlocking([tagPath], [system.util.jsonEncode(tagData)])\n\t" }, "scope": "G", "type": "script" } } }, "meta": { "name": "Button", "tooltip": { "enabled": true, "text": "Missing Data for : [u\u0027deviceList\u0027, u\u0027view\u0027]" } }, "position": { "basis": "150px" }, "propConfig": { "custom.tagData": { "binding": { "config": { "fallbackDelay": 2.5, "mode": "indirect", "references": { "fc": "{session.custom.fc}" }, "tagPath": "[{fc}_SCADA_TAG_PROVIDER]Configuration/DetailedViews" }, "transforms": [ { "code": "\treturn [{\"PageId\":k,\"DeviceList\":v}for k,v in system.util.jsonDecode(value).items()]", "type": "script" } ], "type": "tag" } }, "props.enabled": { "binding": { "config": { "path": "this.custom.rowToAdd" }, "transforms": [ { "code": "\n\tmissing_data \u003d []\n\tfor k, v in value.items():\n\t\tif not v:\n\t\t\tmissing_data.append(k)\n\t\n\tif missing_data:\n\t\tenabled \u003d False\n\t\tmsg \u003d \"Missing Data for : %s\"%missing_data\n\telse:\n\t\tenabled \u003d True\n\t\tmsg \u003d \"\"\n\t\n\tself.meta.tooltip.text \u003d msg \n\t\n\treturn enabled\n\t", "type": "script" } ], "type": "property" } } }, "props": { "image": { "icon": { "path": "material/add_circle" }, "position": "right" }, "primary": false, "text": "Submit" }, "scripts": { "customMethods": [], "extensionFunctions": null, "messageHandlers": [ { "messageType": "update-devicelist-data", "pageScope": true, "script": "\t# implement your handler here\n\tself.custom.rowToAdd[\"deviceList\"] \u003d payload", "sessionScope": false, "viewScope": false }, { "messageType": "update-view-data", "pageScope": true, "script": "\t# implement your handler here\n\tself.custom.rowToAdd[\"view\"] \u003d payload", "sessionScope": false, "viewScope": false }, { "messageType": "multiple_selection", "pageScope": true, "script": "\t# implement your handler here\n\tself.position.display \u003d not payload", "sessionScope": false, "viewScope": false } ] }, "type": "ia.input.button" } ], "meta": { "name": "FlexContainer_5" }, "position": { "basis": "40px" }, "props": { "justify": "space-around", "style": { "margin-top": "10px" } }, "type": "ia.container.flex" } ], "meta": { "name": "root" }, "props": { "direction": "column", "style": { "borderBottomLeftRadius": "5px", "borderBottomRightRadius": "5px", "borderStyle": "solid", "borderTopLeftRadius": "5px", "borderTopRightRadius": "5px", "margin": "10px" } }, "type": "ia.container.flex" } }