mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-07 17:23:56 -05:00
Add Storage Class params to MIAA deploy (#11993)
This commit is contained in:
@@ -57,8 +57,8 @@ export class DeployClusterWizard extends WizardBase<DeployClusterWizard, WizardP
|
||||
this._saveConfigButton.hidden = true;
|
||||
}
|
||||
|
||||
constructor(private wizardInfo: BdcWizardInfo, private _kubeService: IKubeService, private _azdataService: IAzdataService, private _notebookService: INotebookService, private _toolsService: IToolsService) {
|
||||
super(DeployClusterWizard.getTitle(wizardInfo.type), new DeployClusterWizardModel(wizardInfo.type));
|
||||
constructor(private wizardInfo: BdcWizardInfo, private _kubeService: IKubeService, private _azdataService: IAzdataService, private _notebookService: INotebookService, toolsService: IToolsService) {
|
||||
super(DeployClusterWizard.getTitle(wizardInfo.type), new DeployClusterWizardModel(wizardInfo.type), toolsService);
|
||||
this._saveConfigButton = azdata.window.createButton(localize('deployCluster.SaveConfigFiles', "Save config files"), 'left');
|
||||
this._saveConfigButton.hidden = true;
|
||||
this.addButton(this._saveConfigButton);
|
||||
@@ -141,7 +141,7 @@ export class DeployClusterWizard extends WizardBase<DeployClusterWizard, WizardP
|
||||
|
||||
private async scriptToNotebook(): Promise<void> {
|
||||
this.setEnvironmentVariables(process.env);
|
||||
const variableValueStatements = this.model.getCodeCellContentForNotebook(this._toolsService.toolsForCurrentProvider);
|
||||
const variableValueStatements = this.model.getCodeCellContentForNotebook(this.toolsService.toolsForCurrentProvider);
|
||||
const insertionPosition = 5; // Cell number 5 is the position where the python variable setting statements need to be inserted in this.wizardInfo.notebook.
|
||||
try {
|
||||
await this.notebookService.launchNotebookWithEdits(this.wizardInfo.notebook, variableValueStatements, insertionPosition);
|
||||
|
||||
@@ -139,7 +139,8 @@ export class AzureSettingsPage extends WizardPageBase<DeployClusterWizard> {
|
||||
self.validators.push(validator);
|
||||
},
|
||||
container: this.wizard.wizardObject,
|
||||
inputComponents: this.wizard.inputComponents
|
||||
inputComponents: this.wizard.inputComponents,
|
||||
toolsService: this.wizard.toolsService
|
||||
});
|
||||
const formBuilder = view.modelBuilder.formContainer().withFormItems(
|
||||
[{
|
||||
|
||||
@@ -222,7 +222,8 @@ export class ClusterSettingsPage extends WizardPageBase<DeployClusterWizard> {
|
||||
},
|
||||
onNewValidatorCreated: (validator: Validator): void => {
|
||||
self.validators.push(validator);
|
||||
}
|
||||
},
|
||||
toolsService: this.wizard.toolsService
|
||||
});
|
||||
const activeDirectorySettingsGroup = await createSection({
|
||||
view: view,
|
||||
@@ -237,7 +238,8 @@ export class ClusterSettingsPage extends WizardPageBase<DeployClusterWizard> {
|
||||
},
|
||||
onNewValidatorCreated: (validator: Validator): void => {
|
||||
self.validators.push(validator);
|
||||
}
|
||||
},
|
||||
toolsService: this.wizard.toolsService
|
||||
});
|
||||
const dockerSettingsGroup = await createSection({
|
||||
view: view,
|
||||
@@ -252,7 +254,8 @@ export class ClusterSettingsPage extends WizardPageBase<DeployClusterWizard> {
|
||||
},
|
||||
onNewValidatorCreated: (validator: Validator): void => {
|
||||
self.validators.push(validator);
|
||||
}
|
||||
},
|
||||
toolsService: this.wizard.toolsService
|
||||
});
|
||||
const basicSettingsFormItem = { title: '', component: basicSettingsGroup };
|
||||
const dockerSettingsFormItem = { title: '', component: dockerSettingsGroup };
|
||||
|
||||
@@ -128,7 +128,8 @@ export class ServiceSettingsPage extends WizardPageBase<DeployClusterWizard> {
|
||||
this.inputComponents[name] = { component: inputComponentInfo.component };
|
||||
},
|
||||
onNewValidatorCreated: (validator: Validator): void => {
|
||||
}
|
||||
},
|
||||
toolsService: this.wizard.toolsService
|
||||
});
|
||||
};
|
||||
const scaleSection = await createSectionFunc(scaleSectionInfo);
|
||||
|
||||
@@ -296,7 +296,8 @@ export class SummaryPage extends WizardPageBase<DeployClusterWizard> {
|
||||
view: this.view,
|
||||
onNewDisposableCreated: () => { },
|
||||
onNewInputComponentCreated: () => { },
|
||||
onNewValidatorCreated: () => { }
|
||||
onNewValidatorCreated: () => { },
|
||||
toolsService: this.wizard.toolsService
|
||||
})
|
||||
};
|
||||
};
|
||||
|
||||
@@ -13,6 +13,7 @@ import { IPlatformService } from '../services/platformService';
|
||||
import { DialogBase } from './dialogBase';
|
||||
import { Model } from './model';
|
||||
import { initializeDialog, InputComponentInfo, InputComponents, setModelValues, Validator } from './modelViewUtils';
|
||||
import { IToolsService } from '../services/toolsService';
|
||||
|
||||
const localize = nls.loadMessageBundle();
|
||||
|
||||
@@ -22,6 +23,7 @@ export class DeploymentInputDialog extends DialogBase {
|
||||
|
||||
constructor(private notebookService: INotebookService,
|
||||
private platformService: IPlatformService,
|
||||
private toolsService: IToolsService,
|
||||
private dialogInfo: DialogInfo) {
|
||||
super(dialogInfo.title, dialogInfo.name, false);
|
||||
let okButtonText: string;
|
||||
@@ -51,7 +53,8 @@ export class DeploymentInputDialog extends DialogBase {
|
||||
},
|
||||
onNewValidatorCreated: (validator: Validator): void => {
|
||||
validators.push(validator);
|
||||
}
|
||||
},
|
||||
toolsService: this.toolsService
|
||||
});
|
||||
this._dialogObject.registerCloseValidator(() => {
|
||||
const messages: string[] = [];
|
||||
|
||||
@@ -17,6 +17,8 @@ import { assert, getDateTimeString, getErrorMessage } from '../utils';
|
||||
import { WizardInfoBase } from './../interfaces';
|
||||
import { Model } from './model';
|
||||
import { RadioGroupLoadingComponentBuilder } from './radioGroupLoadingComponentBuilder';
|
||||
import { IToolsService } from '../services/toolsService';
|
||||
import { KubeCtlToolName, KubeCtlTool } from '../services/tools/kubeCtlTool';
|
||||
|
||||
const localize = nls.loadMessageBundle();
|
||||
|
||||
@@ -107,6 +109,7 @@ interface AzureAccountComponents {
|
||||
|
||||
interface ContextBase {
|
||||
container: azdata.window.Dialog | azdata.window.Wizard;
|
||||
toolsService: IToolsService,
|
||||
inputComponents: InputComponents;
|
||||
onNewValidatorCreated: (validator: Validator) => void;
|
||||
onNewDisposableCreated: (disposable: vscode.Disposable) => void;
|
||||
@@ -197,7 +200,8 @@ export function initializeDialog(dialogContext: DialogContext): void {
|
||||
onNewInputComponentCreated: dialogContext.onNewInputComponentCreated,
|
||||
onNewValidatorCreated: dialogContext.onNewValidatorCreated,
|
||||
container: dialogContext.container,
|
||||
inputComponents: dialogContext.inputComponents
|
||||
inputComponents: dialogContext.inputComponents,
|
||||
toolsService: dialogContext.toolsService
|
||||
});
|
||||
}));
|
||||
const formBuilder = view.modelBuilder.formContainer().withFormItems(
|
||||
@@ -229,6 +233,7 @@ export function initializeWizardPage(context: WizardPageContext): void {
|
||||
return createSection({
|
||||
view: view,
|
||||
container: context.container,
|
||||
toolsService: context.toolsService,
|
||||
inputComponents: context.inputComponents,
|
||||
onNewDisposableCreated: context.onNewDisposableCreated,
|
||||
onNewInputComponentCreated: context.onNewInputComponentCreated,
|
||||
@@ -299,7 +304,8 @@ async function processFields(fieldInfoArray: FieldInfo[], components: azdata.Com
|
||||
fieldInfo: fieldInfo,
|
||||
container: context.container,
|
||||
inputComponents: context.inputComponents,
|
||||
components: components
|
||||
components: components,
|
||||
toolsService: context.toolsService
|
||||
});
|
||||
if (spaceBetweenFields && i < fieldInfoArray.length - 1) {
|
||||
components.push(context.view.modelBuilder.divContainer().withLayout({ width: spaceBetweenFields }).component());
|
||||
@@ -380,6 +386,9 @@ async function processField(context: FieldContext): Promise<void> {
|
||||
case FieldType.KubeClusterContextPicker:
|
||||
processKubeConfigClusterPickerField(context);
|
||||
break;
|
||||
case FieldType.KubeStorageClass:
|
||||
await processKubeStorageClassField(context);
|
||||
break;
|
||||
default:
|
||||
throw new Error(localize('UnknownFieldTypeError', "Unknown field type: \"{0}\"", context.fieldInfo.type));
|
||||
}
|
||||
@@ -719,7 +728,8 @@ async function processKubeConfigClusterPickerField(context: KubeClusterContextFi
|
||||
variableName: kubeConfigFilePathVariableName,
|
||||
labelPosition: LabelPosition.Left,
|
||||
required: true
|
||||
}
|
||||
},
|
||||
toolsService: context.toolsService
|
||||
};
|
||||
const filePicker = processFilePickerField(filePickerContext);
|
||||
context.fieldInfo.subFields = context.fieldInfo.subFields || [];
|
||||
@@ -840,6 +850,42 @@ async function processAzureAccountField(context: AzureAccountFieldContext): Prom
|
||||
}, 0);
|
||||
}
|
||||
|
||||
async function processKubeStorageClassField(context: FieldContext): Promise<void> {
|
||||
const label = createLabel(context.view, {
|
||||
text: context.fieldInfo.label,
|
||||
description: context.fieldInfo.description,
|
||||
required: context.fieldInfo.required,
|
||||
width: context.fieldInfo.labelWidth,
|
||||
cssStyles: context.fieldInfo.labelCSSStyles
|
||||
});
|
||||
|
||||
// Try to query for the available storage classes - but if this fails the dropdown is editable
|
||||
// so users can still enter their own
|
||||
let storageClasses: string[] = [];
|
||||
let defaultStorageClass = '';
|
||||
try {
|
||||
const kubeCtlTool = context.toolsService.getToolByName(KubeCtlToolName) as KubeCtlTool;
|
||||
const response = await kubeCtlTool.getStorageClasses();
|
||||
storageClasses = response.storageClasses;
|
||||
defaultStorageClass = response.defaultStorageClass;
|
||||
} catch (err) {
|
||||
vscode.window.showErrorMessage(localize('resourceDeployment.errorFetchingStorageClasses', "Unexpected error fetching available kubectl storage classes : {0}", err.message ?? err));
|
||||
}
|
||||
|
||||
const storageClassDropdown = createDropdown(context.view, {
|
||||
width: context.fieldInfo.inputWidth,
|
||||
editable: true,
|
||||
required: context.fieldInfo.required,
|
||||
label: context.fieldInfo.label,
|
||||
values: storageClasses,
|
||||
defaultValue: defaultStorageClass
|
||||
});
|
||||
storageClassDropdown.fireOnTextChange = true;
|
||||
context.onNewInputComponentCreated(context.fieldInfo.variableName!, { component: storageClassDropdown });
|
||||
addLabelInputPairToContainer(context.view, context.components, label, storageClassDropdown, context.fieldInfo);
|
||||
}
|
||||
|
||||
|
||||
function getAccountDisplayString(account: azdata.Account) {
|
||||
return `${account.displayInfo.displayName} (${account.displayInfo.userId})`;
|
||||
}
|
||||
|
||||
@@ -35,8 +35,8 @@ export class NotebookWizard extends WizardBase<NotebookWizard, NotebookWizardPag
|
||||
return this._inputComponents;
|
||||
}
|
||||
|
||||
constructor(private _wizardInfo: NotebookWizardInfo, private _notebookService: INotebookService, private _platformService: IPlatformService, private _toolsService: IToolsService) {
|
||||
super(_wizardInfo.title, new Model());
|
||||
constructor(private _wizardInfo: NotebookWizardInfo, private _notebookService: INotebookService, private _platformService: IPlatformService, toolsService: IToolsService) {
|
||||
super(_wizardInfo.title, new Model(), toolsService);
|
||||
if (this._wizardInfo.codeCellInsertionPosition === undefined) {
|
||||
this._wizardInfo.codeCellInsertionPosition = 0;
|
||||
}
|
||||
@@ -67,7 +67,7 @@ export class NotebookWizard extends WizardBase<NotebookWizard, NotebookWizardPag
|
||||
const notebook: Notebook = await this.notebookService.getNotebook(this.wizardInfo.notebook);
|
||||
// generate python code statements for all variables captured by the wizard
|
||||
const statements = this.model.getCodeCellContentForNotebook(
|
||||
this._toolsService.toolsForCurrentProvider,
|
||||
this.toolsService.toolsForCurrentProvider,
|
||||
(varName) => {
|
||||
const isPassword = !!this.inputComponents[varName]?.isPassword;
|
||||
return !isPassword;
|
||||
|
||||
@@ -79,6 +79,7 @@ export class NotebookWizardAutoSummaryPage extends NotebookWizardPage {
|
||||
title: pageInfo.title,
|
||||
component: await createSection({
|
||||
container: this.wizard.wizardObject,
|
||||
toolsService: this.wizard.toolsService,
|
||||
inputComponents: this.wizard.inputComponents,
|
||||
sectionInfo: summarySectionInfo,
|
||||
view: this.view,
|
||||
|
||||
@@ -53,6 +53,7 @@ export class NotebookWizardPage extends WizardPageBase<NotebookWizard> {
|
||||
onNewValidatorCreated: (validator: Validator): void => {
|
||||
this.validators.push(validator);
|
||||
},
|
||||
toolsService: this.wizard.toolsService
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -94,7 +94,7 @@ export class ResourceTypePickerDialog extends DialogBase {
|
||||
this._agreementContainer = view.modelBuilder.divContainer().component();
|
||||
const toolColumn: azdata.TableColumn = {
|
||||
value: localize('deploymentDialog.toolNameColumnHeader', "Tool"),
|
||||
width: 55
|
||||
width: 80
|
||||
};
|
||||
const descriptionColumn: azdata.TableColumn = {
|
||||
value: localize('deploymentDialog.toolDescriptionColumnHeader', "Description"),
|
||||
|
||||
@@ -8,6 +8,7 @@ import * as vscode from 'vscode';
|
||||
import * as nls from 'vscode-nls';
|
||||
import { WizardPageBase } from './wizardPageBase';
|
||||
import { Model } from './model';
|
||||
import { IToolsService } from '../services/toolsService';
|
||||
const localize = nls.loadMessageBundle();
|
||||
|
||||
export abstract class WizardBase<T, P extends WizardPageBase<T>, M extends Model> {
|
||||
@@ -20,7 +21,7 @@ export abstract class WizardBase<T, P extends WizardPageBase<T>, M extends Model
|
||||
return this._model;
|
||||
}
|
||||
|
||||
constructor(private title: string, private _model: M) {
|
||||
constructor(private title: string, private _model: M, public toolsService: IToolsService) {
|
||||
this.wizardObject = azdata.window.createWizard(title);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user