Fix node update in bdc dashboard on reconnect (#8138)

* Fix node update in bdc dashboard on reconnect

* Fix no floating promises

* Fix opening from dashboard to always save controller node
This commit is contained in:
Charles Gagnon
2019-10-31 14:42:15 -07:00
committed by GitHub
parent 333f634e94
commit 7569f7fa32
4 changed files with 34 additions and 13 deletions

View File

@@ -311,7 +311,6 @@ export class ClusterController {
this._connectionPromise = this._dialog.showDialog();
}
const controller = await this._connectionPromise;
this._connectionPromise = undefined;
if (controller) {
this._username = controller._username;
this._password = controller._password;
@@ -325,6 +324,8 @@ export class ClusterController {
}
} catch (error) {
throw new ControllerError(error, errorMessage);
} finally {
this._connectionPromise = undefined;
}
}
}

View File

@@ -12,7 +12,7 @@ import { AuthType } from '../constants';
import { ConnectControllerDialog, ConnectControllerModel } from './connectControllerDialog';
import { ControllerTreeDataProvider } from '../tree/controllerTreeDataProvider';
export type BdcDashboardOptions = { url: string, auth: AuthType, username: string, password: string };
export type BdcDashboardOptions = { url: string, auth: AuthType, username: string, password: string, rememberPassword: boolean };
export type BdcErrorType = 'bdcStatus' | 'bdcEndpoints' | 'general';
export type BdcErrorEvent = { error: Error, errorType: BdcErrorType };
@@ -121,12 +121,20 @@ export class BdcDashboardModel {
*/
private async promptReconnect(): Promise<void> {
this._clusterController = await new ConnectControllerDialog(new ConnectControllerModel(this._options)).showDialog();
await this.updateController();
}
private async updateController(): Promise<void> {
if (!this._clusterController) {
return;
}
this._treeDataProvider.addOrUpdateController(
this._clusterController.url,
this._clusterController.authType,
this._clusterController.username,
this._clusterController.password,
/* Remember password */false);
this._options.rememberPassword);
await this._treeDataProvider.saveControllers();
}
}