fix informational/error messages when tools not installed/not discovered/not installable (#8679)

* fix informational/error messages
This commit is contained in:
Arvind Ranasaria
2019-12-13 18:32:20 -08:00
committed by GitHub
parent a0c3f8f614
commit 6816f2dabb
2 changed files with 22 additions and 18 deletions

View File

@@ -98,7 +98,7 @@ export abstract class ToolBase implements ITool {
}
public get autoInstallNeeded(): boolean {
return this.status !== ToolStatus.Installed && this.autoInstallSupported;
return this.status === ToolStatus.NotInstalled && this.autoInstallSupported;
}
public get isNotInstalled(): boolean {

View File

@@ -221,40 +221,45 @@ export class ResourceTypePickerDialog extends DialogBase {
if (this.toolRefreshTimestamp !== currentRefreshTimestamp) {
return;
}
let installationNeeded = false;
let minVersionCheckFailed = false;
const messages: string[] = [];
const toolsToAutoInstall: ITool[] = [];
let messages: string[] = [];
this._toolsTable.data = toolRequirements.map(toolRequirement => {
const tool = this.toolsService.getToolByName(toolRequirement.name)!;
// subscribe to onUpdateData event of the tool.
this._toDispose.push(tool.onDidUpdateData((t: ITool) => {
this.updateToolsDisplayTableData(t);
}));
if (tool.isNotInstalled && !tool.autoInstallSupported) {
messages.push(localize('deploymentDialog.ToolInformation', "'{0}' was not discovered and automated installation is not supported. Kindly install it manually or if installed make sure it is started and discoverable. Once done please restart Azure Data Studio. See [{1}] .", tool.displayName, tool.homePage));
if (tool.isNotInstalled) {
if (tool.autoInstallSupported) {
toolsToAutoInstall.push(tool);
} else {
messages.push(localize('deploymentDialog.ToolInformation', "'{0}' was not discovered and automated installation is not currently supported. Install '{0}' manually or ensure it is started and discoverable. Once done please restart Azure Data Studio. See [{1}] .", tool.displayName, tool.homePage));
}
} else if (tool.isInstalled && toolRequirement.version && !tool.isSameOrNewerThan(toolRequirement.version)) {
minVersionCheckFailed = true;
messages.push(localize('deploymentDialog.ToolDoesNotMeetVersionRequirement', "'{0}' [ {1} ] does not meet the minimum version requirement, please uninstall it and restart Azure Data Studio.", tool.displayName, tool.homePage));
}
installationNeeded = installationNeeded || tool.autoInstallNeeded;
return [tool.displayName, tool.description, tool.displayStatus, tool.fullVersion || '', toolRequirement.version || '', tool.installationPath || ''];
});
this._installToolButton.hidden = minVersionCheckFailed || !installationNeeded;
this._dialogObject.okButton.enabled = messages.length === 0 && !minVersionCheckFailed && !installationNeeded;
this._installToolButton.hidden = minVersionCheckFailed || (toolsToAutoInstall.length === 0);
this._dialogObject.okButton.enabled = messages.length === 0 && !minVersionCheckFailed && (toolsToAutoInstall.length === 0);
if (messages.length !== 0) {
if (!minVersionCheckFailed) {
messages.push(localize('deploymentDialog.VersionInformationDebugHint', "You will need to restart Azure Data Studio if the tools are installed by yourself after Azure Data Studio is launched to pick up the updated PATH environment variable. You may find additional details in 'Deployments' output channel"));
if (messages.length > 1) {
messages = messages.map(message => `${message}`);
}
messages.push(localize('deploymentDialog.VersionInformationDebugHint', "You will need to restart Azure Data Studio if the tools are installed manually after Azure Data Studio is launched to pick up the updated PATH environment variable. You may find additional details in 'Deployments' output channel"));
this._dialogObject.message = {
level: azdata.window.MessageLevel.Error,
text: [
localize('deploymentDialog.ToolCheckFailed', "Some required tools are not installed or do not meet the minimum version requirement."),
...messages
].join(EOL)
text: messages.join(EOL)
};
} else if (installationNeeded && !this._installationInProgress) {
let infoText: string[] = [localize('deploymentDialog.InstallToolsHint', "Some required tools are not installed, you can click the \"{0}\" button to install them.", this._installToolButton.label)];
} else if ((toolsToAutoInstall.length !== 0) && !this._installationInProgress) {
const installationNeededHeader = toolsToAutoInstall.length === 1
? localize('deploymentDialog.InstallToolsHintOne', "Tool: {0} is not installed, you can click the \"{1}\" button to install it.", toolsToAutoInstall[0].displayName, this._installToolButton.label)
: localize('deploymentDialog.InstallToolsHintMany', "Tools: {0} are not installed, you can click the \"{1}\" button to install them.", toolsToAutoInstall.map(t => t.displayName).join(', '), this._installToolButton.label);
let infoText: string[] = [installationNeededHeader];
const informationalMessagesArray = this._tools.reduce<string[]>((returnArray, currentTool) => {
if (currentTool.autoInstallNeeded) {
returnArray.push(...currentTool.dependencyMessages);
@@ -265,8 +270,7 @@ export class ResourceTypePickerDialog extends DialogBase {
if (informationalMessagesSet.size > 0) {
infoText.push(...informationalMessagesSet.values());
}
// we don't have scenarios that have mixed type of tools
// either we don't support auto install: docker, or we support auto install for all required tools
// we don't have scenarios that have mixed type of tools - either we don't support auto install: docker, or we support auto install for all required tools
this._dialogObject.message = {
level: azdata.window.MessageLevel.Warning,
text: infoText.join(EOL)