mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-01-25 09:35:37 -05:00
Support left nav bar and inner tabs (#751)
* Add left nav bar and inner tab contribution * place holder for dashboard left nav bar * formatting * refactor widget helper * improving the panel look and feel * removed extra files that added by accident
This commit is contained in:
@@ -34,6 +34,7 @@ export interface IDashboardRegistry {
|
||||
registerDashboardProvider(id: string, properties: ProviderProperties): void;
|
||||
getProperties(id: string): ProviderProperties;
|
||||
registerTab(tab: IDashboardTab): void;
|
||||
registerTabContent(id: string, schema: IJSONSchema): void;
|
||||
tabs: Array<IDashboardTab>;
|
||||
tabContentSchemaProperties: IJSONSchemaMap;
|
||||
}
|
||||
|
||||
70
src/sql/platform/dashboard/common/innerTabRegistry.ts
Normal file
70
src/sql/platform/dashboard/common/innerTabRegistry.ts
Normal file
@@ -0,0 +1,70 @@
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import { Registry } from 'vs/platform/registry/common/platform';
|
||||
import { IJSONSchema, IJSONSchemaMap } from 'vs/base/common/jsonSchema';
|
||||
import { Extensions as ConfigurationExtension } from 'vs/platform/configuration/common/configurationRegistry';
|
||||
import { deepClone } from 'vs/base/common/objects';
|
||||
|
||||
import { WidgetConfig } from 'sql/parts/dashboard/common/dashboardWidget';
|
||||
|
||||
export const Extensions = {
|
||||
InnerTabContributions: 'dashboard.contributions.innerTabs'
|
||||
};
|
||||
|
||||
export interface IDashboardInnerTab {
|
||||
id: string;
|
||||
title: string;
|
||||
hasIcon: boolean;
|
||||
content?: object;
|
||||
}
|
||||
|
||||
export interface IDashboardInnerTabRegistry {
|
||||
registerInnerTab(tab: IDashboardInnerTab): void;
|
||||
registerInnerTabContent(id: string, schema: IJSONSchema): void;
|
||||
innerTabs: Array<IDashboardInnerTab>;
|
||||
innerTabContentSchemaProperties: IJSONSchemaMap;
|
||||
}
|
||||
|
||||
class DashboardInnerTabRegistry implements IDashboardInnerTabRegistry {
|
||||
private _innertabs = new Array<IDashboardInnerTab>();
|
||||
private _dashboardInnerTabContentSchemaProperties: IJSONSchemaMap = {};
|
||||
|
||||
public registerInnerTab(tab: IDashboardInnerTab): void {
|
||||
this._innertabs.push(tab);
|
||||
}
|
||||
|
||||
public get innerTabs(): Array<IDashboardInnerTab> {
|
||||
return this._innertabs;
|
||||
}
|
||||
|
||||
/**
|
||||
* Register a dashboard widget
|
||||
* @param id id of the widget
|
||||
* @param schema config schema of the widget
|
||||
*/
|
||||
public registerInnerTabContent(id: string, schema: IJSONSchema): void {
|
||||
this._dashboardInnerTabContentSchemaProperties[id] = schema;
|
||||
}
|
||||
|
||||
public get innerTabContentSchemaProperties(): IJSONSchemaMap {
|
||||
return deepClone(this._dashboardInnerTabContentSchemaProperties);
|
||||
}
|
||||
}
|
||||
|
||||
const dashboardInnerTabRegistry = new DashboardInnerTabRegistry();
|
||||
Registry.add(Extensions.InnerTabContributions, dashboardInnerTabRegistry);
|
||||
|
||||
export function registerInnerTab(innerTab: IDashboardInnerTab): void {
|
||||
dashboardInnerTabRegistry.registerInnerTab(innerTab);
|
||||
}
|
||||
|
||||
export function registerInnerTabContent(id: string, schema: IJSONSchema): void {
|
||||
dashboardInnerTabRegistry.registerInnerTabContent(id, schema);
|
||||
}
|
||||
|
||||
export function generateInnerTabContentSchemaProperties(): IJSONSchemaMap {
|
||||
return dashboardInnerTabRegistry.innerTabContentSchemaProperties;
|
||||
}
|
||||
Reference in New Issue
Block a user