mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-16 10:58:30 -05:00
make the azdata install url configurable (#7989)
* make the azdata install url configurable * use settings without reloading * comments
This commit is contained in:
@@ -25,6 +25,23 @@
|
||||
"microsoft.notebook"
|
||||
],
|
||||
"contributes": {
|
||||
"configuration": [
|
||||
{
|
||||
"title": "%deployment.configuration.title%",
|
||||
"properties": {
|
||||
"deployment.azdataPipInstallUri": {
|
||||
"type": "string",
|
||||
"default": "https://aka.ms/azdata",
|
||||
"description": "%azdata-pip-install-uri-description%"
|
||||
},
|
||||
"deployment.azdataPipInstallArgs": {
|
||||
"type": "string",
|
||||
"default": "",
|
||||
"description": "%azdata-pip-install-args-description%"
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"commands": [
|
||||
{
|
||||
"command": "azdata.resource.deploy",
|
||||
|
||||
@@ -48,7 +48,10 @@
|
||||
"resource-type-sql-windows-setup-display-name": "SQL Server on Windows",
|
||||
"resource-type-sql-windows-setup-description": "Run SQL Server on Windows, select a version to get started.",
|
||||
"bdc-agreement": "I accept {0}, {1} and {2}.",
|
||||
"bdc-agreement-privacy-statement":"Microsoft Privacy Statement",
|
||||
"bdc-agreement-azdata-eula":"azdata License Terms",
|
||||
"bdc-agreement-bdc-eula":"SQL Server License Terms"
|
||||
"bdc-agreement-privacy-statement": "Microsoft Privacy Statement",
|
||||
"bdc-agreement-azdata-eula": "azdata License Terms",
|
||||
"bdc-agreement-bdc-eula": "SQL Server License Terms",
|
||||
"deployment.configuration.title": "Deployment configuration",
|
||||
"azdata-pip-install-uri-description": "Location of the azdata package used for the pip install command",
|
||||
"azdata-pip-install-args-description": "Additional arguments for the pip install azdata command"
|
||||
}
|
||||
|
||||
8
extensions/resource-deployment/src/constants.ts
Normal file
8
extensions/resource-deployment/src/constants.ts
Normal file
@@ -0,0 +1,8 @@
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
export const DeploymentConfigurationKey: string = 'deployment';
|
||||
export const AzdataPipInstallUriKey: string = 'azdataPipInstallUri';
|
||||
export const azdataPipInstallArgsKey: string = 'azdataPipInstallArgs';
|
||||
@@ -51,7 +51,7 @@ export class AzCliTool extends ToolBase {
|
||||
}
|
||||
}
|
||||
|
||||
readonly allInstallationCommands: Map<OsType, Command[]> = new Map<OsType, Command[]>([
|
||||
protected readonly allInstallationCommands: Map<OsType, Command[]> = new Map<OsType, Command[]>([
|
||||
[OsType.linux, linuxInstallationCommands],
|
||||
[OsType.win32, win32InstallationCommands],
|
||||
[OsType.darwin, macOsInstallationCommands],
|
||||
|
||||
@@ -3,12 +3,14 @@
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
import { EOL } from 'os';
|
||||
import * as vscode from 'vscode';
|
||||
import * as path from 'path';
|
||||
import { SemVer } from 'semver';
|
||||
import * as nls from 'vscode-nls';
|
||||
import { Command, OsType, ToolType } from '../../interfaces';
|
||||
import { IPlatformService } from '../platformService';
|
||||
import { ToolBase } from './toolBase';
|
||||
import { DeploymentConfigurationKey, AzdataPipInstallUriKey, azdataPipInstallArgsKey } from '../../constants';
|
||||
|
||||
const localize = nls.loadMessageBundle();
|
||||
const installationRoot = '~/.local/bin';
|
||||
@@ -66,22 +68,50 @@ export class AzdataTool extends ToolBase {
|
||||
}
|
||||
}
|
||||
|
||||
readonly allInstallationCommands: Map<OsType, Command[]> = new Map<OsType, Command[]>([
|
||||
[OsType.linux, linuxInstallationCommands],
|
||||
[OsType.win32, defaultInstallationCommands],
|
||||
[OsType.darwin, defaultInstallationCommands],
|
||||
[OsType.others, defaultInstallationCommands]
|
||||
]);
|
||||
protected get allInstallationCommands(): Map<OsType, Command[]> {
|
||||
return new Map<OsType, Command[]>([
|
||||
[OsType.linux, this.defaultInstallationCommands],
|
||||
[OsType.win32, this.defaultInstallationCommands],
|
||||
[OsType.darwin, this.defaultInstallationCommands],
|
||||
[OsType.others, this.defaultInstallationCommands]
|
||||
]);
|
||||
}
|
||||
|
||||
protected get uninstallCommand(): string | undefined {
|
||||
if (this.osType !== OsType.linux) {
|
||||
return defaultUninstallCommand;
|
||||
return this.defaultUninstallCommand;
|
||||
} else {
|
||||
return super.uninstallCommand;
|
||||
}
|
||||
}
|
||||
|
||||
private get defaultInstallationCommands(): Command[] {
|
||||
return [
|
||||
{
|
||||
comment: localize('resourceDeployment.Azdata.InstallUpdatePythonRequestsPackage', "installing/updating to latest version of requests python package azdata ..."),
|
||||
command: `pip3 install -U requests`
|
||||
},
|
||||
{
|
||||
comment: localize('resourceDeployment.Azdata.InstallingAzdata', "installing azdata ..."),
|
||||
command: `pip3 install -r ${this.azdataInstallUri} ${this.azdataInstallAdditionalArgs} --quiet --user`
|
||||
}
|
||||
];
|
||||
}
|
||||
|
||||
private get defaultUninstallCommand(): string {
|
||||
return `pip3 uninstall -r ${this.azdataInstallUri} ${this.azdataInstallAdditionalArgs} -y `;
|
||||
}
|
||||
|
||||
private get azdataInstallUri(): string {
|
||||
return vscode.workspace.getConfiguration(DeploymentConfigurationKey)[AzdataPipInstallUriKey];
|
||||
}
|
||||
|
||||
private get azdataInstallAdditionalArgs(): string {
|
||||
return vscode.workspace.getConfiguration(DeploymentConfigurationKey)[azdataPipInstallArgsKey];
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
const linuxInstallationCommands = [
|
||||
{
|
||||
sudo: true,
|
||||
@@ -114,16 +144,4 @@ const linuxInstallationCommands = [
|
||||
command: 'apt-get install -y azdata-cli'
|
||||
}
|
||||
];
|
||||
|
||||
const defaultInstallationCommands = [
|
||||
{
|
||||
comment: localize('resourceDeployment.Azdata.InstallUpdatePythonRequestsPackage', "installing/updating to latest version of requests python package azdata ..."),
|
||||
command: `pip3 install -U requests`
|
||||
},
|
||||
{
|
||||
comment: localize('resourceDeployment.Azdata.InstallingAzdata', "installing azdata ..."),
|
||||
command: `pip3 install -r https://aka.ms/azdata --quiet --user`
|
||||
}
|
||||
];
|
||||
|
||||
const defaultUninstallCommand = `pip3 uninstall -r https://aka.ms/azdata -y `;
|
||||
*/
|
||||
|
||||
@@ -50,7 +50,7 @@ export class DockerTool extends ToolBase {
|
||||
return false;
|
||||
}
|
||||
|
||||
get allInstallationCommands(): Map<OsType, Command[]> {
|
||||
protected get allInstallationCommands(): Map<OsType, Command[]> {
|
||||
throw Error('Installation of DockerTool is not supported');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -53,7 +53,7 @@ export class KubeCtlTool extends ToolBase {
|
||||
return true;
|
||||
}
|
||||
|
||||
readonly allInstallationCommands: Map<OsType, Command[]> = new Map<OsType, Command[]>([
|
||||
protected readonly allInstallationCommands: Map<OsType, Command[]> = new Map<OsType, Command[]>([
|
||||
[OsType.linux, linuxInstallationCommands],
|
||||
[OsType.win32, win32InstallationCommands],
|
||||
[OsType.darwin, macOsInstallationCommands],
|
||||
|
||||
@@ -37,8 +37,7 @@ export abstract class ToolBase implements ITool {
|
||||
abstract type: ToolType;
|
||||
abstract homePage: string;
|
||||
abstract autoInstallSupported: boolean;
|
||||
abstract readonly allInstallationCommands: Map<OsType, Command[]>;
|
||||
|
||||
protected abstract readonly allInstallationCommands: Map<OsType, Command[]>;
|
||||
protected abstract getVersionFromOutput(output: string): SemVer | undefined;
|
||||
protected readonly _onDidUpdateData = new vscode.EventEmitter<ITool>();
|
||||
protected readonly uninstallCommand?: string;
|
||||
|
||||
Reference in New Issue
Block a user