{ "custom": { "api_region_name": "na", "bucket_options": [ { "label": "Image Files", "value": "na-ignition-image-repo" }, { "label": "Source Files", "value": "na-ignition-image-source" } ], "default_query_params": { "bucket": null, "object_key": null, "site": null, "view": null }, "destination_view_suffix": null, "object_key": null, "stage_config": { "account_id": "925510716640", "endpoint": "https://scada-s3-management.narme-scada.rme.amazon.dev/", "lambda_name": "RMESDScadaS3ManagementFlaskLambda-prod", "region": "us-east-2", "repo_bucket": "na-ignition-image-repo", "s3_region": "us-east-1", "source_bucket": "na-ignition-image-source" }, "view_options_by_site_and_bucket": [], "view_suffix": null, "whid_options": [] }, "params": { "query_params": { "bucket": null, "object_key": null, "site": null, "view": null } }, "propConfig": { "custom.api_region_name": { "binding": { "config": { "path": "session.custom.aws.prefix" }, "type": "property" }, "persistent": true }, "custom.bucket_options": { "binding": { "config": { "path": "view.custom.stage_config" }, "transforms": [ { "code": "\treturn [{\u0027value\u0027: value.repo_bucket, \u0027label\u0027: \u0027Image Files\u0027},\n\t\t\t{\u0027value\u0027: value.source_bucket, \u0027label\u0027: \u0027Source Files\u0027}]", "type": "script" } ], "type": "property" }, "persistent": true }, "custom.default_query_params": { "persistent": true }, "custom.object_key": { "binding": { "config": { "path": "view.params.query_params" }, "transforms": [ { "code": "\tstage_config \u003d self.custom.stage_config\n\tbucket \u003d self.params.query_params.bucket\n\tsite \u003d self.params.query_params.site\n\tview \u003d self.params.query_params.view\n\tif bucket and site and view:\n\t\tif bucket \u003d\u003d stage_config.repo_bucket:\n\t\t\tsuffix \u003d \u0027.svg\u0027\n\t\t\tsubfolder \u003d \u0027images\u0027\n\t\telse:\n\t\t\tsuffix \u003d \u0027.drawio\u0027\n\t\t\tsubfolder \u003d \u0027source\u0027\n\t\treturn \"SCADA/%s/%s/%s%s\" % (site, subfolder, view, suffix)\n\telse:\n\t\treturn None\n", "type": "script" } ], "type": "property" }, "onChange": { "enabled": null, "script": "\td \u003d self.params.query_params\n\tif getattr(currentValue, \u0027value\u0027, None):\n\t\tself.params.query_params.object_key \u003d currentValue.value\n\t" }, "persistent": true }, "custom.stage_config": { "binding": { "config": { "expression": "{view.custom.api_region_name}" }, "transforms": [ { "code": "\treturn AWS.s3.STAGE_CONFIG[\u0027prod\u0027][value]", "type": "script" } ], "type": "expr" }, "persistent": true }, "custom.view_options_by_site_and_bucket": { "binding": { "config": { "expression": "{view.params.query_params.site}+{view.params.query_params.bucket}" }, "transforms": [ { "code": "\tbucket \u003d self.params.query_params.bucket\n\tsite \u003d self.params.query_params.site\n\tif bucket and site:\n\t\tfrom AWS.s3 import S3Manager\n\t\tfrom helper.helper import sanitize_tree\n\t\tfrom pprint import pformat\n\t\t\n\t\tapi_stage \u003d \u0027prod\u0027\n\t\tusername \u003d self.session.props.auth.user.userName\n\t\tapi_region_name \u003d self.view.custom.api_region_name\n\t\t\n\t\ts3m \u003d S3Manager(api_stage, api_region_name, username)\n\t\tsuffix \u003d self.custom.view_suffix\n\t\tfiles \u003d sanitize_tree(s3m.fetch_object_list_by_site_and_bucket(site, bucket))\n\t\treturn [{\u0027value\u0027: x[\u0027Filename\u0027].replace(suffix,\u0027\u0027), \n\t\t\t\t\u0027label\u0027: x[\u0027Filename\u0027].replace(suffix,\u0027\u0027)} for x in files]\n\treturn []", "type": "script" } ], "type": "expr" }, "persistent": true }, "custom.view_suffix": { "binding": { "config": { "path": "view.params.query_params.bucket" }, "transforms": [ { "code": "\tif value:\n\t\tstage_config \u003d self.custom.stage_config\n\t\tif value \u003d\u003d stage_config.get(\u0027repo_bucket\u0027, None):\n\t\t\treturn \".svg\"\n\t\tif value \u003d\u003d stage_config.get(\"source_bucket\", None):\n\t\t\treturn \".drawio\"\n\treturn value", "type": "script" } ], "type": "property" }, "persistent": true }, "custom.whid_options": { "binding": { "config": { "path": "view.params.query_params.bucket" }, "transforms": [ { "code": "\tif value:\n\t\tfrom AWS.s3 import S3Manager\n\t\t\n\t\tapi_stage \u003d \u0027prod\u0027\n\t\tusername \u003d self.session.props.auth.user.userName\n\t\tapi_region_name \u003d self.custom.api_region_name\n\t\t\n\t\ts3m \u003d S3Manager(\u0027prod\u0027, api_region_name, username)\n\t\t\n\t\treturn [{\u0027value\u0027: x, \u0027label\u0027: x} for x in s3m.fetch_site_list(value)]\n\treturn []", "type": "script" } ], "type": "property" }, "persistent": true }, "params.query_params": { "onChange": { "enabled": null, "script": "\tif not missedEvents and origin in (\u0027Binding\u0027, \u0027Script\u0027, \u0027BindingWriteback\u0027):\n\t\tpayload \u003d currentValue.value\n\t\tsystem.perspective.sendMessage(\u0027list_versions_query_params_changed\u0027, payload, scope\u003d\u0027session\u0027)\n\t\t" }, "paramDirection": "input", "persistent": true } }, "props": { "defaultSize": { "height": 600 } }, "root": { "children": [ { "children": [ { "meta": { "name": "Label" }, "position": { "shrink": 0 }, "props": { "style": { "borderStyle": "none", "classes": "Framework/Card/Title_transparent" }, "text": "Select Query Params" }, "type": "ia.display.label" }, { "children": [ { "events": { "component": { "onActionPerformed": { "config": { "script": "\t# reset query params to default values \n\t# (stored in `view.custom.default_query_params`)\n\tself.view.params.query_params \u003d self.view.custom.default_query_params" }, "scope": "G", "type": "script" } } }, "meta": { "name": "Clear Button", "tooltip": { "enabled": true, "location": "bottom-right", "text": "Clear Selections" } }, "position": { "shrink": 0 }, "props": { "image": { "icon": { "path": "material/clear_all" } }, "primary": false, "style": { "classes": "Input/Button/Secondary_minimal" }, "text": "" }, "type": "ia.input.button" }, { "events": { "component": { "onActionPerformed": { "config": { "script": "\t# refresh version table query via message handler\n\tsystem.perspective.sendMessage(\u0027refresh_version_table_data\u0027, scope\u003d\u0027session\u0027)\n\t" }, "scope": "G", "type": "script" } } }, "meta": { "name": "Refresh Button", "tooltip": { "enabled": true, "location": "bottom-right", "text": "Refresh Data" } }, "position": { "shrink": 0 }, "propConfig": { "props.enabled": { "binding": { "config": { "expression": "!isNull({view.params.query_params.bucket})\r\n\u0026\u0026!isNull({view.params.query_params.site})\r\n\u0026\u0026!isNull({view.params.query_params.view})\r\n\u0026\u0026!isNull({view.params.query_params.object_key})" }, "type": "expr" } } }, "props": { "image": { "icon": { "path": "material/refresh" } }, "primary": false, "style": { "classes": "Input/Button/Secondary_minimal" }, "text": "" }, "type": "ia.input.button" } ], "meta": { "name": "FlexContainer" }, "position": { "grow": 1 }, "props": { "justify": "flex-end" }, "type": "ia.container.flex" } ], "meta": { "name": "FlexContainer Header" }, "position": { "shrink": 0 }, "props": { "style": { "classes": "Framework/Card/Title_transparent", "marginBottom": "2px" } }, "type": "ia.container.flex" }, { "children": [ { "children": [ { "meta": { "name": "Label" }, "position": { "basis": "125px", "shrink": 0 }, "props": { "style": { "classes": "Framework/Card/Label", "textAlign": "right" }, "text": "Bucket" }, "type": "ia.display.label" }, { "meta": { "name": "Dropdown" }, "position": { "basis": "540px", "grow": 1 }, "propConfig": { "props.options": { "binding": { "config": { "path": "view.custom.bucket_options" }, "type": "property" } }, "props.value": { "binding": { "config": { "bidirectional": true, "path": "view.params.query_params.bucket" }, "type": "property" } } }, "props": { "dropdownOptionStyle": { "overflowWrap": "break-word", "whiteSpace": "normal" }, "showClearIcon": true }, "type": "ia.input.dropdown" }, { "events": { "component": { "onActionPerformed": { "config": { "script": "\tself.view.params.query_params.bucket \u003d None\n\t" }, "scope": "G", "type": "script" } } }, "meta": { "name": "Clear Button" }, "position": { "shrink": 0 }, "propConfig": { "props.enabled": { "binding": { "config": { "expression": "!isNull({view.params.query_params.bucket})\r\n\u0026\u0026{view.params.query_params.bucket}!\u003d\u0027\u0027" }, "type": "expr" } } }, "props": { "image": { "icon": { "path": "material/clear" } }, "primary": false, "style": { "classes": "Input/Button/Secondary_minimal" }, "text": "" }, "type": "ia.input.button" } ], "meta": { "name": "Bucket" }, "position": { "basis": "100%", "grow": 1 }, "props": { "style": { "overflow": "hidden" } }, "type": "ia.container.flex" } ], "meta": { "name": "FlexContainer_1" }, "position": { "shrink": 0 }, "props": { "justify": "center" }, "type": "ia.container.flex" }, { "children": [ { "children": [ { "meta": { "name": "Label" }, "position": { "basis": "125px", "shrink": 0 }, "props": { "style": { "classes": "Framework/Card/Label", "textAlign": "right" }, "text": "Site" }, "type": "ia.display.label" }, { "meta": { "name": "Dropdown" }, "position": { "basis": "540px", "grow": 1 }, "propConfig": { "props.enabled": { "binding": { "config": { "expression": "!isNull({view.params.query_params.bucket})\r\n\u0026\u0026len({view.params.query_params.bucket})\u003e0" }, "type": "expr" } }, "props.options": { "binding": { "config": { "path": "view.custom.whid_options" }, "type": "property" } }, "props.value": { "binding": { "config": { "bidirectional": true, "path": "view.params.query_params.site" }, "type": "property" } } }, "props": { "dropdownOptionStyle": { "overflowWrap": "break-word", "whiteSpace": "normal" }, "showClearIcon": true }, "type": "ia.input.dropdown" }, { "events": { "component": { "onActionPerformed": { "config": { "script": "\tself.view.params.query_params.site \u003d None\n\t" }, "scope": "G", "type": "script" } } }, "meta": { "name": "Clear Button" }, "position": { "shrink": 0 }, "propConfig": { "props.enabled": { "binding": { "config": { "expression": "!isNull({view.params.query_params.site})\r\n\u0026\u0026{view.params.query_params.site}!\u003d\u0027\u0027" }, "type": "expr" } } }, "props": { "image": { "icon": { "path": "material/clear" } }, "primary": false, "style": { "classes": "Input/Button/Secondary_minimal" }, "text": "" }, "type": "ia.input.button" } ], "meta": { "name": "Site" }, "position": { "basis": "100%", "grow": 1 }, "props": { "style": { "overflow": "hidden" } }, "type": "ia.container.flex" } ], "meta": { "name": "FlexContainer_2" }, "position": { "shrink": 0 }, "props": { "justify": "center" }, "type": "ia.container.flex" }, { "children": [ { "children": [ { "meta": { "name": "Label" }, "position": { "basis": "125px", "shrink": 0 }, "props": { "style": { "classes": "Framework/Card/Label", "textAlign": "right" }, "text": "View" }, "type": "ia.display.label" }, { "meta": { "name": "Dropdown" }, "position": { "basis": "540px", "grow": 1 }, "propConfig": { "props.enabled": { "binding": { "config": { "expression": "!isNull({view.params.query_params.bucket})\r\n\u0026\u0026len({view.params.query_params.bucket})\u003e0\r\n\u0026\u0026!isNull({view.params.query_params.site})\r\n\u0026\u0026len({view.params.query_params.site})\u003e0" }, "type": "expr" } }, "props.options": { "binding": { "config": { "path": "view.custom.view_options_by_site_and_bucket" }, "type": "property" } }, "props.value": { "binding": { "config": { "bidirectional": true, "path": "view.params.query_params.view" }, "type": "property" } } }, "props": { "dropdownOptionStyle": { "overflowWrap": "break-word", "whiteSpace": "normal" }, "showClearIcon": true }, "type": "ia.input.dropdown" }, { "events": { "component": { "onActionPerformed": { "config": { "script": "\tself.view.params.query_params.view \u003d None\n\t" }, "scope": "G", "type": "script" } } }, "meta": { "name": "Clear Button" }, "position": { "shrink": 0 }, "propConfig": { "props.enabled": { "binding": { "config": { "expression": "!isNull({view.params.query_params.view})\r\n\u0026\u0026{view.params.query_params.view}!\u003d\u0027\u0027" }, "type": "expr" } } }, "props": { "image": { "icon": { "path": "material/clear" } }, "primary": false, "style": { "classes": "Input/Button/Secondary_minimal" }, "text": "" }, "type": "ia.input.button" } ], "meta": { "name": "View" }, "position": { "basis": "100%", "grow": 1 }, "props": { "style": { "overflow": "hidden" } }, "type": "ia.container.flex" } ], "meta": { "name": "FlexContainer_3" }, "position": { "shrink": 0 }, "props": { "justify": "center" }, "type": "ia.container.flex" }, { "children": [ { "children": [ { "meta": { "name": "Label" }, "position": { "basis": "125px", "shrink": 0 }, "props": { "style": { "classes": "Framework/Card/Label", "textAlign": "right" }, "text": "Object Key" }, "type": "ia.display.label" }, { "meta": { "name": "Label_0" }, "position": { "grow": 1 }, "propConfig": { "props.text": { "binding": { "config": { "path": "view.params.query_params.object_key" }, "type": "property" } } }, "props": { "style": { "classes": "Framework/Card/Value", "textAlign": "left" } }, "type": "ia.display.label" } ], "meta": { "name": "Object Key" }, "position": { "basis": "100%", "grow": 1 }, "props": { "style": { "overflow": "hidden" } }, "type": "ia.container.flex" } ], "meta": { "name": "FlexContainer_4" }, "position": { "shrink": 0 }, "props": { "justify": "center" }, "type": "ia.container.flex" } ], "meta": { "name": "root" }, "props": { "direction": "column" }, "type": "ia.container.flex" } }