mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-17 02:51:36 -05:00
Tasks schema registration (#900)
* inital task update * fix schema update problems * remove dead code
This commit is contained in:
@@ -12,7 +12,7 @@ import { WidgetConfig } from 'sql/parts/dashboard/common/dashboardWidget';
|
|||||||
|
|
||||||
export const WIDGETS_CONTAINER = 'widgets-container';
|
export const WIDGETS_CONTAINER = 'widgets-container';
|
||||||
|
|
||||||
let widgetsSchema: IJSONSchema = {
|
const widgetsSchema: IJSONSchema = {
|
||||||
type: 'array',
|
type: 'array',
|
||||||
description: nls.localize('dashboard.container.widgets', "The list of widgets that will be displayed in this tab."),
|
description: nls.localize('dashboard.container.widgets', "The list of widgets that will be displayed in this tab."),
|
||||||
items: generateDashboardWidgetSchema(undefined, true)
|
items: generateDashboardWidgetSchema(undefined, true)
|
||||||
|
|||||||
@@ -2,30 +2,36 @@
|
|||||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||||
*--------------------------------------------------------------------------------------------*/
|
*--------------------------------------------------------------------------------------------*/
|
||||||
import { IJSONSchema } from 'vs/base/common/jsonSchema';
|
|
||||||
import { registerDashboardWidget } from 'sql/platform/dashboard/common/widgetRegistry';
|
import { registerDashboardWidget } from 'sql/platform/dashboard/common/widgetRegistry';
|
||||||
import { TaskRegistry } from 'sql/platform/tasks/common/tasks';
|
import { TaskRegistry } from 'sql/platform/tasks/common/tasks';
|
||||||
|
|
||||||
|
import { IJSONSchema } from 'vs/base/common/jsonSchema';
|
||||||
|
|
||||||
|
const singleTaskSchema: IJSONSchema = {
|
||||||
|
type: 'string',
|
||||||
|
enum: TaskRegistry.getTasks()
|
||||||
|
};
|
||||||
|
|
||||||
const tasksSchema: IJSONSchema = {
|
const tasksSchema: IJSONSchema = {
|
||||||
type: 'array',
|
type: 'array',
|
||||||
items: {
|
items: {
|
||||||
anyOf: [{
|
anyOf: [
|
||||||
type: 'string',
|
singleTaskSchema,
|
||||||
enum: TaskRegistry.getTasks()
|
{
|
||||||
},
|
type: 'object',
|
||||||
{
|
properties: {
|
||||||
type: 'object',
|
name: singleTaskSchema,
|
||||||
properties: {
|
when: {
|
||||||
name: {
|
type: 'string'
|
||||||
type: 'string',
|
}
|
||||||
enum: TaskRegistry.getTasks()
|
|
||||||
},
|
|
||||||
when: {
|
|
||||||
type: 'string'
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}]
|
]
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
registerDashboardWidget('tasks-widget', '', tasksSchema);
|
TaskRegistry.onTaskRegistered(e => {
|
||||||
|
singleTaskSchema.enum.push(e);
|
||||||
|
});
|
||||||
|
|
||||||
|
registerDashboardWidget('tasks-widget', '', tasksSchema);
|
||||||
|
|||||||
@@ -51,7 +51,7 @@ class DashboardContainerRegistry implements IDashboardContainerRegistry {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public get containerTypeSchemaProperties(): IJSONSchemaMap {
|
public get containerTypeSchemaProperties(): IJSONSchemaMap {
|
||||||
return deepClone(this._dashboardContainerTypeSchemaProperties);
|
return this._dashboardContainerTypeSchemaProperties;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -64,7 +64,7 @@ class DashboardContainerRegistry implements IDashboardContainerRegistry {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public get navSectionContainerTypeSchemaProperties(): IJSONSchemaMap {
|
public get navSectionContainerTypeSchemaProperties(): IJSONSchemaMap {
|
||||||
return deepClone(this._dashboardNavSectionContainerTypeSchemaProperties);
|
return this._dashboardNavSectionContainerTypeSchemaProperties;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -78,7 +78,7 @@ class DashboardWidgetRegistry implements IDashboardWidgetRegistry {
|
|||||||
* @param val cal for default
|
* @param val cal for default
|
||||||
* @param context either 'database' or 'server' for what page to register for; if not specified, will register for both
|
* @param context either 'database' or 'server' for what page to register for; if not specified, will register for both
|
||||||
*/
|
*/
|
||||||
registerNonCustomDashboardWidget(id: string, description: string, val: IInsightsConfig, context?: 'database' | 'server'): WidgetIdentifier {
|
public registerNonCustomDashboardWidget(id: string, description: string, val: IInsightsConfig, context?: 'database' | 'server'): WidgetIdentifier {
|
||||||
if (context === undefined || context === 'database') {
|
if (context === undefined || context === 'database') {
|
||||||
this._dashboardWidgetSchema.properties[id] = { type: 'null', default: null };
|
this._dashboardWidgetSchema.properties[id] = { type: 'null', default: null };
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user