mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-01-17 17:22:42 -05:00
modelview dashboard (#9784)
* modelview dashboard * styles * toolbar support * spaces * add tab icon support
This commit is contained in:
@@ -457,6 +457,57 @@ class WizardImpl implements azdata.window.Wizard {
|
||||
}
|
||||
}
|
||||
|
||||
class ModelViewDashboardImpl implements azdata.window.ModelViewDashboard {
|
||||
constructor(
|
||||
private _editor: ModelViewEditorImpl
|
||||
) {
|
||||
}
|
||||
registerTabs(handler: (view: azdata.ModelView) => Thenable<(azdata.DashboardTab | azdata.DashboardTabGroup)[]>): void {
|
||||
this._editor.registerContent(async (view) => {
|
||||
const dashboardTabs = await handler(view);
|
||||
const tabs: (azdata.TabGroup | azdata.Tab)[] = [];
|
||||
dashboardTabs.forEach((item: azdata.DashboardTab | azdata.DashboardTabGroup) => {
|
||||
if ('tabs' in item) {
|
||||
tabs.push(<azdata.TabGroup>{
|
||||
title: item.title,
|
||||
tabs: item.tabs.map(tab => {
|
||||
return this.createTab(tab, view);
|
||||
})
|
||||
});
|
||||
} else {
|
||||
tabs.push(this.createTab(item, view));
|
||||
}
|
||||
});
|
||||
|
||||
const tabbedPanel = view.modelBuilder.tabbedPanel().withTabs(tabs).withLayout({
|
||||
orientation: 'vertical',
|
||||
showIcon: true
|
||||
}).component();
|
||||
return view.initializeModel(tabbedPanel);
|
||||
});
|
||||
}
|
||||
|
||||
open(): Thenable<void> {
|
||||
return this._editor.openEditor();
|
||||
}
|
||||
|
||||
createTab(tab: azdata.DashboardTab, view: azdata.ModelView): azdata.Tab {
|
||||
if (tab.toolbar) {
|
||||
const flexContainer = view.modelBuilder.flexContainer().withLayout({ flexFlow: 'column' }).component();
|
||||
flexContainer.addItem(tab.toolbar, { flex: '0 0 auto' });
|
||||
flexContainer.addItem(tab.content, { flex: '1 1 auto' });
|
||||
return {
|
||||
title: tab.title,
|
||||
id: tab.id,
|
||||
content: flexContainer,
|
||||
icon: tab.icon
|
||||
};
|
||||
} else {
|
||||
return tab;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export class ExtHostModelViewDialog implements ExtHostModelViewDialogShape {
|
||||
private static _currentHandle = 0;
|
||||
|
||||
@@ -562,6 +613,11 @@ export class ExtHostModelViewDialog implements ExtHostModelViewDialogShape {
|
||||
return editor;
|
||||
}
|
||||
|
||||
public createModelViewDashboard(title: string, extension: IExtensionDescription): azdata.window.ModelViewDashboard {
|
||||
const editor = this.createModelViewEditor(title, extension, { supportsSave: false }) as ModelViewEditorImpl;
|
||||
return new ModelViewDashboardImpl(editor);
|
||||
}
|
||||
|
||||
public updateDialogContent(dialog: azdata.window.Dialog): void {
|
||||
let handle = this.getHandle(dialog);
|
||||
let tabs = dialog.content;
|
||||
|
||||
Reference in New Issue
Block a user