diff --git a/extensions/notebook/src/dialog/configurePythonDialog.ts b/extensions/notebook/src/dialog/configurePythonDialog.ts index 45ea414fff..539430050a 100644 --- a/extensions/notebook/src/dialog/configurePythonDialog.ts +++ b/extensions/notebook/src/dialog/configurePythonDialog.ts @@ -17,7 +17,7 @@ import JupyterServerInstallation from '../jupyter/jupyterServerInstallation'; const localize = nls.loadMessageBundle(); export class ConfigurePythonDialog { - private dialog: azdata.window.modelviewdialog.Dialog; + private dialog: azdata.window.Dialog; private readonly DialogTitle = localize('configurePython.dialogName', 'Configure Python for Notebooks'); private readonly OkButtonText = localize('configurePython.okButtonText', 'Install'); @@ -35,7 +35,7 @@ export class ConfigurePythonDialog { } public async showDialog() { - this.dialog = azdata.window.modelviewdialog.createDialog(this.DialogTitle); + this.dialog = azdata.window.createModelViewDialog(this.DialogTitle); this.initializeContent(); @@ -44,7 +44,7 @@ export class ConfigurePythonDialog { this.dialog.registerCloseValidator(() => this.handleInstall()); - azdata.window.modelviewdialog.openDialog(this.dialog); + azdata.window.openDialog(this.dialog); } private initializeContent() { @@ -158,14 +158,14 @@ export class ConfigurePythonDialog { private showInfoMessage(message: string) { this.dialog.message = { text: message, - level: azdata.window.modelviewdialog.MessageLevel.Information + level: azdata.window.MessageLevel.Information }; } private showErrorMessage(message: string) { this.dialog.message = { text: message, - level: azdata.window.modelviewdialog.MessageLevel.Error + level: azdata.window.MessageLevel.Error }; } } \ No newline at end of file diff --git a/src/sql/azdata.proposed.d.ts b/src/sql/azdata.proposed.d.ts index 22d8737c7d..ee61cd14ce 100644 --- a/src/sql/azdata.proposed.d.ts +++ b/src/sql/azdata.proposed.d.ts @@ -2347,16 +2347,6 @@ declare module 'azdata' { export function registerWebviewProvider(widgetId: string, handler: (webview: DashboardWebview) => void): void; } - export namespace window { - /** - * @deprecated this method has been deprecated and will be removed in a future release, please use azdata.window.createWebViewDialog instead. - * @param title - */ - export function createDialog( - title: string - ): ModalDialog; - } - export namespace workspace { /** * An event that is emitted when a [dashboard](#DashboardDocument) is opened. @@ -3248,338 +3238,6 @@ declare module 'azdata' { } export namespace window { - /** - * @deprecated this namespace has been deprecated and will be removed in a future release, please use the methods under azdata.window namespace. - */ - export namespace modelviewdialog { - /** - * Create a dialog with the given title - * @param title The title of the dialog, displayed at the top - */ - export function createDialog(title: string, dialogName?: string): Dialog; - - /** - * Create a dialog tab which can be included as part of the content of a dialog - * @param title The title of the page, displayed on the tab to select the page - */ - export function createTab(title: string): DialogTab; - - /** - * Create a button which can be included in a dialog - * @param label The label of the button - */ - export function createButton(label: string): Button; - - /** - * Opens the given dialog if it is not already open - */ - export function openDialog(dialog: Dialog): void; - - /** - * Closes the given dialog if it is open - */ - export function closeDialog(dialog: Dialog): void; - - /** - * Create a wizard page with the given title, for inclusion in a wizard - * @param title The title of the page - */ - export function createWizardPage(title: string): WizardPage; - - /** - * Create a wizard with the given title and pages - * @param title The title of the wizard - */ - export function createWizard(title: string): Wizard; - - /** - * Used to control whether a message in a dialog/wizard is displayed as an error, - * warning, or informational message. Default is error. - */ - export enum MessageLevel { - Error = 0, - Warning = 1, - Information = 2 - } - - /** - * A message shown in a dialog. If the level is not set it defaults to error. - */ - export type DialogMessage = { - readonly text: string, - readonly description?: string, - readonly level?: MessageLevel - }; - - export interface ModelViewPanel { - /** - * Register model view content for the dialog. - * Doesn't do anything if model view is already registered - */ - registerContent(handler: (view: ModelView) => Thenable): void; - - /** - * Returns the model view content if registered. Returns undefined if model review is not registered - */ - readonly modelView: ModelView; - - /** - * Whether the panel's content is valid - */ - readonly valid: boolean; - - /** - * Fired whenever the panel's valid property changes - */ - readonly onValidityChanged: vscode.Event; - } - - // Model view dialog classes - export interface Dialog extends ModelViewPanel { - /** - * The title of the dialog - */ - title: string; - - /** - * The content of the dialog. If multiple tabs are given they will be displayed with tabs - * If a string is given, it should be the ID of the dialog's model view content - */ - content: string | DialogTab[]; - - /** - * The ok button - */ - okButton: Button; - - /** - * The cancel button - */ - cancelButton: Button; - - /** - * Any additional buttons that should be displayed - */ - customButtons: Button[]; - - /** - * Set the informational message shown in the dialog. Hidden when the message is - * undefined or the text is empty or undefined. The default level is error. - */ - message: DialogMessage; - - /** - * Set the dialog name when opening - * the dialog for telemetry - */ - dialogName?: string; - - /** - * Register a callback that will be called when the user tries to click done. Only - * one callback can be registered at once, so each registration call will clear - * the previous registration. - * @param validator The callback that gets executed when the user tries to click - * done. Return true to allow the dialog to close or false to block it from closing - */ - registerCloseValidator(validator: () => boolean | Thenable): void; - - /** - * Register an operation to run in the background when the dialog is done - * @param operationInfo Operation Information - */ - registerOperation(operationInfo: BackgroundOperationInfo): void; - } - - export interface DialogTab extends ModelViewPanel { - /** - * The title of the tab - */ - title: string; - - /** - * A string giving the ID of the tab's model view content - */ - content: string; - } - - export interface Button { - /** - * The label displayed on the button - */ - label: string; - - /** - * Whether the button is enabled - */ - enabled: boolean; - - /** - * Whether the button is hidden - */ - hidden: boolean; - - /** - * Raised when the button is clicked - */ - readonly onClick: vscode.Event; - } - - export interface WizardPageChangeInfo { - /** - * The page number that the wizard changed from - */ - lastPage: number; - - /** - * The new page number or undefined if the user is closing the wizard - */ - newPage: number; - } - - export interface WizardPage extends ModelViewPanel { - /** - * The title of the page - */ - title: string; - - /** - * A string giving the ID of the page's model view content - */ - content: string; - - /** - * Any additional buttons that should be displayed while the page is open - */ - customButtons: Button[]; - - /** - * Whether the page is enabled. If the page is not enabled, the user will not be - * able to advance to it. Defaults to true. - */ - enabled: boolean; - - /** - * An optional description for the page. If provided it will be displayed underneath the page title. - */ - description: string; - } - - export interface Wizard { - /** - * The title of the wizard - */ - title: string; - - /** - * The wizard's pages. Pages can be added/removed while the dialog is open by using - * the addPage and removePage methods - */ - pages: WizardPage[]; - - /** - * The index in the pages array of the active page, or undefined if the wizard is - * not currently visible - */ - readonly currentPage: number; - - /** - * The done button - */ - doneButton: Button; - - /** - * The cancel button - */ - cancelButton: Button; - - /** - * The generate script button - */ - generateScriptButton: Button; - - /** - * The next button - */ - nextButton: Button; - - /** - * The back button - */ - backButton: Button; - - /** - * Any additional buttons that should be displayed for all pages of the dialog. If - * buttons are needed for specific pages they can be added using the customButtons - * property on each page. - */ - customButtons: Button[]; - - /** - * When set to false page titles and descriptions will not be displayed at the top - * of each wizard page. The default is true. - */ - displayPageTitles: boolean; - - /** - * Event fired when the wizard's page changes, containing information about the - * previous page and the new page - */ - onPageChanged: vscode.Event; - - /** - * Add a page to the wizard at the given index - * @param page The page to add - * @param index The index in the pages array to add the page at, or undefined to - * add it at the end - */ - addPage(page: WizardPage, index?: number): Thenable; - - /** - * Remove the page at the given index from the wizard - * @param index The index in the pages array to remove - */ - removePage(index: number): Thenable; - - /** - * Go to the page at the given index in the pages array. - * @param index The index of the page to go to - */ - setCurrentPage(index: number): Thenable; - - /** - * Open the wizard. Does nothing if the wizard is already open. - */ - open(): Thenable; - - /** - * Close the wizard. Does nothing if the wizard is not open. - */ - close(): Thenable; - - /** - * Register a callback that will be called when the user tries to navigate by - * changing pages or clicking done. Only one callback can be registered at once, so - * each registration call will clear the previous registration. - * @param validator The callback that gets executed when the user tries to - * navigate. Return true to allow the navigation to proceed, or false to - * cancel it. - */ - registerNavigationValidator(validator: (pageChangeInfo: WizardPageChangeInfo) => boolean | Thenable): void; - - /** - * Set the informational message shown in the wizard. Hidden when the message is - * undefined or the text is empty or undefined. The default level is error. - */ - message: DialogMessage; - - /** - * Register an operation to run in the background when the wizard is done - * @param operationInfo Operation Information - */ - registerOperation(operationInfo: BackgroundOperationInfo): void; - } - } - /** * creates a web view dialog * @param title diff --git a/src/sql/workbench/api/node/sqlExtHost.api.impl.ts b/src/sql/workbench/api/node/sqlExtHost.api.impl.ts index b8b3b4f6b1..3eac5c41d2 100644 --- a/src/sql/workbench/api/node/sqlExtHost.api.impl.ts +++ b/src/sql/workbench/api/node/sqlExtHost.api.impl.ts @@ -381,44 +381,7 @@ export function createApiFactory( } }; - const modelViewDialog: typeof azdata.window.modelviewdialog = { - createDialog(title: string, dialogName?: string): azdata.window.modelviewdialog.Dialog { - console.warn('the method azdata.window.modelviewdialog.createDialog has been deprecated, replace it with azdata.window.createModelViewDialog'); - return extHostModelViewDialog.createDialog(title, dialogName, extension); - }, - createTab(title: string): azdata.window.modelviewdialog.DialogTab { - console.warn('the method azdata.window.modelviewdialog.createTab has been deprecated, replace it with azdata.window.createTab'); - return extHostModelViewDialog.createTab(title, extension); - }, - createButton(label: string): azdata.window.modelviewdialog.Button { - console.warn('the method azdata.window.modelviewdialog.createButton has been deprecated, replace it with azdata.window.createButton'); - return extHostModelViewDialog.createButton(label); - }, - openDialog(dialog: azdata.window.modelviewdialog.Dialog) { - console.warn('the method azdata.window.modelviewdialog.openDialog has been deprecated, replace it with azdata.window.openDialog'); - return extHostModelViewDialog.openDialog(dialog); - }, - closeDialog(dialog: azdata.window.modelviewdialog.Dialog) { - console.warn('the method azdata.window.modelviewdialog.closeDialog has been deprecated, replace it with azdata.window.closeDialog'); - return extHostModelViewDialog.closeDialog(dialog); - }, - createWizardPage(title: string): azdata.window.modelviewdialog.WizardPage { - console.warn('the method azdata.window.modelviewdialog.createWizardPage has been deprecated, replace it with azdata.window.createWizardPage'); - return extHostModelViewDialog.createWizardPage(title); - }, - createWizard(title: string): azdata.window.modelviewdialog.Wizard { - console.warn('the method azdata.window.modelviewdialog.createWizard has been deprecated, replace it with azdata.window.createWizard'); - return extHostModelViewDialog.createWizard(title); - }, - MessageLevel: sqlExtHostTypes.MessageLevel - }; - const window: typeof azdata.window = { - createDialog(name: string) { - console.warn('the method azdata.window.createDialog has been deprecated, replace it with azdata.window.createWebViewDialog'); - return extHostModalDialogs.createDialog(name); - }, - modelviewdialog: modelViewDialog, createWebViewDialog(name: string) { return extHostModalDialogs.createDialog(name); }, @@ -851,31 +814,31 @@ export function createApiFactory( const modelViewDialog: typeof sqlops.window.modelviewdialog = { createDialog(title: string, dialogName?: string): sqlops.window.modelviewdialog.Dialog { - console.warn('the method sqlops.window.modelviewdialog.createDialog has been deprecated, replace it with sqlops.window.createModelViewDialog'); + console.warn('the method sqlops.window.modelviewdialog.createDialog has been deprecated, replace it with azdata.window.createModelViewDialog'); return extHostModelViewDialog.createDialog(title, dialogName, extension); }, createTab(title: string): sqlops.window.modelviewdialog.DialogTab { - console.warn('the method sqlops.window.modelviewdialog.createTab has been deprecated, replace it with sqlops.window.createTab'); + console.warn('the method sqlops.window.modelviewdialog.createTab has been deprecated, replace it with azdata.window.createTab'); return extHostModelViewDialog.createTab(title, extension); }, createButton(label: string): sqlops.window.modelviewdialog.Button { - console.warn('the method sqlops.window.modelviewdialog.createButton has been deprecated, replace it with sqlops.window.createButton'); + console.warn('the method sqlops.window.modelviewdialog.createButton has been deprecated, replace it with azdata.window.createButton'); return extHostModelViewDialog.createButton(label); }, openDialog(dialog: sqlops.window.modelviewdialog.Dialog) { - console.warn('the method sqlops.window.modelviewdialog.openDialog has been deprecated, replace it with sqlops.window.openDialog'); + console.warn('the method sqlops.window.modelviewdialog.openDialog has been deprecated, replace it with azdata.window.openDialog'); return extHostModelViewDialog.openDialog(dialog); }, closeDialog(dialog: sqlops.window.modelviewdialog.Dialog) { - console.warn('the method sqlops.window.modelviewdialog.closeDialog has been deprecated, replace it with sqlops.window.closeDialog'); + console.warn('the method sqlops.window.modelviewdialog.closeDialog has been deprecated, replace it with azdata.window.closeDialog'); return extHostModelViewDialog.closeDialog(dialog); }, createWizardPage(title: string): sqlops.window.modelviewdialog.WizardPage { - console.warn('the method sqlops.window.modelviewdialog.createWizardPage has been deprecated, replace it with sqlops.window.createWizardPage'); + console.warn('the method sqlops.window.modelviewdialog.createWizardPage has been deprecated, replace it with azdata.window.createWizardPage'); return extHostModelViewDialog.createWizardPage(title); }, createWizard(title: string): sqlops.window.modelviewdialog.Wizard { - console.warn('the method sqlops.window.modelviewdialog.createWizard has been deprecated, replace it with sqlops.window.createWizard'); + console.warn('the method sqlops.window.modelviewdialog.createWizard has been deprecated, replace it with azdata.window.createWizard'); return extHostModelViewDialog.createWizard(title); }, MessageLevel: sqlExtHostTypes.MessageLevel @@ -883,7 +846,7 @@ export function createApiFactory( const window: typeof sqlops.window = { createDialog(name: string) { - console.warn('the method sqlops.window.createDialog has been deprecated, replace it with sqlops.window.createWebViewDialog'); + console.warn('the method sqlops.window.createDialog has been deprecated, replace it with azdata.window.createWebViewDialog'); return extHostModalDialogs.createDialog(name); }, modelviewdialog: modelViewDialog,