Fix single event entry download
For event entry download, the href not work since the event entry
download only work with header of "Accept: application/octet-stream" or
the default "*/*", change to click function to make it work.
Refer: https://gerrit.openbmc.org/c/openbmc/bmcweb/+/40136
Change-Id: I11051e913bfd71ef081bed93ffcbeeb1edd8c730
Signed-off-by: Sean Zhang <xiazhang@nvidia.com>
diff --git a/src/views/Logs/EventLogs/EventLogs.vue b/src/views/Logs/EventLogs/EventLogs.vue
index e50be81..392125c 100644
--- a/src/views/Logs/EventLogs/EventLogs.vue
+++ b/src/views/Logs/EventLogs/EventLogs.vue
@@ -151,11 +151,7 @@
</dl>
</b-col>
<b-col class="text-nowrap">
- <b-button
- class="btn btn-secondary float-right"
- :href="item.additionalDataUri"
- target="_blank"
- >
+ <b-button @click="downloadEntry(item.additionalDataUri)">
<icon-download />{{ $t('pageEventLogs.additionalDataUri') }}
</b-button>
</b-col>
@@ -474,6 +470,20 @@
});
},
methods: {
+ downloadEntry(uri) {
+ let filename = uri?.split('LogServices/')?.[1];
+ filename.replace(RegExp('/', 'g'), '_');
+ this.$store
+ .dispatch('eventLog/downloadEntry', uri)
+ .then((blob) => {
+ const link = document.createElement('a');
+ link.href = URL.createObjectURL(blob);
+ link.download = filename;
+ link.click();
+ URL.revokeObjectURL(link.href);
+ })
+ .catch(({ message }) => this.errorToast(message));
+ },
changelogStatus(row) {
this.$store
.dispatch('eventLog/updateEventLogStatus', {