{
  "custom": {},
  "params": {
    "tagProps": [
      "",
      "",
      "PLC",
      "value",
      "value",
      "value",
      "value",
      "value",
      "value",
      "value"
    ]
  },
  "propConfig": {
    "params.tagProps": {
      "paramDirection": "input",
      "persistent": true
    }
  },
  "props": {
    "defaultSize": {
      "height": 148,
      "width": 362
    }
  },
  "root": {
    "children": [
      {
        "children": [
          {
            "meta": {
              "name": "Spacer1"
            },
            "position": {
              "basis": "20px"
            },
            "type": "ia.display.label"
          },
          {
            "meta": {
              "name": "NameField"
            },
            "position": {
              "basis": "50px"
            },
            "props": {
              "text": "NAME"
            },
            "type": "ia.display.label"
          },
          {
            "meta": {
              "name": "Spacer"
            },
            "position": {
              "basis": "100px"
            },
            "type": "ia.display.label"
          },
          {
            "meta": {
              "name": "DeviceName"
            },
            "position": {
              "basis": "205px"
            },
            "propConfig": {
              "props.text": {
                "binding": {
                  "config": {
                    "path": "/root.custom.name"
                  },
                  "type": "property"
                }
              }
            },
            "props": {
              "style": {
                "classes": "Text-Styles/Ariel-Bold-12pt"
              }
            },
            "type": "ia.display.label"
          }
        ],
        "meta": {
          "name": "Name"
        },
        "position": {
          "basis": "35px"
        },
        "props": {
          "style": {
            "classes": "PopUp-Styles/InfoLabel"
          }
        },
        "type": "ia.container.flex"
      },
      {
        "children": [
          {
            "meta": {
              "name": "Spacer1"
            },
            "position": {
              "basis": "20px"
            },
            "type": "ia.display.label"
          },
          {
            "meta": {
              "name": "NameField"
            },
            "position": {
              "basis": "50px"
            },
            "props": {
              "text": "PRIORITY"
            },
            "type": "ia.display.label"
          },
          {
            "meta": {
              "name": "Spacer"
            },
            "position": {
              "basis": "100px"
            },
            "type": "ia.display.label"
          },
          {
            "meta": {
              "name": "Priority"
            },
            "position": {
              "basis": "205px"
            },
            "propConfig": {
              "props.style.classes": {
                "binding": {
                  "config": {
                    "expression": "{/root.custom.priority}"
                  },
                  "transforms": [
                    {
                      "fallback": "Alarms-Styles/NoAlarm",
                      "inputType": "scalar",
                      "mappings": [
                        {
                          "input": 4,
                          "output": "Alarms-Styles/Critical"
                        },
                        {
                          "input": 3,
                          "output": "Alarms-Styles/High"
                        },
                        {
                          "input": 2,
                          "output": "Alarms-Styles/Medium"
                        },
                        {
                          "input": 1,
                          "output": "Alarms-Styles/Low"
                        },
                        {
                          "input": 0,
                          "output": "Alarms-Styles/Diagnostic"
                        }
                      ],
                      "outputType": "style-list",
                      "type": "map"
                    }
                  ],
                  "type": "expr"
                }
              },
              "props.text": {
                "binding": {
                  "config": {
                    "path": "/root.custom.priority"
                  },
                  "transforms": [
                    {
                      "fallback": "",
                      "inputType": "scalar",
                      "mappings": [
                        {
                          "input": 4,
                          "output": "Critical"
                        },
                        {
                          "input": 3,
                          "output": "High"
                        },
                        {
                          "input": 2,
                          "output": "Medium"
                        },
                        {
                          "input": 1,
                          "output": "Low"
                        },
                        {
                          "input": 0,
                          "output": "Warning"
                        },
                        {
                          "input": 5,
                          "output": "No active alarms"
                        }
                      ],
                      "outputType": "scalar",
                      "type": "map"
                    }
                  ],
                  "type": "property"
                }
              }
            },
            "props": {
              "style": {
                "textAlign": "left"
              }
            },
            "type": "ia.display.label"
          }
        ],
        "meta": {
          "name": "Priority"
        },
        "position": {
          "basis": "35px"
        },
        "props": {
          "style": {
            "classes": "PopUp-Styles/InfoLabel"
          }
        },
        "type": "ia.container.flex"
      },
      {
        "children": [
          {
            "meta": {
              "name": "Spacer1"
            },
            "position": {
              "basis": "20px"
            },
            "type": "ia.display.label"
          },
          {
            "meta": {
              "name": "NameField"
            },
            "position": {
              "basis": "50px"
            },
            "props": {
              "text": "TIMESTAMP"
            },
            "type": "ia.display.label"
          },
          {
            "meta": {
              "name": "Spacer"
            },
            "position": {
              "basis": "100px"
            },
            "type": "ia.display.label"
          },
          {
            "meta": {
              "name": "DeviceName"
            },
            "position": {
              "basis": "205px"
            },
            "propConfig": {
              "props.text": {
                "binding": {
                  "config": {
                    "path": "/root.custom.timestamp"
                  },
                  "type": "property"
                }
              }
            },
            "props": {
              "style": {
                "classes": "Text-Styles/Ariel-Bold-12pt"
              }
            },
            "type": "ia.display.label"
          }
        ],
        "meta": {
          "name": "EventTime"
        },
        "position": {
          "basis": "35px"
        },
        "props": {
          "style": {
            "classes": "PopUp-Styles/InfoLabel"
          }
        },
        "type": "ia.container.flex"
      },
      {
        "children": [
          {
            "meta": {
              "name": "Spacer1"
            },
            "position": {
              "basis": "20px"
            },
            "type": "ia.display.label"
          },
          {
            "meta": {
              "name": "NameField"
            },
            "position": {
              "basis": "50px"
            },
            "props": {
              "text": "DURATION"
            },
            "type": "ia.display.label"
          },
          {
            "meta": {
              "name": "Spacer"
            },
            "position": {
              "basis": "91px"
            },
            "type": "ia.display.label"
          },
          {
            "meta": {
              "name": "Spacer_0"
            },
            "position": {
              "basis": "199px"
            },
            "propConfig": {
              "props.text": {
                "binding": {
                  "config": {
                    "path": "/root.custom.duration"
                  },
                  "type": "property"
                }
              }
            },
            "props": {
              "style": {
                "classes": "Text-Styles/Ariel-Bold-12pt"
              }
            },
            "type": "ia.display.label"
          }
        ],
        "meta": {
          "name": "EventTime_0"
        },
        "position": {
          "basis": "40px"
        },
        "props": {
          "style": {
            "classes": "PopUp-Styles/InfoLabel"
          }
        },
        "type": "ia.container.flex"
      }
    ],
    "custom": {
      "delay": 2000,
      "duration": "",
      "enable": true,
      "name": "",
      "priority": "",
      "timestamp": ""
    },
    "meta": {
      "name": "root"
    },
    "propConfig": {
      "custom.active_bit": {
        "binding": {
          "config": {
            "fallbackDelay": 2.5,
            "mode": "indirect",
            "references": {
              "0": "{view.params.tagProps[0]}",
              "1": "{view.params.tagProps[1]}"
            },
            "tagPath": "{0}/Alarms/{1}.IsActive"
          },
          "type": "tag"
        }
      },
      "custom.shelved_bit": {
        "binding": {
          "config": {
            "fallbackDelay": 2.5,
            "mode": "indirect",
            "references": {
              "0": "{view.params.tagProps[0]}",
              "1": "{view.params.tagProps[1]}"
            },
            "tagPath": "{0}/Alarms/{1}.IsShelved"
          },
          "type": "tag"
        }
      },
      "custom.update": {
        "binding": {
          "config": {
            "expression": "now({this.custom.delay})"
          },
          "type": "expr"
        },
        "onChange": {
          "enabled": null,
          "script": "\tif self.custom.enable:\n\t\t\n\t\timport time\n\t\t\n\t\tdef convert(millis):\n\t\t\tmillis \u003d int(millis)\n\t\t\tseconds\u003d(millis/1000)%60\n\t\t\tseconds \u003d int(seconds)\n\t\t\tminutes\u003d(millis/(1000*60))%60\n\t\t\tminutes \u003d int(minutes)\n\t\t\thours\u003d(millis/(1000*60*60))\n\t\t\treturn(\"%d:%d:%d\" % (hours, minutes, seconds))\n\t\t\n\t\tdef update_custom_properties(name, timestamp, duration, priority):\n\t\t\tself.custom.name \u003d name\n\t\t\tself.custom.timestamp \u003d timestamp\n\t\t\tself.custom.duration \u003d duration\n\t\t\tself.custom.priority \u003d priority\n\t\t\n\t\tdef get_alarms():\n\t\t\talarm_dict \u003d system.tag.readBlocking(\"System/ActiveAlarms\")\n\t\t\talarms_decoded \u003d system.util.jsonDecode(alarm_dict[0].value)\n\t\t\treturn alarms_decoded\n\t\t\t\n\t\tdef get_tag_config():\n\t\t\tname \u003d\"\"\n\t\t\tpath \u003d self.view.params.tagProps[0]\n\t\t\tif system.tag.exists(path) and path !\u003d \"\":\n\t\t\t\ttag_config \u003d system.tag.getConfiguration(path)[0]\n\t\t\t\talarms \u003d tag_config.get(\"alarms\")\n\t\t\t\tfor alarm in alarms:\n\t\t\t\t\tif alarm.get(\"name\") \u003d\u003d self.view.params.tagProps[1]:\n\t\t\t\t\t\tname \u003d alarm.get(\"AdditionalInfo\")\n\t\t\t\t\t\tbreak\n\t\t\t\ttimestamp \u003d \"N/A\"\n\t\t\t\tduration \u003d \"N/A\"\n\t\t\t\tpriority \u003d 5\n\t\t\t\tupdate_custom_properties(name, timestamp, duration, priority)\n\t\t\t\t\t\n\t\tdef get_active_alarm():\n\t\t\ttagPath \u003d self.view.params.tagProps[0]\n\t\t\tprops_alarm_name \u003d str(self.view.params.tagProps[1])\n\t\t\ttag_display_path \u003d tagPath + \"/\" + props_alarm_name\n\t\t\talarms \u003d get_alarms()\n\t\t\tfor i in alarms:\n\t\t\t\tdisplaypath \u003d alarms[i].get(\"DisplayPath\")\n\t\t\t\talarm_name \u003d alarms[i].get(\"Name\")\n\t\t\t\tsystem.perspective.print(displaypath)\n\t\t\t\tif tag_display_path \u003d\u003d displaypath:\n\t\t\t\t\tname \u003d alarms[i].get(\"AddInfo\")\n\t\t\t\t\ttimestamp \u003d alarms[i].get(\"TimeStamp\")\n\t\t\t\t\tduration \u003d alarms[i].get(\"Duration\")\n\t\t\t\t\tduration \u003d convert(duration)\n\t\t\t\t\tpriority \u003d alarms[i].get(\"Priority\")\n\t\t\t\t\tupdate_custom_properties(name, timestamp, duration, priority)\n\t\t\t\t\tbreak\n\t\t\t\t\t\n\t\tif self.custom.active_bit and not self.custom.shelved_bit:\n\t\t\tget_active_alarm()\n\t\t\t\n\t\telse:\n\t\t\talarms \u003d get_tag_config()"
        }
      }
    },
    "props": {
      "direction": "column",
      "style": {
        "borderRadius": "10x",
        "borderStyle": "solid",
        "classes": "PopUp-Styles/Information-Device"
      }
    },
    "type": "ia.container.flex"
  }
}