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';
22import { AlertService } from '@/services/alert.service' ;
33import { BlogExportApi } from '@/services/blog-export.api' ;
44import { BlogExportProvider } from '@/tree-view-providers/blog-export-provider' ;
5+ import { MessageItem , window } from 'vscode' ;
56
67export class CreateBlogExportCommandHandler extends CommandHandler {
78 static readonly commandName = 'vscode-cnb.blog-export.create' ;
@@ -13,6 +14,8 @@ export class CreateBlogExportCommandHandler extends CommandHandler {
1314 }
1415
1516 async handle ( ) : Promise < void > {
17+ if ( ! ( await this . confirm ( ) ) ) return ;
18+
1619 if (
1720 ( await this . blogExportApi . create ( ) . catch ( ( e : unknown ) => {
1821 AlertService . httpError ( typeof e === 'object' && e ? e : { } , { message : '创建博客备份失败' } ) ;
@@ -21,4 +24,14 @@ export class CreateBlogExportCommandHandler extends CommandHandler {
2124 )
2225 await BlogExportProvider . optionalInstance ?. refreshRecords ( ) ;
2326 }
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+ }
2437}
You can’t perform that action at this time.
0 commit comments