{ "custom": { "title": "" }, "params": {}, "permissions": { "securityLevels": [], "type": "AllOf" }, "propConfig": { "custom.title": { "persistent": true } }, "props": { "defaultSize": { "height": 400, "width": 1600 } }, "root": { "children": [ { "children": [ { "meta": { "name": "Table" }, "position": { "height": "100%", "width": "100%" }, "props": { "cells": { "style": { "borderBottomColor": "#D5D5D5", "borderBottomStyle": "solid", "borderBottomWidth": "1px", "borderRightColor": "#D5D5D5", "borderRightStyle": "solid", "borderRightWidth": "1px", "color": "#000", "fontFamily": "Helvetica", "fontSize": "14px" } }, "columns": [ { "align": "center", "boolean": "checkbox", "dateFormat": "MM/DD/YYYY", "editable": false, "field": "eventtime", "footer": { "align": "center", "justify": "left", "style": { "classes": "" }, "title": "" }, "header": { "align": "center", "justify": "left", "style": { "classes": "" }, "title": "" }, "justify": "auto", "number": "value", "numberFormat": "0,0.##", "progressBar": { "bar": { "color": "#62A3F6", "linecap": "round", "width": 5 }, "max": 100, "track": { "color": "#DADADA", "linecap": "round", "width": 2 }, "value": { "color": "#7D7D7D", "show": true } }, "render": "auto", "resizable": true, "sort": "none", "sortable": true, "strictWidth": false, "style": { "classes": "" }, "toggleSwitch": { "color": { "selected": "#2196F3", "unselected": "#FFFFFF" } }, "viewParams": {}, "viewPath": "", "visible": true, "width": "" } ], "pager": { "bottom": false }, "rows": { "highlight": { "enabled": false }, "striped": { "enabled": false }, "style": { "classes": "table/highlight" } }, "style": { "fontFamily": "Helvetica", "fontSize": "14px", "fontWeight": "bold" } }, "type": "ia.display.table" } ], "meta": { "name": "Table" }, "position": { "height": "calc(100% - 40px)", "width": "calc(100% - 250px)", "x": 250, "y": 40 }, "props": { "style": { "border-left": "2px solid #000", "min-width": "450px" } }, "type": "ia.container.coord" }, { "meta": { "name": "LabelHeader" }, "position": { "height": 40, "width": "100%" }, "propConfig": { "props.text": { "binding": { "config": { "expression": " \"Custom Reports\"\r\n+if(len({view.custom.title})\u003e0, \" - \" + {view.custom.title}, \"\")" }, "type": "expr" } } }, "props": { "style": { "backgroundColor": "#1A4A5E", "borderBottomColor": "#000000", "borderBottomStyle": "solid", "borderBottomWidth": "2px", "color": "#fff", "fontFamily": "Helvetica", "fontSize": 20, "fontWeight": "bold", "textAlign": "center" } }, "type": "ia.display.label" }, { "events": { "component": { "onActionPerformed": { "config": { "script": "\t# Grab Data:\n\ttable \u003d self.parent.getChild(\"Table\").getChild(\"Table\")\n\tdata \u003d utils.downloadCSV(table, self.view.custom.title)" }, "scope": "G", "type": "script" } } }, "meta": { "name": "Button_Export" }, "position": { "height": 30, "width": 100, "x": "calc(100% - 105px)", "y": 5 }, "props": { "style": { "classes": "Buttons/Grey" }, "text": "Export" }, "type": "ia.input.button" }, { "events": { "component": { "onActionPerformed": { "config": { "script": "\treportTree \u003d self.getSibling(\"ReportTree\")\n\treportTree.meta.visible \u003d not reportTree.meta.visible" }, "scope": "G", "type": "script" } } }, "meta": { "name": "Button_Mode" }, "position": { "height": 32, "width": 85, "x": 4, "y": 4 }, "propConfig": { "props.text": { "binding": { "config": { "expression": "if({../ReportTree.meta.visible},\r\n\t\"Files\",\r\n\t\"Reports\"\r\n)" }, "type": "expr" }, "persistent": true } }, "props": { "enabled": false, "style": { "classes": "Buttons/Grey" }, "text": "Files" }, "type": "ia.input.button" }, { "events": { "component": { "onActionPerformed": { "config": { "draggable": false, "id": "PABE2XXI", "modal": true, "overlayDismiss": true, "resizable": false, "showCloseIcon": true, "title": "Upload Custom Report", "type": "open", "viewPath": "Popups/CustomReports/ConfigUpload" }, "scope": "C", "type": "popup" } } }, "meta": { "name": "Button_UploadConfig", "visible": false }, "position": { "height": 32, "width": 85, "x": 93, "y": 4 }, "propConfig": { "meta.visible": { "binding": { "config": { "expression": "{../ReportTree.meta.visible}\r\n\u0026\u0026 ({session.props.device.type} \u003d \"designer\" || isAuthorized(\r\n\tfalse,\r\n\t\u0027Authenticated/Roles/Administrator\u0027,\r\n\t\u0027Authenticated/Roles/Developer\u0027\r\n))" }, "type": "expr" }, "persistent": true } }, "props": { "style": { "classes": "Buttons/Grey" }, "text": "Upload" }, "type": "ia.input.button" }, { "events": { "component": { "onActionPerformed": { "config": { "script": "\t# Get filenames:\n\ttree \u003d self.getSibling(\u0027ReportTree\u0027)\n\tfilenames \u003d [sel.value for sel in tree.props.selectionData]\n\t\n\terr \u003d reports.downloadConfigs(filenames)\n\n\t# Check if err:\n\tif err is not None:\n\t\tsystem.gui.messageBox(err, \"Error\")" }, "scope": "G", "type": "script" } } }, "meta": { "name": "Button_DownloadConfig", "visible": false }, "position": { "height": 32, "width": 95, "x": 182, "y": 4 }, "propConfig": { "meta.visible": { "binding": { "config": { "expression": "{../ReportTree.meta.visible}\r\n\u0026\u0026 ({session.props.device.type} \u003d \"designer\" || isAuthorized(\r\n\tfalse,\r\n\t\u0027Authenticated/Roles/Administrator\u0027,\r\n\t\u0027Authenticated/Roles/Developer\u0027\r\n))" }, "type": "expr" }, "persistent": true }, "props.enabled": { "binding": { "config": { "path": "../ReportTree.props.selection" }, "transforms": [ { "code": "\treturn len(value)\u003e0", "type": "script" } ], "type": "property" } } }, "props": { "style": { "classes": "Buttons/Grey" }, "text": "Download" }, "type": "ia.input.button" }, { "events": { "component": { "onActionPerformed": { "config": { "draggable": false, "id": "5QyUoYBU", "modal": true, "overlayDismiss": true, "resizable": false, "showCloseIcon": true, "title": "Delete Confirmation", "type": "open", "viewParams": { "filenames": "{/root/ReportTree.props.selectionData}" }, "viewPath": "Popups/CustomReports/DeleteConfirmation" }, "scope": "C", "type": "popup" } } }, "meta": { "name": "Button_DeleteConfig", "visible": false }, "position": { "height": 32, "width": 85, "x": 281, "y": 4 }, "propConfig": { "meta.visible": { "binding": { "config": { "expression": "{../ReportTree.meta.visible}\r\n\u0026\u0026 ({session.props.device.type} \u003d \"designer\" || isAuthorized(\r\n\tfalse,\r\n\t\u0027Authenticated/Roles/Administrator\u0027,\r\n\t\u0027Authenticated/Roles/Developer\u0027\r\n))" }, "type": "expr" }, "persistent": true }, "props.enabled": { "binding": { "config": { "path": "../ReportTree.props.selection" }, "transforms": [ { "code": "\treturn len(value)\u003e0", "type": "script" } ], "type": "property" } } }, "props": { "style": { "classes": "Buttons/Grey" }, "text": "Delete" }, "type": "ia.input.button" }, { "meta": { "name": "FileTree", "visible": false }, "position": { "height": "calc(100% - 97px)", "width": 250, "y": 65 }, "propConfig": { "meta.visible": { "binding": { "config": { "expression": "!{../ReportTree.meta.visible}" }, "type": "expr" }, "persistent": true } }, "props": { "appearance": { "defaultNodeIcons": { "collapsed": { "color": "#5F707E", "path": "material/folder" }, "empty": { "color": "#869DB1", "path": "material/stop" }, "expanded": { "color": "#5F707E", "path": "material/folder_open" } }, "expandIcons": { "collapsed": { "color": "#869DB1", "path": "material/arrow_right" }, "empty": { "color": "#869DB1" }, "expanded": { "color": "#869DB1", "path": "material/arrow_drop_down" } }, "selectedStyle": { "backgroundColor": "#BBE0F6", "color": "#000", "cursor": "pointer" }, "unselectedStyle": { "classes": "Tree/hoverUnselected", "cursor": "pointer" } } }, "type": "ia.display.tree" }, { "events": { "component": { "onActionPerformed": { "config": { "script": "\tsystem.perspective.print(self.getSibling(\"FileTree\").props.selection)" }, "scope": "G", "type": "script" } } }, "meta": { "name": "Button_DownloadFiles", "visible": false }, "position": { "height": 32, "y": "calc(100% - 32px)" }, "propConfig": { "meta.visible": { "binding": { "config": { "path": "../FileTree.meta.visible" }, "type": "property" }, "persistent": true }, "position.width": { "binding": { "config": { "path": "../FileTree.position.width" }, "type": "property" } }, "props.enabled": { "binding": { "config": { "path": "../FileTree.props.selection" }, "transforms": [ { "code": "\treturn len(value)\u003e0", "type": "script" } ], "type": "property" } } }, "props": { "style": { "classes": "Buttons/Grey" }, "text": "Download Selected" }, "type": "ia.input.button" }, { "events": { "dom": { "onDoubleClick": { "config": { "script": "\tdata \u003d self.props.selectionData\n\tif len(data) \u003d\u003d 1:\n\t\tconfig \u003d data[0].value\n\t\tresults \u003d reports.readTable(config)\n\t\t# Return data table:\n\t\tif \u0027err\u0027 in results:\n\t\t\tsystem.gui.messageBox(results[\u0027err\u0027], \"Error\")\n\t\telse:\n\t\t\ttable \u003d self.getSibling(\"Table\").getChild(\"Table\")\n\t\t\ttable.props.data \u003d results[\u0027data\u0027]\n\t\t\ttable.props.columns \u003d results[\u0027columns\u0027]\n\t\t\tself.view.custom.title \u003d \".\".join(config.split(\".\")[:-1])" }, "scope": "G", "type": "script" } }, "system": { "onStartup": { "config": { "script": "\tself.refreshList()" }, "scope": "G", "type": "script" } } }, "meta": { "name": "ReportTree" }, "position": { "height": "calc(100% - 65px)", "width": 250, "y": 65 }, "props": { "appearance": { "defaultNodeIcons": { "collapsed": { "color": "#5F707E", "path": "material/folder" }, "empty": { "color": "#869DB1", "path": "material/stop" }, "expanded": { "color": "#5F707E", "path": "material/folder_open" } }, "expandIcons": { "collapsed": { "color": "#869DB1", "path": "material/arrow_right" }, "empty": { "color": "#869DB1" }, "expanded": { "color": "#869DB1", "path": "material/arrow_drop_down" } }, "selectedStyle": { "backgroundColor": "#BBE0F6", "color": "#000", "cursor": "pointer", "user-select": "none" }, "unselectedStyle": { "classes": "Tree/hoverUnselected", "cursor": "pointer", "user-select": "none" } } }, "scripts": { "customMethods": [ { "name": "refreshList", "params": [], "script": "\ticons \u003d {\n\t\t\"csv\": {\n\t\t\t\"path\": \"material/table_chart\",\n\t\t\t\"color\": \"#869DB1\"\n\t\t},\n\t\t\"sql\": {\n\t\t\t\"path\": \"material/storage\",\n\t\t\t\"color\": \"#869DB1\"\n\t\t}\n\t}\n\t\n\tconfigs \u003d []\n\troles \u003d self.session.props.auth.user.roles\n\tfor config in reports.getConfigs(roles\u003droles):\n\t\tparts \u003d config.split(\".\")\n\t\tconfigs.append({\n\t\t\t\"label\": \".\".join(parts[:-1]),\n\t\t\t\"expanded\": False,\n\t\t\t\"icon\": icons.get(parts[-1], \"\"),\n\t\t\t\"data\": config,\n\t\t\t\"items\": []\n\t\t})\n\t\n\tself.props.items \u003d configs" } ], "messageHandlers": [ { "messageType": "custom-reports-refreshlist", "pageScope": true, "script": "\tself.refreshList()", "sessionScope": false, "viewScope": false } ] }, "type": "ia.display.tree" }, { "meta": { "name": "LabelTree" }, "position": { "height": 25, "width": 250, "y": 40 }, "propConfig": { "props.text": { "binding": { "config": { "expression": "if({../ReportTree.meta.visible},\r\n\t\"On-Demand Reports\",\r\n\t\"Pre-Run Reports\"\r\n)" }, "type": "expr" }, "persistent": true } }, "props": { "style": { "backgroundColor": "#808080", "borderBottomColor": "#000", "borderBottomStyle": "solid", "borderBottomWidth": 2, "color": "#FFF", "fontSize": "16px", "fontWeight": "bold", "textAlign": "center", "user-select": "none" }, "text": "On-Demand Reports" }, "type": "ia.display.label" } ], "meta": { "name": "root" }, "props": { "style": { "min-width": "1000px" } }, "type": "ia.container.coord" } }