mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-16 10:58:30 -05:00
SQL Operations Studio Public Preview 1 (0.23) release source code
This commit is contained in:
@@ -0,0 +1,59 @@
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import { OnInit, Inject, forwardRef, ChangeDetectorRef, OnDestroy } from '@angular/core';
|
||||
|
||||
import { DashboardPage } from 'sql/parts/dashboard/common/dashboardPage.component';
|
||||
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 * as colors from 'vs/platform/theme/common/colorRegistry';
|
||||
import { IDisposable, dispose } from 'vs/base/common/lifecycle';
|
||||
import * as nls from 'vs/nls';
|
||||
|
||||
export class DatabaseDashboardPage extends DashboardPage implements OnInit, OnDestroy {
|
||||
protected propertiesWidget: WidgetConfig = {
|
||||
name: nls.localize('databasePageName', 'DATABASE DASHBOARD'),
|
||||
widget: {
|
||||
'properties-widget': undefined
|
||||
},
|
||||
context: 'database',
|
||||
background_color: colors.editorBackground,
|
||||
border: 'none',
|
||||
fontSize: '14px',
|
||||
fontWeight: '200',
|
||||
padding: '5px 0 0 0',
|
||||
provider: undefined,
|
||||
edition: undefined
|
||||
};
|
||||
|
||||
protected readonly context = 'database';
|
||||
private _dispose: IDisposable[] = [];
|
||||
|
||||
constructor(
|
||||
@Inject(forwardRef(() => IBreadcrumbService)) private _breadcrumbService: IBreadcrumbService,
|
||||
@Inject(forwardRef(() => DashboardServiceInterface)) dashboardService: DashboardServiceInterface,
|
||||
@Inject(forwardRef(() => ChangeDetectorRef)) private _cd: ChangeDetectorRef
|
||||
) {
|
||||
super(dashboardService);
|
||||
this._dispose.push(dashboardService.onUpdatePage(() => {
|
||||
this.refresh(true);
|
||||
this._cd.detectChanges();
|
||||
}));
|
||||
this.init();
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
this._breadcrumbService.setBreadcrumbs(BreadcrumbClass.DatabasePage);
|
||||
this.baseInit();
|
||||
}
|
||||
|
||||
ngOnDestroy() {
|
||||
this._dispose = dispose(this._dispose);
|
||||
this.baseDestroy();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,158 @@
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* 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);
|
||||
|
||||
export const databaseDashboardPropertiesSchema: IJSONSchema = {
|
||||
description: nls.localize('dashboardDatabaseProperties', 'Enable or disable the properties widget'),
|
||||
default: true,
|
||||
oneOf: <IJSONSchema[]>[
|
||||
{ type: 'boolean' },
|
||||
{
|
||||
type: 'array',
|
||||
items: {
|
||||
type: 'object',
|
||||
properties: {
|
||||
provider: {
|
||||
type: 'string'
|
||||
},
|
||||
edition: {
|
||||
type: 'number'
|
||||
},
|
||||
properties: {
|
||||
description: nls.localize('dashboard.databaseproperties', 'Property values to show'),
|
||||
type: 'array',
|
||||
items: {
|
||||
type: 'object',
|
||||
properties: {
|
||||
displayName: {
|
||||
type: 'string',
|
||||
description: nls.localize('dashboard.databaseproperties.displayName', 'Display name of the property')
|
||||
},
|
||||
value: {
|
||||
type: 'string',
|
||||
description: nls.localize('dashboard.databaseproperties.value', 'Value in the Database Info Object')
|
||||
},
|
||||
ignore: {
|
||||
type: 'array',
|
||||
description: nls.localize('dashboard.databaseproperties.ignore', 'Specify specific values to ignore'),
|
||||
items: 'string'
|
||||
}
|
||||
}
|
||||
},
|
||||
default: [
|
||||
{
|
||||
displayName: nls.localize('recoveryModel', 'Recovery Model'),
|
||||
value: 'recoveryModel'
|
||||
},
|
||||
{
|
||||
displayName: nls.localize('lastDatabaseBackup', 'Last Database Backup'),
|
||||
value: 'lastBackupDate',
|
||||
ignore: [
|
||||
'1/1/0001 12:00:00 AM'
|
||||
]
|
||||
},
|
||||
{
|
||||
displayName: nls.localize('lastLogBackup', 'Last Log Backup'),
|
||||
value: 'lastLogBackupDate',
|
||||
ignore: [
|
||||
'1/1/0001 12:00:00 AM'
|
||||
]
|
||||
},
|
||||
{
|
||||
displayName: nls.localize('compatibilityLevel', 'Compatibility Level'),
|
||||
value: 'compatibilityLevel'
|
||||
},
|
||||
{
|
||||
displayName: nls.localize('owner', 'Owner'),
|
||||
value: 'owner'
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
};
|
||||
|
||||
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'
|
||||
}
|
||||
}
|
||||
},
|
||||
widget: {
|
||||
type: 'object',
|
||||
properties: widgetRegistry.databaseWidgetSchema.properties,
|
||||
minItems: 1,
|
||||
maxItems: 1
|
||||
}
|
||||
}
|
||||
},
|
||||
default: [
|
||||
{
|
||||
name: 'Tasks',
|
||||
gridItemConfig: {
|
||||
sizex: 1,
|
||||
sizey: 1
|
||||
},
|
||||
widget: {
|
||||
'tasks-widget': {}
|
||||
}
|
||||
},
|
||||
{
|
||||
gridItemConfig: {
|
||||
sizex: 1,
|
||||
sizey: 2
|
||||
},
|
||||
widget: {
|
||||
'explorer-widget': {}
|
||||
}
|
||||
}
|
||||
]
|
||||
};
|
||||
|
||||
export const DATABASE_DASHBOARD_SETTING = 'dashboard.database.widgets';
|
||||
export const DATABASE_DASHBOARD_PROPERTIES = 'dashboard.database.properties';
|
||||
@@ -0,0 +1,58 @@
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import { OnInit, Inject, forwardRef, OnDestroy, ChangeDetectorRef } from '@angular/core';
|
||||
|
||||
import { DashboardPage } from 'sql/parts/dashboard/common/dashboardPage.component';
|
||||
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 * as colors from 'vs/platform/theme/common/colorRegistry';
|
||||
import * as nls from 'vs/nls';
|
||||
|
||||
export class ServerDashboardPage extends DashboardPage implements OnInit, OnDestroy {
|
||||
protected propertiesWidget: WidgetConfig = {
|
||||
name: nls.localize('serverPageName', 'SERVER DASHBOARD'),
|
||||
widget: {
|
||||
'properties-widget': undefined
|
||||
},
|
||||
context: 'server',
|
||||
background_color: colors.editorBackground,
|
||||
border: 'none',
|
||||
fontSize: '14px',
|
||||
fontWeight: '200',
|
||||
padding: '5px 0 0 0',
|
||||
provider: undefined,
|
||||
edition: undefined
|
||||
};
|
||||
|
||||
protected readonly context = 'server';
|
||||
|
||||
constructor(
|
||||
@Inject(forwardRef(() => IBreadcrumbService)) private breadcrumbService: IBreadcrumbService,
|
||||
@Inject(forwardRef(() => DashboardServiceInterface)) dashboardService: DashboardServiceInterface,
|
||||
@Inject(forwardRef(() => ChangeDetectorRef)) cd: ChangeDetectorRef
|
||||
) {
|
||||
super(dashboardService);
|
||||
// revert back to default database
|
||||
this.dashboardService.connectionManagementService.changeDatabase('master').then(() => {
|
||||
this.dashboardService.connectionManagementService.connectionInfo.connectionProfile.databaseName = undefined;
|
||||
this.init();
|
||||
cd.detectChanges();
|
||||
});
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
this.breadcrumbService.setBreadcrumbs(BreadcrumbClass.ServerPage);
|
||||
this.dashboardService.connectionManagementService.connectionInfo.connectionProfile.databaseName = null;
|
||||
this.baseInit();
|
||||
}
|
||||
|
||||
ngOnDestroy() {
|
||||
this.baseDestroy();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,163 @@
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* 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);
|
||||
|
||||
export interface IPropertiesConfig {
|
||||
edition: number | Array<number>;
|
||||
provider: string | Array<string>;
|
||||
properties: {
|
||||
displayName: string;
|
||||
value: string
|
||||
}[];
|
||||
}
|
||||
|
||||
export const serverDashboardPropertiesSchema: IJSONSchema = {
|
||||
description: nls.localize('dashboardServerProperties', 'Enable or disable the properties widget'),
|
||||
default: true,
|
||||
oneOf: [
|
||||
{ type: 'boolean' },
|
||||
{
|
||||
type: 'object',
|
||||
properties: {
|
||||
provider: {
|
||||
type: 'string'
|
||||
},
|
||||
edition: {
|
||||
type: 'number'
|
||||
},
|
||||
properties: {
|
||||
description: nls.localize('dashboard.serverproperties', 'Property values to show'),
|
||||
type: 'array',
|
||||
items: {
|
||||
type: 'object',
|
||||
properties: {
|
||||
displayName: {
|
||||
type: 'string',
|
||||
description: nls.localize('dashboard.serverproperties.displayName', 'Display name of the property')
|
||||
},
|
||||
value: {
|
||||
type: 'string',
|
||||
description: nls.localize('dashboard.serverproperties.value', 'Value in the Server Info Object')
|
||||
}
|
||||
}
|
||||
},
|
||||
default: [
|
||||
{
|
||||
displayName: nls.localize('version', 'Version'),
|
||||
value: 'serverVersion'
|
||||
},
|
||||
{
|
||||
displayName: nls.localize('edition', 'Edition'),
|
||||
value: 'serverEdition'
|
||||
},
|
||||
{
|
||||
displayName: nls.localize('computerName', 'Computer Name'),
|
||||
value: 'machineName'
|
||||
},
|
||||
{
|
||||
displayName: nls.localize('osVersion', 'OS Version'),
|
||||
value: 'osVersion'
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
};
|
||||
|
||||
let defaultVal = [
|
||||
{
|
||||
name: 'Tasks',
|
||||
widget: {
|
||||
'tasks-widget': {}
|
||||
},
|
||||
gridItemConfig: {
|
||||
sizex: 1,
|
||||
sizey: 1
|
||||
}
|
||||
},
|
||||
{
|
||||
gridItemConfig: {
|
||||
sizex: 1,
|
||||
sizey: 2
|
||||
},
|
||||
widget: {
|
||||
'explorer-widget': {}
|
||||
}
|
||||
},
|
||||
{
|
||||
widget: {
|
||||
'backup-history-server-insight': {
|
||||
cacheId: '0c7cba8b-c87a-4bcc-ae54-2f40a5503a90'
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
widget: {
|
||||
'all-database-size-server-insight': {
|
||||
cacheId: '1d7cba8b-c87a-4bcc-ae54-2f40a5503a90'
|
||||
}
|
||||
}
|
||||
}
|
||||
];
|
||||
|
||||
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
|
||||
}
|
||||
}
|
||||
},
|
||||
default: defaultVal
|
||||
};
|
||||
|
||||
export const SERVER_DASHBOARD_SETTING = 'dashboard.server.widgets';
|
||||
export const SERVER_DASHBOARD_PROPERTIES = 'dashboard.server.properties';
|
||||
Reference in New Issue
Block a user