Skip to content

Commit

Permalink
29 anms fun dap 002 received reports missing reports (#72)
Browse files Browse the repository at this point in the history
* updated rpt handling to avoid max vect in ion

* fixed reloading reports table

* removing test output

* fixed error in patch

* removed dead code

---------

Co-authored-by: d-linko <[email protected]>
  • Loading branch information
d-linko and d-linko authored Feb 27, 2024
1 parent 8507396 commit 86125da
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 8 deletions.
4 changes: 2 additions & 2 deletions amp-sql/postgres/Database_Scripts/Views/rpt_view.sql
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ FROM
(((SELECT
ts,
report_id,
str_value,
COALESCE('''' || str_value ||'''', NULL) as str_value,
uint_value,
int_value,
obj_value,
Expand All @@ -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,
Expand Down
3 changes: 2 additions & 1 deletion anms-core/anms/routes/ARIs/reports.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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 []
Expand Down
11 changes: 9 additions & 2 deletions anms-ui/public/app/components/management/agents/reports.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
10 changes: 7 additions & 3 deletions ion/ion-4.1.1-anms-db.patch
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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.
*/
*/

0 comments on commit 86125da

Please sign in to comment.