239 lines
6.9 KiB
Plaintext
239 lines
6.9 KiB
Plaintext
{
|
|
"custom": {
|
|
"api_region_name": "na",
|
|
"loading": false,
|
|
"query_params": {
|
|
"copy_option": null,
|
|
"destination_bucket": null,
|
|
"destination_site": null,
|
|
"destination_view": null,
|
|
"end_time": null,
|
|
"error_occurred": null,
|
|
"operation": null,
|
|
"source_bucket": null,
|
|
"source_site": null,
|
|
"source_view": null,
|
|
"start_time": null,
|
|
"username": ""
|
|
},
|
|
"raw_data": []
|
|
},
|
|
"events": {
|
|
"system": {
|
|
"onStartup": {
|
|
"config": {
|
|
"script": "\tquery_params \u003d self.params.query_params\n\tself.custom.query_params \u003d query_params\n\tsystem.perspective.sendMessage(\u0027refresh_audit_table_data\u0027, scope\u003d\u0027view\u0027)\n\t"
|
|
},
|
|
"scope": "G",
|
|
"type": "script"
|
|
}
|
|
}
|
|
},
|
|
"params": {
|
|
"query_params": {
|
|
"copy_option": null,
|
|
"destination_bucket": null,
|
|
"destination_site": null,
|
|
"destination_view": null,
|
|
"end_time": null,
|
|
"error_occurred": null,
|
|
"operation": null,
|
|
"source_bucket": null,
|
|
"source_site": null,
|
|
"source_view": null,
|
|
"start_time": null,
|
|
"username": ""
|
|
}
|
|
},
|
|
"propConfig": {
|
|
"custom.api_region_name": {
|
|
"binding": {
|
|
"config": {
|
|
"path": "session.custom.aws.prefix"
|
|
},
|
|
"type": "property"
|
|
},
|
|
"persistent": true
|
|
},
|
|
"custom.loading": {
|
|
"persistent": true
|
|
},
|
|
"custom.query_params": {
|
|
"persistent": true
|
|
},
|
|
"custom.raw_data": {
|
|
"persistent": true
|
|
},
|
|
"params.query_params": {
|
|
"paramDirection": "input",
|
|
"persistent": true
|
|
}
|
|
},
|
|
"props": {
|
|
"defaultSize": {
|
|
"width": 1200
|
|
}
|
|
},
|
|
"root": {
|
|
"children": [
|
|
{
|
|
"meta": {
|
|
"name": "Query Params"
|
|
},
|
|
"position": {
|
|
"shrink": 0
|
|
},
|
|
"propConfig": {
|
|
"props.params.params.query_params": {
|
|
"binding": {
|
|
"config": {
|
|
"path": "view.custom.query_params"
|
|
},
|
|
"type": "property"
|
|
}
|
|
}
|
|
},
|
|
"props": {
|
|
"params": {
|
|
"open_expanded": false,
|
|
"params": {},
|
|
"path": "Objects/Templates/S3/Audit/Query_Options",
|
|
"show_box_shadow_on_expanded": true,
|
|
"title": "Query Params",
|
|
"useDefaultHeight": false,
|
|
"useDefaultWidth": false
|
|
},
|
|
"path": "Framework/Card/Card_Collapsible_Transparent"
|
|
},
|
|
"type": "ia.display.view"
|
|
},
|
|
{
|
|
"meta": {
|
|
"name": "Log Table"
|
|
},
|
|
"position": {
|
|
"basis": "100%"
|
|
},
|
|
"propConfig": {
|
|
"props.params.table_data": {
|
|
"binding": {
|
|
"config": {
|
|
"path": "view.custom.raw_data"
|
|
},
|
|
"type": "property"
|
|
}
|
|
},
|
|
"props.params.title": {
|
|
"binding": {
|
|
"config": {
|
|
"expression": "\u0027SCADA S3 Audit Logs - \u0027+\r\nif({view.custom.loading}, \u0027Loading...\u0027, stringFormat(\u0027%d Record(s)\u0027, len({view.custom.raw_data})))"
|
|
},
|
|
"type": "expr"
|
|
}
|
|
}
|
|
},
|
|
"props": {
|
|
"params": {
|
|
"NavigationSettings": {
|
|
"BaseUrl": "/singleMP/main",
|
|
"Column": "mp_name",
|
|
"Enabled": false
|
|
},
|
|
"SelectedRow": [],
|
|
"filters": [],
|
|
"header_order": [
|
|
"timestamp",
|
|
"username",
|
|
"operation",
|
|
{
|
|
"field": "destination_bucket",
|
|
"visible": true
|
|
},
|
|
"destination_site",
|
|
"destination_view",
|
|
{
|
|
"field": "destination_object_key",
|
|
"visible": false
|
|
},
|
|
{
|
|
"field": "destination_version_id",
|
|
"visible": false
|
|
},
|
|
"expires",
|
|
{
|
|
"field": "source_bucket",
|
|
"visible": true
|
|
},
|
|
"source_site",
|
|
"source_view",
|
|
{
|
|
"field": "source_object_key",
|
|
"visible": false
|
|
},
|
|
{
|
|
"field": "source_version_id",
|
|
"visible": false
|
|
},
|
|
{
|
|
"field": "response",
|
|
"visible": false
|
|
},
|
|
"error_occurred",
|
|
{
|
|
"field": "error_message",
|
|
"visible": true
|
|
},
|
|
{
|
|
"field": "audit_id",
|
|
"visible": false
|
|
},
|
|
{
|
|
"field": "copy_option",
|
|
"visible": false
|
|
},
|
|
{
|
|
"field": "ttl",
|
|
"visible": false
|
|
}
|
|
]
|
|
},
|
|
"path": "Objects/Templates/S3/Audit/Log_Table"
|
|
},
|
|
"type": "ia.display.view"
|
|
}
|
|
],
|
|
"meta": {
|
|
"name": "root"
|
|
},
|
|
"props": {
|
|
"direction": "column"
|
|
},
|
|
"scripts": {
|
|
"customMethods": [
|
|
{
|
|
"name": "refresh_audit_table_data",
|
|
"params": [],
|
|
"script": "\t# refresh the audit table query\n\tfrom helper.helper import sanitize_tree\n\tfrom AWS.s3 import S3Manager\n\t\n\tself.view.custom.loading \u003d True\n\tapi_stage \u003d \u0027prod\u0027\n\tusername \u003d self.session.props.auth.user.userName\n\tapi_region_name \u003d self.view.custom.api_region_name\n\ts3m \u003d S3Manager(api_stage, api_region_name, username)\n\t\n\tparams \u003d sanitize_tree(self.view.custom.query_params)\n\tresp \u003d s3m.query_audit_table(return_items_only\u003dTrue, **params)\n\t# sort records in descending order by timestamp (newest first)\n\tself.view.custom.raw_data \u003d sorted(resp, key\u003dlambda d: d[\u0027timestamp\u0027], reverse\u003dTrue)\n\tself.view.custom.loading \u003d False\n\t"
|
|
}
|
|
],
|
|
"extensionFunctions": null,
|
|
"messageHandlers": [
|
|
{
|
|
"messageType": "audit_table_query_params_changed",
|
|
"pageScope": false,
|
|
"script": "\t# update the `view.custom.query_params` object from received payload\n\tfrom helper.helper import sanitize_tree\n\td \u003d sanitize_tree(payload)\n\tdct \u003d sanitize_tree(self.view.custom.query_params)\n\tdct.update(d)\n\tself.view.custom.query_params \u003d dct\n\t",
|
|
"sessionScope": true,
|
|
"viewScope": true
|
|
},
|
|
{
|
|
"messageType": "refresh_audit_table_data",
|
|
"pageScope": false,
|
|
"script": "\t# implement your handler here\n\tself.refresh_audit_table_data()\n\t",
|
|
"sessionScope": true,
|
|
"viewScope": true
|
|
}
|
|
]
|
|
},
|
|
"type": "ia.container.flex"
|
|
}
|
|
} |