Merge dashboardCommandCenter to master (#697)

* Initial work of adding tab in the dashboard (#526)

* refactor dashboard to have the home tab

* formatting

* fix grid layout issue

* fix initailize issue in database dashboard

* Add action bar to the panel and add close tab to the dashboard (#562)

* add action bar to the panel and add close tab to the dashboard

* formatting

* Tab contribution (#564)

* added contrib

* disabled edit for extensions; fixed new name for insights contrib

* fix merge issue

* move file

* formatting

* fix builds

* moving imports

* Expand on tab contrib (#581)

* added contrib

* disabled edit for extensions; fixed new name for insights contrib

* fix merge issue

* move file

* formatting

* fix builds

* adding to contrib

* updated contrib

* format

* moving imports

* updated contribution to map to current design

* implemented actually using provider and edition filtering

*  Refactor and fix issues in close tab and add the placeholder for pin tab (#588)

* refactor and fix issues in close tab and add the placeholder for pin tab

* formatting

* remove the redundant code

* add clear all tabs in dashboard page init

* Initial work for adding a feature tab dialog (#594)

* initial work for add new dashboard tab

* formatting

* fix add panel action issue

* fix breaking change

* fix issues and tab and panels

* formatting

* minor fix

* address comments

* Add tab status to add extension tab dialog (#610)

* add tab status to add extension tab dialog

* add tab status to add extension tab dialog

* rename add feature tab action

* address comments

* Webview widget (#618)

* getting closer

* webview widget now works

* fix problem with rerendering webview

* formatting

* ensure that webview only shows up for extensions

* formatting

* comments

* fix more compile issues

* Change dashboard page init (#640)

* changed init of serverpage

* formatting

* Webview tab (#638)

* getting closer

* webview widget now works

* fix problem with rerendering webview

* formatting

* ensure that webview only shows up for extensions

* formatting

* comments

* fix more compile issues

* refacting stuff

* added inital webview tab

* piped through messaging and tested

* Implement pin/unpin feature and always on tabs (#629)

* implement pin/unpin feature

* fix issue where insight can't be loaded after reopen

* fix tab look and feel

* implement always show tabs

* make AddFeatureTabAction to track always show and pinned tabs

* formatting

* make dashboard tabs looks like the UX design

* load always show before pinned tab

* fix regression in panel for restore and connection dialog

* fix merge conflict

* don't worry about no widgets if its a webview (#656)

* expose the dashboard server info when a webview is rendering (#644)

* Fix few issues in dashboard command center (#655)

* fix reloading insight wigets and create new tab when there is no extension

* show possible tabIDs in the setting file

* formatting

* address comment

* fix import name

* fixes problem with size of webview widget being wrong (#654)

*  Refactor tab contribution to support content type (#685)

* refactor tab contribution to support content type

* formatting

* address comment

* fix rendering tab issue (#694)

* Add layout option to panel for supporting horizontal and vertical navigation bar  (#700)

* Add left navigation panel for inner tab in the dashboard

* add layout option in panel

* remove panel option in dashboard Page
This commit is contained in:
Abbie Petchtes
2018-02-15 10:27:47 -08:00
committed by GitHub
parent dfc212369a
commit b61fbc806b
72 changed files with 2535 additions and 372 deletions

View File

@@ -4,23 +4,45 @@
*--------------------------------------------------------------------------------------------*/
import { Registry } from 'vs/platform/registry/common/platform';
import { IJSONSchema } from 'vs/base/common/jsonSchema';
import { IConfigurationRegistry, Extensions as ConfigurationExtension } from 'vs/platform/configuration/common/configurationRegistry';
import { IJSONSchema, IJSONSchemaMap } from 'vs/base/common/jsonSchema';
import * as nls from 'vs/nls';
import { deepClone } from 'vs/base/common/objects';
import { IExtensionPointUser, ExtensionsRegistry } from 'vs/platform/extensions/common/extensionsRegistry';
import { ProviderProperties } from 'sql/parts/dashboard/widgets/properties/propertiesWidget.component';
import { DATABASE_DASHBOARD_TABS } from 'sql/parts/dashboard/pages/databaseDashboardPage.contribution';
import { SERVER_DASHBOARD_TABS, SERVER_DASHBOARD_PROPERTIES } from 'sql/parts/dashboard/pages/serverDashboardPage.contribution';
import { DASHBOARD_CONFIG_ID, DASHBOARD_TABS_KEY_PROPERTY } from 'sql/parts/dashboard/pages/dashboardPageContribution';
export const Extensions = {
DashboardContributions: 'dashboard.contributions'
};
export interface IDashboardTab {
id: string;
title: string;
publisher: string;
description?: string;
content?: object;
provider?: string | string[];
edition?: number | number[];
alwaysShow?: boolean;
}
export interface IDashboardRegistry {
registerDashboardProvider(id: string, properties: ProviderProperties): void;
getProperties(id: string): ProviderProperties;
registerTab(tab: IDashboardTab): void;
tabs: Array<IDashboardTab>;
tabContentSchemaProperties: IJSONSchemaMap;
}
class DashboardRegistry implements IDashboardRegistry {
private _properties = new Map<string, ProviderProperties>();
private _tabs = new Array<IDashboardTab>();
private _configurationRegistry = Registry.as<IConfigurationRegistry>(ConfigurationExtension.Configuration);
private _dashboardTabContentSchemaProperties: IJSONSchemaMap = {};
/**
* Register a dashboard widget
@@ -33,11 +55,57 @@ class DashboardRegistry implements IDashboardRegistry {
public getProperties(id: string): ProviderProperties {
return this._properties.get(id);
}
public registerTab(tab: IDashboardTab): void {
this._tabs.push(tab);
let dashboardConfig = this._configurationRegistry.getConfigurations().find(c => c.id === DASHBOARD_CONFIG_ID);
if (dashboardConfig) {
let dashboardDatabaseTabProperty = (<IJSONSchema>dashboardConfig.properties[DATABASE_DASHBOARD_TABS].items).properties[DASHBOARD_TABS_KEY_PROPERTY];
dashboardDatabaseTabProperty.enum.push(tab.id);
dashboardDatabaseTabProperty.enumDescriptions.push(tab.description || '');
let dashboardServerTabProperty = (<IJSONSchema>dashboardConfig.properties[SERVER_DASHBOARD_TABS].items).properties[DASHBOARD_TABS_KEY_PROPERTY];
dashboardServerTabProperty.enum.push(tab.id);
dashboardServerTabProperty.enumDescriptions.push(tab.description || '');
this._configurationRegistry.notifyConfigurationSchemaUpdated(dashboardConfig);
}
}
public get tabs(): Array<IDashboardTab> {
return this._tabs;
}
/**
* Register a dashboard widget
* @param id id of the widget
* @param schema config schema of the widget
*/
public registerTabContent(id: string, schema: IJSONSchema): void {
this._dashboardTabContentSchemaProperties[id] = schema;
}
public get tabContentSchemaProperties(): IJSONSchemaMap {
return deepClone(this._dashboardTabContentSchemaProperties);
}
}
const dashboardRegistry = new DashboardRegistry();
Registry.add(Extensions.DashboardContributions, dashboardRegistry);
export function registerTab(tab: IDashboardTab): void {
dashboardRegistry.registerTab(tab);
}
export function registerTabContent(id: string, schema: IJSONSchema): void {
dashboardRegistry.registerTabContent(id, schema);
}
export function generateTabContentSchemaProperties(): IJSONSchemaMap {
return dashboardRegistry.tabContentSchemaProperties;
}
const dashboardPropertiesPropertyContrib: IJSONSchema = {
description: nls.localize('dashboard.properties.property', "Defines a property to show on the dashboard"),
type: 'object',
@@ -134,4 +202,4 @@ ExtensionsRegistry.registerExtensionPoint<ProviderProperties | ProviderPropertie
handleCommand(value, extension);
}
}
});
});

View File

@@ -5,8 +5,9 @@
import { IInsightsConfig } from 'sql/parts/dashboard/widgets/insights/interfaces';
import * as platform from 'vs/platform/registry/common/platform';
import { IJSONSchema } from 'vs/base/common/jsonSchema';
import { IJSONSchema, IJSONSchemaMap } from 'vs/base/common/jsonSchema';
import * as nls from 'vs/nls';
import { deepClone } from 'vs/base/common/objects';
export type WidgetIdentifier = string;
@@ -14,16 +15,27 @@ export const Extensions = {
DashboardWidgetContribution: 'dashboard.contributions.widgets'
};
export interface IDashboardRegistryOptions {
extensionOnly: boolean;
}
export interface CustomIJSONSchema extends IJSONSchema {
extensionProperties: IJSONSchemaMap;
}
export interface IDashboardWidgetRegistry {
databaseWidgetSchema: IJSONSchema;
serverWidgetSchema: IJSONSchema;
databaseWidgetSchema: CustomIJSONSchema;
serverWidgetSchema: CustomIJSONSchema;
allSchema: CustomIJSONSchema;
registerWidget(id: string, description: string, schema: IJSONSchema, context?: 'database' | 'server'): WidgetIdentifier;
registerNonCustomDashboardWidget(id: string, description: string, val: IInsightsConfig, context?: 'database' | 'server'): WidgetIdentifier;
registerNonCustomDashboardWidget(id: string, description: string, val: IInsightsConfig, context?: 'database' | 'server', options?: IDashboardRegistryOptions): WidgetIdentifier;
}
class DashboardWidgetRegistry implements IDashboardWidgetRegistry {
private _dashboardWidgetSchema: IJSONSchema = { type: 'object', description: nls.localize('schema.dashboardWidgets', 'Widget used in the dashboards'), properties: {}, additionalProperties: false };
private _serverWidgetSchema: IJSONSchema = { type: 'object', description: nls.localize('schema.dashboardWidgets', 'Widget used in the dashboards'), properties: {}, additionalProperties: false };
private _allSchema: CustomIJSONSchema = { type: 'object', description: nls.localize('schema.dashboardWidgets', 'Widget used in the dashboards'), properties: {}, extensionProperties: {}, additionalProperties: false };
private _dashboardWidgetSchema: CustomIJSONSchema = { type: 'object', description: nls.localize('schema.dashboardWidgets', 'Widget used in the dashboards'), properties: {}, extensionProperties: {}, additionalProperties: false };
private _serverWidgetSchema: CustomIJSONSchema = { type: 'object', description: nls.localize('schema.dashboardWidgets', 'Widget used in the dashboards'), properties: {}, extensionProperties: {}, additionalProperties: false };
/**
* Register a dashboard widget
* @param id id of the widget
@@ -31,13 +43,27 @@ class DashboardWidgetRegistry implements IDashboardWidgetRegistry {
* @param schema config schema of the widget
* @param context either 'database' or 'server' for what page to register for; if not specified, will register for both
*/
public registerWidget(id: string, description: string, schema: IJSONSchema, context?: 'database' | 'server'): WidgetIdentifier {
if (context === undefined || context === 'database') {
this._dashboardWidgetSchema.properties[id] = schema;
}
public registerWidget(id: string, description: string, schema: IJSONSchema, context?: 'database' | 'server', options?: IDashboardRegistryOptions): WidgetIdentifier {
if (options && options.extensionOnly) {
if (context === undefined || context === 'database') {
this._dashboardWidgetSchema.extensionProperties[id] = schema;
}
if (context === undefined || context === 'server') {
this._serverWidgetSchema.properties[id] = schema;
if (context === undefined || context === 'server') {
this._serverWidgetSchema.extensionProperties[id] = schema;
}
this._allSchema.extensionProperties[id] = schema;
} else {
if (context === undefined || context === 'database') {
this._dashboardWidgetSchema.properties[id] = schema;
}
if (context === undefined || context === 'server') {
this._serverWidgetSchema.properties[id] = schema;
}
this._allSchema.properties[id] = schema;
}
return id;
@@ -62,20 +88,24 @@ class DashboardWidgetRegistry implements IDashboardWidgetRegistry {
return id;
}
public get databaseWidgetSchema(): IJSONSchema {
return this._dashboardWidgetSchema;
public get databaseWidgetSchema(): CustomIJSONSchema {
return deepClone(this._dashboardWidgetSchema);
}
public get serverWidgetSchema(): IJSONSchema {
return this._serverWidgetSchema;
public get serverWidgetSchema(): CustomIJSONSchema {
return deepClone(this._serverWidgetSchema);
}
public get allSchema(): CustomIJSONSchema {
return deepClone(this._allSchema);
}
}
const dashboardWidgetRegistry = new DashboardWidgetRegistry();
platform.Registry.add(Extensions.DashboardWidgetContribution, dashboardWidgetRegistry);
export function registerDashboardWidget(id: string, description: string, schema: IJSONSchema, context?: 'database' | 'server'): WidgetIdentifier {
return dashboardWidgetRegistry.registerWidget(id, description, schema, context);
export function registerDashboardWidget(id: string, description: string, schema: IJSONSchema, context?: 'database' | 'server', options?: IDashboardRegistryOptions): WidgetIdentifier {
return dashboardWidgetRegistry.registerWidget(id, description, schema, context, options);
}
export function registerNonCustomDashboardWidget(id: string, description: string, val: IInsightsConfig): WidgetIdentifier {