diff --git a/x-pack/plugins/index_management/index.js b/x-pack/plugins/index_management/index.js index c48eaa6ba15ca..6e29b91882d48 100644 --- a/x-pack/plugins/index_management/index.js +++ b/x-pack/plugins/index_management/index.js @@ -21,7 +21,13 @@ export function indexManagement(kibana) { styleSheetPaths: `${__dirname}/public/index.scss`, managementSections: [ 'plugins/index_management', - ] + ], + injectDefaultVars(server) { + const config = server.config(); + return { + indexManagementUiEnabled: config.get(`${PLUGIN.ID}.enabled`) + }; + }, }, init: function (server) { server.expose('addIndexManagementDataEnricher', addIndexManagementDataEnricher); diff --git a/x-pack/plugins/index_management/public/register_management_section.js b/x-pack/plugins/index_management/public/register_management_section.js index 78dec3515a899..3f084da770e1d 100644 --- a/x-pack/plugins/index_management/public/register_management_section.js +++ b/x-pack/plugins/index_management/public/register_management_section.js @@ -7,12 +7,15 @@ import { management } from 'ui/management'; import { i18n } from '@kbn/i18n'; import { BASE_PATH } from '../common/constants'; +import chrome from 'ui/chrome'; +if (chrome.getInjected('indexManagementUiEnabled')) { + const esSection = management.getSection('elasticsearch'); + esSection.register('index_management', { + visible: true, + display: i18n.translate('xpack.idxMgmt.appTitle', { defaultMessage: 'Index Management' }), + order: 1, + url: `#${BASE_PATH}home` + }); +} -const esSection = management.getSection('elasticsearch'); -esSection.register('index_management', { - visible: true, - display: i18n.translate('xpack.idxMgmt.appTitle', { defaultMessage: 'Index Management' }), - order: 1, - url: `#${BASE_PATH}home` -}); diff --git a/x-pack/plugins/index_management/public/register_routes.js b/x-pack/plugins/index_management/public/register_routes.js index 02666e81a0b5c..acae726940b04 100644 --- a/x-pack/plugins/index_management/public/register_routes.js +++ b/x-pack/plugins/index_management/public/register_routes.js @@ -19,6 +19,7 @@ import routes from 'ui/routes'; import template from './main.html'; import { manageAngularLifecycle } from './lib/manage_angular_lifecycle'; import { indexManagementStore } from './store'; +import chrome from 'ui/chrome'; const renderReact = async (elem) => { render( @@ -32,21 +33,22 @@ const renderReact = async (elem) => { elem ); }; - -routes.when(`${BASE_PATH}:view?/:id?`, { - template: template, - controllerAs: 'indexManagement', - controller: class IndexManagementController { - constructor($scope, $route, $http) { +if (chrome.getInjected('indexManagementUiEnabled')) { + routes.when(`${BASE_PATH}:view?/:id?`, { + template: template, + controllerAs: 'indexManagement', + controller: class IndexManagementController { + constructor($scope, $route, $http) { // NOTE: We depend upon Angular's $http service because it's decorated with interceptors, // e.g. to check license status per request. - setHttpClient($http); + setHttpClient($http); - $scope.$$postDigest(() => { - const elem = document.getElementById('indexManagementReactRoot'); - renderReact(elem); - manageAngularLifecycle($scope, $route, elem); - }); + $scope.$$postDigest(() => { + const elem = document.getElementById('indexManagementReactRoot'); + renderReact(elem); + manageAngularLifecycle($scope, $route, elem); + }); + } } - } -}); + }); +}