mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 01:38:56 -04:00
[7.2] Feature Controls - only navigate to index pattern manage… (#40126)
* only navigate to index pattern management if available * fix tests entry template * don't resolve capabilities until absolutely necessary
This commit is contained in:
parent
8a1b4d19bf
commit
137252b590
4 changed files with 35 additions and 2 deletions
|
@ -28,6 +28,7 @@ import { I18nContext } from 'ui/i18n';
|
|||
import { uiModules } from 'ui/modules';
|
||||
import appTemplate from './app.html';
|
||||
import landingTemplate from './landing.html';
|
||||
import { capabilities } from 'ui/capabilities';
|
||||
import { management, SidebarNav, MANAGEMENT_BREADCRUMB } from 'ui/management';
|
||||
import { FeatureCatalogueRegistryProvider, FeatureCatalogueCategory } from 'ui/registry/feature_catalogue';
|
||||
import { timefilter } from 'ui/timefilter';
|
||||
|
@ -50,7 +51,10 @@ uiRoutes
|
|||
});
|
||||
|
||||
require('ui/index_patterns/route_setup/load_default')({
|
||||
whenMissingRedirectTo: '/management/kibana/index_pattern'
|
||||
whenMissingRedirectTo: () => {
|
||||
const canManageIndexPatterns = capabilities.get().management.kibana.index_patterns;
|
||||
return canManageIndexPatterns ? '/management/kibana/index_pattern' : '/home';
|
||||
}
|
||||
});
|
||||
|
||||
export function updateLandingPage(version) {
|
||||
|
|
|
@ -57,6 +57,13 @@ const uiCapabilities = {
|
|||
timelion: {
|
||||
save: true
|
||||
},
|
||||
management: {
|
||||
kibana: {
|
||||
settings: true,
|
||||
index_patterns: true,
|
||||
objects: true
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
// Stub fetch for CoreSystem calls.
|
||||
|
|
|
@ -104,7 +104,7 @@ export default function (opts) {
|
|||
const hasDefault = !(err instanceof NoDefaultIndexPattern);
|
||||
if (hasDefault || !whenMissingRedirectTo) throw err; // rethrow
|
||||
|
||||
kbnUrl.change(whenMissingRedirectTo);
|
||||
kbnUrl.change(whenMissingRedirectTo());
|
||||
|
||||
displayBanner();
|
||||
}
|
||||
|
|
|
@ -143,5 +143,27 @@ export default function({ getPageObjects, getService }: KibanaFunctionalTestDefa
|
|||
await PageObjects.discover.expectMissingFieldListItemVisualize('bytes');
|
||||
});
|
||||
});
|
||||
|
||||
describe('space with index pattern management disabled', async () => {
|
||||
before(async () => {
|
||||
await spacesService.create({
|
||||
id: 'custom_space',
|
||||
name: 'custom_space',
|
||||
disabledFeatures: ['indexPatterns'],
|
||||
});
|
||||
});
|
||||
|
||||
after(async () => {
|
||||
await spacesService.delete('custom_space');
|
||||
});
|
||||
|
||||
it('Navigates to Kibana home rather than index pattern management when no index patterns exist', async () => {
|
||||
await PageObjects.common.navigateToUrl('discover', '', {
|
||||
basePath: '/s/custom_space',
|
||||
ensureCurrentUrl: false,
|
||||
});
|
||||
await testSubjects.existOrFail('homeApp', 10000);
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue