1
1
import { Component , Mixins } from 'vue-property-decorator' ;
2
2
import GlobalMixins from '@/plugins/mixins' ;
3
3
import { BundlePackage } from '@/interface/bundle' ;
4
+ import { SweetAlertOptions } from 'sweetalert2' ;
4
5
5
6
const { ipcRenderer } = window . require ( 'electron' ) ;
6
7
const fs = window . require ( 'fs' ) ;
@@ -53,17 +54,33 @@ export default class BundleMixin extends Mixins(GlobalMixins) {
53
54
} ) ;
54
55
return ;
55
56
}
56
- ipcRenderer . sendSync ( 'zip:uncompress-buffer' , res . data [ 0 ] , this . getBundlePath ( pkg ) ) ;
57
+
58
+ const p = this . getBundlePath ( pkg ) ;
59
+ ipcRenderer . sendSync ( 'zip:uncompress-buffer' , res . data [ 0 ] , p ) ;
57
60
58
61
if ( showNoti ) {
59
- this . $swal ( {
62
+ const option : SweetAlertOptions = {
60
63
icon : 'success' ,
61
64
toast : true ,
62
65
position : 'top-end' ,
63
66
html : this . $t ( 'bundle.store.install-scucess' , pkg . name ) ,
64
67
timer : 3000 ,
65
68
showCloseButton : false ,
66
69
showConfirmButton : false ,
70
+ showCancelButton : true ,
71
+ cancelButtonText : this . $t ( 'close' ) ,
72
+ } ;
73
+
74
+ if ( pkg . page ) {
75
+ option . showConfirmButton = true ;
76
+ option . confirmButtonText = this . $t ( 'bundle.store.move-bundle-page' ) ;
77
+ }
78
+
79
+ this . $swal ( option ) . then ( ( result ) => {
80
+ if ( pkg . page && result . isConfirmed ) {
81
+ this . $emit ( 'close' ) ;
82
+ this . $assign ( `/bundle/${ path . basename ( p ) } /` ) ;
83
+ }
67
84
} ) ;
68
85
}
69
86
}
@@ -88,6 +105,8 @@ export default class BundleMixin extends Mixins(GlobalMixins) {
88
105
timer : 3000 ,
89
106
showCloseButton : false ,
90
107
showConfirmButton : false ,
108
+ showCancelButton : true ,
109
+ cancelButtonText : this . $t ( 'close' ) ,
91
110
html : this . $t ( 'bundle.store.remove-bundle-success' , pkg . name ) ,
92
111
} ) ;
93
112
}
0 commit comments