From 4a4fe584d507cae6b6305e12910926d5274cb9b0 Mon Sep 17 00:00:00 2001 From: Anthony Dresser Date: Tue, 13 Mar 2018 13:55:21 -0700 Subject: [PATCH] Fix tab contrib to be accurate (#901) * update tab contrib to be accurate with expectation * update contracts * formatting --- .../common/dashboardTab.contribution.ts | 37 +++---------------- .../dashboard/common/dashboardRegistry.ts | 2 - 2 files changed, 6 insertions(+), 33 deletions(-) diff --git a/src/sql/parts/dashboard/common/dashboardTab.contribution.ts b/src/sql/parts/dashboard/common/dashboardTab.contribution.ts index a22a77fa25..cb7c8cda79 100644 --- a/src/sql/parts/dashboard/common/dashboardTab.contribution.ts +++ b/src/sql/parts/dashboard/common/dashboardTab.contribution.ts @@ -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('dashboard.tabs', [], tabContributionSchema).setHandler(extensions => { function handleCommand(tab: IDashboardTabContrib, extension: IExtensionPointUser) { - 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