mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-04 01:25:38 -05:00
Port 807a4ae8c4 (#12747)
This commit is contained in:
@@ -66,7 +66,7 @@ export class ConfigurePythonWizard {
|
||||
} else {
|
||||
wizardTitle = localize('configurePython.wizardNameWithoutKernel', "Configure Python to run kernels");
|
||||
}
|
||||
this._wizard = azdata.window.createWizard(wizardTitle, 600);
|
||||
this._wizard = azdata.window.createWizard(wizardTitle, 'ConfigurePythonWizard', 600);
|
||||
let page0 = azdata.window.createWizardPage(localize('configurePython.page0Name', "Configure Python Runtime"));
|
||||
let page1 = azdata.window.createWizardPage(localize('configurePython.page1Name', "Install Dependencies"));
|
||||
|
||||
|
||||
@@ -119,6 +119,7 @@ export interface WizardInfoBase extends FieldInfoBase {
|
||||
type?: DeploymentType;
|
||||
actionText?: string;
|
||||
title: string;
|
||||
name?: string;
|
||||
pages: PageInfoBase[];
|
||||
isSummaryPageAutoGenerated?: boolean
|
||||
}
|
||||
|
||||
@@ -58,7 +58,7 @@ export class DeployClusterWizard extends WizardBase<DeployClusterWizard, WizardP
|
||||
}
|
||||
|
||||
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);
|
||||
super(DeployClusterWizard.getTitle(wizardInfo.type), 'DeployBdcClusterWizard', 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);
|
||||
|
||||
@@ -36,7 +36,7 @@ export class NotebookWizard extends WizardBase<NotebookWizard, NotebookWizardPag
|
||||
}
|
||||
|
||||
constructor(private _wizardInfo: NotebookWizardInfo, private _notebookService: INotebookService, private _platformService: IPlatformService, toolsService: IToolsService) {
|
||||
super(_wizardInfo.title, new Model(), toolsService);
|
||||
super(_wizardInfo.title, _wizardInfo.name || '', new Model(), toolsService);
|
||||
if (this._wizardInfo.codeCellInsertionPosition === undefined) {
|
||||
this._wizardInfo.codeCellInsertionPosition = 0;
|
||||
}
|
||||
|
||||
@@ -21,8 +21,8 @@ export abstract class WizardBase<T, P extends WizardPageBase<T>, M extends Model
|
||||
return this._model;
|
||||
}
|
||||
|
||||
constructor(private title: string, private _model: M, public toolsService: IToolsService) {
|
||||
this.wizardObject = azdata.window.createWizard(title);
|
||||
constructor(private title: string, name: string, private _model: M, public toolsService: IToolsService) {
|
||||
this.wizardObject = azdata.window.createWizard(title, name);
|
||||
}
|
||||
|
||||
public async open(): Promise<void> {
|
||||
|
||||
7
src/sql/azdata.proposed.d.ts
vendored
7
src/sql/azdata.proposed.d.ts
vendored
@@ -529,6 +529,10 @@ declare module 'azdata' {
|
||||
}
|
||||
|
||||
export interface Wizard {
|
||||
/**
|
||||
* The name used to identify the wizard in telemetry
|
||||
*/
|
||||
name?: string;
|
||||
/**
|
||||
* Width of the wizard
|
||||
*/
|
||||
@@ -548,9 +552,10 @@ declare module 'azdata' {
|
||||
/**
|
||||
* Create a wizard with the given title and width
|
||||
* @param title The title of the wizard
|
||||
* @param name The name used to identify the wizard in telemetry
|
||||
* @param width The width of the wizard, default value is 'narrow'
|
||||
*/
|
||||
export function createWizard(title: string, width?: DialogWidth): Wizard;
|
||||
export function createWizard(title: string, name?: string, width?: DialogWidth): Wizard;
|
||||
}
|
||||
|
||||
export namespace workspace {
|
||||
|
||||
@@ -170,7 +170,7 @@ export class MainThreadModelViewDialog implements MainThreadModelViewDialogShape
|
||||
public $setWizardDetails(handle: number, details: IModelViewWizardDetails): Thenable<void> {
|
||||
let wizard = this._wizards.get(handle);
|
||||
if (!wizard) {
|
||||
wizard = new Wizard(details.title);
|
||||
wizard = new Wizard(details.title, details.name || 'WizardPage');
|
||||
wizard.width = details.width;
|
||||
wizard.backButton = this.getButton(details.backButton);
|
||||
wizard.cancelButton = this.getButton(details.cancelButton);
|
||||
|
||||
@@ -383,7 +383,7 @@ class WizardImpl implements azdata.window.Wizard {
|
||||
private _operationHandler: BackgroundOperationHandler;
|
||||
private _width: DialogWidth;
|
||||
|
||||
constructor(public title: string, private _extHostModelViewDialog: ExtHostModelViewDialog, extHostTaskManagement: ExtHostBackgroundTaskManagementShape) {
|
||||
constructor(public title: string, public name: string, private _extHostModelViewDialog: ExtHostModelViewDialog, extHostTaskManagement: ExtHostBackgroundTaskManagementShape) {
|
||||
this.doneButton = this._extHostModelViewDialog.createButton(DONE_LABEL);
|
||||
this.cancelButton = this._extHostModelViewDialog.createButton(CANCEL_LABEL);
|
||||
this.generateScriptButton = this._extHostModelViewDialog.createButton(GENERATE_SCRIPT_LABEL);
|
||||
@@ -764,8 +764,8 @@ export class ExtHostModelViewDialog implements ExtHostModelViewDialogShape {
|
||||
return page;
|
||||
}
|
||||
|
||||
public createWizard(title: string, width: azdata.window.DialogWidth = 'wide'): azdata.window.Wizard {
|
||||
let wizard = new WizardImpl(title, this, this._extHostTaskManagement);
|
||||
public createWizard(title: string, name: string = 'ModelViewWizard', width: azdata.window.DialogWidth = 'wide'): azdata.window.Wizard {
|
||||
let wizard = new WizardImpl(title, name, this, this._extHostTaskManagement);
|
||||
wizard.width = width;
|
||||
this.getHandle(wizard);
|
||||
return wizard;
|
||||
@@ -798,6 +798,7 @@ export class ExtHostModelViewDialog implements ExtHostModelViewDialogShape {
|
||||
}
|
||||
return this._proxy.$setWizardDetails(handle, {
|
||||
title: wizard.title,
|
||||
name: wizard.name,
|
||||
width: wizard.width,
|
||||
pages: wizard.pages.map(page => this.getHandle(page)),
|
||||
currentPage: wizard.currentPage,
|
||||
|
||||
@@ -437,8 +437,8 @@ export function createAdsApiFactory(accessor: ServicesAccessor): IAdsExtensionAp
|
||||
createWizardPage(title: string): azdata.window.WizardPage {
|
||||
return extHostModelViewDialog.createWizardPage(title, extension);
|
||||
},
|
||||
createWizard(title: string, width?: azdata.window.DialogWidth): azdata.window.Wizard {
|
||||
return extHostModelViewDialog.createWizard(title, width);
|
||||
createWizard(title: string, name?: string, width?: azdata.window.DialogWidth): azdata.window.Wizard {
|
||||
return extHostModelViewDialog.createWizard(title, name, width);
|
||||
},
|
||||
createModelViewDashboard(title: string, name?: string, options?: azdata.ModelViewDashboardOptions): azdata.window.ModelViewDashboard {
|
||||
return extHostModelViewDialog.createModelViewDashboard(title, name, options, extension);
|
||||
|
||||
@@ -280,6 +280,7 @@ export interface IModelViewWizardPageDetails {
|
||||
|
||||
export interface IModelViewWizardDetails {
|
||||
title: string;
|
||||
name?: string;
|
||||
pages: number[];
|
||||
currentPage: number;
|
||||
doneButton: number;
|
||||
|
||||
@@ -392,12 +392,15 @@ export abstract class Modal extends Disposable implements IThemable {
|
||||
/**
|
||||
* Hides the modal and removes key listeners
|
||||
*/
|
||||
protected hide() {
|
||||
protected hide(reason?: string) {
|
||||
this._modalShowingContext.get()!.pop();
|
||||
this._bodyContainer!.remove();
|
||||
this.disposableStore.clear();
|
||||
this._telemetryService.createActionEvent(TelemetryKeys.TelemetryView.Shell, TelemetryKeys.ModalDialogClosed)
|
||||
.withAdditionalProperties({ name: this._name })
|
||||
.withAdditionalProperties({
|
||||
name: this._name,
|
||||
reason: reason
|
||||
})
|
||||
.send();
|
||||
this.restoreKeyboardFocus();
|
||||
}
|
||||
|
||||
@@ -203,7 +203,7 @@ export class NewDashboardTabDialog extends Modal {
|
||||
}
|
||||
|
||||
public close() {
|
||||
this.hide();
|
||||
this.hide('close');
|
||||
}
|
||||
|
||||
private addNewTabs() {
|
||||
@@ -214,7 +214,7 @@ export class NewDashboardTabDialog extends Modal {
|
||||
}
|
||||
|
||||
public cancel() {
|
||||
this.hide();
|
||||
this.hide('cancel');
|
||||
}
|
||||
|
||||
public open(dashboardTabs: Array<IDashboardTab>, openedTabs: Array<IDashboardTab>) {
|
||||
|
||||
@@ -27,7 +27,7 @@ export class CustomDialogService {
|
||||
}
|
||||
|
||||
public showWizard(wizard: Wizard, options?: IModalOptions): void {
|
||||
let wizardModal = this._instantiationService.createInstance(WizardModal, wizard, 'WizardPage', options || DefaultWizardOptions);
|
||||
let wizardModal = this._instantiationService.createInstance(WizardModal, wizard, options || DefaultWizardOptions);
|
||||
this._wizardModals.set(wizard, wizardModal);
|
||||
wizardModal.render();
|
||||
wizardModal.open();
|
||||
|
||||
@@ -132,7 +132,7 @@ export class DialogModal extends Modal {
|
||||
if (await this._dialog.validateClose()) {
|
||||
this._onDone.fire();
|
||||
this.dispose();
|
||||
this.hide();
|
||||
this.hide('close');
|
||||
}
|
||||
clearTimeout(buttonSpinnerHandler);
|
||||
this._doneButton.element.classList.remove('validating');
|
||||
@@ -143,15 +143,7 @@ export class DialogModal extends Modal {
|
||||
public cancel(): void {
|
||||
this._onCancel.fire();
|
||||
this.dispose();
|
||||
this.hide();
|
||||
}
|
||||
|
||||
protected hide(): void {
|
||||
super.hide();
|
||||
}
|
||||
|
||||
protected show(): void {
|
||||
super.show();
|
||||
this.hide('cancel');
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -46,7 +46,6 @@ export class WizardModal extends Modal {
|
||||
|
||||
constructor(
|
||||
private _wizard: Wizard,
|
||||
name: string,
|
||||
options: IModalOptions,
|
||||
@ILayoutService layoutService: ILayoutService,
|
||||
@IThemeService themeService: IThemeService,
|
||||
@@ -57,7 +56,7 @@ export class WizardModal extends Modal {
|
||||
@ILogService logService: ILogService,
|
||||
@ITextResourcePropertiesService textResourcePropertiesService: ITextResourcePropertiesService
|
||||
) {
|
||||
super(_wizard.title, name, telemetryService, layoutService, clipboardService, themeService, logService, textResourcePropertiesService, contextKeyService, options);
|
||||
super(_wizard.title, _wizard.name, telemetryService, layoutService, clipboardService, themeService, logService, textResourcePropertiesService, contextKeyService, options);
|
||||
this._useDefaultMessageBoxLocation = false;
|
||||
}
|
||||
|
||||
@@ -266,14 +265,14 @@ export class WizardModal extends Modal {
|
||||
}
|
||||
this._onDone.fire();
|
||||
this.dispose();
|
||||
this.hide();
|
||||
this.hide('done');
|
||||
}
|
||||
}
|
||||
|
||||
public cancel(): void {
|
||||
this._onCancel.fire();
|
||||
this.dispose();
|
||||
this.hide();
|
||||
this.hide('cancel');
|
||||
}
|
||||
|
||||
private async validateNavigation(newPage: number): Promise<boolean> {
|
||||
@@ -290,14 +289,6 @@ export class WizardModal extends Modal {
|
||||
return navigationValid;
|
||||
}
|
||||
|
||||
protected hide(): void {
|
||||
super.hide();
|
||||
}
|
||||
|
||||
protected show(): void {
|
||||
super.show();
|
||||
}
|
||||
|
||||
/**
|
||||
* Overridable to change behavior of escape key
|
||||
*/
|
||||
|
||||
@@ -201,7 +201,7 @@ export class Wizard {
|
||||
public displayPageTitles: boolean;
|
||||
public width: DialogWidth;
|
||||
|
||||
constructor(public title: string) { }
|
||||
constructor(public title: string, public readonly name: string) { }
|
||||
|
||||
public get currentPage(): number {
|
||||
return this._currentPage;
|
||||
|
||||
@@ -107,7 +107,7 @@ export class ProfilerFilterDialog extends Modal {
|
||||
this._loadFilterButton = this.addFooterButton(LoadFilterText, () => this.loadSavedFilter(), 'left');
|
||||
this._applyButton = this.addFooterButton(ApplyText, () => this.filterSession());
|
||||
this._okButton = this.addFooterButton(OkText, () => this.handleOkButtonClick());
|
||||
this._cancelButton = this.addFooterButton(CancelText, () => this.hide());
|
||||
this._cancelButton = this.addFooterButton(CancelText, () => this.hide('cancel'));
|
||||
this._register(attachButtonStyler(this._okButton, this._themeService));
|
||||
this._register(attachButtonStyler(this._cancelButton, this._themeService));
|
||||
this._register(attachButtonStyler(this._applyButton, this._themeService));
|
||||
@@ -139,7 +139,7 @@ export class ProfilerFilterDialog extends Modal {
|
||||
|
||||
/* espace key */
|
||||
protected onClose() {
|
||||
this.hide();
|
||||
this.hide('close');
|
||||
}
|
||||
|
||||
/* enter key */
|
||||
@@ -149,7 +149,7 @@ export class ProfilerFilterDialog extends Modal {
|
||||
|
||||
private handleOkButtonClick(): void {
|
||||
this.filterSession();
|
||||
this.hide();
|
||||
this.hide('ok');
|
||||
}
|
||||
|
||||
private handleClearButtonClick() {
|
||||
|
||||
Reference in New Issue
Block a user