提交 9b4c2b5a 编写于 作者: J Johannes Rieken

perf - polish profile, create issue, restart flow

上级 c6d715e4
......@@ -181,15 +181,28 @@ class StartupProfiler implements IWorkbenchContribution {
secondaryButton: localize('prof.restart', "Restart")
});
let createIssue = TPromise.as<void>(void 0);
if (primaryButton) {
const action = this._instantiationService.createInstance(ReportPerformanceIssueAction, ReportPerformanceIssueAction.ID, ReportPerformanceIssueAction.LABEL);
createIssue = action.run(`:warning: Make sure to **attach** these files: :warning:\n${files.map(file => `-\`${join(profileStartup.dir, file)}\``).join('\n')}`).then(() => {
return this._windowsService.showItemInFolder(join(profileStartup.dir, files[0]));
TPromise.join<any>([
this._windowsService.showItemInFolder(join(profileStartup.dir, files[0])),
action.run(`:warning: Make sure to **attach** these files: :warning:\n${files.map(file => `-\`${join(profileStartup.dir, file)}\``).join('\n')}`)
]).then(() => {
// keep window stable until restart is selected
this._messageService.confirm({
type: 'info',
message: localize('prof.thanks', "Thanks for helping us."),
detail: localize('prof.detail.restart', "A final restart is required to continue to use '{0}'. Again, thank you for your contribution.", this._environmentService.appNameLong),
primaryButton: localize('prof.restart', "Restart"),
secondaryButton: null
});
// now we are ready to restart
this._windowsService.relaunch({ removeArgs: ['--prof-startup'] });
});
} else {
// simply restart
this._windowsService.relaunch({ removeArgs: ['--prof-startup'] });
}
createIssue.then(() => this._windowsService.relaunch({ removeArgs: ['--prof-startup'] }));
});
});
}
......
......@@ -26,17 +26,24 @@ export class MessageService extends WorkbenchMessageService implements IChoiceSe
}
public confirm(confirmation: IConfirmation): boolean {
if (!confirmation.primaryButton) {
confirmation.primaryButton = nls.localize({ key: 'yesButton', comment: ['&& denotes a mnemonic'] }, "&&Yes");
const buttons: string[] = [];
if (confirmation.primaryButton) {
buttons.push(confirmation.primaryButton);
} else {
buttons.push(nls.localize({ key: 'yesButton', comment: ['&& denotes a mnemonic'] }, "&&Yes"));
}
if (!confirmation.secondaryButton) {
confirmation.secondaryButton = nls.localize('cancelButton', "Cancel");
if (confirmation.secondaryButton) {
buttons.push(confirmation.secondaryButton);
} else if (typeof confirmation.secondaryButton === 'undefined') {
buttons.push(nls.localize('cancelButton', "Cancel"));
}
let opts: Electron.ShowMessageBoxOptions = {
title: confirmation.title,
message: confirmation.message,
buttons: [confirmation.primaryButton, confirmation.secondaryButton],
buttons,
defaultId: 0,
cancelId: 1
};
......@@ -102,4 +109,4 @@ export class MessageService extends WorkbenchMessageService implements IChoiceSe
return label.replace(/&&/g, '&');
}
}
\ No newline at end of file
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册