Fix BDC remember password and reprompting connection (#7957)

* Fix remember password and reprompting connection

* comment

* Fix to remember password for session

* Fix floating promises
This commit is contained in:
Charles Gagnon
2019-10-29 07:27:31 -07:00
committed by GitHub
parent 789ee4b133
commit d315ccff68
8 changed files with 183 additions and 97 deletions

View File

@@ -20,13 +20,13 @@ import { getControllerEndpoint } from './bigDataCluster/utils';
const localize = nls.loadMessageBundle();
const AddControllerCommand = 'bigDataClusters.command.addController';
const DeleteControllerCommand = 'bigDataClusters.command.deleteController';
const RefreshControllerCommand = 'bigDataClusters.command.refreshController';
const ManageControllerCommand = 'bigDataClusters.command.manageController';
const MountHdfsCommand = 'bigDataClusters.command.mount';
const RefreshMountCommand = 'bigDataClusters.command.refreshmount';
const DeleteMountCommand = 'bigDataClusters.command.deletemount';
export const AddControllerCommand = 'bigDataClusters.command.addController';
export const DeleteControllerCommand = 'bigDataClusters.command.deleteController';
export const RefreshControllerCommand = 'bigDataClusters.command.refreshController';
export const ManageControllerCommand = 'bigDataClusters.command.manageController';
export const MountHdfsCommand = 'bigDataClusters.command.mount';
export const RefreshMountCommand = 'bigDataClusters.command.refreshmount';
export const DeleteMountCommand = 'bigDataClusters.command.deletemount';
const endpointNotFoundError = localize('mount.error.endpointNotFound', "Controller endpoint information was not found");
@@ -51,8 +51,8 @@ function registerCommands(context: vscode.ExtensionContext, treeDataProvider: Co
runThrottledAction(AddControllerCommand, () => addBdcController(treeDataProvider, node));
});
vscode.commands.registerCommand(DeleteControllerCommand, (node: TreeNode) => {
deleteBdcController(treeDataProvider, node);
vscode.commands.registerCommand(DeleteControllerCommand, async (node: TreeNode) => {
await deleteBdcController(treeDataProvider, node);
});
vscode.commands.registerCommand(RefreshControllerCommand, (node: TreeNode) => {
@@ -64,7 +64,7 @@ function registerCommands(context: vscode.ExtensionContext, treeDataProvider: Co
vscode.commands.registerCommand(ManageControllerCommand, async (info: ControllerNode | BdcDashboardOptions) => {
const title: string = `${localize('bdc.dashboard.title', "Big Data Cluster Dashboard -")} ${ControllerNode.toIpAndPort(info.url)}`;
const dashboard: BdcDashboard = new BdcDashboard(title, new BdcDashboardModel(info));
const dashboard: BdcDashboard = new BdcDashboard(title, new BdcDashboardModel(info, treeDataProvider));
dashboard.showDashboard();
});
@@ -80,26 +80,26 @@ function registerCommands(context: vscode.ExtensionContext, treeDataProvider: Co
}
async function mountHdfs(explorerContext?: azdata.ObjectExplorerContext): Promise<void> {
let mountProps = await getMountProps(explorerContext);
const mountProps = await getMountProps(explorerContext);
if (mountProps) {
let dialog = new MountHdfsDialog(new MountHdfsModel(mountProps));
dialog.showDialog();
const dialog = new MountHdfsDialog(new MountHdfsModel(mountProps));
await dialog.showDialog();
}
}
async function refreshMount(explorerContext?: azdata.ObjectExplorerContext): Promise<void> {
let mountProps = await getMountProps(explorerContext);
const mountProps = await getMountProps(explorerContext);
if (mountProps) {
let dialog = new RefreshMountDialog(new RefreshMountModel(mountProps));
dialog.showDialog();
const dialog = new RefreshMountDialog(new RefreshMountModel(mountProps));
await dialog.showDialog();
}
}
async function deleteMount(explorerContext?: azdata.ObjectExplorerContext): Promise<void> {
let mountProps = await getMountProps(explorerContext);
const mountProps = await getMountProps(explorerContext);
if (mountProps) {
let dialog = new DeleteMountDialog(new DeleteMountModel(mountProps));
dialog.showDialog();
const dialog = new DeleteMountDialog(new DeleteMountModel(mountProps));
await dialog.showDialog();
}
}
@@ -169,15 +169,15 @@ async function deleteBdcController(treeDataProvider: ControllerTreeDataProvider,
let result = await vscode.window.showQuickPick(Object.keys(choices), options);
let remove: boolean = !!(result && choices[result]);
if (remove) {
deleteControllerInternal(treeDataProvider, controllerNode);
await deleteControllerInternal(treeDataProvider, controllerNode);
}
return remove;
}
function deleteControllerInternal(treeDataProvider: ControllerTreeDataProvider, controllerNode: ControllerNode): void {
let deleted = treeDataProvider.deleteController(controllerNode.url, controllerNode.auth, controllerNode.username);
async function deleteControllerInternal(treeDataProvider: ControllerTreeDataProvider, controllerNode: ControllerNode): Promise<void> {
const deleted = treeDataProvider.deleteController(controllerNode.url, controllerNode.auth, controllerNode.username);
if (deleted) {
treeDataProvider.saveControllers();
await treeDataProvider.saveControllers();
}
}