mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-15 02:48:30 -05:00
Refactoring Deploy Cluster to use the a generic Wizard (#13105)
* Refactoring Deploy Cluster to use the generic ResourceTypeWizard * - Remove unnecessary error message - Fixed spacing - Fixed onCancel method implementation in deploy cluster
This commit is contained in:
@@ -8,19 +8,19 @@ import * as vscode from 'vscode';
|
||||
import * as nls from 'vscode-nls';
|
||||
import { FieldType, LabelPosition, SectionInfo } from '../../../interfaces';
|
||||
import { createSection, getDropdownComponent, InputComponentInfo, InputComponents, setModelValues, Validator } from '../../modelViewUtils';
|
||||
import { WizardPageBase } from '../../wizardPageBase';
|
||||
import { AksName_VariableName, Location_VariableName, ResourceGroup_VariableName, SubscriptionId_VariableName, VMCount_VariableName, VMSize_VariableName } from '../constants';
|
||||
import { DeployClusterWizard } from '../deployClusterWizard';
|
||||
import { AzureRegion } from 'azurecore';
|
||||
import { DeployClusterWizardModel } from '../deployClusterWizardModel';
|
||||
import { ResourceTypePage } from '../../resourceTypeWizard';
|
||||
const localize = nls.loadMessageBundle();
|
||||
const MissingRequiredInformationErrorMessage = localize('deployCluster.MissingRequiredInfoError', "Please fill out the required fields marked with red asterisks.");
|
||||
|
||||
export class AzureSettingsPage extends WizardPageBase<DeployClusterWizard> {
|
||||
export class AzureSettingsPage extends ResourceTypePage {
|
||||
private inputComponents: InputComponents = {};
|
||||
|
||||
constructor(wizard: DeployClusterWizard) {
|
||||
constructor(private _model: DeployClusterWizardModel) {
|
||||
super(localize('deployCluster.AzureSettingsPageTitle', "Azure settings"),
|
||||
localize('deployCluster.AzureSettingsPageDescription', "Configure the settings to create an Azure Kubernetes Service cluster"), wizard);
|
||||
localize('deployCluster.AzureSettingsPageDescription', "Configure the settings to create an Azure Kubernetes Service cluster"), _model.wizard);
|
||||
}
|
||||
|
||||
public initialize(): void {
|
||||
@@ -134,13 +134,13 @@ export class AzureSettingsPage extends WizardPageBase<DeployClusterWizard> {
|
||||
},
|
||||
onNewInputComponentCreated: (name: string, inputComponentInfo: InputComponentInfo): void => {
|
||||
self.inputComponents[name] = inputComponentInfo;
|
||||
self.wizard.inputComponents[name] = inputComponentInfo;
|
||||
self._model.inputComponents[name] = inputComponentInfo;
|
||||
},
|
||||
onNewValidatorCreated: (validator: Validator): void => {
|
||||
self.validators.push(validator);
|
||||
},
|
||||
container: this.wizard.wizardObject,
|
||||
inputComponents: this.wizard.inputComponents,
|
||||
inputComponents: this._model.inputComponents,
|
||||
toolsService: this.wizard.toolsService
|
||||
});
|
||||
const formBuilder = view.modelBuilder.formContainer().withFormItems(
|
||||
|
||||
@@ -9,24 +9,23 @@ import * as vscode from 'vscode';
|
||||
import * as nls from 'vscode-nls';
|
||||
import { FieldType, LabelPosition, SectionInfo } from '../../../interfaces';
|
||||
import { createSection, getInputBoxComponent, getInvalidSQLPasswordMessage, getPasswordMismatchMessage, InputComponentInfo, InputComponents, isValidSQLPassword, setModelValues, Validator } from '../../modelViewUtils';
|
||||
import { WizardPageBase } from '../../wizardPageBase';
|
||||
import * as VariableNames from '../constants';
|
||||
import { DeployClusterWizard } from '../deployClusterWizard';
|
||||
import { AuthenticationMode } from '../deployClusterWizardModel';
|
||||
import { AuthenticationMode, DeployClusterWizardModel } from '../deployClusterWizardModel';
|
||||
import * as localizedConstants from '../../../localizedConstants';
|
||||
import { ResourceTypePage } from '../../resourceTypeWizard';
|
||||
const localize = nls.loadMessageBundle();
|
||||
|
||||
const ConfirmPasswordName = 'ConfirmPassword';
|
||||
const clusterNameFieldDescription = localize('deployCluster.ClusterNameDescription', "The cluster name must consist only of alphanumeric lowercase characters or '-' and must start and end with an alphanumeric character.");
|
||||
|
||||
export class ClusterSettingsPage extends WizardPageBase<DeployClusterWizard> {
|
||||
export class ClusterSettingsPage extends ResourceTypePage {
|
||||
private inputComponents: InputComponents = {};
|
||||
private activeDirectorySection!: azdata.FormComponent;
|
||||
private formBuilder!: azdata.FormBuilder;
|
||||
|
||||
constructor(wizard: DeployClusterWizard) {
|
||||
constructor(private _model: DeployClusterWizardModel) {
|
||||
super(localize('deployCluster.ClusterSettingsPageTitle', "Cluster settings"),
|
||||
localize('deployCluster.ClusterSettingsPageDescription', "Configure the SQL Server Big Data Cluster settings"), wizard);
|
||||
localize('deployCluster.ClusterSettingsPageDescription', "Configure the SQL Server Big Data Cluster settings"), _model.wizard);
|
||||
}
|
||||
|
||||
public initialize(): void {
|
||||
@@ -212,14 +211,14 @@ export class ClusterSettingsPage extends WizardPageBase<DeployClusterWizard> {
|
||||
const basicSettingsGroup = await createSection({
|
||||
view: view,
|
||||
container: self.wizard.wizardObject,
|
||||
inputComponents: this.wizard.inputComponents,
|
||||
inputComponents: this._model.inputComponents,
|
||||
sectionInfo: basicSection,
|
||||
onNewDisposableCreated: (disposable: vscode.Disposable): void => {
|
||||
self.wizard.registerDisposable(disposable);
|
||||
},
|
||||
onNewInputComponentCreated: (name: string, inputComponentInfo: InputComponentInfo): void => {
|
||||
self.inputComponents[name] = inputComponentInfo;
|
||||
self.wizard.inputComponents[name] = inputComponentInfo;
|
||||
self._model.inputComponents[name] = inputComponentInfo;
|
||||
},
|
||||
onNewValidatorCreated: (validator: Validator): void => {
|
||||
self.validators.push(validator);
|
||||
@@ -229,14 +228,14 @@ export class ClusterSettingsPage extends WizardPageBase<DeployClusterWizard> {
|
||||
const activeDirectorySettingsGroup = await createSection({
|
||||
view: view,
|
||||
container: self.wizard.wizardObject,
|
||||
inputComponents: this.wizard.inputComponents,
|
||||
inputComponents: this._model.inputComponents,
|
||||
sectionInfo: activeDirectorySection,
|
||||
onNewDisposableCreated: (disposable: vscode.Disposable): void => {
|
||||
self.wizard.registerDisposable(disposable);
|
||||
},
|
||||
onNewInputComponentCreated: (name: string, inputComponentInfo: InputComponentInfo): void => {
|
||||
self.inputComponents[name] = inputComponentInfo;
|
||||
self.wizard.inputComponents[name] = inputComponentInfo;
|
||||
self._model.inputComponents[name] = inputComponentInfo;
|
||||
},
|
||||
onNewValidatorCreated: (validator: Validator): void => {
|
||||
self.validators.push(validator);
|
||||
@@ -246,14 +245,14 @@ export class ClusterSettingsPage extends WizardPageBase<DeployClusterWizard> {
|
||||
const dockerSettingsGroup = await createSection({
|
||||
view: view,
|
||||
container: self.wizard.wizardObject,
|
||||
inputComponents: this.wizard.inputComponents,
|
||||
inputComponents: this._model.inputComponents,
|
||||
sectionInfo: dockerSection,
|
||||
onNewDisposableCreated: (disposable: vscode.Disposable): void => {
|
||||
self.wizard.registerDisposable(disposable);
|
||||
},
|
||||
onNewInputComponentCreated: (name: string, inputComponentInfo: InputComponentInfo): void => {
|
||||
self.inputComponents[name] = inputComponentInfo;
|
||||
self.wizard.inputComponents[name] = inputComponentInfo;
|
||||
self._model.inputComponents[name] = inputComponentInfo;
|
||||
},
|
||||
onNewValidatorCreated: (validator: Validator): void => {
|
||||
self.validators.push(validator);
|
||||
@@ -294,7 +293,7 @@ export class ClusterSettingsPage extends WizardPageBase<DeployClusterWizard> {
|
||||
|
||||
public async onLeave(): Promise<void> {
|
||||
await setModelValues(this.inputComponents, this.wizard.model);
|
||||
if (this.wizard.model.authenticationMode === AuthenticationMode.ActiveDirectory) {
|
||||
if (this._model.authenticationMode === AuthenticationMode.ActiveDirectory) {
|
||||
const variableDNSPrefixMapping: { [s: string]: string } = {};
|
||||
variableDNSPrefixMapping[VariableNames.AppServiceProxyDNSName_VariableName] = 'bdc-appproxy';
|
||||
variableDNSPrefixMapping[VariableNames.ControllerDNSName_VariableName] = 'bdc-control';
|
||||
@@ -319,9 +318,9 @@ export class ClusterSettingsPage extends WizardPageBase<DeployClusterWizard> {
|
||||
getInputBoxComponent(VariableNames.DockerImageTag_VariableName, this.inputComponents).value = this.wizard.model.getStringValue(VariableNames.DockerImageTag_VariableName);
|
||||
const authModeDropdown = <azdata.DropDownComponent>this.inputComponents[VariableNames.AuthenticationMode_VariableName].component;
|
||||
if (authModeDropdown) {
|
||||
authModeDropdown.enabled = this.wizard.model.adAuthSupported;
|
||||
authModeDropdown.enabled = this._model.adAuthSupported;
|
||||
const adAuthSelected = (<azdata.CategoryValue>authModeDropdown.value).name === 'ad';
|
||||
if (!this.wizard.model.adAuthSupported && adAuthSelected) {
|
||||
if (!this._model.adAuthSupported && adAuthSelected) {
|
||||
this.formBuilder.removeFormItem(this.activeDirectorySection);
|
||||
authModeDropdown.value = {
|
||||
name: AuthenticationMode.Basic,
|
||||
|
||||
@@ -8,9 +8,9 @@ import * as nls from 'vscode-nls';
|
||||
import { BdcDeploymentType } from '../../../interfaces';
|
||||
import { BigDataClusterDeploymentProfile } from '../../../services/bigDataClusterDeploymentProfile';
|
||||
import { createFlexContainer, createLabel } from '../../modelViewUtils';
|
||||
import { WizardPageBase } from '../../wizardPageBase';
|
||||
import { ResourceTypePage } from '../../resourceTypeWizard';
|
||||
import * as VariableNames from '../constants';
|
||||
import { DeployClusterWizard } from '../deployClusterWizard';
|
||||
import { DeployClusterWizardModel } from '../deployClusterWizardModel';
|
||||
const localize = nls.loadMessageBundle();
|
||||
|
||||
const serviceScaleTableTitle = localize('deployCluster.serviceScaleTableTitle', "Service scale settings (Instances)");
|
||||
@@ -19,13 +19,13 @@ const featureTableTitle = localize('deployCluster.featureTableTitle', "Features"
|
||||
const YesText = localize('deployCluster.yesText', "Yes");
|
||||
const NoText = localize('deployCluster.noText', "No");
|
||||
|
||||
export class DeploymentProfilePage extends WizardPageBase<DeployClusterWizard> {
|
||||
export class DeploymentProfilePage extends ResourceTypePage {
|
||||
private _loadingComponent: azdata.LoadingComponent | undefined;
|
||||
private _container: azdata.FlexContainer | undefined;
|
||||
|
||||
constructor(wizard: DeployClusterWizard) {
|
||||
constructor(private _model: DeployClusterWizardModel) {
|
||||
super(localize('deployCluster.summaryPageTitle', "Deployment configuration profile"),
|
||||
localize('deployCluster.summaryPageDescription', "Select the target configuration profile"), wizard);
|
||||
localize('deployCluster.summaryPageDescription', "Select the target configuration profile"), _model.wizard);
|
||||
}
|
||||
|
||||
public initialize(): void {
|
||||
@@ -59,36 +59,36 @@ export class DeploymentProfilePage extends WizardPageBase<DeployClusterWizard> {
|
||||
}
|
||||
|
||||
private setModelValuesByProfile(selectedProfile: BigDataClusterDeploymentProfile): void {
|
||||
this.wizard.model.setPropertyValue(VariableNames.DeploymentProfile_VariableName, selectedProfile.profileName);
|
||||
this.wizard.model.setPropertyValue(VariableNames.SparkPoolScale_VariableName, selectedProfile.sparkReplicas);
|
||||
this.wizard.model.setPropertyValue(VariableNames.DataPoolScale_VariableName, selectedProfile.dataReplicas);
|
||||
this.wizard.model.setPropertyValue(VariableNames.HDFSPoolScale_VariableName, selectedProfile.hdfsReplicas);
|
||||
this.wizard.model.setPropertyValue(VariableNames.ComputePoolScale_VariableName, selectedProfile.computeReplicas);
|
||||
this.wizard.model.setPropertyValue(VariableNames.HDFSNameNodeScale_VariableName, selectedProfile.hdfsNameNodeReplicas);
|
||||
this.wizard.model.setPropertyValue(VariableNames.SQLServerScale_VariableName, selectedProfile.sqlServerReplicas);
|
||||
this.wizard.model.setPropertyValue(VariableNames.SparkHeadScale_VariableName, selectedProfile.sparkHeadReplicas);
|
||||
this.wizard.model.setPropertyValue(VariableNames.ZooKeeperScale_VariableName, selectedProfile.zooKeeperReplicas);
|
||||
this.wizard.model.setPropertyValue(VariableNames.ControllerDataStorageSize_VariableName, selectedProfile.controllerDataStorageSize);
|
||||
this.wizard.model.setPropertyValue(VariableNames.ControllerLogsStorageSize_VariableName, selectedProfile.controllerLogsStorageSize);
|
||||
this.wizard.model.setPropertyValue(VariableNames.SQLServerPort_VariableName, selectedProfile.sqlServerPort);
|
||||
this.wizard.model.setPropertyValue(VariableNames.GateWayPort_VariableName, selectedProfile.gatewayPort);
|
||||
this.wizard.model.setPropertyValue(VariableNames.ControllerPort_VariableName, selectedProfile.controllerPort);
|
||||
this.wizard.model.setPropertyValue(VariableNames.ServiceProxyPort_VariableName, selectedProfile.serviceProxyPort);
|
||||
this.wizard.model.setPropertyValue(VariableNames.AppServiceProxyPort_VariableName, selectedProfile.appServiceProxyPort);
|
||||
this.wizard.model.setPropertyValue(VariableNames.IncludeSpark_VariableName, selectedProfile.includeSpark);
|
||||
this.wizard.model.setPropertyValue(VariableNames.ControllerDataStorageClassName_VariableName, selectedProfile.controllerDataStorageClass);
|
||||
this.wizard.model.setPropertyValue(VariableNames.ControllerLogsStorageClassName_VariableName, selectedProfile.controllerLogsStorageClass);
|
||||
this.wizard.model.setPropertyValue(VariableNames.ReadableSecondaryPort_VariableName, selectedProfile.sqlServerReadableSecondaryPort);
|
||||
this.wizard.model.setPropertyValue(VariableNames.DockerRegistry_VariableName, selectedProfile.registry);
|
||||
this.wizard.model.setPropertyValue(VariableNames.DockerRepository_VariableName, selectedProfile.repository);
|
||||
this.wizard.model.setPropertyValue(VariableNames.DockerImageTag_VariableName, selectedProfile.imageTag);
|
||||
this.wizard.model.adAuthSupported = selectedProfile.activeDirectorySupported;
|
||||
this.wizard.model.selectedProfile = selectedProfile;
|
||||
this._model.setPropertyValue(VariableNames.DeploymentProfile_VariableName, selectedProfile.profileName);
|
||||
this._model.setPropertyValue(VariableNames.SparkPoolScale_VariableName, selectedProfile.sparkReplicas);
|
||||
this._model.setPropertyValue(VariableNames.DataPoolScale_VariableName, selectedProfile.dataReplicas);
|
||||
this._model.setPropertyValue(VariableNames.HDFSPoolScale_VariableName, selectedProfile.hdfsReplicas);
|
||||
this._model.setPropertyValue(VariableNames.ComputePoolScale_VariableName, selectedProfile.computeReplicas);
|
||||
this._model.setPropertyValue(VariableNames.HDFSNameNodeScale_VariableName, selectedProfile.hdfsNameNodeReplicas);
|
||||
this._model.setPropertyValue(VariableNames.SQLServerScale_VariableName, selectedProfile.sqlServerReplicas);
|
||||
this._model.setPropertyValue(VariableNames.SparkHeadScale_VariableName, selectedProfile.sparkHeadReplicas);
|
||||
this._model.setPropertyValue(VariableNames.ZooKeeperScale_VariableName, selectedProfile.zooKeeperReplicas);
|
||||
this._model.setPropertyValue(VariableNames.ControllerDataStorageSize_VariableName, selectedProfile.controllerDataStorageSize);
|
||||
this._model.setPropertyValue(VariableNames.ControllerLogsStorageSize_VariableName, selectedProfile.controllerLogsStorageSize);
|
||||
this._model.setPropertyValue(VariableNames.SQLServerPort_VariableName, selectedProfile.sqlServerPort);
|
||||
this._model.setPropertyValue(VariableNames.GateWayPort_VariableName, selectedProfile.gatewayPort);
|
||||
this._model.setPropertyValue(VariableNames.ControllerPort_VariableName, selectedProfile.controllerPort);
|
||||
this._model.setPropertyValue(VariableNames.ServiceProxyPort_VariableName, selectedProfile.serviceProxyPort);
|
||||
this._model.setPropertyValue(VariableNames.AppServiceProxyPort_VariableName, selectedProfile.appServiceProxyPort);
|
||||
this._model.setPropertyValue(VariableNames.IncludeSpark_VariableName, selectedProfile.includeSpark);
|
||||
this._model.setPropertyValue(VariableNames.ControllerDataStorageClassName_VariableName, selectedProfile.controllerDataStorageClass);
|
||||
this._model.setPropertyValue(VariableNames.ControllerLogsStorageClassName_VariableName, selectedProfile.controllerLogsStorageClass);
|
||||
this._model.setPropertyValue(VariableNames.ReadableSecondaryPort_VariableName, selectedProfile.sqlServerReadableSecondaryPort);
|
||||
this._model.setPropertyValue(VariableNames.DockerRegistry_VariableName, selectedProfile.registry);
|
||||
this._model.setPropertyValue(VariableNames.DockerRepository_VariableName, selectedProfile.repository);
|
||||
this._model.setPropertyValue(VariableNames.DockerImageTag_VariableName, selectedProfile.imageTag);
|
||||
this._model.adAuthSupported = selectedProfile.activeDirectorySupported;
|
||||
this._model.selectedProfile = selectedProfile;
|
||||
}
|
||||
|
||||
private async loadProfiles(view: azdata.ModelView): Promise<void> {
|
||||
try {
|
||||
const profiles = await this.wizard.azdataService.getDeploymentProfiles(this.wizard.deploymentType);
|
||||
const profiles = await this.wizard.azdataService.getDeploymentProfiles(this._model.deploymentType);
|
||||
const radioButtonGroup = this.createRadioButtonGroup(view, profiles);
|
||||
const serviceScaleTable = this.createServiceScaleTable(view, profiles);
|
||||
const storageTable = this.createStorageTable(view, profiles);
|
||||
@@ -240,7 +240,7 @@ export class DeploymentProfilePage extends WizardPageBase<DeployClusterWizard> {
|
||||
}
|
||||
|
||||
private getDefaultProfile(): string {
|
||||
switch (this.wizard.deploymentType) {
|
||||
switch (this._model.deploymentType) {
|
||||
case BdcDeploymentType.NewAKS:
|
||||
case BdcDeploymentType.ExistingAKS:
|
||||
return 'aks-dev-test';
|
||||
@@ -251,7 +251,7 @@ export class DeploymentProfilePage extends WizardPageBase<DeployClusterWizard> {
|
||||
case BdcDeploymentType.ExistingOpenShift:
|
||||
return 'openshift-dev-test';
|
||||
default:
|
||||
throw new Error(`Unknown deployment type: ${this.wizard.deploymentType}`);
|
||||
throw new Error(`Unknown deployment type: ${this._model.deploymentType}`);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,17 +7,16 @@ import * as vscode from 'vscode';
|
||||
import * as nls from 'vscode-nls';
|
||||
import { FieldType, SectionInfo } from '../../../interfaces';
|
||||
import { createFlexContainer, createGroupContainer, createLabel, createNumberInput, createSection, createTextInput, getCheckboxComponent, getDropdownComponent, getInputBoxComponent, InputComponentInfo, InputComponents, setModelValues, Validator } from '../../modelViewUtils';
|
||||
import { WizardPageBase } from '../../wizardPageBase';
|
||||
import { ResourceTypePage } from '../../resourceTypeWizard';
|
||||
import * as VariableNames from '../constants';
|
||||
import { DeployClusterWizard } from '../deployClusterWizard';
|
||||
import { AuthenticationMode } from '../deployClusterWizardModel';
|
||||
import { AuthenticationMode, DeployClusterWizardModel } from '../deployClusterWizardModel';
|
||||
const localize = nls.loadMessageBundle();
|
||||
|
||||
const NumberInputWidth = '100px';
|
||||
const inputWidth = '180px';
|
||||
const labelWidth = '200px';
|
||||
|
||||
export class ServiceSettingsPage extends WizardPageBase<DeployClusterWizard> {
|
||||
export class ServiceSettingsPage extends ResourceTypePage {
|
||||
private inputComponents: InputComponents = {};
|
||||
private endpointHeaderRow!: azdata.FlexContainer;
|
||||
private dnsColumnHeader!: azdata.TextComponent;
|
||||
@@ -49,8 +48,8 @@ export class ServiceSettingsPage extends WizardPageBase<DeployClusterWizard> {
|
||||
private readableSecondaryNameLabel!: azdata.TextComponent;
|
||||
private endpointSection!: azdata.GroupContainer;
|
||||
|
||||
constructor(wizard: DeployClusterWizard) {
|
||||
super(localize('deployCluster.ServiceSettingsPageTitle', "Service settings"), '', wizard);
|
||||
constructor(private _model: DeployClusterWizardModel) {
|
||||
super(localize('deployCluster.ServiceSettingsPageTitle', "Service settings"), '', _model.wizard);
|
||||
}
|
||||
public initialize(): void {
|
||||
const self = this;
|
||||
@@ -120,7 +119,7 @@ export class ServiceSettingsPage extends WizardPageBase<DeployClusterWizard> {
|
||||
return await createSection({
|
||||
view: view,
|
||||
container: this.wizard.wizardObject,
|
||||
inputComponents: this.wizard.inputComponents,
|
||||
inputComponents: this._model.inputComponents,
|
||||
sectionInfo: sectionInfo,
|
||||
onNewDisposableCreated: (disposable: vscode.Disposable): void => {
|
||||
self.wizard.registerDisposable(disposable);
|
||||
@@ -156,7 +155,7 @@ export class ServiceSettingsPage extends WizardPageBase<DeployClusterWizard> {
|
||||
|
||||
private onNewInputComponentCreated(name: string, inputComponentInfo: InputComponentInfo) {
|
||||
this.inputComponents[name] = inputComponentInfo;
|
||||
this.wizard.inputComponents[name] = inputComponentInfo;
|
||||
this._model.inputComponents[name] = inputComponentInfo;
|
||||
}
|
||||
|
||||
private handleSparkSettingEvents(): void {
|
||||
@@ -352,7 +351,7 @@ export class ServiceSettingsPage extends WizardPageBase<DeployClusterWizard> {
|
||||
this.setInputBoxValue(VariableNames.ControllerLogsStorageClassName_VariableName);
|
||||
this.setInputBoxValue(VariableNames.ControllerLogsStorageSize_VariableName);
|
||||
this.endpointHeaderRow.clearItems();
|
||||
const adAuth = this.wizard.model.authenticationMode === AuthenticationMode.ActiveDirectory;
|
||||
const adAuth = this._model.authenticationMode === AuthenticationMode.ActiveDirectory;
|
||||
const sqlServerScale = this.wizard.model.getIntegerValue(VariableNames.SQLServerScale_VariableName);
|
||||
|
||||
this.endpointSection.collapsed = !adAuth;
|
||||
@@ -425,7 +424,7 @@ export class ServiceSettingsPage extends WizardPageBase<DeployClusterWizard> {
|
||||
row.clearItems();
|
||||
const itemLayout: azdata.FlexItemLayout = { CSSStyles: { 'margin-right': '20px' } };
|
||||
row.addItem(label);
|
||||
if (this.wizard.model.authenticationMode === AuthenticationMode.ActiveDirectory) {
|
||||
if (this._model.authenticationMode === AuthenticationMode.ActiveDirectory) {
|
||||
row.addItem(dnsInput, itemLayout);
|
||||
}
|
||||
row.addItem(portInput);
|
||||
|
||||
@@ -4,22 +4,21 @@
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
import * as azdata from 'azdata';
|
||||
import * as nls from 'vscode-nls';
|
||||
import { DeployClusterWizard } from '../deployClusterWizard';
|
||||
import { SectionInfo, FieldType, LabelPosition, BdcDeploymentType, FontWeight } from '../../../interfaces';
|
||||
import { createSection, createGroupContainer, createFlexContainer, createLabel } from '../../modelViewUtils';
|
||||
import { WizardPageBase } from '../../wizardPageBase';
|
||||
import * as VariableNames from '../constants';
|
||||
import { AuthenticationMode } from '../deployClusterWizardModel';
|
||||
import { AuthenticationMode, DeployClusterWizardModel } from '../deployClusterWizardModel';
|
||||
import * as localizedConstants from '../../../localizedConstants';
|
||||
import { ResourceTypePage } from '../../resourceTypeWizard';
|
||||
const localize = nls.loadMessageBundle();
|
||||
|
||||
export class SummaryPage extends WizardPageBase<DeployClusterWizard> {
|
||||
export class SummaryPage extends ResourceTypePage {
|
||||
private formItems: azdata.FormComponent[] = [];
|
||||
private form!: azdata.FormBuilder;
|
||||
private view!: azdata.ModelView;
|
||||
|
||||
constructor(wizard: DeployClusterWizard) {
|
||||
super(localize('deployCluster.summaryPageTitle', "Summary"), '', wizard);
|
||||
constructor(private _model: DeployClusterWizardModel) {
|
||||
super(localize('deployCluster.summaryPageTitle', "Summary"), '', _model.wizard);
|
||||
}
|
||||
|
||||
public initialize(): void {
|
||||
@@ -31,7 +30,7 @@ export class SummaryPage extends WizardPageBase<DeployClusterWizard> {
|
||||
}
|
||||
|
||||
public async onEnter(): Promise<void> {
|
||||
this.wizard.showCustomButtons();
|
||||
this._model.showCustomButtons();
|
||||
this.formItems.forEach(item => {
|
||||
this.form!.removeFormItem(item);
|
||||
});
|
||||
@@ -92,7 +91,7 @@ export class SummaryPage extends WizardPageBase<DeployClusterWizard> {
|
||||
}, {
|
||||
type: FieldType.ReadonlyText,
|
||||
label: localize('deployCluster.AuthenticationMode', "Authentication mode"),
|
||||
defaultValue: this.wizard.model.authenticationMode === AuthenticationMode.ActiveDirectory ?
|
||||
defaultValue: this._model.authenticationMode === AuthenticationMode.ActiveDirectory ?
|
||||
localize('deployCluster.AuthenticationMode.ActiveDirectory', "Active Directory") :
|
||||
localize('deployCluster.AuthenticationMode.Basic', "Basic"),
|
||||
labelCSSStyles: { fontWeight: FontWeight.Bold }
|
||||
@@ -102,13 +101,13 @@ export class SummaryPage extends WizardPageBase<DeployClusterWizard> {
|
||||
]
|
||||
};
|
||||
|
||||
if (this.wizard.model.authenticationMode === AuthenticationMode.ActiveDirectory) {
|
||||
if (this._model.authenticationMode === AuthenticationMode.ActiveDirectory) {
|
||||
clusterSectionInfo.rows!.push({
|
||||
items: [
|
||||
{
|
||||
type: FieldType.ReadonlyText,
|
||||
label: localize('deployCluster.OuDistinguishedName', "Organizational unit"),
|
||||
defaultValue: this.wizard.model.getStringValue(VariableNames.OrganizationalUnitDistinguishedName_VariableName),
|
||||
defaultValue: this._model.getStringValue(VariableNames.OrganizationalUnitDistinguishedName_VariableName),
|
||||
labelCSSStyles: { fontWeight: FontWeight.Bold }
|
||||
},
|
||||
{
|
||||
@@ -291,7 +290,7 @@ export class SummaryPage extends WizardPageBase<DeployClusterWizard> {
|
||||
title: '',
|
||||
component: await createSection({
|
||||
container: this.wizard.wizardObject,
|
||||
inputComponents: this.wizard.inputComponents,
|
||||
inputComponents: this._model.inputComponents,
|
||||
sectionInfo: sectionInfo,
|
||||
view: this.view,
|
||||
onNewDisposableCreated: () => { },
|
||||
@@ -302,7 +301,7 @@ export class SummaryPage extends WizardPageBase<DeployClusterWizard> {
|
||||
};
|
||||
};
|
||||
|
||||
if (this.wizard.deploymentType === BdcDeploymentType.ExistingAKS || this.wizard.deploymentType === BdcDeploymentType.ExistingKubeAdm) {
|
||||
if (this._model.deploymentType === BdcDeploymentType.ExistingAKS || this._model.deploymentType === BdcDeploymentType.ExistingKubeAdm) {
|
||||
const deploymentTargetSection = await createSectionFunc(deploymentTargetSectionInfo);
|
||||
this.formItems.push(deploymentTargetSection);
|
||||
}
|
||||
@@ -327,7 +326,7 @@ export class SummaryPage extends WizardPageBase<DeployClusterWizard> {
|
||||
}
|
||||
|
||||
public async onLeave(): Promise<void> {
|
||||
this.wizard.hideCustomButtons();
|
||||
this._model.hideCustomButtons();
|
||||
this.wizard.wizardObject.message = { text: '' };
|
||||
}
|
||||
|
||||
@@ -422,7 +421,7 @@ export class SummaryPage extends WizardPageBase<DeployClusterWizard> {
|
||||
private createEndpointRow(name: string, dnsVariableName: string, portVariableName: string): azdata.FlexContainer {
|
||||
const items = [];
|
||||
items.push(createLabel(this.view, { text: name, width: '150px', cssStyles: { fontWeight: FontWeight.Bold } }));
|
||||
if (this.wizard.model.authenticationMode === AuthenticationMode.ActiveDirectory) {
|
||||
if (this._model.authenticationMode === AuthenticationMode.ActiveDirectory) {
|
||||
items.push(createLabel(this.view, {
|
||||
text: this.wizard.model.getStringValue(dnsVariableName)!, width: '200px'
|
||||
}));
|
||||
|
||||
@@ -7,15 +7,15 @@ import * as azdata from 'azdata';
|
||||
import * as os from 'os';
|
||||
import * as vscode from 'vscode';
|
||||
import * as nls from 'vscode-nls';
|
||||
import { DeployClusterWizard } from '../deployClusterWizard';
|
||||
import { WizardPageBase } from '../../wizardPageBase';
|
||||
import { KubeClusterContext } from '../../../services/kubeService';
|
||||
import { ClusterContext_VariableName, KubeConfigPath_VariableName } from '../constants';
|
||||
import { ResourceTypePage } from '../../resourceTypeWizard';
|
||||
import { DeployClusterWizardModel } from '../deployClusterWizardModel';
|
||||
const localize = nls.loadMessageBundle();
|
||||
|
||||
const ClusterRadioButtonGroupName = 'ClusterRadioGroup';
|
||||
|
||||
export class TargetClusterContextPage extends WizardPageBase<DeployClusterWizard> {
|
||||
export class TargetClusterContextPage extends ResourceTypePage {
|
||||
private existingClusterControl: azdata.FlexContainer | undefined;
|
||||
private clusterContextsLabel: azdata.TextComponent | undefined;
|
||||
private errorLoadingClustersLabel: azdata.TextComponent | undefined;
|
||||
@@ -26,9 +26,9 @@ export class TargetClusterContextPage extends WizardPageBase<DeployClusterWizard
|
||||
private loadDefaultKubeConfigFile: boolean = true;
|
||||
private view: azdata.ModelView | undefined;
|
||||
|
||||
constructor(wizard: DeployClusterWizard) {
|
||||
constructor(private _model: DeployClusterWizardModel) {
|
||||
super(localize('deployCluster.TargetClusterContextPageTitle', "Target cluster context"),
|
||||
localize('deployCluster.TargetClusterContextPageDescription', "Select the kube config file and then select a cluster context from the list"), wizard);
|
||||
localize('deployCluster.TargetClusterContextPageDescription', "Select the kube config file and then select a cluster context from the list"), _model.wizard);
|
||||
}
|
||||
|
||||
public initialize(): void {
|
||||
@@ -53,7 +53,7 @@ export class TargetClusterContextPage extends WizardPageBase<DeployClusterWizard
|
||||
|
||||
public async onEnter(): Promise<void> {
|
||||
if (this.loadDefaultKubeConfigFile) {
|
||||
let defaultKubeConfigPath = this.wizard.kubeService.getDefaultConfigPath();
|
||||
let defaultKubeConfigPath = this._model.kubeService.getDefaultConfigPath();
|
||||
this.loadClusterContexts(defaultKubeConfigPath);
|
||||
this.loadDefaultKubeConfigFile = false;
|
||||
}
|
||||
@@ -140,7 +140,7 @@ export class TargetClusterContextPage extends WizardPageBase<DeployClusterWizard
|
||||
|
||||
let clusterContexts: KubeClusterContext[] = [];
|
||||
try {
|
||||
clusterContexts = await this.wizard.kubeService.getClusterContexts(configPath);
|
||||
clusterContexts = await this._model.kubeService.getClusterContexts(configPath);
|
||||
} catch (error) {
|
||||
this.wizard.wizardObject.message = {
|
||||
text: localize('deployCluster.ConfigParseError', "Failed to load the config file"),
|
||||
|
||||
Reference in New Issue
Block a user