disabling UI for index management when enabled is false in kibana.yml

This commit is contained in:
Bill McConaghy 2018-11-06 09:22:52 -05:00
parent 008d37c637
commit 45d4e8c51d
3 changed files with 33 additions and 22 deletions

View file

@ -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);

View file

@ -7,7 +7,8 @@
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,
@ -15,4 +16,6 @@ esSection.register('index_management', {
order: 1,
url: `#${BASE_PATH}home`
});
}

View file

@ -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,7 +33,7 @@ const renderReact = async (elem) => {
elem
);
};
if (chrome.getInjected('indexManagementUiEnabled')) {
routes.when(`${BASE_PATH}:view?/:id?`, {
template: template,
controllerAs: 'indexManagement',
@ -50,3 +51,4 @@ routes.when(`${BASE_PATH}:view?/:id?`, {
}
}
});
}