mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-01-18 17:22:45 -05:00
modelview dashboard (#9784)
* modelview dashboard * styles * toolbar support * spaces * add tab icon support
This commit is contained in:
@@ -10,11 +10,13 @@ import { TabOrientation, TabbedPanelLayout } from 'sql/workbench/api/common/sqlE
|
||||
import { ContainerBase } from 'sql/workbench/browser/modelComponents/componentBase';
|
||||
import { ComponentEventType, IComponent, IComponentDescriptor, IModelStore } from 'sql/platform/dashboard/browser/interfaces';
|
||||
import 'vs/css!./media/tabbedPanel';
|
||||
import { IUserFriendlyIcon, createIconCssClass } from 'sql/workbench/browser/modelComponents/iconUtils';
|
||||
|
||||
export interface TabConfig {
|
||||
title: string;
|
||||
id?: string;
|
||||
group: string;
|
||||
icon?: IUserFriendlyIcon;
|
||||
}
|
||||
|
||||
interface Tab {
|
||||
@@ -22,6 +24,7 @@ interface Tab {
|
||||
content?: IComponentDescriptor;
|
||||
id?: string;
|
||||
type: TabType;
|
||||
iconClass?: string;
|
||||
}
|
||||
|
||||
@Component({
|
||||
@@ -56,7 +59,7 @@ export default class TabbedPanelComponent extends ContainerBase<TabConfig> imple
|
||||
this._panel.options = {
|
||||
showTabsWhenOne: true,
|
||||
layout: layout.orientation === TabOrientation.Horizontal ? NavigationBarLayout.horizontal : NavigationBarLayout.vertical,
|
||||
showIcon: false
|
||||
showIcon: layout.showIcon
|
||||
};
|
||||
}
|
||||
|
||||
@@ -86,6 +89,7 @@ export default class TabbedPanelComponent extends ContainerBase<TabConfig> imple
|
||||
title: item.config.title,
|
||||
id: item.config.id,
|
||||
content: item.descriptor,
|
||||
iconClass: item.config.icon ? createIconCssClass(item.config.icon) : undefined,
|
||||
type: 'tab'
|
||||
});
|
||||
}
|
||||
@@ -93,4 +97,11 @@ export default class TabbedPanelComponent extends ContainerBase<TabConfig> imple
|
||||
}
|
||||
return this._tabs;
|
||||
}
|
||||
|
||||
onItemsUpdated(): void {
|
||||
const firstTabIndex = this.tabs.findIndex(tab => tab.type === 'tab');
|
||||
if (firstTabIndex >= 0) {
|
||||
this._panel.selectTab(firstTabIndex);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user