Changes to remove Pip3 based installations for azdata (#8577)

* saving intermediate work - to merge master

* remove inadvertent change

* Remove Pip3 installation from all tools

* working version

* making some small fixes

* add back accidently removed file

* Update resourceTypePickerDialog.ts

* Removing redundant trailing ","

* Remove commented dead code

* fix casing of nls string

* remove inadvertent change

* change installation locations from field to properties so that they are constructed at run time'
This commit is contained in:
Arvind Ranasaria
2019-12-05 17:15:27 -08:00
committed by GitHub
parent 4787d7ba5c
commit 7201025a15
11 changed files with 129 additions and 160 deletions

View File

@@ -27,6 +27,7 @@ export class ResourceTypePickerDialog extends DialogBase {
private _agreementContainer!: azdata.DivContainer;
private _agreementCheckboxChecked: boolean = false;
private _installToolButton: azdata.window.Button;
private _installationInProgress: boolean = false;
private _tools: ITool[] = [];
constructor(
@@ -42,6 +43,7 @@ export class ResourceTypePickerDialog extends DialogBase {
this._dialogObject.customButtons = [this._installToolButton];
this._installToolButton.hidden = true;
this._dialogObject.okButton.label = localize('deploymentDialog.OKButtonText', "Select");
this._dialogObject.okButton.enabled = false; // this is enabled after all tools are discovered.
}
initialize() {
@@ -216,33 +218,33 @@ export class ResourceTypePickerDialog extends DialogBase {
if (this.toolRefreshTimestamp !== currentRefreshTimestamp) {
return;
}
let installationRequired = false;
let installationNeeded = false;
let minVersionCheckFailed = false;
const messages: string[] = [];
this._toolsTable.data = toolRequirements.map(toolReq => {
const tool = this.toolsService.getToolByName(toolReq.name)!;
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}' [ {1} ]", tool.displayName, tool.homePage));
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.statusDescription !== undefined) {
console.warn(localize('deploymentDialog.DetailToolStatusDescription', "Additional status information for tool: '{0}' [ {1} ]. {2}", tool.name, tool.homePage, tool.statusDescription));
}
} else if (tool.isInstalled && toolReq.version && !tool.isSameOrNewerThan(toolReq.version)) {
} 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));
}
installationRequired = installationRequired || tool.autoInstallRequired;
return [tool.displayName, tool.description, tool.displayStatus, tool.fullVersion || '', toolReq.version || ''];
installationNeeded = installationNeeded || tool.autoInstallNeeded;
return [tool.displayName, tool.description, tool.displayStatus, tool.fullVersion || '', toolRequirement.version || ''];
});
this._installToolButton.hidden = minVersionCheckFailed || !installationRequired;
this._dialogObject.okButton.enabled = messages.length === 0 && !minVersionCheckFailed && !installationRequired;
this._installToolButton.hidden = minVersionCheckFailed || !installationNeeded;
this._dialogObject.okButton.enabled = messages.length === 0 && !minVersionCheckFailed && !installationNeeded;
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 the debug console by running the 'Toggle Developer Tools' command in the Azure Data Studio Command Palette."));
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"));
}
this._dialogObject.message = {
level: azdata.window.MessageLevel.Error,
@@ -251,10 +253,10 @@ export class ResourceTypePickerDialog extends DialogBase {
...messages
].join(EOL)
};
} else if (installationRequired) {
} 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)];
const informationalMessagesArray = this._tools.reduce<string[]>((returnArray, currentTool) => {
if (currentTool.needsInstallation) {
if (currentTool.autoInstallNeeded) {
returnArray.push(...currentTool.dependencyMessages);
}
return returnArray;
@@ -338,13 +340,15 @@ export class ResourceTypePickerDialog extends DialogBase {
private async installTools(): Promise<void> {
this._installToolButton.enabled = false;
this._installationInProgress = true;
let tool: ITool;
try {
const toolRequirements = this.getCurrentProvider().requiredTools;
let toolsNotInstalled: ITool[] = [];
for (let i: number = 0; i < toolRequirements.length; i++) {
const toolReq = toolRequirements[i];
tool = this.toolsService.getToolByName(toolReq.name)!;
if (tool.needsInstallation) {
if (tool.autoInstallNeeded) {
// Update the informational message
this._dialogObject.message = {
level: azdata.window.MessageLevel.Information,
@@ -358,14 +362,23 @@ export class ResourceTypePickerDialog extends DialogBase {
)
);
}
} else {
toolsNotInstalled.push(tool);
}
}
// Update the informational message
this._dialogObject.message = {
level: azdata.window.MessageLevel.Information,
text: localize('deploymentDialog.InstalledTools', "All required tools are installed now.")
};
this._dialogObject.okButton.enabled = true;
if (toolsNotInstalled.length === 0) {
this._dialogObject.message = {
level: azdata.window.MessageLevel.Information,
text: localize('deploymentDialog.InstalledTools', "All required tools are installed now.")
};
this._dialogObject.okButton.enabled = true;
} else {
this._dialogObject.message = {
level: azdata.window.MessageLevel.Information,
text: localize('deploymentDialog.PendingInstallation', "Following tools: {0} were still not discovered. Please make sure that they are installed, running and discoverable", toolsNotInstalled.map(t => t.displayName).join(','))
};
}
} catch (error) {
const errorMessage = tool!.statusDescription || getErrorMessage(error);
if (errorMessage) {
@@ -377,5 +390,6 @@ export class ResourceTypePickerDialog extends DialogBase {
}
tool!.showOutputChannel(/*preserverFocus*/false);
}
this._installationInProgress = false;
}
}