From dcb6cddab47af4bd88f3b971b567d808cdd5552b Mon Sep 17 00:00:00 2001 From: Aasim Khan Date: Wed, 16 Dec 2020 10:32:51 -0800 Subject: [PATCH] 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 --- .../src/localizedConstants.ts | 6 +++- .../src/ui/toolsAndEulaSettingsPage.ts | 36 +++++++++++++------ 2 files changed, 30 insertions(+), 12 deletions(-) diff --git a/extensions/resource-deployment/src/localizedConstants.ts b/extensions/resource-deployment/src/localizedConstants.ts index b4f766f04b..d6257f9c04 100644 --- a/extensions/resource-deployment/src/localizedConstants.ts +++ b/extensions/resource-deployment/src/localizedConstants.ts @@ -7,7 +7,7 @@ import { EOL } from 'os'; import * as nls from 'vscode-nls'; import { getErrorMessage } from './common/utils'; import { ResourceTypeCategories } from './constants'; -import { FieldType, OptionsType } from './interfaces'; +import { FieldType, ITool, OptionsType } from './interfaces'; const localize = nls.loadMessageBundle(); 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 installToolsText = localize('resourceDeployment.InstallTools', "Install tools"); 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); +} diff --git a/extensions/resource-deployment/src/ui/toolsAndEulaSettingsPage.ts b/extensions/resource-deployment/src/ui/toolsAndEulaSettingsPage.ts index 81c9835db2..6ce67a62f4 100644 --- a/extensions/resource-deployment/src/ui/toolsAndEulaSettingsPage.ts +++ b/extensions/resource-deployment/src/ui/toolsAndEulaSettingsPage.ts @@ -31,7 +31,6 @@ export class ToolsAndEulaPage extends ResourceTypePage { private _tools: ITool[] = []; private _eulaValidationSucceeded: boolean = false; private _isInitialized = false; - private _isDoneButtonEnabled = false; private _resourceType: ResourceType; 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 } - if (!this._isDoneButtonEnabled) { - this.wizard.wizardObject.message = { - 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 - }; - return false; + 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 = { + 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 + }; + return false; + } } + this.wizard.wizardObject.message = { + text: '' + }; return true; }); } @@ -293,6 +306,7 @@ export class ToolsAndEulaPage extends ResourceTypePage { this._installationInProgress = true; let tool: ITool; try { + this.enableDoneButton(false); const toolRequirements = this.toolRequirements; let toolsNotInstalled: ITool[] = []; for (let i: number = 0; i < toolRequirements.length; i++) { @@ -302,7 +316,7 @@ export class ToolsAndEulaPage extends ResourceTypePage { // Update the informational message this.wizard.wizardObject.message = { 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(); if (tool.status === ToolStatus.Installed && toolReq.version && !tool.isSameOrNewerThan(toolReq.version)) { @@ -313,7 +327,9 @@ export class ToolsAndEulaPage extends ResourceTypePage { ); } } else { - toolsNotInstalled.push(tool); + if (this._tools[i].status !== ToolStatus.Installed) { + toolsNotInstalled.push(tool); + } } } // Update the informational message @@ -365,7 +381,6 @@ export class ToolsAndEulaPage extends ResourceTypePage { this._agreementContainer.enabled = enable; this._optionsContainer.enabled = enable; this.wizard.wizardObject.cancelButton.enabled = enable; - // select and install tools buttons are controlled separately } public async onLeave(): Promise { @@ -503,7 +518,6 @@ export class ToolsAndEulaPage extends ResourceTypePage { } private enableDoneButton(enable: boolean) { - this._isDoneButtonEnabled = enable; this.wizard.wizardObject.doneButton.enabled = enable; this.wizard.wizardObject.nextButton.enabled = enable; }