modelview dashboard (#9784)

* modelview dashboard

* styles

* toolbar support

* spaces

* add tab icon support
This commit is contained in:
Alan Ren
2020-04-01 17:30:33 -07:00
committed by GitHub
parent dd56908a06
commit 41d21d799c
12 changed files with 152 additions and 49 deletions

View File

@@ -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);
}
}
}