{ "custom": {}, "events": { "system": { "onStartup": { "config": { "script": "\tend \u003d system.date.now()\n\tstart \u003d system.date.addDays(end, -1)\n\tself.getChild(\"root\").getChild(\"AlarmJournalTable\").props.dateRange.historical.startDate \u003d start\n\tself.getChild(\"root\").getChild(\"AlarmJournalTable\").props.dateRange.historical.endDate \u003d end" }, "scope": "G", "type": "script" } } }, "params": {}, "props": { "defaultSize": { "height": 1163, "width": 1290 } }, "root": { "children": [ { "children": [ { "children": [ { "meta": { "name": "Label" }, "position": { "basis": "20%", "grow": 1 }, "propConfig": { "props.text": { "binding": { "config": { "path": "parent.meta.name" }, "type": "property" } } }, "props": { "textStyle": { "fontSize": 14, "fontWeight": "bold" } }, "type": "ia.display.label" }, { "meta": { "name": "TextField" }, "position": { "basis": "80%", "grow": 1 }, "props": { "placeholder": "Use * for wildcard - e.g. *SomeTag/Alarm*" }, "type": "ia.input.text-field" } ], "meta": { "name": "Source Filter" }, "position": { "basis": "50px", "grow": 1 }, "props": { "style": { "paddingBottom": "10px", "paddingLeft": "10px", "paddingRight": "10px", "paddingTop": "10px" } }, "type": "ia.container.flex" }, { "children": [ { "meta": { "name": "Label" }, "position": { "basis": "20%", "grow": 1 }, "propConfig": { "props.text": { "binding": { "config": { "path": "parent.meta.name" }, "type": "property" } } }, "props": { "textStyle": { "fontSize": 14, "fontWeight": "bold" } }, "type": "ia.display.label" }, { "meta": { "name": "TextField" }, "position": { "basis": "80%", "grow": 1 }, "props": { "placeholder": "Use * for wildcard - e.g. *CHWP\n*" }, "type": "ia.input.text-field" } ], "meta": { "name": "Display Path Filter" }, "position": { "basis": "50px", "grow": 1 }, "props": { "style": { "paddingBottom": "10px", "paddingLeft": "10px", "paddingRight": "10px", "paddingTop": "10px" } }, "type": "ia.container.flex" } ], "meta": { "name": "Header" }, "position": { "basis": "50px", "shrink": 0 }, "type": "ia.container.flex" }, { "meta": { "name": "AlarmJournalTable" }, "position": { "basis": "400px", "grow": 1 }, "propConfig": { "props.filter.conditions.displayPath": { "binding": { "config": { "path": "../Header/Display Path Filter/TextField.props.text" }, "type": "property" } }, "props.filter.conditions.source": { "binding": { "config": { "path": "../Header/Source Filter/TextField.props.text" }, "type": "property" } } }, "props": { "columns": { "displayPath": { "enabled": true }, "eventId": { "enabled": false }, "state": { "enabled": true } }, "dateRange": { "historical": { "endDate": { "$": [ "ts", 192, 1776899144055 ], "$ts": 1776899144053 }, "startDate": { "$": [ "ts", 192, 1776899144055 ], "$ts": 1776812744053 } }, "realtime": { "interval": 1 } }, "filter": { "conditions": {}, "events": { "acked": false, "active": false, "cleared": false }, "priorities": { "critical": false, "high": false, "low": false, "medium": false } }, "pager": { "initialOption": 100 }, "rowStyles": { "acked": { "base": { "color": "#000000" }, "priorities": { "critical": { "backgroundColor": "#e2202888" }, "diagnostic": { "backgroundColor": "#7166b788" }, "high": { "backgroundColor": "#de7c3388" }, "low": { "backgroundColor": "#7266b788" }, "medium": { "backgroundColor": "#f4b83488" } } }, "active": { "base": { "color": "#000000" }, "priorities": { "critical": { "backgroundColor": "#ed1c24" }, "diagnostic": { "backgroundColor": "#7166b7", "color": "#FFFFFF" }, "high": { "backgroundColor": "#de7c33" }, "low": { "backgroundColor": "#7166b7", "color": "#FFFFFF" }, "medium": { "backgroundColor": "#f4b834" } } }, "cleared": { "base": { "color": "#FFFFFF" }, "priorities": { "critical": { "backgroundColor": "#2E5EAA" }, "diagnostic": { "backgroundColor": "#FFFFFF" }, "high": { "backgroundColor": "#507ABF" }, "low": { "backgroundColor": "#A0BEEF" }, "medium": { "backgroundColor": "#7198D6" } } } }, "toolbar": { "enableFilter": false, "enableFilterResults": false, "toggleableFilter": false } }, "type": "ia.display.alarmjournaltable" }, { "children": [ { "events": { "component": { "onActionPerformed": { "config": { "script": "\t\n\tdateRange \u003d self.parent.parent.getChild(\"AlarmJournalTable\").props.dateRange\n\tif dateRange[\u0027mode\u0027] \u003d\u003d \u0027historical\u0027:\n\t\thist \u003d dateRange[\u0027historical\u0027]\n\t\tstartDate \u003d hist[\u0027startDate\u0027]\n\t\tendDate \u003d hist[\u0027endDate\u0027]\n\telse:\n\t\treal \u003d dateRange[\u0027realtime\u0027]\n\t\t\n\t\tendDate \u003d system.date.now()\n\t\tunit \u003d real[\u0027unit\u0027]\n\t\tinterval \u003d real[\u0027interval\u0027]\n\t\t\n\t\tif unit \u003d\u003d \"seconds\":\n\t\t\tstartDate \u003d system.date.addSeconds(endDate, -interval)\n\t\telif unit \u003d\u003d \"minutes\":\n\t\t\tstartDate \u003d system.date.addMinutes(endDate, -interval)\n\t\telif unit \u003d\u003d \"hours\":\n\t\t\tstartDate \u003d system.date.addHours(endDate, -interval)\n\t\telif unit \u003d\u003d \"days\":\n\t\t\tstartDate \u003d system.date.addDays(endDate, -interval)\n\t\telif unit \u003d\u003d \"weeks\":\n\t\t\tstartDate \u003d system.date.addWeeks(endDate, -interval)\n\t\telif unit \u003d\u003d \"months\":\n\t\t\tstartDate \u003d system.date.addMonths(endDate, -interval)\n\t\telif unit \u003d\u003d \"years\":\n\t\t\tstartDate \u003d system.date.addYears(endDate, -interval)\n\t\n\t\n\tfilter \u003d self.parent.parent.getChild(\"AlarmJournalTable\").props.filter\n\tpriority \u003d helper.util.true_keys(filter[\u0027priorities\u0027])\n\tevents \u003d helper.util.true_keys(filter[\u0027events\u0027])\n\tstate \u003d helper.util.parse_event_filter_to_query_states(events)\n\tsource \u003d filter[\u0027conditions\u0027][\u0027source\u0027]\n\tdisplayPath \u003d filter[\u0027conditions\u0027][\u0027displayPath\u0027]\n\t\n\n\talarms \u003d system.alarm.queryJournal(startDate \u003d startDate, endDate\u003dendDate, priority\u003dpriority, state\u003dstate, includeData\u003dTrue, source\u003dsource, displaypath\u003ddisplayPath)\n\t\n\theaders \u003d [\u0027eventTime\u0027, \u0027source\u0027, \u0027eventState\u0027, \u0027eventValue\u0027, \u0027displayPath\u0027, \u0027label\u0027, \u0027id\u0027]\n\trows \u003d []\n\t\n\tfor alarm in alarms:\n\t\trows.append([str(alarm[header]) for header in headers])\n\t\t\n\talarmData \u003d system.dataset.toDataSet(headers, rows)\n\tsummaryDS \u003d helper.journal.groupJournalByPathAndState(alarms)\n\t\n\texcelBytes \u003d system.dataset.toExcel(True, [alarmData, summaryDS], sheetNames\u003d[\"Journal\", \"Counts\"])\n\t# Trigger download on the client\n\tend_str \u003d system.date.format(endDate, \u0027yyMMddHHmmss\u0027)\n\tstart_str \u003d system.date.format(startDate, \u0027yyMMddHHmmss\u0027)\n\tfname \u003d \u0027_\u0027.join([\u0027AlarmHist\u0027,end_str, start_str,\u0027.xlsx\u0027])\n\t\n\tsystem.perspective.download(fname, excelBytes, \"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet\")\n\t\n\treturn\n\t" }, "scope": "G", "type": "script" } } }, "meta": { "name": "DirectExport" }, "position": { "basis": "205px" }, "props": { "style": { "marginBottom": "10px", "marginTop": "10px" }, "text": "Export Summary" }, "type": "ia.input.button" } ], "meta": { "name": "FlexContainer" }, "position": { "basis": "58px" }, "props": { "justify": "center" }, "type": "ia.container.flex" } ], "meta": { "name": "root" }, "props": { "direction": "column" }, "type": "ia.container.flex" } }