in src/views/connectionUI.ts [338:392]
public promptToManageProfiles(): Promise<boolean> {
const self = this;
return new Promise<boolean>((resolve, reject) => {
// Create profile, clear recent connections, edit profiles, or remove profile?
let choices: INameValueChoice[] = [
{ name: LocalizedConstants.CreateProfileLabel, value: ManageProfileTask.Create },
{ name: LocalizedConstants.ClearRecentlyUsedLabel, value: ManageProfileTask.ClearRecentlyUsed},
{ name: LocalizedConstants.EditProfilesLabel, value: ManageProfileTask.Edit},
{ name: LocalizedConstants.RemoveProfileLabel, value: ManageProfileTask.Remove}
];
let question: IQuestion = {
type: QuestionTypes.expand,
name: LocalizedConstants.ManageProfilesPrompt,
message: LocalizedConstants.ManageProfilesPrompt,
choices: choices,
onAnswered: (value) => {
switch (value) {
case ManageProfileTask.Create:
self.connectionManager.onCreateProfile().then(result => {
resolve(result);
});
break;
case ManageProfileTask.ClearRecentlyUsed:
self.promptToClearRecentConnectionsList().then(result => {
if (result) {
self.connectionManager.clearRecentConnectionsList().then(() => {
self.vscodeWrapper.showInformationMessage(LocalizedConstants.msgClearedRecentConnections);
resolve(true);
});
} else {
resolve(false);
}
});
break;
case ManageProfileTask.Edit:
self.vscodeWrapper.executeCommand('workbench.action.openGlobalSettings').then( () => {
resolve(true);
});
break;
case ManageProfileTask.Remove:
self.connectionManager.onRemoveProfile().then(result => {
resolve(result);
});
break;
default:
resolve(false);
break;
}
}
};
this._prompter.promptSingle(question);
});
}