Fixed the stray validation error message in Resource Deployment wizard (#13747)

* Fixed the stray validation error message

* Removed not working ' with validation
Adding back cancel button disabling
This commit is contained in:
Aasim Khan
2020-12-16 10:32:51 -08:00
committed by GitHub
parent 4575f2bbe6
commit dcb6cddab4
2 changed files with 30 additions and 12 deletions

View File

@@ -7,7 +7,7 @@ import { EOL } from 'os';
import * as nls from 'vscode-nls'; import * as nls from 'vscode-nls';
import { getErrorMessage } from './common/utils'; import { getErrorMessage } from './common/utils';
import { ResourceTypeCategories } from './constants'; import { ResourceTypeCategories } from './constants';
import { FieldType, OptionsType } from './interfaces'; import { FieldType, ITool, OptionsType } from './interfaces';
const localize = nls.loadMessageBundle(); const localize = nls.loadMessageBundle();
export const account = localize('azure.account', "Azure Account"); export const account = localize('azure.account', "Azure Account");
@@ -81,3 +81,7 @@ export const discoverPathOrAdditionalInformationText = localize('resourceDeploym
export const requiredToolsText = localize('resourceDeployment.requiredTools', "Required tools"); export const requiredToolsText = localize('resourceDeployment.requiredTools', "Required tools");
export const installToolsText = localize('resourceDeployment.InstallTools', "Install tools"); export const installToolsText = localize('resourceDeployment.InstallTools', "Install tools");
export const optionsText = localize('resourceDeployment.Options', "Options"); export const optionsText = localize('resourceDeployment.Options', "Options");
export function getToolInstallingMessage(tool: ITool): string {
return localize('deploymentDialog.InstallingTool', "Required tool '{0}' [ {1} ] is being installed now.", tool.displayName, tool.homePage);
}

View File

@@ -31,7 +31,6 @@ export class ToolsAndEulaPage extends ResourceTypePage {
private _tools: ITool[] = []; private _tools: ITool[] = [];
private _eulaValidationSucceeded: boolean = false; private _eulaValidationSucceeded: boolean = false;
private _isInitialized = false; private _isInitialized = false;
private _isDoneButtonEnabled = false;
private _resourceType: ResourceType; private _resourceType: ResourceType;
public set resourceProvider(provider: DeploymentProvider) { public set resourceProvider(provider: DeploymentProvider) {
@@ -58,14 +57,28 @@ export class ToolsAndEulaPage extends ResourceTypePage {
return false; // we return false so that the workflow does not proceed and user gets to either click acceptEulaAndSelect again or cancel return false; // we return false so that the workflow does not proceed and user gets to either click acceptEulaAndSelect again or cancel
} }
if (!this._isDoneButtonEnabled) { for (let i = 0; i < this._tools.length; i++) {
switch (this._tools[i].status) {
case ToolStatus.Installing:
this.wizard.wizardObject.message = {
text: loc.getToolInstallingMessage(this._tools[i]),
level: azdata.window.MessageLevel.Information
};
return false;
case ToolStatus.Installed:
continue;
default:
this.wizard.wizardObject.message = { this.wizard.wizardObject.message = {
text: localize('deploymentDialog.FailedToolsInstallation', "Some tools were still not discovered. Please make sure that they are installed, running and discoverable"), text: localize('deploymentDialog.FailedToolsInstallation', "Some tools were still not discovered. Please make sure that they are installed, running and discoverable"),
level: azdata.window.MessageLevel.Error level: azdata.window.MessageLevel.Error
}; };
return false; return false;
} }
}
this.wizard.wizardObject.message = {
text: ''
};
return true; return true;
}); });
} }
@@ -293,6 +306,7 @@ export class ToolsAndEulaPage extends ResourceTypePage {
this._installationInProgress = true; this._installationInProgress = true;
let tool: ITool; let tool: ITool;
try { try {
this.enableDoneButton(false);
const toolRequirements = this.toolRequirements; const toolRequirements = this.toolRequirements;
let toolsNotInstalled: ITool[] = []; let toolsNotInstalled: ITool[] = [];
for (let i: number = 0; i < toolRequirements.length; i++) { for (let i: number = 0; i < toolRequirements.length; i++) {
@@ -302,7 +316,7 @@ export class ToolsAndEulaPage extends ResourceTypePage {
// Update the informational message // Update the informational message
this.wizard.wizardObject.message = { this.wizard.wizardObject.message = {
level: azdata.window.MessageLevel.Information, level: azdata.window.MessageLevel.Information,
text: localize('deploymentDialog.InstallingTool', "Required tool '{0}' [ {1} ] is being installed now.", tool.displayName, tool.homePage) text: loc.getToolInstallingMessage(tool)
}; };
await this._tools[i].install(); await this._tools[i].install();
if (tool.status === ToolStatus.Installed && toolReq.version && !tool.isSameOrNewerThan(toolReq.version)) { if (tool.status === ToolStatus.Installed && toolReq.version && !tool.isSameOrNewerThan(toolReq.version)) {
@@ -313,9 +327,11 @@ export class ToolsAndEulaPage extends ResourceTypePage {
); );
} }
} else { } else {
if (this._tools[i].status !== ToolStatus.Installed) {
toolsNotInstalled.push(tool); toolsNotInstalled.push(tool);
} }
} }
}
// Update the informational message // Update the informational message
if (toolsNotInstalled.length === 0) { if (toolsNotInstalled.length === 0) {
this.wizard.wizardObject.message = { this.wizard.wizardObject.message = {
@@ -365,7 +381,6 @@ export class ToolsAndEulaPage extends ResourceTypePage {
this._agreementContainer.enabled = enable; this._agreementContainer.enabled = enable;
this._optionsContainer.enabled = enable; this._optionsContainer.enabled = enable;
this.wizard.wizardObject.cancelButton.enabled = enable; this.wizard.wizardObject.cancelButton.enabled = enable;
// select and install tools buttons are controlled separately
} }
public async onLeave(): Promise<void> { public async onLeave(): Promise<void> {
@@ -503,7 +518,6 @@ export class ToolsAndEulaPage extends ResourceTypePage {
} }
private enableDoneButton(enable: boolean) { private enableDoneButton(enable: boolean) {
this._isDoneButtonEnabled = enable;
this.wizard.wizardObject.doneButton.enabled = enable; this.wizard.wizardObject.doneButton.enabled = enable;
this.wizard.wizardObject.nextButton.enabled = enable; this.wizard.wizardObject.nextButton.enabled = enable;
} }