Fix tab contrib to be accurate (#901)

* update tab contrib to be accurate with expectation

* update contracts

* formatting
This commit is contained in:
Anthony Dresser
2018-03-13 13:55:21 -07:00
committed by GitHub
parent bcd72d21c7
commit 4a4fe584d5
2 changed files with 6 additions and 33 deletions

View File

@@ -17,9 +17,8 @@ export interface IDashboardTabContrib {
id: string;
title: string;
container: object;
when?: string;
description?: string;
provider?: string | string[];
edition?: number | number[];
alwaysShow?: boolean;
}
@@ -38,33 +37,9 @@ const tabSchema: IJSONSchema = {
description: localize('sqlops.extension.contributes.dashboard.tab.description', "Description of this tab that will be shown to the user."),
type: 'string'
},
provider: {
description: localize('sqlops.extension.contributes.dashboard.tab.provider', "Providers for which this tab should be allowed for."),
anyOf: [
{
type: 'string'
},
{
type: 'array',
items: {
type: 'string'
}
}
]
},
edition: {
description: localize('sqlops.extension.contributes.dashboard.tab.edition', "Editions for which this tab should be allowed for."),
anyOf: [
{
type: 'number'
},
{
type: 'array',
items: {
type: 'number'
}
}
]
when: {
description: localize('sqlops.extension.contributes.tab.when', 'Condition which must be true to show this item'),
type: 'string'
},
container: {
description: localize('sqlops.extension.contributes.dashboard.tab.container', "The container that will be displayed in this tab."),
@@ -92,7 +67,7 @@ const tabContributionSchema: IJSONSchema = {
ExtensionsRegistry.registerExtensionPoint<IDashboardTabContrib | IDashboardTabContrib[]>('dashboard.tabs', [], tabContributionSchema).setHandler(extensions => {
function handleCommand(tab: IDashboardTabContrib, extension: IExtensionPointUser<any>) {
let { description, container, title, edition, provider, id, alwaysShow } = tab;
let { description, container, title, when, id, alwaysShow } = tab;
// If always show is not specified, set it to true by default.
if (!types.isBoolean(alwaysShow)) {
@@ -135,7 +110,7 @@ ExtensionsRegistry.registerExtensionPoint<IDashboardTabContrib | IDashboardTabCo
}
if (result) {
registerTab({ description, title, container, edition, provider, id, alwaysShow, publisher });
registerTab({ description, title, container, when, id, alwaysShow, publisher });
}
}

View File

@@ -25,8 +25,6 @@ export interface IDashboardTab {
publisher: string;
description?: string;
container?: object;
provider?: string | string[];
edition?: number | number[];
when?: string;
alwaysShow?: boolean;
}