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"
|
"microsoft.notebook"
|
||||||
],
|
],
|
||||||
"contributes": {
|
"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": [
|
"commands": [
|
||||||
{
|
{
|
||||||
"command": "azdata.resource.deploy",
|
"command": "azdata.resource.deploy",
|
||||||
|
|||||||
@@ -48,7 +48,10 @@
|
|||||||
"resource-type-sql-windows-setup-display-name": "SQL Server on Windows",
|
"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.",
|
"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": "I accept {0}, {1} and {2}.",
|
||||||
"bdc-agreement-privacy-statement":"Microsoft Privacy Statement",
|
"bdc-agreement-privacy-statement": "Microsoft Privacy Statement",
|
||||||
"bdc-agreement-azdata-eula":"azdata License Terms",
|
"bdc-agreement-azdata-eula": "azdata License Terms",
|
||||||
"bdc-agreement-bdc-eula":"SQL Server 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.linux, linuxInstallationCommands],
|
||||||
[OsType.win32, win32InstallationCommands],
|
[OsType.win32, win32InstallationCommands],
|
||||||
[OsType.darwin, macOsInstallationCommands],
|
[OsType.darwin, macOsInstallationCommands],
|
||||||
|
|||||||
@@ -3,12 +3,14 @@
|
|||||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||||
*--------------------------------------------------------------------------------------------*/
|
*--------------------------------------------------------------------------------------------*/
|
||||||
import { EOL } from 'os';
|
import { EOL } from 'os';
|
||||||
|
import * as vscode from 'vscode';
|
||||||
import * as path from 'path';
|
import * as path from 'path';
|
||||||
import { SemVer } from 'semver';
|
import { SemVer } from 'semver';
|
||||||
import * as nls from 'vscode-nls';
|
import * as nls from 'vscode-nls';
|
||||||
import { Command, OsType, ToolType } from '../../interfaces';
|
import { Command, OsType, ToolType } from '../../interfaces';
|
||||||
import { IPlatformService } from '../platformService';
|
import { IPlatformService } from '../platformService';
|
||||||
import { ToolBase } from './toolBase';
|
import { ToolBase } from './toolBase';
|
||||||
|
import { DeploymentConfigurationKey, AzdataPipInstallUriKey, azdataPipInstallArgsKey } from '../../constants';
|
||||||
|
|
||||||
const localize = nls.loadMessageBundle();
|
const localize = nls.loadMessageBundle();
|
||||||
const installationRoot = '~/.local/bin';
|
const installationRoot = '~/.local/bin';
|
||||||
@@ -66,22 +68,50 @@ export class AzdataTool extends ToolBase {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
readonly allInstallationCommands: Map<OsType, Command[]> = new Map<OsType, Command[]>([
|
protected get allInstallationCommands(): Map<OsType, Command[]> {
|
||||||
[OsType.linux, linuxInstallationCommands],
|
return new Map<OsType, Command[]>([
|
||||||
[OsType.win32, defaultInstallationCommands],
|
[OsType.linux, this.defaultInstallationCommands],
|
||||||
[OsType.darwin, defaultInstallationCommands],
|
[OsType.win32, this.defaultInstallationCommands],
|
||||||
[OsType.others, defaultInstallationCommands]
|
[OsType.darwin, this.defaultInstallationCommands],
|
||||||
]);
|
[OsType.others, this.defaultInstallationCommands]
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
protected get uninstallCommand(): string | undefined {
|
protected get uninstallCommand(): string | undefined {
|
||||||
if (this.osType !== OsType.linux) {
|
if (this.osType !== OsType.linux) {
|
||||||
return defaultUninstallCommand;
|
return this.defaultUninstallCommand;
|
||||||
} else {
|
} else {
|
||||||
return super.uninstallCommand;
|
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 = [
|
const linuxInstallationCommands = [
|
||||||
{
|
{
|
||||||
sudo: true,
|
sudo: true,
|
||||||
@@ -114,16 +144,4 @@ const linuxInstallationCommands = [
|
|||||||
command: 'apt-get install -y azdata-cli'
|
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;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
get allInstallationCommands(): Map<OsType, Command[]> {
|
protected get allInstallationCommands(): Map<OsType, Command[]> {
|
||||||
throw Error('Installation of DockerTool is not supported');
|
throw Error('Installation of DockerTool is not supported');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -53,7 +53,7 @@ export class KubeCtlTool extends ToolBase {
|
|||||||
return true;
|
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.linux, linuxInstallationCommands],
|
||||||
[OsType.win32, win32InstallationCommands],
|
[OsType.win32, win32InstallationCommands],
|
||||||
[OsType.darwin, macOsInstallationCommands],
|
[OsType.darwin, macOsInstallationCommands],
|
||||||
|
|||||||
@@ -37,8 +37,7 @@ export abstract class ToolBase implements ITool {
|
|||||||
abstract type: ToolType;
|
abstract type: ToolType;
|
||||||
abstract homePage: string;
|
abstract homePage: string;
|
||||||
abstract autoInstallSupported: boolean;
|
abstract autoInstallSupported: boolean;
|
||||||
abstract readonly allInstallationCommands: Map<OsType, Command[]>;
|
protected abstract readonly allInstallationCommands: Map<OsType, Command[]>;
|
||||||
|
|
||||||
protected abstract getVersionFromOutput(output: string): SemVer | undefined;
|
protected abstract getVersionFromOutput(output: string): SemVer | undefined;
|
||||||
protected readonly _onDidUpdateData = new vscode.EventEmitter<ITool>();
|
protected readonly _onDidUpdateData = new vscode.EventEmitter<ITool>();
|
||||||
protected readonly uninstallCommand?: string;
|
protected readonly uninstallCommand?: string;
|
||||||
|
|||||||
Reference in New Issue
Block a user