mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-16 18:46:40 -05:00
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:
102
src/sql/parts/dashboard/pages/dashboardPageContribution.ts
Normal file
102
src/sql/parts/dashboard/pages/dashboardPageContribution.ts
Normal file
@@ -0,0 +1,102 @@
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
import { Extensions, IDashboardWidgetRegistry } from 'sql/platform/dashboard/common/widgetRegistry';
|
||||
|
||||
import { Registry } from 'vs/platform/registry/common/platform';
|
||||
import { IJSONSchema } from 'vs/base/common/jsonSchema';
|
||||
import { mixin } from 'vs/base/common/objects';
|
||||
import { localize } from 'vs/nls';
|
||||
|
||||
let widgetRegistry = <IDashboardWidgetRegistry>Registry.as(Extensions.DashboardWidgetContribution);
|
||||
|
||||
export function generateDashboardWidgetSchema(type?: 'database' | 'server', extension?: boolean): IJSONSchema {
|
||||
let schemas;
|
||||
if (extension) {
|
||||
let extensionSchemas = type === 'server' ? widgetRegistry.serverWidgetSchema.extensionProperties : type === 'database' ? widgetRegistry.databaseWidgetSchema.extensionProperties : widgetRegistry.allSchema.extensionProperties;
|
||||
schemas = type === 'server' ? widgetRegistry.serverWidgetSchema.properties : type === 'database' ? widgetRegistry.databaseWidgetSchema.properties : widgetRegistry.allSchema.properties;
|
||||
schemas = mixin(schemas, extensionSchemas, true);
|
||||
} else {
|
||||
schemas = type === 'server' ? widgetRegistry.serverWidgetSchema.properties : type === 'database' ? widgetRegistry.databaseWidgetSchema.properties : widgetRegistry.allSchema.properties;
|
||||
}
|
||||
|
||||
return {
|
||||
type: 'object',
|
||||
properties: {
|
||||
name: {
|
||||
type: 'string'
|
||||
},
|
||||
icon: {
|
||||
type: 'string'
|
||||
},
|
||||
provider: {
|
||||
anyOf: [
|
||||
{
|
||||
type: 'string'
|
||||
},
|
||||
{
|
||||
type: 'array',
|
||||
items: {
|
||||
type: 'string'
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
edition: {
|
||||
anyOf: [
|
||||
{
|
||||
type: 'number'
|
||||
},
|
||||
{
|
||||
type: 'array',
|
||||
items: {
|
||||
type: 'number'
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
gridItemConfig: {
|
||||
type: 'object',
|
||||
properties: {
|
||||
sizex: {
|
||||
type: 'number'
|
||||
},
|
||||
sizey: {
|
||||
type: 'number'
|
||||
},
|
||||
col: {
|
||||
type: 'number'
|
||||
},
|
||||
row: {
|
||||
type: 'number'
|
||||
}
|
||||
}
|
||||
},
|
||||
widget: {
|
||||
type: 'object',
|
||||
properties: schemas,
|
||||
minItems: 1,
|
||||
maxItems: 1
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
export function generateDashboardTabSchema(type?: 'database' | 'server'): IJSONSchema {
|
||||
return {
|
||||
type: 'object',
|
||||
properties: {
|
||||
tabId: {
|
||||
type: 'string',
|
||||
description: localize('sqlops.extension.contributes.dashboard.tab.id', "Unique identifier for this tab. Will be passed to the extension for any requests."),
|
||||
enum: [],
|
||||
enumDescriptions: [],
|
||||
errorMessage: localize('dashboardTabError', "Extension tab is unknown or not installed.")
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
export const DASHBOARD_CONFIG_ID = 'Dashboard';
|
||||
export const DASHBOARD_TABS_KEY_PROPERTY = 'tabId';
|
||||
@@ -10,6 +10,7 @@ import { BreadcrumbClass } from 'sql/parts/dashboard/services/breadcrumb.service
|
||||
import { IBreadcrumbService } from 'sql/base/browser/ui/breadcrumb/interfaces';
|
||||
import { DashboardServiceInterface } from 'sql/parts/dashboard/services/dashboardServiceInterface.service';
|
||||
import { WidgetConfig } from 'sql/parts/dashboard/common/dashboardWidget';
|
||||
import { IBootstrapService, BOOTSTRAP_SERVICE_ID } from 'sql/services/bootstrap/bootstrapService';
|
||||
|
||||
import * as colors from 'vs/platform/theme/common/colorRegistry';
|
||||
import * as nls from 'vs/nls';
|
||||
@@ -34,19 +35,21 @@ export class DatabaseDashboardPage extends DashboardPage implements OnInit {
|
||||
|
||||
constructor(
|
||||
@Inject(forwardRef(() => IBreadcrumbService)) private _breadcrumbService: IBreadcrumbService,
|
||||
@Inject(BOOTSTRAP_SERVICE_ID) bootstrapService: IBootstrapService,
|
||||
@Inject(forwardRef(() => DashboardServiceInterface)) dashboardService: DashboardServiceInterface,
|
||||
@Inject(forwardRef(() => ChangeDetectorRef)) _cd: ChangeDetectorRef,
|
||||
@Inject(forwardRef(() => ElementRef)) el: ElementRef
|
||||
) {
|
||||
super(dashboardService, el, _cd);
|
||||
super(dashboardService, bootstrapService, el, _cd);
|
||||
this._register(dashboardService.onUpdatePage(() => {
|
||||
this.refresh(true);
|
||||
this._cd.detectChanges();
|
||||
}));
|
||||
this.init();
|
||||
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
this.init();
|
||||
this._breadcrumbService.setBreadcrumbs(BreadcrumbClass.DatabasePage);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,12 +3,9 @@
|
||||
* 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 } from 'vs/base/common/jsonSchema';
|
||||
import { Extensions, IDashboardWidgetRegistry } from 'sql/platform/dashboard/common/widgetRegistry';
|
||||
import * as nls from 'vs/nls';
|
||||
|
||||
let widgetRegistry = <IDashboardWidgetRegistry>Registry.as(Extensions.DashboardWidgetContribution);
|
||||
import { generateDashboardWidgetSchema, generateDashboardTabSchema } from './dashboardPageContribution';
|
||||
|
||||
export const databaseDashboardPropertiesSchema: IJSONSchema = {
|
||||
description: nls.localize('dashboardDatabaseProperties', 'Enable or disable the properties widget'),
|
||||
@@ -85,58 +82,7 @@ export const databaseDashboardPropertiesSchema: IJSONSchema = {
|
||||
export const databaseDashboardSettingSchema: IJSONSchema = {
|
||||
type: ['array'],
|
||||
description: nls.localize('dashboardDatabase', 'Customizes the database dashboard page'),
|
||||
items: <IJSONSchema>{
|
||||
type: 'object',
|
||||
properties: {
|
||||
name: {
|
||||
type: 'string'
|
||||
},
|
||||
icon: {
|
||||
type: 'string'
|
||||
},
|
||||
provider: {
|
||||
anyOf: [
|
||||
'string',
|
||||
{
|
||||
type: 'array',
|
||||
items: 'string'
|
||||
}
|
||||
]
|
||||
},
|
||||
edition: {
|
||||
anyOf: [
|
||||
'number',
|
||||
{
|
||||
type: 'array',
|
||||
items: 'number'
|
||||
}
|
||||
]
|
||||
},
|
||||
gridItemConfig: {
|
||||
type: 'object',
|
||||
properties: {
|
||||
sizex: {
|
||||
type: 'number'
|
||||
},
|
||||
sizey: {
|
||||
type: 'number'
|
||||
},
|
||||
col: {
|
||||
type: 'number'
|
||||
},
|
||||
row: {
|
||||
type: 'number'
|
||||
}
|
||||
}
|
||||
},
|
||||
widget: {
|
||||
type: 'object',
|
||||
properties: widgetRegistry.databaseWidgetSchema.properties,
|
||||
minItems: 1,
|
||||
maxItems: 1
|
||||
}
|
||||
}
|
||||
},
|
||||
items: generateDashboardWidgetSchema('database'),
|
||||
default: [
|
||||
{
|
||||
name: 'Tasks',
|
||||
@@ -160,5 +106,14 @@ export const databaseDashboardSettingSchema: IJSONSchema = {
|
||||
]
|
||||
};
|
||||
|
||||
export const databaseDashboardTabsSchema: IJSONSchema = {
|
||||
type: ['array'],
|
||||
description: nls.localize('dashboardDatabaseTabs', 'Customizes the database dashboard tabs'),
|
||||
items: generateDashboardTabSchema('database'),
|
||||
default: [
|
||||
]
|
||||
};
|
||||
|
||||
export const DATABASE_DASHBOARD_SETTING = 'dashboard.database.widgets';
|
||||
export const DATABASE_DASHBOARD_PROPERTIES = 'dashboard.database.properties';
|
||||
export const DATABASE_DASHBOARD_TABS = 'dashboard.database.tabs';
|
||||
|
||||
@@ -10,6 +10,7 @@ import { BreadcrumbClass } from 'sql/parts/dashboard/services/breadcrumb.service
|
||||
import { IBreadcrumbService } from 'sql/base/browser/ui/breadcrumb/interfaces';
|
||||
import { WidgetConfig } from 'sql/parts/dashboard/common/dashboardWidget';
|
||||
import { DashboardServiceInterface } from 'sql/parts/dashboard/services/dashboardServiceInterface.service';
|
||||
import { IBootstrapService, BOOTSTRAP_SERVICE_ID } from 'sql/services/bootstrap/bootstrapService';
|
||||
|
||||
import * as colors from 'vs/platform/theme/common/colorRegistry';
|
||||
import * as nls from 'vs/nls';
|
||||
@@ -31,24 +32,26 @@ export class ServerDashboardPage extends DashboardPage implements OnInit {
|
||||
};
|
||||
|
||||
protected readonly context = 'server';
|
||||
private _letDashboardPromise: Thenable<boolean>;
|
||||
|
||||
constructor(
|
||||
@Inject(forwardRef(() => IBreadcrumbService)) private breadcrumbService: IBreadcrumbService,
|
||||
@Inject(BOOTSTRAP_SERVICE_ID) bootstrapService: IBootstrapService,
|
||||
@Inject(forwardRef(() => DashboardServiceInterface)) dashboardService: DashboardServiceInterface,
|
||||
@Inject(forwardRef(() => ChangeDetectorRef)) cd: ChangeDetectorRef,
|
||||
@Inject(forwardRef(() => ChangeDetectorRef)) _cd: ChangeDetectorRef,
|
||||
@Inject(forwardRef(() => ElementRef)) el: ElementRef
|
||||
) {
|
||||
super(dashboardService, el, cd);
|
||||
super(dashboardService, bootstrapService, el, _cd);
|
||||
// revert back to default database
|
||||
this.dashboardService.connectionManagementService.changeDatabase('master').then(() => {
|
||||
this.dashboardService.connectionManagementService.connectionInfo.connectionProfile.databaseName = undefined;
|
||||
this.init();
|
||||
cd.detectChanges();
|
||||
});
|
||||
this._letDashboardPromise = this.dashboardService.connectionManagementService.changeDatabase('master');
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
this.breadcrumbService.setBreadcrumbs(BreadcrumbClass.ServerPage);
|
||||
this.dashboardService.connectionManagementService.connectionInfo.connectionProfile.databaseName = null;
|
||||
this._letDashboardPromise.then(() => {
|
||||
this.breadcrumbService.setBreadcrumbs(BreadcrumbClass.ServerPage);
|
||||
this.dashboardService.connectionManagementService.connectionInfo.connectionProfile.databaseName = null;
|
||||
this.init();
|
||||
this._cd.detectChanges();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,12 +2,9 @@
|
||||
* 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 } from 'vs/base/common/jsonSchema';
|
||||
import { Extensions, IDashboardWidgetRegistry } from 'sql/platform/dashboard/common/widgetRegistry';
|
||||
import * as nls from 'vs/nls';
|
||||
|
||||
let widgetRegistry = <IDashboardWidgetRegistry>Registry.as(Extensions.DashboardWidgetContribution);
|
||||
import { generateDashboardWidgetSchema, generateDashboardTabSchema } from 'sql/parts/dashboard/pages/dashboardPageContribution';
|
||||
|
||||
export interface IPropertiesConfig {
|
||||
edition: number | Array<number>;
|
||||
@@ -111,53 +108,18 @@ let defaultVal = [
|
||||
export const serverDashboardSettingSchema: IJSONSchema = {
|
||||
type: ['array'],
|
||||
description: nls.localize('dashboardServer', 'Customizes the server dashboard page'),
|
||||
items: <IJSONSchema>{
|
||||
type: 'object',
|
||||
properties: {
|
||||
name: {
|
||||
type: 'string'
|
||||
},
|
||||
icon: {
|
||||
type: 'string'
|
||||
},
|
||||
provider: {
|
||||
anyOf: [
|
||||
'string',
|
||||
{
|
||||
type: 'array',
|
||||
items: 'string'
|
||||
}
|
||||
]
|
||||
},
|
||||
edition: {
|
||||
anyOf: [
|
||||
'number',
|
||||
{
|
||||
type: 'array',
|
||||
items: 'number'
|
||||
}
|
||||
]
|
||||
},
|
||||
gridItemConfig: {
|
||||
type: 'object',
|
||||
properties: {
|
||||
sizex: {
|
||||
type: 'number'
|
||||
},
|
||||
sizey: {
|
||||
type: 'number'
|
||||
}
|
||||
}
|
||||
},
|
||||
widget: {
|
||||
type: 'object',
|
||||
properties: widgetRegistry.serverWidgetSchema.properties,
|
||||
maxItems: 1
|
||||
}
|
||||
}
|
||||
},
|
||||
items: generateDashboardWidgetSchema('server'),
|
||||
default: defaultVal
|
||||
};
|
||||
|
||||
export const serverDashboardTabsSchema: IJSONSchema = {
|
||||
type: ['array'],
|
||||
description: nls.localize('dashboardServerTabs', 'Customizes the Server dashboard tabs'),
|
||||
items: generateDashboardTabSchema('server'),
|
||||
default: [
|
||||
]
|
||||
};
|
||||
|
||||
export const SERVER_DASHBOARD_SETTING = 'dashboard.server.widgets';
|
||||
export const SERVER_DASHBOARD_PROPERTIES = 'dashboard.server.properties';
|
||||
export const SERVER_DASHBOARD_PROPERTIES = 'dashboard.server.properties';
|
||||
export const SERVER_DASHBOARD_TABS = 'dashboard.server.tabs';
|
||||
Reference in New Issue
Block a user