File tree Expand file tree Collapse file tree 1 file changed +13
-0
lines changed Expand file tree Collapse file tree 1 file changed +13
-0
lines changed Original file line number Diff line number Diff line change @@ -2,6 +2,7 @@ import { CommandHandler } from '@/commands/command-handler';
2
2
import { AlertService } from '@/services/alert.service' ;
3
3
import { BlogExportApi } from '@/services/blog-export.api' ;
4
4
import { BlogExportProvider } from '@/tree-view-providers/blog-export-provider' ;
5
+ import { MessageItem , window } from 'vscode' ;
5
6
6
7
export class CreateBlogExportCommandHandler extends CommandHandler {
7
8
static readonly commandName = 'vscode-cnb.blog-export.create' ;
@@ -13,6 +14,8 @@ export class CreateBlogExportCommandHandler extends CommandHandler {
13
14
}
14
15
15
16
async handle ( ) : Promise < void > {
17
+ if ( ! ( await this . confirm ( ) ) ) return ;
18
+
16
19
if (
17
20
( await this . blogExportApi . create ( ) . catch ( ( e : unknown ) => {
18
21
AlertService . httpError ( typeof e === 'object' && e ? e : { } , { message : '创建博客备份失败' } ) ;
@@ -21,4 +24,14 @@ export class CreateBlogExportCommandHandler extends CommandHandler {
21
24
)
22
25
await BlogExportProvider . optionalInstance ?. refreshRecords ( ) ;
23
26
}
27
+
28
+ private async confirm ( ) : Promise < boolean > {
29
+ const items : MessageItem [ ] = [ { title : '确定' , isCloseAffordance : false } ] ;
30
+ const result = await window . showInformationMessage (
31
+ '确定要创建备份吗?' ,
32
+ { modal : true , detail : '一天可以创建一次备份' } ,
33
+ ...items
34
+ ) ;
35
+ return result != null ;
36
+ }
24
37
}
You can’t perform that action at this time.
0 commit comments