confirm to reset in the turn off command

This commit is contained in:
Sandeep Somavarapu 2020-05-19 10:34:03 +02:00
parent 6c9f5fa082
commit c8eccf9b16
2 changed files with 17 additions and 16 deletions

View file

@ -1041,17 +1041,27 @@ export class UserDataSyncWorkbenchContribution extends Disposable implements IWo
}
}
}));
this._register(registerAction2(class TurnOffEveryWhereAction extends Action2 {
registerAction2(class extends Action2 {
constructor() {
super({
id: TURN_OFF_EVERYWHERE_SYNC_COMMAND_ID,
title: turnOffSyncCommand.title,
title: localize('workbench.actions.syncData.reset', "Reset Synced Data"),
precondition: CONTEXT_ACCOUNT_STATE.isEqualTo(AccountStatus.Available),
});
}
run(): Promise<any> {
return that.turnOffEveryWhere();
async run(accessor: ServicesAccessor): Promise<void> {
const dialogService = accessor.get(IDialogService);
const result = await dialogService.confirm({
message: localize('reset', "This will clear your synced data from the cloud and stop sync on all your devices."),
title: localize('reset title', "Reset Synced Data"),
type: 'info',
primaryButton: localize('reset button', "Reset"),
});
if (result.confirmed) {
await that.turnOffEveryWhere();
}
}
}));
});
}
private registerConfigureSyncAction(): void {

View file

@ -242,17 +242,8 @@ export class UserDataSyncDataViews extends Disposable {
}
async run(accessor: ServicesAccessor): Promise<void> {
const commandService = accessor.get(ICommandService);
const dialogService = accessor.get(IDialogService);
const result = await dialogService.confirm({
message: localize('reset', "This will clear your synced data from the cloud and stop sync on all your devices."),
title: localize('reset title', "Reset Synced Data"),
type: 'info',
primaryButton: localize('reset button', "Reset"),
});
if (result.confirmed) {
await commandService.executeCommand(TURN_OFF_EVERYWHERE_SYNC_COMMAND_ID);
await view.refresh();
}
await commandService.executeCommand(TURN_OFF_EVERYWHERE_SYNC_COMMAND_ID);
await view.refresh();
}
});
}