From 371ff3dd0dc6db52883e6dba0d059ad6e5a69eb3 Mon Sep 17 00:00:00 2001 From: Brandon Kobel Date: Tue, 15 Oct 2019 12:03:12 -0700 Subject: [PATCH] Removing the lens feature, using visualize instead (#48041) * Removing the lens feature, using visualize instead * Updating /api/features test because lens isn't a feature anymore * Updating capability from lens to visualize in test * Fixing api integration test --- x-pack/legacy/plugins/lens/index.ts | 27 ------------------- .../lens/public/app_plugin/app.test.tsx | 6 ++--- .../plugins/lens/public/app_plugin/app.tsx | 4 +-- .../embeddable/embeddable_factory.ts | 2 +- .../plugins/features/server/oss_features.ts | 2 +- .../apis/features/features/features.ts | 1 - .../apis/security/privileges.ts | 1 - 7 files changed, 7 insertions(+), 36 deletions(-) diff --git a/x-pack/legacy/plugins/lens/index.ts b/x-pack/legacy/plugins/lens/index.ts index f7cadbc6433e7..7acd62502d428 100644 --- a/x-pack/legacy/plugins/lens/index.ts +++ b/x-pack/legacy/plugins/lens/index.ts @@ -54,33 +54,6 @@ export const lens: LegacyPluginInitializer = kibana => { init(server: Server) { const kbnServer = (server as unknown) as KbnServer; - server.plugins.xpack_main.registerFeature({ - id: PLUGIN_ID, - name: NOT_INTERNATIONALIZED_PRODUCT_NAME, - app: [PLUGIN_ID, 'kibana'], - catalogue: [PLUGIN_ID], - privileges: { - all: { - api: [PLUGIN_ID], - catalogue: [PLUGIN_ID], - savedObject: { - all: ['search'], - read: ['index-pattern'], - }, - ui: ['save', 'show', 'saveQuery'], - }, - read: { - api: [PLUGIN_ID], - catalogue: [PLUGIN_ID], - savedObject: { - all: [], - read: ['index-pattern'], - }, - ui: ['show'], - }, - }, - }); - // Set up with the new platform plugin lifecycle API. const plugin = lensServerPlugin(); plugin.setup(kbnServer.newPlatform.setup.core, { diff --git a/x-pack/legacy/plugins/lens/public/app_plugin/app.test.tsx b/x-pack/legacy/plugins/lens/public/app_plugin/app.test.tsx index 9c4b0fa737428..83d6e273578d5 100644 --- a/x-pack/legacy/plugins/lens/public/app_plugin/app.test.tsx +++ b/x-pack/legacy/plugins/lens/public/app_plugin/app.test.tsx @@ -88,7 +88,7 @@ describe('Lens App', () => { ...core.application, capabilities: { ...core.application.capabilities, - lens: { save: true, saveQuery: true, show: true }, + visualize: { save: true, saveQuery: true, show: true }, }, }, }, @@ -302,7 +302,7 @@ describe('Lens App', () => { ...args.core.application, capabilities: { ...args.core.application.capabilities, - lens: { save: false, saveQuery: false, show: true }, + visualize: { save: false, saveQuery: false, show: true }, }, }; args.editorFrame = frame; @@ -520,7 +520,7 @@ describe('Lens App', () => { ...args.core.application, capabilities: { ...args.core.application.capabilities, - lens: { save: false, saveQuery: false, show: true }, + visualize: { save: false, saveQuery: false, show: true }, }, }; diff --git a/x-pack/legacy/plugins/lens/public/app_plugin/app.tsx b/x-pack/legacy/plugins/lens/public/app_plugin/app.tsx index 4746b1cac3ecd..e578205696364 100644 --- a/x-pack/legacy/plugins/lens/public/app_plugin/app.tsx +++ b/x-pack/legacy/plugins/lens/public/app_plugin/app.tsx @@ -153,7 +153,7 @@ export function App({ // Can save if the frame has told us what it has, and there is either: // a) No saved doc // b) A saved doc that differs from the frame state - const isSaveable = state.isDirty && (core.application.capabilities.lens.save as boolean); + const isSaveable = state.isDirty && (core.application.capabilities.visualize.save as boolean); const onError = useCallback( (e: { message: string }) => @@ -229,7 +229,7 @@ export function App({ showDatePicker={true} showQueryBar={true} showFilterBar={true} - showSaveQuery={core.application.capabilities.lens.saveQuery as boolean} + showSaveQuery={core.application.capabilities.visualize.saveQuery as boolean} savedQuery={state.savedQuery} onSaved={savedQuery => { setState(s => ({ ...s, savedQuery })); diff --git a/x-pack/legacy/plugins/lens/public/editor_frame_plugin/embeddable/embeddable_factory.ts b/x-pack/legacy/plugins/lens/public/editor_frame_plugin/embeddable/embeddable_factory.ts index d779dfa5c401f..9ad6864b64853 100644 --- a/x-pack/legacy/plugins/lens/public/editor_frame_plugin/embeddable/embeddable_factory.ts +++ b/x-pack/legacy/plugins/lens/public/editor_frame_plugin/embeddable/embeddable_factory.ts @@ -48,7 +48,7 @@ export class EmbeddableFactory extends AbstractEmbeddableFactory { } public isEditable() { - return capabilities.get().lens.save as boolean; + return capabilities.get().visualize.save as boolean; } canCreateNew() { diff --git a/x-pack/plugins/features/server/oss_features.ts b/x-pack/plugins/features/server/oss_features.ts index 9350abf2fe7e7..ff19df62bc3db 100644 --- a/x-pack/plugins/features/server/oss_features.ts +++ b/x-pack/plugins/features/server/oss_features.ts @@ -46,7 +46,7 @@ export const buildOSSFeatures = ({ savedObjectTypes, includeTimelion }: BuildOSS }), icon: 'visualizeApp', navLinkId: 'kibana:visualize', - app: ['kibana'], + app: ['kibana', 'lens'], catalogue: ['visualize'], privileges: { all: { diff --git a/x-pack/test/api_integration/apis/features/features/features.ts b/x-pack/test/api_integration/apis/features/features/features.ts index 469c32541c23d..fb17c76cb6bc8 100644 --- a/x-pack/test/api_integration/apis/features/features/features.ts +++ b/x-pack/test/api_integration/apis/features/features/features.ts @@ -112,7 +112,6 @@ export default function({ getService }: FtrProviderContext) { 'canvas', 'code', 'infrastructure', - 'lens', 'logs', 'maps', 'uptime', diff --git a/x-pack/test/api_integration/apis/security/privileges.ts b/x-pack/test/api_integration/apis/security/privileges.ts index a01277d7ab606..846d5cbdf4e1a 100644 --- a/x-pack/test/api_integration/apis/security/privileges.ts +++ b/x-pack/test/api_integration/apis/security/privileges.ts @@ -38,7 +38,6 @@ export default function({ getService }: FtrProviderContext) { apm: ['all', 'read'], siem: ['all', 'read'], code: ['all', 'read'], - lens: ['all', 'read'], }, global: ['all', 'read'], space: ['all', 'read'],