Skip to content

Commit

Permalink
fixed reloading reports table
Browse files Browse the repository at this point in the history
  • Loading branch information
d-linko committed Feb 20, 2024
1 parent 4a447d9 commit 51c1c21
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions anms-ui/public/app/components/management/agents/reports.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@

<template>
<div>
{{ selected }}
<h5>Reports sent:</h5>
<div v-if="loading"
class="spinner-border text-primary"
Expand Down Expand Up @@ -45,27 +46,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

0 comments on commit 51c1c21

Please sign in to comment.