* redirect on disabled management app path
This commit is contained in:
parent
c62349689e
commit
587f64fa99
|
@ -1,3 +1,3 @@
|
|||
<kbn-management-app>
|
||||
<div id="management-landing"></div>
|
||||
<div id="management-landing" data-test-subj="management-landing"></div>
|
||||
</kbn-management-app>
|
||||
|
|
|
@ -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([
|
||||
|
|
|
@ -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(<div>This is a secret that should never be seen!</div>, params.element);
|
||||
|
||||
return () => {
|
||||
ReactDOM.unmountComponentAtNode(params.element);
|
||||
};
|
||||
},
|
||||
})
|
||||
.disable();
|
||||
|
||||
return {};
|
||||
}
|
||||
|
||||
|
|
|
@ -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');
|
||||
});
|
||||
});
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue