mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-16 10:58:30 -05:00
wizard for deploying bdc (#7183)
* wip * wip2 * wip eod 820 * wip 822 * text component improvements and misc changes * aria-label * targetClusterPage wip * target cluster page * target cluster page * wip 827 * wip deployment profile page * profile page * service settings page * wip 0903 * 0909 wip * 0910 * 0911 * sql instance and working directory * notebooks * docker version on windows * EULA env var * 917 updates * address comments * use async file access * fix the summary page display issue for ad auth * add save json file buttons * use promise for private methds * review feedbacks * refactor * pass json to notebooks * fix no tool scenario * bypass tool check if installed * update hint text * update notebooks * workaround azdata first time use * comments * accept eula and some text update * fix the error in package.json * promise instead of thenable * comments * fix typo
This commit is contained in:
@@ -2,12 +2,20 @@
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
'use strict';
|
||||
import { ToolType, ITool } from '../../interfaces';
|
||||
|
||||
import { ToolType } from '../../interfaces';
|
||||
import * as nls from 'vscode-nls';
|
||||
import { SemVer } from 'semver';
|
||||
import { IPlatformService } from '../platformService';
|
||||
import { EOL } from 'os';
|
||||
import { ToolBase } from './toolBase';
|
||||
const localize = nls.loadMessageBundle();
|
||||
|
||||
export class AzCliTool implements ITool {
|
||||
export class AzCliTool extends ToolBase {
|
||||
constructor(platformService: IPlatformService) {
|
||||
super(platformService);
|
||||
}
|
||||
|
||||
get name(): string {
|
||||
return 'azcli';
|
||||
}
|
||||
@@ -23,4 +31,19 @@ export class AzCliTool implements ITool {
|
||||
get displayName(): string {
|
||||
return localize('resourceDeployment.AzCLIDisplayName', 'Azure CLI');
|
||||
}
|
||||
|
||||
get homePage(): string {
|
||||
return 'https://docs.microsoft.com/cli/azure/install-azure-cli';
|
||||
}
|
||||
|
||||
protected getVersionFromOutput(output: string): SemVer | undefined {
|
||||
if (output && output.includes('azure-cli')) {
|
||||
return new SemVer(output.split(EOL)[0].replace('azure-cli', '').replace(/ /g, '').replace('*', ''));
|
||||
} else {
|
||||
return undefined;
|
||||
}
|
||||
}
|
||||
protected get versionCommand(): string {
|
||||
return 'az --version';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,12 +2,21 @@
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
'use strict';
|
||||
import { ToolType, ITool } from '../../interfaces';
|
||||
|
||||
import { ToolType } from '../../interfaces';
|
||||
import * as nls from 'vscode-nls';
|
||||
import { SemVer } from 'semver';
|
||||
import { EOL } from 'os';
|
||||
import { IPlatformService } from '../platformService';
|
||||
import { ToolBase } from './toolBase';
|
||||
|
||||
const localize = nls.loadMessageBundle();
|
||||
|
||||
export class AzdataTool implements ITool {
|
||||
export class AzdataTool extends ToolBase {
|
||||
constructor(platformService: IPlatformService) {
|
||||
super(platformService);
|
||||
}
|
||||
|
||||
get name(): string {
|
||||
return 'azdata';
|
||||
}
|
||||
@@ -23,4 +32,20 @@ export class AzdataTool implements ITool {
|
||||
get displayName(): string {
|
||||
return localize('resourceDeployment.AzdataDisplayName', "azdata");
|
||||
}
|
||||
}
|
||||
|
||||
get homePage(): string {
|
||||
return 'https://docs.microsoft.com/sql/big-data-cluster/deploy-install-azdata';
|
||||
}
|
||||
|
||||
protected get versionCommand(): string {
|
||||
return 'azdata -v';
|
||||
}
|
||||
|
||||
protected getVersionFromOutput(output: string): SemVer | undefined {
|
||||
let version: SemVer | undefined = undefined;
|
||||
if (output && output.split(EOL).length > 0) {
|
||||
version = new SemVer(output.split(EOL)[0].replace(/ /g, ''));
|
||||
}
|
||||
return version;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,12 +2,20 @@
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
'use strict';
|
||||
import { ToolType, ITool } from '../../interfaces';
|
||||
|
||||
import { ToolType } from '../../interfaces';
|
||||
import * as nls from 'vscode-nls';
|
||||
import { SemVer } from 'semver';
|
||||
import { IPlatformService } from '../platformService';
|
||||
import { ToolBase } from './toolBase';
|
||||
|
||||
const localize = nls.loadMessageBundle();
|
||||
|
||||
export class DockerTool implements ITool {
|
||||
export class DockerTool extends ToolBase {
|
||||
constructor(platformService: IPlatformService) {
|
||||
super(platformService);
|
||||
}
|
||||
|
||||
get name(): string {
|
||||
return 'docker';
|
||||
}
|
||||
@@ -23,4 +31,19 @@ export class DockerTool implements ITool {
|
||||
get displayName(): string {
|
||||
return localize('resourceDeployment.DockerDisplayName', 'Docker');
|
||||
}
|
||||
}
|
||||
|
||||
get homePage(): string {
|
||||
return 'https://docs.docker.com/install';
|
||||
}
|
||||
|
||||
protected getVersionFromOutput(output: string): SemVer | undefined {
|
||||
let version: SemVer | undefined = undefined;
|
||||
if (output) {
|
||||
version = new SemVer(JSON.parse(output).Client.Version, true);
|
||||
}
|
||||
return version;
|
||||
}
|
||||
protected get versionCommand(): string {
|
||||
return 'docker version --format "{{json .}}"';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,12 +2,20 @@
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
'use strict';
|
||||
import { ToolType, ITool } from '../../interfaces';
|
||||
|
||||
import { ToolType } from '../../interfaces';
|
||||
import * as nls from 'vscode-nls';
|
||||
import { SemVer } from 'semver';
|
||||
import { IPlatformService } from '../platformService';
|
||||
import { ToolBase } from './toolBase';
|
||||
|
||||
const localize = nls.loadMessageBundle();
|
||||
|
||||
export class KubeCtlTool implements ITool {
|
||||
export class KubeCtlTool extends ToolBase {
|
||||
constructor(platformService: IPlatformService) {
|
||||
super(platformService);
|
||||
}
|
||||
|
||||
get name(): string {
|
||||
return 'kubectl';
|
||||
}
|
||||
@@ -23,4 +31,21 @@ export class KubeCtlTool implements ITool {
|
||||
get displayName(): string {
|
||||
return localize('resourceDeployment.KubeCtlDisplayName', 'kubectl');
|
||||
}
|
||||
|
||||
get homePage(): string {
|
||||
return 'https://kubernetes.io/docs/tasks/tools/install-kubectl';
|
||||
}
|
||||
|
||||
protected getVersionFromOutput(output: string): SemVer | undefined {
|
||||
let version: SemVer | undefined = undefined;
|
||||
if (output) {
|
||||
const versionJson = JSON.parse(output);
|
||||
version = new SemVer(`${versionJson.clientVersion.major}.${versionJson.clientVersion.minor}.0`);
|
||||
}
|
||||
return version;
|
||||
}
|
||||
|
||||
protected get versionCommand(): string {
|
||||
return 'kubectl version -o json --client';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,63 @@
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import { ToolType, ITool } from '../../interfaces';
|
||||
import { SemVer } from 'semver';
|
||||
import { IPlatformService } from '../platformService';
|
||||
import * as nls from 'vscode-nls';
|
||||
import { EOL } from 'os';
|
||||
const localize = nls.loadMessageBundle();
|
||||
|
||||
export abstract class ToolBase implements ITool {
|
||||
constructor(private _platformService: IPlatformService) { }
|
||||
|
||||
abstract name: string;
|
||||
abstract displayName: string;
|
||||
abstract description: string;
|
||||
abstract type: ToolType;
|
||||
abstract homePage: string;
|
||||
protected abstract getVersionFromOutput(output: string): SemVer | undefined;
|
||||
protected abstract readonly versionCommand: string;
|
||||
|
||||
public get version(): SemVer | undefined {
|
||||
return this._version;
|
||||
}
|
||||
|
||||
public get isInstalled(): boolean {
|
||||
return this._isInstalled;
|
||||
}
|
||||
|
||||
public get statusDescription(): string | undefined {
|
||||
return this._statusDescription;
|
||||
}
|
||||
|
||||
public loadInformation(): Promise<void> {
|
||||
if (this._isInstalled) {
|
||||
return Promise.resolve();
|
||||
}
|
||||
this._isInstalled = false;
|
||||
this._statusDescription = undefined;
|
||||
this._version = undefined;
|
||||
this._versionOutput = undefined;
|
||||
return this._platformService.runCommand(this.versionCommand).then((stdout) => {
|
||||
this._versionOutput = stdout;
|
||||
this._version = this.getVersionFromOutput(stdout);
|
||||
if (this._version) {
|
||||
this._isInstalled = true;
|
||||
} else {
|
||||
throw localize('deployCluster.InvalidToolVersionOutput', "Invalid output received.");
|
||||
}
|
||||
}).catch((error) => {
|
||||
const errorMessage = typeof error === 'string' ? error :
|
||||
typeof error.message === 'string' ? error.message : '';
|
||||
this._statusDescription = localize('deployCluster.GetToolVersionError', "Error retrieving version information.{0}Error: {1}{0}stdout: {2} ", EOL, errorMessage, this._versionOutput);
|
||||
});
|
||||
}
|
||||
|
||||
private _isInstalled: boolean = false;
|
||||
private _version?: SemVer;
|
||||
private _statusDescription?: string;
|
||||
private _versionOutput?: string;
|
||||
}
|
||||
Reference in New Issue
Block a user