mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 17:59:23 -04:00
Fix engine routes that are meta engine or non-meta-engine specific (#104757)
- to include conditionals in their routing - this matches their nav link behavior - we should have checks in routes as well just in case
This commit is contained in:
parent
b911369485
commit
7af3be0655
2 changed files with 10 additions and 5 deletions
|
@ -39,6 +39,7 @@ describe('EngineRouter', () => {
|
|||
...mockEngineValues,
|
||||
dataLoading: false,
|
||||
engineNotFound: false,
|
||||
isMetaEngine: false,
|
||||
myRole: {},
|
||||
};
|
||||
const actions = {
|
||||
|
@ -175,14 +176,18 @@ describe('EngineRouter', () => {
|
|||
});
|
||||
|
||||
it('renders a source engines view', () => {
|
||||
setMockValues({ ...values, myRole: { canViewMetaEngineSourceEngines: true } });
|
||||
setMockValues({
|
||||
...values,
|
||||
myRole: { canViewMetaEngineSourceEngines: true },
|
||||
isMetaEngine: true,
|
||||
});
|
||||
const wrapper = shallow(<EngineRouter />);
|
||||
|
||||
expect(wrapper.find(SourceEngines)).toHaveLength(1);
|
||||
});
|
||||
|
||||
it('renders a crawler view', () => {
|
||||
setMockValues({ ...values, myRole: { canViewEngineCrawler: true } });
|
||||
setMockValues({ ...values, myRole: { canViewEngineCrawler: true }, isMetaEngine: false });
|
||||
const wrapper = shallow(<EngineRouter />);
|
||||
|
||||
expect(wrapper.find(CrawlerRouter)).toHaveLength(1);
|
||||
|
|
|
@ -66,7 +66,7 @@ export const EngineRouter: React.FC = () => {
|
|||
} = useValues(AppLogic);
|
||||
|
||||
const { engineName: engineNameFromUrl } = useParams() as { engineName: string };
|
||||
const { engineName, dataLoading, engineNotFound } = useValues(EngineLogic);
|
||||
const { engineName, dataLoading, engineNotFound, isMetaEngine } = useValues(EngineLogic);
|
||||
const { setEngineName, initializeEngine, pollEmptyEngine, stopPolling, clearEngine } = useActions(
|
||||
EngineLogic
|
||||
);
|
||||
|
@ -120,12 +120,12 @@ export const EngineRouter: React.FC = () => {
|
|||
<SchemaRouter />
|
||||
</Route>
|
||||
)}
|
||||
{canViewMetaEngineSourceEngines && (
|
||||
{canViewMetaEngineSourceEngines && isMetaEngine && (
|
||||
<Route path={META_ENGINE_SOURCE_ENGINES_PATH}>
|
||||
<SourceEngines />
|
||||
</Route>
|
||||
)}
|
||||
{canViewEngineCrawler && (
|
||||
{canViewEngineCrawler && !isMetaEngine && (
|
||||
<Route path={ENGINE_CRAWLER_PATH}>
|
||||
<CrawlerRouter />
|
||||
</Route>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue