{
  "custom": {
    "PLCs": "{   \"MCM05 Sorter Destination and Chutes\": [     \"MCM05\"   ],   \"MCM04 Sorter Destination, Chutes and Bypass\": [     \"MCM04\"   ],   \"MCM03 Fluid Inbound\": [     \"MCM03\"   ],   \"MCM02 Fluid Inbound\": [     \"MCM02\"   ],   \"MCM01 Bulk Inbound\": [     \"MCM01\"   ] }",
    "activityLogger": {
      "alt_pageid": "command_control",
      "start_time": {
        "$": [
          "ts",
          192,
          1756710337161
        ],
        "$ts": 1756710337161
      }
    },
    "devices": {
      "MCM01": {
        "area": "Bulk Inbound",
        "name": "MCM01",
        "tagProps": [
          "MCM01",
          "value",
          "value",
          "value",
          "value",
          "value",
          "value",
          "value",
          "value",
          "value"
        ]
      },
      "MCM02": {
        "area": "Fluid Inbound",
        "name": "MCM02",
        "tagProps": [
          "MCM02",
          "value",
          "value",
          "value",
          "value",
          "value",
          "value",
          "value",
          "value",
          "value"
        ]
      },
      "MCM03": {
        "area": "Fluid Inbound",
        "name": "MCM03",
        "tagProps": [
          "MCM03",
          "value",
          "value",
          "value",
          "value",
          "value",
          "value",
          "value",
          "value",
          "value"
        ]
      },
      "MCM04": {
        "area": "Sorter Destination, Chutes and Bypass",
        "name": "MCM04",
        "tagProps": [
          "MCM04",
          "value",
          "value",
          "value",
          "value",
          "value",
          "value",
          "value",
          "value",
          "value"
        ]
      },
      "MCM05": {
        "area": "Sorter Destination and Chutes",
        "name": "MCM05",
        "tagProps": [
          "MCM05",
          "value",
          "value",
          "value",
          "value",
          "value",
          "value",
          "value",
          "value",
          "value"
        ]
      }
    }
  },
  "events": {
    "system": {
      "onShutdown": {
        "config": {
          "script": "\tactivityLog.logger.callLogger(self, \u0027page\u0027)\n\tactivityLog.productMetrics.callLogger(self, \u0027page\u0027)"
        },
        "scope": "G",
        "type": "script"
      },
      "onStartup": {
        "config": {
          "script": "\tself.custom.activityLogger.start_time \u003d system.date.now()"
        },
        "scope": "G",
        "type": "script"
      }
    }
  },
  "params": {
    "page_name": "Command and Control"
  },
  "propConfig": {
    "custom.PLCs": {
      "binding": {
        "config": {
          "fallbackDelay": 2.5,
          "mode": "indirect",
          "references": {
            "fc": "{session.custom.fc}"
          },
          "tagPath": "[{fc}_SCADA_TAG_PROVIDER]Configuration/DetailedViews"
        },
        "type": "tag"
      },
      "persistent": true
    },
    "custom.activityLogger": {
      "persistent": true
    },
    "custom.activityLogger.pageid": {
      "binding": {
        "config": {
          "expression": "{page.props.path}"
        },
        "transforms": [
          {
            "code": "\tif value \u003d\u003d\u0027/\u0027 or value \u003d\u003d \u0027\u0027 or value \u003d\u003d None:\n\t\treturn self.custom.activityLogger.alt_pageid.lower()\n\telse:\n\t\treturn value[1:].lower()",
            "type": "script"
          }
        ],
        "type": "expr"
      }
    },
    "custom.devices": {
      "binding": {
        "config": {
          "path": "view.custom.PLCs"
        },
        "transforms": [
          {
            "code": "\tdevices \u003d system.util.jsonDecode(value)\n\tPLCs \u003d {}\n\tfc \u003d self.session.custom.fc\n\tconfig \u003d system.tag.readBlocking(\u0027[\u0027 + fc + \u0027_SCADA_TAG_PROVIDER]\u0027 + \u0027/Configuration/PLC\u0027)[0].value\n\t\n\tif devices:\n\t\tfor k, v in devices.items():\n\t\t\tdevice_list \u003d v\n\t\t\tfor i in device_list:\n\t\t\t\tdecode \u003d system.util.jsonDecode(config)\n\t\t\t\tif decode:\n\t\t\t\t\tarea \u003d decode[i][\"Area\"]\n\t\t\t\t\tsub_area \u003d decode[i][\"SubArea\"]\n\t\t\t\t\tarea_label \u003d str(area) + \"/\" + str(sub_area) if sub_area else str(area)\n\t\t\t\telse:\n\t\t\t\t\tarea \u003d \"\"\n\t\t\t\t\tarea_label \u003d \"\"\n\t\t\t\t\t\n\t\t\t\t\n\t\t\t\tPLCs[i] \u003d {\u0027name\u0027:i,\u0027area\u0027:area_label,\u0027tagProps\u0027:[\n\t\t\t\t\t\t\t\t      i,\n\t\t\t\t\t\t\t\t      \"value\",\n\t\t\t\t\t\t\t\t      \"value\",\n\t\t\t\t\t\t\t\t      \"value\",\n\t\t\t\t\t\t\t\t      \"value\",\n\t\t\t\t\t\t\t\t      \"value\",\n\t\t\t\t\t\t\t\t      \"value\",\n\t\t\t\t\t\t\t\t      \"value\",\n\t\t\t\t\t\t\t\t      \"value\",\n\t\t\t\t\t\t\t\t      \"value\"\n\t\t\t\t\t\t\t\t    ]}\n\t\n\treturn PLCs",
            "type": "script"
          }
        ],
        "type": "property"
      },
      "persistent": true
    },
    "params.page_name": {
      "paramDirection": "input",
      "persistent": true
    }
  },
  "props": {
    "defaultSize": {
      "height": 1080,
      "width": 1920
    }
  },
  "root": {
    "children": [
      {
        "meta": {
          "name": "Table"
        },
        "position": {
          "grow": 1
        },
        "propConfig": {
          "props.data": {
            "binding": {
              "config": {
                "path": "view.custom.devices"
              },
              "transforms": [
                {
                  "code": "\tresults \u003d []\n\tfor row, val in value.items():\n\t\tresults.append({\"plc\": val[\"name\"], \"area\": val[\"area\"],\"status\": {\"tagProps\":val[\"tagProps\"]},\"alarms\": {\"tagProps\":val[\"tagProps\"]},\"actions\": {\"tagProps\":val[\"tagProps\"]}})\n\t\n\tresults.sort(key\u003dlambda item: item[\u0027plc\u0027])\n\treturn results",
                  "type": "script"
                }
              ],
              "type": "property"
            }
          }
        },
        "props": {
          "cells": {
            "style": {
              "borderColor": "#4A4A4A",
              "borderStyle": "solid",
              "borderWidth": 1,
              "fontFamily": "Arial",
              "fontSize": 14,
              "fontWeight": "bold",
              "paddingLeft": 16,
              "paddingRight": 16
            }
          },
          "columns": [
            {
              "align": "center",
              "boolean": "checkbox",
              "dateFormat": "MM/DD/YYYY",
              "editable": false,
              "field": "plc",
              "footer": {
                "align": "center",
                "justify": "left",
                "style": {
                  "classes": ""
                },
                "title": ""
              },
              "header": {
                "align": "center",
                "justify": "left",
                "style": {
                  "borderColor": "#4A4A4A",
                  "borderStyle": "solid",
                  "borderWidth": 1,
                  "classes": "",
                  "color": "#4A4A4A",
                  "fontFamily": "Arial",
                  "fontSize": 14,
                  "fontWeight": "bold",
                  "paddingLeft": 11,
                  "paddingRight": 11
                },
                "title": "PLC"
              },
              "justify": "auto",
              "number": "value",
              "numberFormat": "0,0.##",
              "progressBar": {
                "bar": {
                  "color": "",
                  "style": {
                    "classes": ""
                  }
                },
                "max": 100,
                "min": 0,
                "track": {
                  "color": "",
                  "style": {
                    "classes": ""
                  }
                },
                "value": {
                  "enabled": true,
                  "format": "0,0.##",
                  "justify": "center",
                  "style": {
                    "classes": ""
                  }
                }
              },
              "render": "auto",
              "resizable": false,
              "sort": "none",
              "sortable": true,
              "strictWidth": false,
              "style": {
                "classes": ""
              },
              "toggleSwitch": {
                "color": {
                  "selected": "",
                  "unselected": ""
                }
              },
              "viewParams": {},
              "viewPath": "",
              "visible": true,
              "width": 50
            },
            {
              "align": "center",
              "boolean": "checkbox",
              "dateFormat": "MM/DD/YYYY",
              "editable": false,
              "field": "area",
              "footer": {
                "align": "center",
                "justify": "left",
                "style": {
                  "classes": ""
                },
                "title": ""
              },
              "header": {
                "align": "center",
                "justify": "left",
                "style": {
                  "borderColor": "#4A4A4A",
                  "borderStyle": "solid",
                  "borderWidth": 1,
                  "classes": "",
                  "color": "#4A4A4A",
                  "fontFamily": "Arial",
                  "fontSize": 14,
                  "fontWeight": "bold",
                  "paddingLeft": 11,
                  "paddingRight": 11
                },
                "title": "Area"
              },
              "justify": "auto",
              "number": "value",
              "numberFormat": "0,0.##",
              "progressBar": {
                "bar": {
                  "color": "",
                  "style": {
                    "classes": ""
                  }
                },
                "max": 100,
                "min": 0,
                "track": {
                  "color": "",
                  "style": {
                    "classes": ""
                  }
                },
                "value": {
                  "enabled": true,
                  "format": "0,0.##",
                  "justify": "center",
                  "style": {
                    "classes": ""
                  }
                }
              },
              "render": "auto",
              "resizable": false,
              "sort": "none",
              "sortable": true,
              "strictWidth": false,
              "style": {
                "classes": ""
              },
              "toggleSwitch": {
                "color": {
                  "selected": "",
                  "unselected": ""
                }
              },
              "viewParams": {},
              "viewPath": "",
              "visible": true,
              "width": 50
            },
            {
              "align": "center",
              "boolean": "checkbox",
              "dateFormat": "MM/DD/YYYY",
              "editable": false,
              "field": "status",
              "footer": {
                "align": "center",
                "justify": "left",
                "style": {
                  "classes": ""
                },
                "title": ""
              },
              "header": {
                "align": "center",
                "justify": "left",
                "style": {
                  "borderColor": "#4A4A4A",
                  "borderStyle": "solid",
                  "borderWidth": 1,
                  "classes": "",
                  "color": "#4A4A4A",
                  "fontFamily": "Arial",
                  "fontSize": 14,
                  "fontWeight": "bold",
                  "paddingLeft": 11,
                  "paddingRight": 11
                },
                "title": "Status"
              },
              "justify": "auto",
              "number": "value",
              "numberFormat": "0,0.##",
              "progressBar": {
                "bar": {
                  "color": "",
                  "style": {
                    "classes": ""
                  }
                },
                "max": 100,
                "min": 0,
                "track": {
                  "color": "",
                  "style": {
                    "classes": ""
                  }
                },
                "value": {
                  "enabled": true,
                  "format": "0,0.##",
                  "justify": "center",
                  "style": {
                    "classes": ""
                  }
                }
              },
              "render": "auto",
              "resizable": false,
              "sort": "none",
              "sortable": false,
              "strictWidth": false,
              "style": {
                "classes": ""
              },
              "toggleSwitch": {
                "color": {
                  "selected": "",
                  "unselected": ""
                }
              },
              "viewParams": {},
              "viewPath": "Symbol-Views/Controller-Views/CommandControlStatus",
              "visible": true,
              "width": 75
            },
            {
              "align": "center",
              "boolean": "checkbox",
              "dateFormat": "MM/DD/YYYY",
              "editable": false,
              "field": "alarms",
              "footer": {
                "align": "center",
                "justify": "left",
                "style": {
                  "classes": ""
                },
                "title": ""
              },
              "header": {
                "align": "center",
                "justify": "left",
                "style": {
                  "borderColor": "#4A4A4A",
                  "borderStyle": "solid",
                  "borderWidth": 1,
                  "classes": "",
                  "color": "#4A4A4A",
                  "fontFamily": "Arial",
                  "fontSize": 14,
                  "fontWeight": "bold",
                  "paddingLeft": 11,
                  "paddingRight": 11
                },
                "title": "Active Alarms"
              },
              "justify": "auto",
              "number": "value",
              "numberFormat": "0,0.##",
              "progressBar": {
                "bar": {
                  "color": "",
                  "style": {
                    "classes": ""
                  }
                },
                "max": 100,
                "min": 0,
                "track": {
                  "color": "",
                  "style": {
                    "classes": ""
                  }
                },
                "value": {
                  "enabled": true,
                  "format": "0,0.##",
                  "justify": "center",
                  "style": {
                    "classes": ""
                  }
                }
              },
              "render": "auto",
              "resizable": false,
              "sort": "none",
              "sortable": false,
              "strictWidth": false,
              "style": {
                "classes": ""
              },
              "toggleSwitch": {
                "color": {
                  "selected": "",
                  "unselected": ""
                }
              },
              "viewParams": {},
              "viewPath": "Symbol-Views/Controller-Views/CommandControlAlarms",
              "visible": true,
              "width": "auto"
            },
            {
              "align": "center",
              "boolean": "checkbox",
              "dateFormat": "MM/DD/YYYY",
              "editable": false,
              "field": "actions",
              "footer": {
                "align": "center",
                "justify": "left",
                "style": {
                  "classes": ""
                },
                "title": ""
              },
              "header": {
                "align": "center",
                "justify": "left",
                "style": {
                  "borderColor": "#4A4A4A",
                  "borderStyle": "solid",
                  "borderWidth": 1,
                  "classes": "",
                  "color": "#4A4A4A",
                  "fontFamily": "Arial",
                  "fontSize": 14,
                  "fontWeight": "bold",
                  "paddingLeft": 11,
                  "paddingRight": 11
                },
                "title": "Controls"
              },
              "justify": "auto",
              "number": "value",
              "numberFormat": "0,0.##",
              "progressBar": {
                "bar": {
                  "color": "",
                  "style": {
                    "classes": ""
                  }
                },
                "max": 100,
                "min": 0,
                "track": {
                  "color": "",
                  "style": {
                    "classes": ""
                  }
                },
                "value": {
                  "enabled": true,
                  "format": "0,0.##",
                  "justify": "center",
                  "style": {
                    "classes": ""
                  }
                }
              },
              "render": "view",
              "resizable": false,
              "sort": "none",
              "sortable": false,
              "strictWidth": false,
              "style": {
                "classes": "",
                "textAlign": "center"
              },
              "toggleSwitch": {
                "color": {
                  "selected": "",
                  "unselected": ""
                }
              },
              "viewParams": {},
              "viewPath": "Symbol-Views/Controller-Views/CommandControlActions",
              "visible": true,
              "width": "auto"
            }
          ],
          "dragOrderable": false,
          "pager": {
            "activeOption": 50,
            "initialOption": 50
          },
          "rows": {
            "height": 44,
            "highlight": {
              "color": "#EEEEEE"
            },
            "striped": {
              "enabled": false
            },
            "style": {
              "backgroundColor": "#FFFFFF",
              "borderColor": "#4A4A4A",
              "borderStyle": "none",
              "borderWidth": 1,
              "classes": "Fonts/BodyText14",
              "color": "#4A4A4A"
            }
          },
          "selection": {
            "enableRowSelection": false
          },
          "style": {
            "borderStyle": "none",
            "margin": 5,
            "overflow": "hidden",
            "overflowX": "hidden",
            "overflowY": "hidden"
          },
          "virtualized": false
        },
        "type": "ia.display.table"
      }
    ],
    "custom": {
      "Devices": [],
      "count": "value",
      "delay": 4000
    },
    "events": {
      "system": {
        "onShutdown": [
          {
            "config": {
              "script": "\tself.session.custom.command_auth.enabled \u003d False"
            },
            "scope": "G",
            "type": "script"
          },
          {
            "config": {
              "script": "\twhid \u003d self.session.custom.fc\n\tsession_id \u003d self.session.props.id\n\tpage_id \u003d self.view.params.page_name\n\tCommands.analytics.send_page_details(whid, session_id, page_id)"
            },
            "scope": "G",
            "type": "script"
          }
        ]
      }
    },
    "meta": {
      "name": "root"
    },
    "props": {
      "direction": "column"
    },
    "type": "ia.container.flex"
  }
}