a few deploy cluster wizard changes (#4644)

* update icon for target types

* Revert "update icon for target types"

This reverts commit 79bd7674f2c09602430a0b10829f7b0d3234eb98.

* update target type icons

* update eula and privacy policy links

* existing cluster page

* adjust the loading indicator position
This commit is contained in:
Alan Ren
2019-03-22 11:29:51 -07:00
committed by GitHub
parent 71db7e10b6
commit 8d5f676039
9 changed files with 88 additions and 57 deletions

View File

@@ -9,6 +9,8 @@ import { getContexts, KubectlContext, setContext, inferCurrentClusterType } from
import { Kubectl } from '../../kubectl/kubectl';
import { Scriptable, ScriptingDictionary } from '../../scripting/scripting';
import * as nls from 'vscode-nls';
import * as os from 'os';
import * as path from 'path';
const localize = nls.loadMessageBundle();
@@ -61,8 +63,8 @@ export class CreateClusterModel implements Scriptable {
description: localize('bdc-create.AKSClusterDescription',
'This option configures new Azure Kubernetes Service (AKS) for SQL Server big data cluster deployments. AKS makes it simple to create, configure and manage a cluster of virutal machines that are preconfigured with a Kubernetes cluster to run containerized applications.'),
iconPath: {
dark: 'images/cluster_inverse.svg',
light: 'images/cluster.svg'
dark: 'images/aks.svg',
light: 'images/aks.svg'
}
};
@@ -72,8 +74,8 @@ export class CreateClusterModel implements Scriptable {
fullName: localize('bdc-create.ExistingClusterFullName', 'Existing Kubernetes Cluster'),
description: localize('bdc-create.ExistingClusterDescription', 'This option assumes you already have a Kubernetes cluster installed, Once a prerequisite check is done, ensure the correct cluster context is selected.'),
iconPath: {
dark: 'images/cluster_inverse.svg',
light: 'images/cluster.svg'
dark: 'images/kubernetes.svg',
light: 'images/kubernetes.svg'
}
};
resolve([aksCluster, existingCluster]);
@@ -120,6 +122,10 @@ export class CreateClusterModel implements Scriptable {
return promise;
}
public getDefaultKubeConfigPath(): string {
return path.join(os.homedir(), '.kube', 'config');
}
public targetClusterType: TargetClusterType;
public selectedCluster: KubectlContext;

View File

@@ -7,6 +7,7 @@
import * as azdata from 'azdata';
import * as vscode from 'vscode';
import * as os from 'os';
import * as fs from 'fs';
import { WizardPageBase } from '../../wizardPageBase';
import { CreateClusterWizard } from '../createClusterWizard';
import { setActiveKubeconfig } from '../../../config/config';
@@ -21,6 +22,11 @@ export class SelectExistingClusterPage extends WizardPageBase<CreateClusterWizar
private clusterContextsLabel: azdata.TextComponent;
private errorLoadingClustersLabel: azdata.TextComponent;
private clusterContextContainer: azdata.DivContainer;
private clusterContextLoadingComponent: azdata.LoadingComponent;
private configFileInput: azdata.InputBoxComponent;
private browseFileButton: azdata.ButtonComponent;
private loadDefaultKubeConfigFile: boolean = true;
private view: azdata.ModelView;
constructor(wizard: CreateClusterWizard) {
super(localize('bdc-create.selectTargetClusterPageTitle', 'Where do you want to deploy this SQL Server big data cluster?'),
@@ -29,7 +35,8 @@ export class SelectExistingClusterPage extends WizardPageBase<CreateClusterWizar
}
protected initialize(view: azdata.ModelView): Thenable<void> {
this.initExistingClusterControl(view);
this.view = view;
this.initExistingClusterControl();
let formBuilder = view.modelBuilder.formContainer().withFormItems(
[
{
@@ -47,6 +54,14 @@ export class SelectExistingClusterPage extends WizardPageBase<CreateClusterWizar
}
public onEnter() {
if (this.loadDefaultKubeConfigFile) {
let defaultKubeConfigPath = this.wizard.model.getDefaultKubeConfigPath();
if (fs.existsSync(defaultKubeConfigPath)) {
this.loadClusterContexts(defaultKubeConfigPath);
}
this.loadDefaultKubeConfigFile = false;
}
this.wizard.wizardObject.registerNavigationValidator((e) => {
if (e.lastPage > e.newPage) {
this.wizard.wizardObject.message = null;
@@ -63,21 +78,24 @@ export class SelectExistingClusterPage extends WizardPageBase<CreateClusterWizar
});
}
private initExistingClusterControl(view: azdata.ModelView): void {
private initExistingClusterControl(): void {
let self = this;
let configFileLabel = view.modelBuilder.text().withProperties({ value: localize('bdc-create.kubeConfigFileLabelText', 'Kube config file path') }).component();
let configFileInput = view.modelBuilder.inputBox().withProperties({ width: '300px' }).component();
configFileInput.enabled = false;
let browseFileButton = view.modelBuilder.button().withProperties({ label: localize('bdc-browseText', 'Browse'), width: '100px' }).component();
let configFileContainer = view.modelBuilder.flexContainer()
let configFileLabel = this.view.modelBuilder.text().withProperties({ value: localize('bdc-create.kubeConfigFileLabelText', 'Kube config file path') }).component();
this.configFileInput = this.view.modelBuilder.inputBox().withProperties({ width: '300px' }).component();
this.configFileInput.enabled = false;
this.browseFileButton = this.view.modelBuilder.button().withProperties({ label: localize('bdc-browseText', 'Browse'), width: '100px' }).component();
let configFileContainer = this.view.modelBuilder.flexContainer()
.withLayout({ flexFlow: 'row', alignItems: 'baseline' })
.withItems([configFileLabel, configFileInput, browseFileButton], { CSSStyles: { 'margin-right': '10px' } }).component();
this.clusterContextsLabel = view.modelBuilder.text().withProperties({ value: localize('bdc-clusterContextsLabelText', 'Cluster Contexts') }).component();
this.errorLoadingClustersLabel = view.modelBuilder.text().withProperties({ value: localize('bdc-errorLoadingClustersText', 'No cluster information is found in the config file or an error ocurred while loading the config file') }).component();
this.clusterContextContainer = view.modelBuilder.divContainer().component();
this.existingClusterControl = view.modelBuilder.divContainer().withItems([configFileContainer, this.clusterContextContainer], { CSSStyles: { 'margin-top': '0px' } }).component();
.withItems([configFileLabel, this.configFileInput, this.browseFileButton], { CSSStyles: { 'margin-right': '10px' } }).component();
this.clusterContextsLabel = this.view.modelBuilder.text().withProperties({ value: localize('bdc-clusterContextsLabelText', 'Cluster Contexts') }).component();
this.errorLoadingClustersLabel = this.view.modelBuilder.text().withProperties({ value: localize('bdc-errorLoadingClustersText', 'No cluster information is found in the config file or an error ocurred while loading the config file') }).component();
this.clusterContextContainer = this.view.modelBuilder.divContainer().component();
this.clusterContextLoadingComponent = this.view.modelBuilder.loadingComponent().withItem(this.clusterContextContainer).component();
this.existingClusterControl = this.view.modelBuilder.divContainer().component();
this.existingClusterControl.addItem(configFileContainer, { CSSStyles: { 'margin-top': '0px' } });
this.existingClusterControl.addItem(this.clusterContextLoadingComponent, { CSSStyles: { 'width': '400px', 'margin-top': '10px' } });
browseFileButton.onDidClick(async () => {
this.browseFileButton.onDidClick(async () => {
let fileUris = await vscode.window.showOpenDialog(
{
canSelectFiles: true,
@@ -98,35 +116,42 @@ export class SelectExistingClusterPage extends WizardPageBase<CreateClusterWizar
let fileUri = fileUris[0];
configFileInput.value = fileUri.fsPath;
await setActiveKubeconfig(fileUri.fsPath);
let clusters = await self.wizard.model.loadClusters();
if (clusters.length !== 0) {
let options = clusters.map(cluster => {
let option = view.modelBuilder.radioButton().withProperties<azdata.RadioButtonProperties>({
label: cluster.contextName,
checked: cluster.active,
name: ClusterRadioButtonGroupName
}).component();
if (cluster.active) {
self.wizard.model.selectedCluster = cluster;
self.wizard.wizardObject.message = null;
}
option.onDidClick(() => {
self.wizard.model.selectedCluster = cluster;
self.wizard.wizardObject.message = null;
});
return option;
});
self.clusterContextContainer.addItem(self.clusterContextsLabel);
self.clusterContextContainer.addItems(options);
} else {
self.clusterContextContainer.addItem(this.errorLoadingClustersLabel);
}
self.loadClusterContexts(fileUri.fsPath);
});
}
private async loadClusterContexts(configPath: string): Promise<void> {
this.clusterContextLoadingComponent.loading = true;
let self = this;
this.configFileInput.value = configPath;
await setActiveKubeconfig(configPath);
let clusters = await this.wizard.model.loadClusters();
if (clusters.length !== 0) {
let options = clusters.map(cluster => {
let option = this.view.modelBuilder.radioButton().withProperties<azdata.RadioButtonProperties>({
label: cluster.contextName,
checked: cluster.active,
name: ClusterRadioButtonGroupName
}).component();
if (cluster.active) {
self.wizard.model.selectedCluster = cluster;
self.wizard.wizardObject.message = null;
}
option.onDidClick(() => {
self.wizard.model.selectedCluster = cluster;
self.wizard.wizardObject.message = null;
});
return option;
});
self.clusterContextContainer.addItem(self.clusterContextsLabel);
self.clusterContextContainer.addItems(options);
} else {
self.clusterContextContainer.addItem(this.errorLoadingClustersLabel);
}
this.clusterContextLoadingComponent.loading = false;
}
}

View File

@@ -30,8 +30,8 @@ export class SelectTargetClusterTypePage extends WizardPageBase<CreateClusterWiz
private requiredTools: ToolInfo[];
constructor(wizard: CreateClusterWizard) {
super(localize('bdc-create.selectTargetClusterTypePageTitle', 'Where do you want to deploy this SQL Server big data cluster?'),
localize('bdc-create.selectTargetClusterTypePageDescription', 'Choose the target environment and then install the required tools.'),
super(localize('bdc-create.selectTargetClusterTypePageTitle', 'What is your target cluster environment?'),
localize('bdc-create.selectTargetClusterTypePageDescription', 'Choose the target environment and then install the required tools for it.'),
wizard);
this.installToolsButton = azdata.window.createButton(InstallToolsButtonText);
this.installToolsButton.hidden = true;
@@ -74,7 +74,7 @@ export class SelectTargetClusterTypePage extends WizardPageBase<CreateClusterWiz
let card = self.createCard(view, clusterType);
self.cards.push(card);
});
let cardsContainer = view.modelBuilder.flexContainer().withItems(self.cards, { flex: '0 0 auto' }).withLayout({ flexFlow: 'row', alignItems: 'left' }).component();
let cardsContainer = view.modelBuilder.flexContainer().withItems(self.cards, { flex: '0 0 auto', CSSStyles: { 'margin-bottom': '20px' } }).withLayout({ flexFlow: 'row', alignItems: 'left' }).component();
self.targetDescriptionText = view.modelBuilder.text().component();

View File

@@ -180,18 +180,18 @@ export class SettingsPage extends WizardPageBase<CreateClusterWizard> {
acceptEulaCheckbox.checked = false;
let eulaLink: azdata.LinkArea = {
text: localize('bdc-create.LicenseAgreementText', 'License Agreement'),
url: 'https://docs.microsoft.com/en-us/sql/getting-started/about-the-sql-server-license-terms?view=sql-server-2014'
text: localize('bdc-create.LicenseTerms', 'license terms'),
url: 'https://go.microsoft.com/fwlink/?LinkId=2002534'
};
let privacyPolicyLink: azdata.LinkArea = {
text: localize('bdc-create.PrivacyPolicyText', 'Privacy Policy'),
url: 'https://privacy.microsoft.com/en-us/privacystatement'
text: localize('bdc-create.PrivacyPolicyText', 'privacy policy'),
url: 'https://go.microsoft.com/fwlink/?LinkId=853010'
};
let checkboxText = view.modelBuilder.text().withProperties<azdata.TextComponentProperties>({
value: localize({
key: 'bdc-create.AcceptTermsText',
comment: ['{0} is the place holder for License Agreement, {1} is the place holder for Privacy Policy']
comment: ['{0} is the place holder for license terms, {1} is the place holder for privacy policy']
}, 'I accept the {0} and {1}.'),
links: [eulaLink, privacyPolicyLink]
}).component();