File tree 3 files changed +32
-5
lines changed
3 files changed +32
-5
lines changed Original file line number Diff line number Diff line change 282
282
"errorLogStatusUpdate" : " Error updating log status." ,
283
283
"errorResolveLogs" : " Error resolving %{count} log. | Error resolving %{count} logs." ,
284
284
"errorUnresolveLogs" : " Error unresolving %{count} log. | Error unresolving %{count} logs." ,
285
+ "errorDownloadEventEntry" : " Error download event log entry." ,
285
286
"successDelete" : " Successfully deleted %{count} log. | Successfully deleted %{count} logs." ,
286
287
"successResolveLogs" : " Successfully resolved %{count} log. | Successfully resolved %{count} logs." ,
287
288
"successUnresolveLogs" : " Successfully unresolved %{count} log. | Successfully unresolved %{count} logs."
Original file line number Diff line number Diff line change @@ -220,6 +220,22 @@ const EventLogStore = {
220
220
throw new Error ( i18n . t ( 'pageEventLogs.toast.errorLogStatusUpdate' ) ) ;
221
221
} ) ;
222
222
} ,
223
+ async downloadEntry ( _ , uri ) {
224
+ return await api
225
+ . get ( uri )
226
+ . then ( ( response ) => {
227
+ const blob = new Blob ( [ response . data ] , {
228
+ type : response . headers [ 'content-type' ] ,
229
+ } ) ;
230
+ return blob ;
231
+ } )
232
+ . catch ( ( error ) => {
233
+ console . log ( error ) ;
234
+ throw new Error (
235
+ i18n . t ( 'pageEventLogs.toast.errorDownloadEventEntry' ) ,
236
+ ) ;
237
+ } ) ;
238
+ } ,
223
239
} ,
224
240
} ;
225
241
Original file line number Diff line number Diff line change 151
151
</dl >
152
152
</b-col >
153
153
<b-col class =" text-nowrap" >
154
- <b-button
155
- class =" btn btn-secondary float-right"
156
- :href =" item.additionalDataUri"
157
- target =" _blank"
158
- >
154
+ <b-button @click =" downloadEntry(item.additionalDataUri)" >
159
155
<icon-download />{{ $t('pageEventLogs.additionalDataUri') }}
160
156
</b-button >
161
157
</b-col >
@@ -471,6 +467,20 @@ export default {
471
467
});
472
468
},
473
469
methods: {
470
+ downloadEntry (uri ) {
471
+ let filename = uri? .split (' LogServices/' )? .[1 ];
472
+ filename .replace (RegExp (' /' , ' g' ), ' _' );
473
+ this .$store
474
+ .dispatch (' eventLog/downloadEntry' , uri)
475
+ .then ((blob ) => {
476
+ const link = document .createElement (' a' );
477
+ link .href = URL .createObjectURL (blob);
478
+ link .download = filename;
479
+ link .click ();
480
+ URL .revokeObjectURL (link .href );
481
+ })
482
+ .catch (({ message }) => this .errorToast (message));
483
+ },
474
484
changelogStatus (row ) {
475
485
this .$store
476
486
.dispatch (' eventLog/updateEventLogStatus' , {
You can’t perform that action at this time.
0 commit comments