1041 lines
43 KiB
Plaintext
1041 lines
43 KiB
Plaintext
{
|
|
"custom": {
|
|
"api_region_name": "eu",
|
|
"developer_user": true,
|
|
"enable_add_new_site": true,
|
|
"enabled_whids": [
|
|
"DNK7",
|
|
"EWR4"
|
|
],
|
|
"expanded": false,
|
|
"loading": false,
|
|
"new_site_is_not_in_S3": true,
|
|
"new_site_to_add": "EWR4",
|
|
"show_add_new_site": false,
|
|
"stage_config": {
|
|
"account_id": "006306898152",
|
|
"api_call_role": "arn:aws:iam::609617486056:role/RMESDScadaS3ManagementAPIcallRole-prod-eu-west-1",
|
|
"endpoint": "https://eu-west-1.scada-s3-management.scada.eurme.amazon.dev/",
|
|
"lambda_name": "RMESDScadaS3ManagementFlaskLambda-prod",
|
|
"region": "eu-west-1",
|
|
"repo_bucket": "ignition-image-repo",
|
|
"s3_region": "eu-west-1",
|
|
"source_bucket": "ignition-image-source"
|
|
},
|
|
"whid": "",
|
|
"whids_in_s3": [
|
|
"BOS3",
|
|
"BRS1",
|
|
"CGN9",
|
|
"DAO1",
|
|
"DAO3",
|
|
"DAR2",
|
|
"DBE2",
|
|
"DBH3",
|
|
"DBI7",
|
|
"DBT3",
|
|
"DCT7",
|
|
"DCT9",
|
|
"DCZ3",
|
|
"DCZ4",
|
|
"DEH1",
|
|
"DER1",
|
|
"DER2",
|
|
"DER3",
|
|
"DER5",
|
|
"DFV1",
|
|
"DHA1",
|
|
"DHE3",
|
|
"DHE4",
|
|
"DHE6",
|
|
"DIF2",
|
|
"DIF6",
|
|
"DIP1",
|
|
"DLO1",
|
|
"DLO2",
|
|
"DLO3",
|
|
"DLO4",
|
|
"DLO5",
|
|
"DLO7",
|
|
"DLZ1",
|
|
"DLZ2",
|
|
"DLZ3",
|
|
"DMA3",
|
|
"DMA4",
|
|
"DMA6",
|
|
"DMV1",
|
|
"DMV3",
|
|
"DMZ2",
|
|
"DMZ4",
|
|
"DNC1",
|
|
"DNC2",
|
|
"DNE2",
|
|
"DNG2",
|
|
"DNM7",
|
|
"DNP1",
|
|
"DNX3",
|
|
"DNZ2",
|
|
"DPI3",
|
|
"DPU1",
|
|
"DRM2",
|
|
"DSI2",
|
|
"DSO2",
|
|
"DSY6",
|
|
"DTC2",
|
|
"DVN1",
|
|
"DVN2",
|
|
"DVN5",
|
|
"DWN2",
|
|
"IST2",
|
|
"MAD6",
|
|
"MAN2",
|
|
"QCB6"
|
|
]
|
|
},
|
|
"events": {
|
|
"system": {
|
|
"onStartup": {
|
|
"config": {
|
|
"script": "\tself.custom.expanded \u003d False\n\tself.custom.new_site_to_add \u003d self.params.selected_whid"
|
|
},
|
|
"scope": "G",
|
|
"type": "script"
|
|
}
|
|
}
|
|
},
|
|
"params": {
|
|
"enables": {},
|
|
"selected_whid": "EWR4"
|
|
},
|
|
"propConfig": {
|
|
"custom.api_region_name": {
|
|
"binding": {
|
|
"config": {
|
|
"path": "session.custom.aws.prefix"
|
|
},
|
|
"type": "property"
|
|
},
|
|
"persistent": true
|
|
},
|
|
"custom.developer_user": {
|
|
"binding": {
|
|
"config": {
|
|
"expression": "isAuthorized(false, \u0027Authenticated/Roles/eurme-ignition-developers\u0027)"
|
|
},
|
|
"type": "expr"
|
|
},
|
|
"persistent": true
|
|
},
|
|
"custom.enable_add_new_site": {
|
|
"binding": {
|
|
"config": {
|
|
"expression": "isAuthorized(false, \u0027Authenticated/Roles/rme-c4\u0027, \u0027Authenticated/Roles/narme-ignition-developers\u0027,\r\n\t\t\t\u0027Authenticated/Roles/eurme-ignition-developers\u0027)\r\n"
|
|
},
|
|
"type": "expr"
|
|
},
|
|
"persistent": true
|
|
},
|
|
"custom.enabled_whids": {
|
|
"binding": {
|
|
"config": {
|
|
"expression": "{session.custom.fc}"
|
|
},
|
|
"transforms": [
|
|
{
|
|
"code": "\tchild_projects \u003d config.project_config.get_child_scada_projects()\n\treturn [x.replace(\u0027_SCADA\u0027,\u0027\u0027) for x in child_projects]",
|
|
"type": "script"
|
|
}
|
|
],
|
|
"type": "expr"
|
|
},
|
|
"persistent": true
|
|
},
|
|
"custom.expanded": {
|
|
"persistent": true
|
|
},
|
|
"custom.loading": {
|
|
"persistent": true
|
|
},
|
|
"custom.new_site_is_not_in_S3": {
|
|
"binding": {
|
|
"config": {
|
|
"expression": "{view.custom.new_site_to_add}+toStr({view.custom.whids_in_s3})"
|
|
},
|
|
"transforms": [
|
|
{
|
|
"code": "\tnew_site \u003d self.custom.new_site_to_add\n\twhids \u003d self.custom.whids_in_s3\n\tif new_site and new_site not in whids:\n\t\treturn True\n\treturn False",
|
|
"type": "script"
|
|
}
|
|
],
|
|
"type": "expr"
|
|
},
|
|
"persistent": true
|
|
},
|
|
"custom.new_site_to_add": {
|
|
"persistent": true
|
|
},
|
|
"custom.show_add_new_site": {
|
|
"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.whid": {
|
|
"binding": {
|
|
"config": {
|
|
"path": "session.custom.fc"
|
|
},
|
|
"type": "property"
|
|
},
|
|
"persistent": true
|
|
},
|
|
"custom.whids_in_s3": {
|
|
"binding": {
|
|
"config": {
|
|
"expression": "{session.custom.fc}"
|
|
},
|
|
"transforms": [
|
|
{
|
|
"code": "\tfrom AWS.s3 import S3Manager\n\t\n\tusername \u003d self.session.props.auth.user.userName\n\tapi_region_name \u003d self.custom.api_region_name\n\t\n\ts3m \u003d S3Manager(\u0027prod\u0027, api_region_name, username)\n\n\tbucket \u003d self.custom.stage_config.repo_bucket\n\treturn s3m.fetch_site_list(bucket)\n",
|
|
"type": "script"
|
|
}
|
|
],
|
|
"type": "expr"
|
|
},
|
|
"persistent": true
|
|
},
|
|
"params.enables": {
|
|
"paramDirection": "input",
|
|
"persistent": true
|
|
},
|
|
"params.selected_whid": {
|
|
"onChange": {
|
|
"enabled": null,
|
|
"script": "\tself.custom.new_site_to_add \u003d getattr(currentValue, \u0027value\u0027, \u0027\u0027)"
|
|
},
|
|
"paramDirection": "input",
|
|
"persistent": true
|
|
}
|
|
},
|
|
"props": {
|
|
"defaultSize": {
|
|
"height": 330,
|
|
"width": 600
|
|
}
|
|
},
|
|
"root": {
|
|
"children": [
|
|
{
|
|
"children": [
|
|
{
|
|
"children": [
|
|
{
|
|
"meta": {
|
|
"name": "Label"
|
|
},
|
|
"position": {
|
|
"basis": "125px",
|
|
"shrink": 0
|
|
},
|
|
"props": {
|
|
"style": {
|
|
"classes": "Framework/Card/Label Text/RightAlign_with_Padding",
|
|
"paddingLeft": "5px"
|
|
},
|
|
"text": "S3 Image Bucket:"
|
|
},
|
|
"type": "ia.display.label"
|
|
},
|
|
{
|
|
"meta": {
|
|
"name": "label_LeftAlign"
|
|
},
|
|
"position": {
|
|
"basis": "200px",
|
|
"grow": 1
|
|
},
|
|
"propConfig": {
|
|
"position.display": {
|
|
"binding": {
|
|
"config": {
|
|
"expression": "!{view.params.enables.bucket}"
|
|
},
|
|
"type": "expr"
|
|
}
|
|
},
|
|
"props.params.text": {
|
|
"binding": {
|
|
"config": {
|
|
"path": "view.custom.stage_config.repo_bucket"
|
|
},
|
|
"type": "property"
|
|
}
|
|
}
|
|
},
|
|
"props": {
|
|
"path": "Objects/Templates/Labels/label_LeftAlign",
|
|
"style": {
|
|
"classes": "Framework/Card/Value"
|
|
}
|
|
},
|
|
"type": "ia.display.view"
|
|
}
|
|
],
|
|
"meta": {
|
|
"name": "FlexContainer Image Bucket"
|
|
},
|
|
"position": {
|
|
"basis": "26px",
|
|
"shrink": 0
|
|
},
|
|
"type": "ia.container.flex"
|
|
},
|
|
{
|
|
"children": [
|
|
{
|
|
"meta": {
|
|
"name": "Label"
|
|
},
|
|
"position": {
|
|
"basis": "125px",
|
|
"shrink": 0
|
|
},
|
|
"props": {
|
|
"style": {
|
|
"classes": "Framework/Card/Label Text/RightAlign_with_Padding",
|
|
"paddingLeft": "5px"
|
|
},
|
|
"text": "S3 Source Bucket:"
|
|
},
|
|
"type": "ia.display.label"
|
|
},
|
|
{
|
|
"meta": {
|
|
"name": "label_LeftAlign"
|
|
},
|
|
"position": {
|
|
"basis": "200px",
|
|
"grow": 1
|
|
},
|
|
"propConfig": {
|
|
"position.display": {
|
|
"binding": {
|
|
"config": {
|
|
"expression": "!{view.params.enables.bucket}"
|
|
},
|
|
"type": "expr"
|
|
}
|
|
},
|
|
"props.params.text": {
|
|
"binding": {
|
|
"config": {
|
|
"path": "view.custom.stage_config.source_bucket"
|
|
},
|
|
"type": "property"
|
|
}
|
|
}
|
|
},
|
|
"props": {
|
|
"path": "Objects/Templates/Labels/label_LeftAlign",
|
|
"style": {
|
|
"classes": "Framework/Card/Value"
|
|
}
|
|
},
|
|
"type": "ia.display.view"
|
|
}
|
|
],
|
|
"meta": {
|
|
"name": "FlexContainer Source Bucket"
|
|
},
|
|
"position": {
|
|
"basis": "26px",
|
|
"shrink": 0
|
|
},
|
|
"type": "ia.container.flex"
|
|
},
|
|
{
|
|
"children": [
|
|
{
|
|
"meta": {
|
|
"name": "Label"
|
|
},
|
|
"position": {
|
|
"basis": "125px",
|
|
"shrink": 0
|
|
},
|
|
"props": {
|
|
"style": {
|
|
"classes": "Framework/Card/Label Text/RightAlign_with_Padding",
|
|
"paddingLeft": "5px"
|
|
},
|
|
"text": "Child Projects:"
|
|
},
|
|
"type": "ia.display.label"
|
|
},
|
|
{
|
|
"meta": {
|
|
"name": "label_LeftAlign"
|
|
},
|
|
"position": {
|
|
"basis": "200px",
|
|
"grow": 1
|
|
},
|
|
"propConfig": {
|
|
"props.params.text": {
|
|
"binding": {
|
|
"config": {
|
|
"expression": "len({view.custom.enabled_whids})"
|
|
},
|
|
"type": "expr"
|
|
}
|
|
}
|
|
},
|
|
"props": {
|
|
"path": "Objects/Templates/Labels/label_LeftAlign",
|
|
"style": {
|
|
"classes": "Framework/Card/Value"
|
|
}
|
|
},
|
|
"type": "ia.display.view"
|
|
},
|
|
{
|
|
"meta": {
|
|
"name": "Label_0"
|
|
},
|
|
"position": {
|
|
"basis": "100px",
|
|
"shrink": 0
|
|
},
|
|
"props": {
|
|
"style": {
|
|
"classes": "Framework/Card/Label Text/RightAlign_with_Padding",
|
|
"paddingLeft": "5px"
|
|
},
|
|
"text": "Sites in S3:"
|
|
},
|
|
"type": "ia.display.label"
|
|
},
|
|
{
|
|
"meta": {
|
|
"name": "label_LeftAlign_0"
|
|
},
|
|
"position": {
|
|
"basis": "200px",
|
|
"grow": 1
|
|
},
|
|
"propConfig": {
|
|
"props.params.text": {
|
|
"binding": {
|
|
"config": {
|
|
"expression": "len({view.custom.whids_in_s3})"
|
|
},
|
|
"type": "expr"
|
|
}
|
|
}
|
|
},
|
|
"props": {
|
|
"path": "Objects/Templates/Labels/label_LeftAlign",
|
|
"style": {
|
|
"classes": "Framework/Card/Value"
|
|
}
|
|
},
|
|
"type": "ia.display.view"
|
|
},
|
|
{
|
|
"children": [
|
|
{
|
|
"events": {
|
|
"component": {
|
|
"onActionPerformed": {
|
|
"config": {
|
|
"script": "\tself.view.custom.expanded \u003d not self.view.custom.expanded"
|
|
},
|
|
"scope": "G",
|
|
"type": "script"
|
|
}
|
|
}
|
|
},
|
|
"meta": {
|
|
"name": "Button"
|
|
},
|
|
"propConfig": {
|
|
"props.image.icon.path": {
|
|
"binding": {
|
|
"config": {
|
|
"expression": "if({view.custom.expanded}, \u0027material/expand_less\u0027, \u0027material/expand_more\u0027)"
|
|
},
|
|
"type": "expr"
|
|
}
|
|
}
|
|
},
|
|
"props": {
|
|
"image": {
|
|
"icon": {}
|
|
},
|
|
"primary": false,
|
|
"style": {
|
|
"classes": "Input/Button/Secondary_minimal"
|
|
},
|
|
"text": ""
|
|
},
|
|
"type": "ia.input.button"
|
|
}
|
|
],
|
|
"meta": {
|
|
"name": "FlexContainer"
|
|
},
|
|
"position": {
|
|
"grow": 1,
|
|
"shrink": 0
|
|
},
|
|
"props": {
|
|
"justify": "flex-end"
|
|
},
|
|
"type": "ia.container.flex"
|
|
}
|
|
],
|
|
"meta": {
|
|
"name": "FlexContainer Sites"
|
|
},
|
|
"position": {
|
|
"basis": "26px",
|
|
"shrink": 0
|
|
},
|
|
"type": "ia.container.flex"
|
|
},
|
|
{
|
|
"children": [
|
|
{
|
|
"children": [
|
|
{
|
|
"meta": {
|
|
"name": "Label"
|
|
},
|
|
"position": {
|
|
"basis": "125px",
|
|
"shrink": 0
|
|
},
|
|
"props": {
|
|
"style": {
|
|
"classes": "Framework/Card/Label Text/RightAlign_with_Padding",
|
|
"paddingLeft": "5px"
|
|
},
|
|
"text": "Site to Add:"
|
|
},
|
|
"type": "ia.display.label"
|
|
},
|
|
{
|
|
"meta": {
|
|
"name": "label_LeftAlign"
|
|
},
|
|
"position": {
|
|
"grow": 1
|
|
},
|
|
"propConfig": {
|
|
"props.params.text": {
|
|
"binding": {
|
|
"config": {
|
|
"path": "view.custom.new_site_to_add"
|
|
},
|
|
"type": "property"
|
|
}
|
|
}
|
|
},
|
|
"props": {
|
|
"path": "Objects/Templates/Labels/label_LeftAlign",
|
|
"style": {
|
|
"classes": "Framework/Card/Value"
|
|
}
|
|
},
|
|
"type": "ia.display.view"
|
|
},
|
|
{
|
|
"events": {
|
|
"component": {
|
|
"onActionPerformed": {
|
|
"config": {
|
|
"script": "\t# show confirm dialog for user before adding site\n\tself.show_confirm_dialog()\n"
|
|
},
|
|
"scope": "G",
|
|
"type": "script"
|
|
}
|
|
}
|
|
},
|
|
"meta": {
|
|
"name": "Button Add New Site",
|
|
"tooltip": {
|
|
"location": "bottom",
|
|
"style": {
|
|
"whiteSpace": "pre"
|
|
}
|
|
}
|
|
},
|
|
"position": {
|
|
"shrink": 0
|
|
},
|
|
"propConfig": {
|
|
"meta.tooltip.enabled": {
|
|
"binding": {
|
|
"config": {
|
|
"path": "this.props.enabled"
|
|
},
|
|
"type": "property"
|
|
}
|
|
},
|
|
"meta.tooltip.text": {
|
|
"binding": {
|
|
"config": {
|
|
"expression": "stringFormat(\u0027Add %s site folder to the image and source buckets:\\n[%s, %s]\u0027,\r\n\t{view.custom.new_site_to_add},{view.custom.stage_config.repo_bucket},\r\n\t{view.custom.stage_config.source_bucket})"
|
|
},
|
|
"type": "expr"
|
|
}
|
|
},
|
|
"props.enabled": {
|
|
"binding": {
|
|
"config": {
|
|
"expression": "!isNull({view.custom.new_site_to_add})\r\n\u0026\u0026len({view.custom.new_site_to_add})\r\n\u0026\u0026{view.custom.new_site_is_not_in_S3}\r\n\u0026\u0026{view.custom.developer_user}"
|
|
},
|
|
"type": "expr"
|
|
}
|
|
}
|
|
},
|
|
"props": {
|
|
"image": {
|
|
"icon": {
|
|
"path": "material/library_add"
|
|
}
|
|
},
|
|
"style": {
|
|
"margin": "2px"
|
|
},
|
|
"text": "Add Site"
|
|
},
|
|
"scripts": {
|
|
"customMethods": [
|
|
{
|
|
"name": "show_success_dialog",
|
|
"params": [
|
|
"msg\u003dNone"
|
|
],
|
|
"script": "\t# ~~ 13 PARAMETERS ~~\n\t# state\t\t\t\t\t(default \u003d info) empty string uses generic gray styling\n\t# title \t\t\t\t(default \u003d Alert Title) empty string sets the title visibility to false\n\t# message \t\t\t\t(default \u003d Alert message goes here.)\n\t# show close button\t\t(default \u003d true) boolean\n\t# btn text primary\t\t(default \u003d \"Primary\")\n\t# btn text secondary\t(default \u003d \"Secondary\")\n\t# btn icon primary \t\t(default \u003d chevron_right) do not include \u0027material/\u0027 in the path, just the icon name\n\t# btn icon secondary \t(default \u003d \"\") do not include \u0027material/\u0027 in the path, just the icon name\n\t# btn icon alignment\t(default \u003d \"right\") left or right\n\t# btn primary action\t(default \u003d \"\") add message handlers on this button to enable other script actions\n\t# btn secondary action\t(default \u003d \"\") add message handlers on this button to enable other script actions\n\t# btn close action\t\t(default \u003d \"\") add message handlers on this icon to enable other script actions\n\t# payload\t\t\t\t(default \u003d {}) add a payload here to return to the target message handler\n\t\n\tAlerts.showAlert(\n\t\t\"success\", \n\t\t\"New Site Added\", \n\t\tmsg, \n\t\t\"true\",\n\t\t\"OK\", \n\t\t\"CLOSE\", \n\t\t\"\", \n\t\t\"\", \n\t\t\"left\", \n\t\t\"closePopup\", \n\t\t\"closePopup\", \n\t\t\"closePopup\",\n\t\t{}\n\t)\n\t\t\t\t\t"
|
|
},
|
|
{
|
|
"name": "show_warning_dialog",
|
|
"params": [
|
|
"msg\u003dNone"
|
|
],
|
|
"script": "\t# ~~ 13 PARAMETERS ~~\n\t# state\t\t\t\t\t(default \u003d info) empty string uses generic gray styling\n\t# title \t\t\t\t(default \u003d Alert Title) empty string sets the title visibility to false\n\t# message \t\t\t\t(default \u003d Alert message goes here.)\n\t# show close button\t\t(default \u003d true) boolean\n\t# btn text primary\t\t(default \u003d \"Primary\")\n\t# btn text secondary\t(default \u003d \"Secondary\")\n\t# btn icon primary \t\t(default \u003d chevron_right) do not include \u0027material/\u0027 in the path, just the icon name\n\t# btn icon secondary \t(default \u003d \"\") do not include \u0027material/\u0027 in the path, just the icon name\n\t# btn icon alignment\t(default \u003d \"right\") left or right\n\t# btn primary action\t(default \u003d \"\") add message handlers on this button to enable other script actions\n\t# btn secondary action\t(default \u003d \"\") add message handlers on this button to enable other script actions\n\t# btn close action\t\t(default \u003d \"\") add message handlers on this icon to enable other script actions\n\t# payload\t\t\t\t(default \u003d {}) add a payload here to return to the target message handler\n\t\n\tAlerts.showAlert(\n\t\t\"warning\", \n\t\t\"New Site NOT Added\", \n\t\tmsg, \n\t\t\"true\",\n\t\t\"OK\", \n\t\t\"CLOSE\", \n\t\t\"\", \n\t\t\"\", \n\t\t\"left\", \n\t\t\"closePopup\", \n\t\t\"closePopup\", \n\t\t\"closePopup\",\n\t\t{}\n\t)\n\t\t\t\t\t"
|
|
},
|
|
{
|
|
"name": "show_error_dialog",
|
|
"params": [
|
|
"msg\u003dNone"
|
|
],
|
|
"script": "\t# ~~ 13 PARAMETERS ~~\n\t# state\t\t\t\t\t(default \u003d info) empty string uses generic gray styling\n\t# title \t\t\t\t(default \u003d Alert Title) empty string sets the title visibility to false\n\t# message \t\t\t\t(default \u003d Alert message goes here.)\n\t# show close button\t\t(default \u003d true) boolean\n\t# btn text primary\t\t(default \u003d \"Primary\")\n\t# btn text secondary\t(default \u003d \"Secondary\")\n\t# btn icon primary \t\t(default \u003d chevron_right) do not include \u0027material/\u0027 in the path, just the icon name\n\t# btn icon secondary \t(default \u003d \"\") do not include \u0027material/\u0027 in the path, just the icon name\n\t# btn icon alignment\t(default \u003d \"right\") left or right\n\t# btn primary action\t(default \u003d \"\") add message handlers on this button to enable other script actions\n\t# btn secondary action\t(default \u003d \"\") add message handlers on this button to enable other script actions\n\t# btn close action\t\t(default \u003d \"\") add message handlers on this icon to enable other script actions\n\t# payload\t\t\t\t(default \u003d {}) add a payload here to return to the target message handler\n\t\n\tAlerts.showAlert(\n\t\t\"error\", \n\t\t\"New Site Add Error!\", \n\t\tmsg, \n\t\t\"true\",\n\t\t\"OK\", \n\t\t\"CLOSE\", \n\t\t\"\", \n\t\t\"\", \n\t\t\"left\", \n\t\t\"closePopup\", \n\t\t\"closePopup\", \n\t\t\"closePopup\",\n\t\t{}\n\t)\n\t\t\t\t\t"
|
|
},
|
|
{
|
|
"name": "show_confirm_dialog",
|
|
"params": [
|
|
"payload\u003dNone"
|
|
],
|
|
"script": "\t# ~~ 13 PARAMETERS ~~\n\t# state\t\t\t\t\t(default \u003d info) empty string uses generic gray styling\n\t# title \t\t\t\t(default \u003d Alert Title) empty string sets the title visibility to false\n\t# message \t\t\t\t(default \u003d Alert message goes here.)\n\t# show close button\t\t(default \u003d true) boolean\n\t# btn text primary\t\t(default \u003d \"Primary\")\n\t# btn text secondary\t(default \u003d \"Secondary\")\n\t# btn icon primary \t\t(default \u003d chevron_right) do not include \u0027material/\u0027 in the path, just the icon name\n\t# btn icon secondary \t(default \u003d \"\") do not include \u0027material/\u0027 in the path, just the icon name\n\t# btn icon alignment\t(default \u003d \"right\") left or right\n\t# btn primary action\t(default \u003d \"\") add message handlers on this button to enable other script actions\n\t# btn secondary action\t(default \u003d \"\") add message handlers on this button to enable other script actions\n\t# btn close action\t\t(default \u003d \"\") add message handlers on this icon to enable other script actions\n\t# payload\t\t\t\t(default \u003d {}) add payload of data to pass to the popup\n\tmsg \u003d (\u0027Are you sure you want to add %s site to S3? \u0027\n\t\t\u0027\\nThis will create a new folder in the in each of the image repo and source file S3 buckets\u0027) % (\n\t\tself.view.custom.new_site_to_add)\n\tpayload \u003d {}\t\t\n\tAlerts.showAlert(\n\t\t\"info\", \n\t\t\"Add New Site to S3?\", \n\t\tmsg, \n\t\t\"true\",\n\t\t\"Continue\", \n\t\t\"Cancel\", \n\t\t\"library_add\", \n\t\t\"\", \n\t\t\"left\", \n\t\t\"confirm_add_new_site\", \n\t\t\"closePopup\", \n\t\t\"closePopup\",\n\t\tpayload\n\t)\n\t\t\t"
|
|
},
|
|
{
|
|
"name": "update_bindings",
|
|
"params": [],
|
|
"script": "\t\"\"\"\n\t\tAfter data saved to S3, refresh session and view bindings\n\t\"\"\"\n\tself.view.refreshBinding(\u0027custom.enabled_whids\u0027)\n\tself.view.refreshBinding(\u0027custom.whids_in_s3\u0027)\n\tproject_table \u003d self.parent.parent.getChild(\"FlexContainer Tables\").getChild(\"FlexContainer Projects\").getChild(\"Table\")\n\tproject_table.refreshBinding(\u0027props.data\u0027)\n\tsystem.perspective.sendMessage(\u0027update_enabled_whids\u0027, {}, scope\u003d\u0027session\u0027)\n\tself.view.custom.new_site_to_add \u003d None\n\tself.view.custom.loading \u003d False\n\t\t"
|
|
},
|
|
{
|
|
"name": "add_new_site",
|
|
"params": [],
|
|
"script": "\t\"\"\"\n\t\tCall AWS.s3.S3Manager.add_new_site() method with user selections\n\t\"\"\"\n\tfrom AWS.s3 import S3Manager\n\tfrom pprint import pformat\n\tfrom helper.helper import sanitize_tree\n\t\n\tapi_region_name \u003d self.view.custom.api_region_name\n\tusername \u003d self.session.props.auth.user.userName\n\tsite \u003d self.view.custom.new_site_to_add\n\tself.view.custom.loading \u003d True\n\n\ts3m \u003d S3Manager(\u0027prod\u0027, api_region_name, username)\n\t# Setting `bucket` \u003d \u0027both\u0027 will add the site folder to both the image and source buckets\n\tbucket \u003d \u0027both\u0027\n\toperation \u003d \u0027add_new_site\u0027\n\tparams \u003d {\u0027site\u0027: site, \u0027bucket\u0027: bucket}\n\ttry:\n\t\tresp \u003d getattr(s3m, operation)(**params)\n\t\tmsg \u003d pformat(sanitize_tree(resp))\n\t\tsystem.perspective.print(msg)\n\t\tresp_code \u003d resp.get(\u0027code\u0027, None)\n\t\tif (resp_code and resp_code !\u003d 200) or (not resp_code and \u0027message\u0027 in resp):\n\t\t\t# \u0027code\u0027 in resp indicates API encountered and returned an error\n\t\t\tself.show_error_dialog(msg)\n\t\t\tself.view.custom.loading \u003d False\n\t\telse:\n\t\t\tself.show_success_dialog(msg)\n\t\t\tself.update_bindings()\n\texcept:\n\t\timport traceback\n\t\tmsg \u003d \u0027Error executing %s operation! \\nError: %s\u0027 % (\n\t\t\t\toperation, traceback.format_exc())\n\t\tsystem.perspective.print(msg)\n\t\tself.view.custom.loading \u003d False\n\t\tself.show_error_dialog(msg)\n\t"
|
|
}
|
|
],
|
|
"extensionFunctions": null,
|
|
"messageHandlers": [
|
|
{
|
|
"messageType": "confirm_add_new_site",
|
|
"pageScope": false,
|
|
"script": "\tsystem.perspective.closePopup(\u0027alertDialog\u0027)\n\t# call the add_new_site custom method\n\tself.add_new_site()\n\t\t\t",
|
|
"sessionScope": true,
|
|
"viewScope": true
|
|
}
|
|
]
|
|
},
|
|
"type": "ia.input.button"
|
|
}
|
|
],
|
|
"meta": {
|
|
"name": "FlexContainer Add New Site"
|
|
},
|
|
"position": {
|
|
"basis": "32px",
|
|
"shrink": 0
|
|
},
|
|
"propConfig": {
|
|
"position.display": {
|
|
"binding": {
|
|
"config": {
|
|
"expression": "{view.custom.developer_user}\r\n\u0026\u0026!isNull({view.custom.new_site_to_add})\r\n\u0026\u0026{view.custom.new_site_is_not_in_S3}"
|
|
},
|
|
"type": "expr"
|
|
}
|
|
}
|
|
},
|
|
"type": "ia.container.flex"
|
|
},
|
|
{
|
|
"children": [
|
|
{
|
|
"children": [
|
|
{
|
|
"events": {
|
|
"component": {
|
|
"onSelectionChange": {
|
|
"config": {
|
|
"script": "\t# validate the selection data is not null\n\tif self.props.selection.data:\n\t\tproject \u003d self.props.selection.data[0].Project\n\t\tif getattr(project, \u0027value\u0027, None):\n\t\t\t# if this returns something, the row is styled, grab the value\n\t\t\tproject \u003d project.get(\u0027value\u0027)\n\t\tproject_site \u003d project.replace(\"_SCADA\", \"\")\n\t\tself.view.custom.new_site_to_add \u003d project_site\n"
|
|
},
|
|
"scope": "G",
|
|
"type": "script"
|
|
}
|
|
}
|
|
},
|
|
"meta": {
|
|
"name": "Table"
|
|
},
|
|
"position": {
|
|
"basis": "200px",
|
|
"shrink": 0
|
|
},
|
|
"propConfig": {
|
|
"props.data": {
|
|
"binding": {
|
|
"config": {
|
|
"expression": "toStr({view.custom.enabled_whids})+toStr({view.custom.whids_in_s3})"
|
|
},
|
|
"transforms": [
|
|
{
|
|
"code": "\tenabled_whids \u003d self.view.custom.enabled_whids\n\twhids_in_s3 \u003d self.view.custom.whids_in_s3\n\tdata \u003d [{\u0027Project\u0027: x + \u0027_SCADA\u0027} for x in enabled_whids]\n\tfor row in data:\n\t\tproject \u003d row[\u0027Project\u0027]\n\t\twhid \u003d project.replace(\u0027_SCADA\u0027,\u0027\u0027)\n\t\tif whid not in whids_in_s3:\n\t\t\tstyle \u003d {\u0027backgroundColor\u0027: \u0027#FFFF00\u0027}\n\t\t\trow[\u0027Project\u0027] \u003d {\u0027value\u0027: project, \u0027style\u0027: style}\n\treturn data",
|
|
"type": "script"
|
|
}
|
|
],
|
|
"type": "expr"
|
|
}
|
|
},
|
|
"props.filter.enabled": {
|
|
"onChange": {
|
|
"enabled": null,
|
|
"script": "\tif not getattr(currentValue, \u0027value\u0027, None):\n\t\t# clear filter text when filter is disabled\n\t\tself.props.filter.text \u003d \u0027\u0027\n\t\t"
|
|
}
|
|
}
|
|
},
|
|
"props": {
|
|
"columns": [
|
|
{
|
|
"align": "center",
|
|
"boolean": "checkbox",
|
|
"dateFormat": "MM/DD/YYYY",
|
|
"editable": false,
|
|
"field": "Project",
|
|
"filter": {
|
|
"boolean": {
|
|
"condition": ""
|
|
},
|
|
"date": {
|
|
"condition": "",
|
|
"value": ""
|
|
},
|
|
"enabled": false,
|
|
"number": {
|
|
"condition": "",
|
|
"value": ""
|
|
},
|
|
"string": {
|
|
"condition": "",
|
|
"value": ""
|
|
},
|
|
"visible": "on-hover"
|
|
},
|
|
"footer": {
|
|
"align": "center",
|
|
"justify": "left",
|
|
"style": {
|
|
"classes": ""
|
|
},
|
|
"title": ""
|
|
},
|
|
"header": {
|
|
"align": "center",
|
|
"justify": "center",
|
|
"style": {
|
|
"classes": ""
|
|
},
|
|
"title": "Child Project"
|
|
},
|
|
"justify": "center",
|
|
"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": true,
|
|
"sort": "none",
|
|
"sortable": true,
|
|
"strictWidth": false,
|
|
"style": {
|
|
"classes": ""
|
|
},
|
|
"toggleSwitch": {
|
|
"color": {
|
|
"selected": "",
|
|
"unselected": ""
|
|
}
|
|
},
|
|
"viewParams": {},
|
|
"viewPath": "",
|
|
"visible": true,
|
|
"width": ""
|
|
}
|
|
],
|
|
"style": {
|
|
"margin": "5px"
|
|
}
|
|
},
|
|
"type": "ia.display.table"
|
|
}
|
|
],
|
|
"meta": {
|
|
"name": "FlexContainer Projects"
|
|
},
|
|
"position": {
|
|
"basis": "50%",
|
|
"grow": 1
|
|
},
|
|
"props": {
|
|
"direction": "column"
|
|
},
|
|
"type": "ia.container.flex"
|
|
},
|
|
{
|
|
"children": [
|
|
{
|
|
"meta": {
|
|
"name": "Table"
|
|
},
|
|
"position": {
|
|
"basis": "200px",
|
|
"shrink": 0
|
|
},
|
|
"propConfig": {
|
|
"props.data": {
|
|
"binding": {
|
|
"config": {
|
|
"path": "view.custom.whids_in_s3"
|
|
},
|
|
"transforms": [
|
|
{
|
|
"code": "\treturn [{\u0027WHID\u0027: x} for x in value]",
|
|
"type": "script"
|
|
}
|
|
],
|
|
"type": "property"
|
|
}
|
|
},
|
|
"props.filter.enabled": {
|
|
"onChange": {
|
|
"enabled": null,
|
|
"script": "\tif not getattr(currentValue, \u0027value\u0027, None):\n\t\t# clear filter text when filter is disabled\n\t\tself.props.filter.text \u003d \u0027\u0027\n\t\t"
|
|
}
|
|
}
|
|
},
|
|
"props": {
|
|
"columns": [
|
|
{
|
|
"align": "center",
|
|
"boolean": "checkbox",
|
|
"dateFormat": "MM/DD/YYYY",
|
|
"editable": false,
|
|
"field": "WHID",
|
|
"filter": {
|
|
"boolean": {
|
|
"condition": ""
|
|
},
|
|
"date": {
|
|
"condition": "",
|
|
"value": ""
|
|
},
|
|
"enabled": false,
|
|
"number": {
|
|
"condition": "",
|
|
"value": ""
|
|
},
|
|
"string": {
|
|
"condition": "",
|
|
"value": ""
|
|
},
|
|
"visible": "on-hover"
|
|
},
|
|
"footer": {
|
|
"align": "center",
|
|
"justify": "left",
|
|
"style": {
|
|
"classes": ""
|
|
},
|
|
"title": ""
|
|
},
|
|
"header": {
|
|
"align": "center",
|
|
"justify": "center",
|
|
"style": {
|
|
"classes": ""
|
|
},
|
|
"title": "FC"
|
|
},
|
|
"justify": "center",
|
|
"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": true,
|
|
"sort": "none",
|
|
"sortable": true,
|
|
"strictWidth": false,
|
|
"style": {
|
|
"classes": ""
|
|
},
|
|
"toggleSwitch": {
|
|
"color": {
|
|
"selected": "",
|
|
"unselected": ""
|
|
}
|
|
},
|
|
"viewParams": {},
|
|
"viewPath": "",
|
|
"visible": true,
|
|
"width": ""
|
|
}
|
|
],
|
|
"style": {
|
|
"margin": "5px"
|
|
}
|
|
},
|
|
"type": "ia.display.table"
|
|
}
|
|
],
|
|
"meta": {
|
|
"name": "FlexContainer Site Folders"
|
|
},
|
|
"position": {
|
|
"basis": "50%",
|
|
"grow": 1
|
|
},
|
|
"props": {
|
|
"direction": "column"
|
|
},
|
|
"type": "ia.container.flex"
|
|
}
|
|
],
|
|
"meta": {
|
|
"name": "FlexContainer Tables"
|
|
},
|
|
"type": "ia.container.flex"
|
|
}
|
|
],
|
|
"meta": {
|
|
"name": "FlexContainer Projects vs Folders"
|
|
},
|
|
"propConfig": {
|
|
"position.display": {
|
|
"binding": {
|
|
"config": {
|
|
"path": "view.custom.expanded"
|
|
},
|
|
"type": "property"
|
|
}
|
|
}
|
|
},
|
|
"props": {
|
|
"direction": "column"
|
|
},
|
|
"type": "ia.container.flex"
|
|
}
|
|
],
|
|
"meta": {
|
|
"name": "FlexContainer"
|
|
},
|
|
"position": {
|
|
"basis": "100%",
|
|
"grow": 1
|
|
},
|
|
"props": {
|
|
"direction": "column"
|
|
},
|
|
"type": "ia.container.flex"
|
|
}
|
|
],
|
|
"meta": {
|
|
"name": "root"
|
|
},
|
|
"props": {
|
|
"direction": "column"
|
|
},
|
|
"type": "ia.container.flex"
|
|
}
|
|
} |