Skip to content

Commit 595a5fa

Browse files
Fixed Download Event Logs and Informational Logs (#115)
- Error log download was failing when informational error logs were present. Fixed it in this change. - Defect: https://jazz07.rchland.ibm.com:13443/jazz/web/projects/CSSD#action=com.ibm.team.workitem.viewWorkItem&id=459205 Signed-off-by: Nikhil Ashoka <[email protected]>
1 parent 34907fa commit 595a5fa

File tree

2 files changed

+41
-109
lines changed

2 files changed

+41
-109
lines changed

src/store/modules/Logs/EventLogStore.js

Lines changed: 4 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -260,27 +260,10 @@ const EventLogStore = {
260260
throw new Error(i18n.t('pageEventLogs.toast.errorLogStatusUpdate'));
261261
});
262262
},
263-
async downloadCELogData(_, eventId) {
264-
return await api
265-
.get(
266-
`/redfish/v1/Systems/system/LogServices/CELog/Entries/` +
267-
eventId +
268-
`/OemPelAttachment`
269-
)
270-
.then((response) => {
271-
return response?.data?.Oem?.IBM?.PelJson;
272-
});
273-
},
274-
async downloadEventLogData(_, eventId) {
275-
return await api
276-
.get(
277-
`/redfish/v1/Systems/system/LogServices/EventLog/Entries/` +
278-
eventId +
279-
`/OemPelAttachment`
280-
)
281-
.then((response) => {
282-
return response?.data?.Oem?.IBM?.PelJson;
283-
});
263+
async downloadLogData(_, uri) {
264+
return await api.get(uri + `/OemPelAttachment`).then((response) => {
265+
return response?.data?.Oem?.IBM?.PelJson;
266+
});
284267
},
285268
},
286269
};

src/views/Logs/EventLogs/EventLogs.vue

Lines changed: 37 additions & 88 deletions
Original file line numberDiff line numberDiff line change
@@ -578,7 +578,7 @@ export default {
578578
return this.sortStatus(a, b, key);
579579
}
580580
},
581-
onTableRowAction(action, { id, name, uri }) {
581+
onTableRowAction(action, { uri }) {
582582
if (action === 'delete') {
583583
this.$bvModal
584584
.msgBoxConfirm(this.$tc('pageEventLogs.modal.deleteMessage'), {
@@ -593,27 +593,15 @@ export default {
593593
// download single log
594594
const pelJsonInfo = [];
595595
this.startLoader();
596-
if (name === 'System CE Log Entry') {
597-
this.$store
598-
.dispatch('eventLog/downloadCELogData', id)
599-
.then((returned) => {
600-
pelJsonInfo.push(returned);
601-
})
602-
.finally(() => {
603-
this.downloadFile(pelJsonInfo);
604-
this.endLoader();
605-
});
606-
} else {
607-
this.$store
608-
.dispatch('eventLog/downloadEventLogData', id)
609-
.then((returned) => {
610-
pelJsonInfo.push(returned);
611-
})
612-
.finally(() => {
613-
this.downloadFile(pelJsonInfo);
614-
this.endLoader();
615-
});
616-
}
596+
this.$store
597+
.dispatch('eventLog/downloadLogData', uri)
598+
.then((returned) => {
599+
pelJsonInfo.push(returned);
600+
})
601+
.finally(() => {
602+
this.downloadFile(pelJsonInfo);
603+
this.endLoader();
604+
});
617605
}
618606
},
619607
onBatchAction(action) {
@@ -697,78 +685,39 @@ export default {
697685
let counter = 1;
698686
while (counter <= this.allLogs.length) {
699687
this.startLoader();
700-
if (this.allLogs[counter - 1].name === 'System CE Log Entry') {
701-
await this.$store
702-
.dispatch(
703-
'eventLog/downloadCELogData',
704-
this.allLogs[counter - 1].id
705-
)
706-
.then((returned) => {
707-
pelJsonInfo.push(returned);
708-
counter = counter + 1;
709-
})
710-
.finally(() => {
711-
if (pelJsonInfo.length === this.allLogs.length) {
712-
this.downloadFile(pelJsonInfo);
713-
this.endLoader();
714-
}
715-
});
716-
} else {
717-
await this.$store
718-
.dispatch(
719-
'eventLog/downloadEventLogData',
720-
this.allLogs[counter - 1].id
721-
)
722-
.then((returned) => {
723-
pelJsonInfo.push(returned);
724-
counter = counter + 1;
725-
})
726-
.finally(() => {
727-
if (pelJsonInfo.length === this.allLogs.length) {
728-
this.downloadFile(pelJsonInfo);
729-
this.endLoader();
730-
}
731-
});
732-
}
688+
await this.$store
689+
.dispatch('eventLog/downloadLogData', this.allLogs[counter - 1].uri)
690+
.then((returned) => {
691+
pelJsonInfo.push(returned);
692+
counter = counter + 1;
693+
})
694+
.finally(() => {
695+
if (pelJsonInfo.length === this.allLogs.length) {
696+
this.downloadFile(pelJsonInfo);
697+
this.endLoader();
698+
}
699+
});
733700
}
734701
} else {
735702
// several logs
736703
let counter = 1;
737704
while (counter <= this.selectedRows.length) {
738705
this.startLoader();
739-
if (this.selectedRows[counter - 1].name === 'System CE Log Entry') {
740-
await this.$store
741-
.dispatch(
742-
'eventLog/downloadCELogData',
743-
this.selectedRows[counter - 1].id
744-
)
745-
.then((returned) => {
746-
pelJsonInfo.push(returned);
747-
counter = counter + 1;
748-
})
749-
.finally(() => {
750-
if (pelJsonInfo.length === this.selectedRows.length) {
751-
this.downloadFile(pelJsonInfo);
752-
this.endLoader();
753-
}
754-
});
755-
} else {
756-
await this.$store
757-
.dispatch(
758-
'eventLog/downloadEventLogData',
759-
this.selectedRows[counter - 1].id
760-
)
761-
.then((returned) => {
762-
pelJsonInfo.push(returned);
763-
counter = counter + 1;
764-
})
765-
.finally(() => {
766-
if (pelJsonInfo.length === this.selectedRows.length) {
767-
this.downloadFile(pelJsonInfo);
768-
this.endLoader();
769-
}
770-
});
771-
}
706+
await this.$store
707+
.dispatch(
708+
'eventLog/downloadLogData',
709+
this.selectedRows[counter - 1].uri
710+
)
711+
.then((returned) => {
712+
pelJsonInfo.push(returned);
713+
counter = counter + 1;
714+
})
715+
.finally(() => {
716+
if (pelJsonInfo.length === this.selectedRows.length) {
717+
this.downloadFile(pelJsonInfo);
718+
this.endLoader();
719+
}
720+
});
772721
}
773722
}
774723
},

0 commit comments

Comments
 (0)