mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-01-17 01:25:36 -05:00
add custom width support for dialogs (#10641)
* add custom width support for dialogs * comments * fix test
This commit is contained in:
@@ -10,12 +10,13 @@ import { IInstantiationService } from 'vs/platform/instantiation/common/instanti
|
||||
|
||||
import { MainThreadModelViewDialogShape, SqlMainContext, ExtHostModelViewDialogShape, SqlExtHostContext } from 'sql/workbench/api/common/sqlExtHost.protocol';
|
||||
import { Dialog, DialogTab, DialogButton, WizardPage, Wizard } from 'sql/workbench/services/dialog/common/dialogTypes';
|
||||
import { CustomDialogService } from 'sql/workbench/services/dialog/browser/customDialogService';
|
||||
import { CustomDialogService, DefaultWizardOptions, DefaultDialogOptions } from 'sql/workbench/services/dialog/browser/customDialogService';
|
||||
import { IModelViewDialogDetails, IModelViewTabDetails, IModelViewButtonDetails, IModelViewWizardPageDetails, IModelViewWizardDetails } from 'sql/workbench/api/common/sqlExtHostTypes';
|
||||
import { ModelViewInput, ModelViewInputModel, ModeViewSaveHandler } from 'sql/workbench/browser/modelComponents/modelViewInput';
|
||||
|
||||
import * as vscode from 'vscode';
|
||||
import * as azdata from 'azdata';
|
||||
import { assign } from 'vs/base/common/objects';
|
||||
|
||||
@extHostNamedCustomer(SqlMainContext.MainThreadModelViewDialog)
|
||||
export class MainThreadModelViewDialog implements MainThreadModelViewDialogShape {
|
||||
@@ -67,7 +68,9 @@ export class MainThreadModelViewDialog implements MainThreadModelViewDialogShape
|
||||
|
||||
public $openDialog(handle: number, dialogName?: string): Thenable<void> {
|
||||
let dialog = this.getDialog(handle);
|
||||
this._dialogService.showDialog(dialog, dialogName, { hasBackButton: false, isWide: dialog.isWide, hasErrors: true });
|
||||
const options = assign({}, DefaultDialogOptions);
|
||||
options.width = dialog.width;
|
||||
this._dialogService.showDialog(dialog, dialogName, options);
|
||||
return Promise.resolve();
|
||||
}
|
||||
|
||||
@@ -91,7 +94,7 @@ export class MainThreadModelViewDialog implements MainThreadModelViewDialogShape
|
||||
}
|
||||
|
||||
dialog.title = details.title;
|
||||
dialog.isWide = details.isWide;
|
||||
dialog.width = details.width;
|
||||
if (details.content && typeof details.content !== 'string') {
|
||||
dialog.content = details.content.map(tabHandle => this.getTab(tabHandle));
|
||||
} else {
|
||||
@@ -163,6 +166,7 @@ export class MainThreadModelViewDialog implements MainThreadModelViewDialogShape
|
||||
let wizard = this._wizards.get(handle);
|
||||
if (!wizard) {
|
||||
wizard = new Wizard(details.title);
|
||||
wizard.width = details.width;
|
||||
wizard.backButton = this.getButton(details.backButton);
|
||||
wizard.cancelButton = this.getButton(details.cancelButton);
|
||||
wizard.generateScriptButton = this.getButton(details.generateScriptButton);
|
||||
@@ -213,7 +217,9 @@ export class MainThreadModelViewDialog implements MainThreadModelViewDialogShape
|
||||
|
||||
public $openWizard(handle: number): Thenable<void> {
|
||||
let wizard = this.getWizard(handle);
|
||||
this._dialogService.showWizard(wizard);
|
||||
const options = assign({}, DefaultWizardOptions);
|
||||
options.width = wizard.width;
|
||||
this._dialogService.showWizard(wizard, options);
|
||||
return Promise.resolve();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user