diff --git a/src/legacy/core_plugins/kibana/public/management/landing.html b/src/legacy/core_plugins/kibana/public/management/landing.html
index a69033e4131c9..39459b26f7415 100644
--- a/src/legacy/core_plugins/kibana/public/management/landing.html
+++ b/src/legacy/core_plugins/kibana/public/management/landing.html
@@ -1,3 +1,3 @@
-
+
diff --git a/src/plugins/management/public/management_app.tsx b/src/plugins/management/public/management_app.tsx
index f7e8dba4f8210..705d98eaaf2ff 100644
--- a/src/plugins/management/public/management_app.tsx
+++ b/src/plugins/management/public/management_app.tsx
@@ -34,7 +34,7 @@ export class ManagementApp {
readonly basePath: string;
readonly order: number;
readonly mount: ManagementSectionMount;
- protected enabledStatus: boolean = true;
+ private enabledStatus = true;
constructor(
{ id, title, basePath, order = 100, mount }: CreateManagementApp,
@@ -54,6 +54,11 @@ export class ManagementApp {
title,
mount: async ({}, params) => {
let appUnmount: Unmount;
+ if (!this.enabledStatus) {
+ const [coreStart] = await getStartServices();
+ coreStart.application.navigateToApp('kibana#/management');
+ return () => {};
+ }
async function setBreadcrumbs(crumbs: ChromeBreadcrumb[]) {
const [coreStart] = await getStartServices();
coreStart.chrome.setBreadcrumbs([
diff --git a/test/plugin_functional/plugins/management_test_plugin/public/plugin.tsx b/test/plugin_functional/plugins/management_test_plugin/public/plugin.tsx
index 8b7cdd653ed8c..f3b7a19f70ae3 100644
--- a/test/plugin_functional/plugins/management_test_plugin/public/plugin.tsx
+++ b/test/plugin_functional/plugins/management_test_plugin/public/plugin.tsx
@@ -62,6 +62,22 @@ export class ManagementTestPlugin
};
},
});
+
+ testSection!
+ .registerApp({
+ id: 'test-management-disabled',
+ title: 'Management Test Disabled',
+ mount(params) {
+ params.setBreadcrumbs([{ text: 'Management Test Disabled' }]);
+ ReactDOM.render(
This is a secret that should never be seen!
, params.element);
+
+ return () => {
+ ReactDOM.unmountComponentAtNode(params.element);
+ };
+ },
+ })
+ .disable();
+
return {};
}
diff --git a/test/plugin_functional/test_suites/management/management_plugin.js b/test/plugin_functional/test_suites/management/management_plugin.js
index d65fb1dcd3a7e..0c185f4b385b5 100644
--- a/test/plugin_functional/test_suites/management/management_plugin.js
+++ b/test/plugin_functional/test_suites/management/management_plugin.js
@@ -36,5 +36,13 @@ export default function({ getService, getPageObjects }) {
await testSubjects.click('test-management-link-basepath');
await testSubjects.existOrFail('test-management-link-one');
});
+
+ it('should redirect when app is disabled', async () => {
+ await PageObjects.common.navigateToActualUrl(
+ 'kibana',
+ 'management/test-section/test-management-disabled'
+ );
+ await testSubjects.existOrFail('management-landing');
+ });
});
}