mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-17 02:51:36 -05:00
add options to customize the model view dashboard (#9872)
* add options to customize the mv dashboard * rename the property
This commit is contained in:
26
src/sql/azdata.proposed.d.ts
vendored
26
src/sql/azdata.proposed.d.ts
vendored
@@ -224,8 +224,20 @@ declare module 'azdata' {
|
|||||||
* Layout of TabbedPanelComponent, can be used to initialize the component when using ModelBuilder
|
* Layout of TabbedPanelComponent, can be used to initialize the component when using ModelBuilder
|
||||||
*/
|
*/
|
||||||
export interface TabbedPanelLayout {
|
export interface TabbedPanelLayout {
|
||||||
|
/**
|
||||||
|
* Tab orientation
|
||||||
|
*/
|
||||||
orientation: TabOrientation;
|
orientation: TabOrientation;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Whether to show the tab icon
|
||||||
|
*/
|
||||||
showIcon: boolean;
|
showIcon: boolean;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Whether to show the tab navigation pane even when there is only one tab
|
||||||
|
*/
|
||||||
|
alwaysShowTabs: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -300,7 +312,7 @@ declare module 'azdata' {
|
|||||||
open(): Thenable<void>;
|
open(): Thenable<void>;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function createModelViewDashboard(title: string): ModelViewDashboard;
|
export function createModelViewDashboard(title: string, options?: ModelViewDashboardOptions): ModelViewDashboard;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface DashboardTab extends Tab {
|
export interface DashboardTab extends Tab {
|
||||||
@@ -321,5 +333,17 @@ declare module 'azdata' {
|
|||||||
*/
|
*/
|
||||||
tabs: DashboardTab[];
|
tabs: DashboardTab[];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export interface ModelViewDashboardOptions {
|
||||||
|
/**
|
||||||
|
* Whether to show the tab icon, default is true
|
||||||
|
*/
|
||||||
|
showIcon?: boolean;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Whether to show the tab navigation pane even when there is only one tab, default is false
|
||||||
|
*/
|
||||||
|
alwaysShowTabs?: boolean;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ export interface IPanelOptions {
|
|||||||
/**
|
/**
|
||||||
* Whether or not to show the tabs if there is only one tab present
|
* Whether or not to show the tabs if there is only one tab present
|
||||||
*/
|
*/
|
||||||
showTabsWhenOne?: boolean;
|
alwaysShowTabs?: boolean;
|
||||||
layout?: NavigationBarLayout;
|
layout?: NavigationBarLayout;
|
||||||
showIcon?: boolean;
|
showIcon?: boolean;
|
||||||
}
|
}
|
||||||
@@ -39,7 +39,7 @@ export enum NavigationBarLayout {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const defaultOptions: IPanelOptions = {
|
const defaultOptions: IPanelOptions = {
|
||||||
showTabsWhenOne: true,
|
alwaysShowTabs: true,
|
||||||
layout: NavigationBarLayout.horizontal,
|
layout: NavigationBarLayout.horizontal,
|
||||||
showIcon: false
|
showIcon: false
|
||||||
};
|
};
|
||||||
@@ -50,7 +50,7 @@ let idPool = 0;
|
|||||||
selector: 'panel',
|
selector: 'panel',
|
||||||
template: `
|
template: `
|
||||||
<div class="tabbedPanel fullsize" [ngClass]="options.layout === NavigationBarLayout.vertical ? 'vertical' : 'horizontal'">
|
<div class="tabbedPanel fullsize" [ngClass]="options.layout === NavigationBarLayout.vertical ? 'vertical' : 'horizontal'">
|
||||||
<div *ngIf="!options.showTabsWhenOne ? _tabs.length !== 1 : true" class="composite title">
|
<div *ngIf="!options.alwaysShowTabs ? _tabs.length !== 1 : true" class="composite title">
|
||||||
<div class="tabContainer">
|
<div class="tabContainer">
|
||||||
<div *ngIf="options.layout === NavigationBarLayout.vertical" class="vertical-tab-action-container">
|
<div *ngIf="options.layout === NavigationBarLayout.vertical" class="vertical-tab-action-container">
|
||||||
<button [attr.aria-expanded]="_tabExpanded" [title]="toggleTabPanelButtonAriaLabel" [attr.aria-label]="toggleTabPanelButtonAriaLabel" [ngClass]="toggleTabPanelButtonCssClass" tabindex="0" (click)="toggleTabPanel()"></button>
|
<button [attr.aria-expanded]="_tabExpanded" [title]="toggleTabPanelButtonAriaLabel" [attr.aria-label]="toggleTabPanelButtonAriaLabel" [ngClass]="toggleTabPanelButtonCssClass" tabindex="0" (click)="toggleTabPanel()"></button>
|
||||||
|
|||||||
@@ -459,7 +459,8 @@ class WizardImpl implements azdata.window.Wizard {
|
|||||||
|
|
||||||
class ModelViewDashboardImpl implements azdata.window.ModelViewDashboard {
|
class ModelViewDashboardImpl implements azdata.window.ModelViewDashboard {
|
||||||
constructor(
|
constructor(
|
||||||
private _editor: ModelViewEditorImpl
|
private _editor: ModelViewEditorImpl,
|
||||||
|
private _options?: azdata.ModelViewDashboardOptions
|
||||||
) {
|
) {
|
||||||
}
|
}
|
||||||
registerTabs(handler: (view: azdata.ModelView) => Thenable<(azdata.DashboardTab | azdata.DashboardTabGroup)[]>): void {
|
registerTabs(handler: (view: azdata.ModelView) => Thenable<(azdata.DashboardTab | azdata.DashboardTabGroup)[]>): void {
|
||||||
@@ -481,7 +482,8 @@ class ModelViewDashboardImpl implements azdata.window.ModelViewDashboard {
|
|||||||
|
|
||||||
const tabbedPanel = view.modelBuilder.tabbedPanel().withTabs(tabs).withLayout({
|
const tabbedPanel = view.modelBuilder.tabbedPanel().withTabs(tabs).withLayout({
|
||||||
orientation: 'vertical',
|
orientation: 'vertical',
|
||||||
showIcon: true
|
showIcon: this._options?.showIcon ?? true,
|
||||||
|
alwaysShowTabs: this._options?.alwaysShowTabs ?? false
|
||||||
}).component();
|
}).component();
|
||||||
return view.initializeModel(tabbedPanel);
|
return view.initializeModel(tabbedPanel);
|
||||||
});
|
});
|
||||||
@@ -613,9 +615,9 @@ export class ExtHostModelViewDialog implements ExtHostModelViewDialogShape {
|
|||||||
return editor;
|
return editor;
|
||||||
}
|
}
|
||||||
|
|
||||||
public createModelViewDashboard(title: string, extension: IExtensionDescription): azdata.window.ModelViewDashboard {
|
public createModelViewDashboard(title: string, options: azdata.ModelViewDashboardOptions | undefined, extension: IExtensionDescription): azdata.window.ModelViewDashboard {
|
||||||
const editor = this.createModelViewEditor(title, extension, { supportsSave: false }) as ModelViewEditorImpl;
|
const editor = this.createModelViewEditor(title, extension, { supportsSave: false }) as ModelViewEditorImpl;
|
||||||
return new ModelViewDashboardImpl(editor);
|
return new ModelViewDashboardImpl(editor, options);
|
||||||
}
|
}
|
||||||
|
|
||||||
public updateDialogContent(dialog: azdata.window.Dialog): void {
|
public updateDialogContent(dialog: azdata.window.Dialog): void {
|
||||||
|
|||||||
@@ -418,8 +418,8 @@ export function createAdsApiFactory(accessor: ServicesAccessor): IAdsExtensionAp
|
|||||||
createWizard(title: string): azdata.window.Wizard {
|
createWizard(title: string): azdata.window.Wizard {
|
||||||
return extHostModelViewDialog.createWizard(title);
|
return extHostModelViewDialog.createWizard(title);
|
||||||
},
|
},
|
||||||
createModelViewDashboard(title: string): azdata.window.ModelViewDashboard {
|
createModelViewDashboard(title: string, options?: azdata.ModelViewDashboardOptions): azdata.window.ModelViewDashboard {
|
||||||
return extHostModelViewDialog.createModelViewDashboard(title, extension);
|
return extHostModelViewDialog.createModelViewDashboard(title, options, extension);
|
||||||
},
|
},
|
||||||
MessageLevel: sqlExtHostTypes.MessageLevel
|
MessageLevel: sqlExtHostTypes.MessageLevel
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -840,4 +840,5 @@ export enum TabOrientation {
|
|||||||
export interface TabbedPanelLayout {
|
export interface TabbedPanelLayout {
|
||||||
orientation: TabOrientation;
|
orientation: TabOrientation;
|
||||||
showIcon: boolean;
|
showIcon: boolean;
|
||||||
|
alwaysShowTabs: boolean;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -57,7 +57,7 @@ export default class TabbedPanelComponent extends ContainerBase<TabConfig> imple
|
|||||||
|
|
||||||
setLayout(layout: TabbedPanelLayout): void {
|
setLayout(layout: TabbedPanelLayout): void {
|
||||||
this._panel.options = {
|
this._panel.options = {
|
||||||
showTabsWhenOne: true,
|
alwaysShowTabs: layout.alwaysShowTabs,
|
||||||
layout: layout.orientation === TabOrientation.Horizontal ? NavigationBarLayout.horizontal : NavigationBarLayout.vertical,
|
layout: layout.orientation === TabOrientation.Horizontal ? NavigationBarLayout.horizontal : NavigationBarLayout.vertical,
|
||||||
showIcon: layout.showIcon
|
showIcon: layout.showIcon
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -157,7 +157,7 @@ export abstract class DashboardPage extends AngularDisposable implements IConfig
|
|||||||
});
|
});
|
||||||
this.propertiesWidget = properties ? properties[0] : undefined;
|
this.propertiesWidget = properties ? properties[0] : undefined;
|
||||||
this._panel.options = {
|
this._panel.options = {
|
||||||
showTabsWhenOne: true,
|
alwaysShowTabs: true,
|
||||||
layout: NavigationBarLayout.vertical,
|
layout: NavigationBarLayout.vertical,
|
||||||
showIcon: true
|
showIcon: true
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -46,7 +46,7 @@ export class AgentViewComponent {
|
|||||||
public readonly operatorsComponentTitle: string = nls.localize('jobview.Operators', "Operators");
|
public readonly operatorsComponentTitle: string = nls.localize('jobview.Operators', "Operators");
|
||||||
|
|
||||||
public readonly panelOpt: IPanelOptions = {
|
public readonly panelOpt: IPanelOptions = {
|
||||||
showTabsWhenOne: true,
|
alwaysShowTabs: true,
|
||||||
layout: NavigationBarLayout.horizontal,
|
layout: NavigationBarLayout.horizontal,
|
||||||
showIcon: true
|
showIcon: true
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user