diff --git a/amp-sql/postgres/Database_Scripts/Views/rpt_view.sql b/amp-sql/postgres/Database_Scripts/Views/rpt_view.sql index 7cc7767..fcc5e6a 100644 --- a/amp-sql/postgres/Database_Scripts/Views/rpt_view.sql +++ b/amp-sql/postgres/Database_Scripts/Views/rpt_view.sql @@ -141,7 +141,7 @@ FROM (((SELECT ts, report_id, - str_value, + COALESCE('''' || str_value ||'''', NULL) as str_value, uint_value, int_value, obj_value, @@ -155,7 +155,7 @@ FROM ari_id FROM report_definition - INNER JOIN vw_tnvc_entries ON report_definition.tnvc_id = vw_tnvc_entries.tnvc_id order by report_id , order_num) AS sel1 + LEFT JOIN vw_tnvc_entries ON report_definition.tnvc_id = vw_tnvc_entries.tnvc_id order by report_id , order_num) AS sel1 INNER JOIN obj_actual_definition ON sel1.ari_id = obj_actual_definition.obj_actual_definition_id) INNER JOIN vw_obj_metadata ON vw_obj_metadata.obj_metadata_id = obj_actual_definition.obj_metadata_id) GROUP BY report_id,ts, diff --git a/anms-core/anms/routes/ARIs/reports.py b/anms-core/anms/routes/ARIs/reports.py index 7382432..4259bfc 100644 --- a/anms-core/anms/routes/ARIs/reports.py +++ b/anms-core/anms/routes/ARIs/reports.py @@ -29,6 +29,7 @@ from fastapi_pagination.ext.async_sqlalchemy import paginate from sqlalchemy import select, and_ from sqlalchemy.engine import Result +import re from anms.components.schemas import ARIs from anms.models.relational import get_async_session, get_session @@ -159,7 +160,7 @@ async def report_ac(agent_id: str, adm: str, report_name: str): for entry in entries: curr_values = [] - string_values = entry.string_values.split(',') if entry.string_values else [] + string_values = list(filter(None, re.split(r",|'(.*?)'", entry.string_values))) if entry.string_values else [] uint_values = entry.uint_values.split(',') if entry.uint_values else [] int_values = entry.int_values.split(',') if entry.int_values else [] real32_values = entry.real32_values.split(',') if entry.real32_values else [] diff --git a/anms-ui/public/app/components/management/agents/reports.vue b/anms-ui/public/app/components/management/agents/reports.vue index 0591738..ed0de04 100644 --- a/anms-ui/public/app/components/management/agents/reports.vue +++ b/anms-ui/public/app/components/management/agents/reports.vue @@ -45,27 +45,34 @@ export default { tableItems: [], title: "", reports: {}, + reportsHeader: {}, loading: true, } }, methods: { async onReportSelect() { this.loading = true; - + this.tableHeaders = []; + this.tableItems = []; if (this.reports[this.selected] == undefined) { this.loading = true; let rpt_name = this.rptts[this.selected].name; let rpt_adm = this.rptts[this.selected].adm; await api.methods.apiEntriesForReport(this.agentName, rpt_adm, rpt_name) .then(res => { - this.reports[this.selected] = res.data; this.processReport(res.data); + this.reports[this.selected] = this.tableItems; + this.reportsHeader[this.selected] = this.tableHeaders; }).catch(error => { // handle error console.error("reports error", error); console.info("error obj:", error); }); + } else{ + this.tableHeaders = this.reportsHeader[this.selected]; + this.tableItems = this.reports[this.selected]; } + this.loading = false; }, processReport(report) { diff --git a/ion/ion-4.1.1-anms-db.patch b/ion/ion-4.1.1-anms-db.patch index b707326..51d701c 100644 --- a/ion/ion-4.1.1-anms-db.patch +++ b/ion/ion-4.1.1-anms-db.patch @@ -278,15 +278,19 @@ diff -ur ion-open-source-4.1.1/nm/mgr/nm_mgr_rx.c ion-open-source-4.1.1_postgres /* Copy the message group to the database tables */ uint32_t incoming_idx = db_incoming_initialize(grp->time, meta.senderEid); int32_t db_status = AMP_OK; -@@ -348,7 +348,7 @@ +@@ -347,10 +347,10 @@ void *mgr_rx_thread(int *running) + case MSG_TYPE_RPT_SET: { msg_rpt_t *rpt_msg = msg_rpt_deserialize(msg_data, &success); - rx_data_rpt(&meta, rpt_msg); +- rx_data_rpt(&meta, rpt_msg); -#ifdef HAVE_MYSQL +#if defined(HAVE_MYSQL) || defined(HAVE_POSTGRESQL) db_insert_msg_rpt_set(incoming_idx, rpt_msg, &db_status); #endif ++ rx_data_rpt(&meta, rpt_msg); msg_rpt_release(rpt_msg, 1); + break; + } @@ -358,7 +358,7 @@ { msg_tbl_t *tbl_msg = msg_tbl_deserialize(msg_data, &success); @@ -3434,4 +3438,4 @@ diff -ur ion-open-source-4.1.1/nm/mgr/nm_mgr_ui.h ion-open-source-4.1.1_postgres + * appropriate formatting to the buffer. The buffer will be appended to be subsequent calls to * ui_printf(), and displayed with ui_display_exec(). The display function can be suppressed * in favor of file logging by calling ui_display_to_file() first. - */ + */ \ No newline at end of file