1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-01-25 00:07:47 +01:00

fix: do not filter parent routes for main nav

This commit is contained in:
Ivar Conradi Østhus 2021-08-26 19:27:37 +02:00
parent 11f1ca7393
commit d1baea385d
3 changed files with 231 additions and 2 deletions

View File

@ -2,6 +2,15 @@
exports[`returns all baseRoutes 1`] = `
Array [
Object {
"component": [Function],
"layout": "main",
"menu": Object {},
"parent": "/features",
"path": "/features/:activeTab/:name",
"title": ":name",
"type": "protected",
},
Object {
"component": [Function],
"layout": "main",
@ -12,6 +21,24 @@ Array [
"title": "Feature Toggles",
"type": "protected",
},
Object {
"component": [Function],
"layout": "main",
"menu": Object {},
"parent": "/strategies",
"path": "/strategies/create",
"title": "Create",
"type": "protected",
},
Object {
"component": [Function],
"layout": "main",
"menu": Object {},
"parent": "/strategies",
"path": "/strategies/:activeTab/:strategyName",
"title": ":strategyName",
"type": "protected",
},
Object {
"component": [Function],
"layout": "main",
@ -23,6 +50,15 @@ Array [
"title": "Strategies",
"type": "protected",
},
Object {
"component": [Function],
"layout": "main",
"menu": Object {},
"parent": "/history",
"path": "/history/:toggleName",
"title": ":toggleName",
"type": "protected",
},
Object {
"component": [Function],
"layout": "main",
@ -33,6 +69,15 @@ Array [
"title": "Event History",
"type": "protected",
},
Object {
"component": [Function],
"layout": "main",
"menu": Object {},
"parent": "/archive",
"path": "/projects/:id/archived/:name/:activeTab",
"title": ":name",
"type": "protected",
},
Object {
"component": [Function],
"layout": "main",
@ -41,6 +86,15 @@ Array [
"title": "Archived Toggles",
"type": "protected",
},
Object {
"component": [Function],
"layout": "main",
"menu": Object {},
"parent": "/applications",
"path": "/applications/:name",
"title": ":name",
"type": "protected",
},
Object {
"component": [Function],
"layout": "main",
@ -52,6 +106,24 @@ Array [
"title": "Applications",
"type": "protected",
},
Object {
"component": [Function],
"layout": "main",
"menu": Object {},
"parent": "/context",
"path": "/context/create",
"title": "Create",
"type": "protected",
},
Object {
"component": [Function],
"layout": "main",
"menu": Object {},
"parent": "/context",
"path": "/context/edit/:name",
"title": ":name",
"type": "protected",
},
Object {
"component": [Function],
"flag": "C",
@ -64,6 +136,79 @@ Array [
"title": "Context Fields",
"type": "protected",
},
Object {
"component": [Function],
"layout": "main",
"menu": Object {},
"parent": "/projects",
"path": "/projects/create",
"title": "Create",
"type": "protected",
},
Object {
"component": [Function],
"layout": "main",
"menu": Object {},
"parent": "/projects",
"path": "/projects/:id/edit",
"title": ":id",
"type": "protected",
},
Object {
"component": [Function],
"layout": "main",
"menu": Object {},
"parent": "/projects",
"path": "/projects/:id/access",
"title": ":id",
"type": "protected",
},
Object {
"component": [Function],
"layout": "main",
"menu": Object {},
"parent": "/archive",
"path": "/projects/:id/archived",
"title": ":name",
"type": "protected",
},
Object {
"component": [Function],
"layout": "main",
"menu": Object {},
"parent": "/projects/:id/features/:name/:activeTab",
"path": "/projects/:id/features/:name/:activeTab/copy",
"title": "Copy",
"type": "protected",
},
Object {
"component": [Function],
"layout": "main",
"menu": Object {},
"parent": "/projects",
"path": "/projects/:id/features/:name/:activeTab",
"title": ":name",
"type": "protected",
},
Object {
"component": [Function],
"layout": "main",
"menu": Object {},
"parent": "/projects",
"path": "/projects/:id/create-toggle",
"title": "Create",
"type": "protected",
},
Object {
"component": [Function],
"flag": "P",
"layout": "main",
"menu": Object {},
"parent": "/projects",
"path": "/projects/:id",
"title": ":id",
"type": "protected",
},
Object {
"component": [Function],
"flag": "P",
@ -75,6 +220,24 @@ Array [
"title": "Projects",
"type": "protected",
},
Object {
"component": [Function],
"layout": "main",
"menu": Object {},
"parent": "/tag-types",
"path": "/tag-types/create",
"title": "Create",
"type": "protected",
},
Object {
"component": [Function],
"layout": "main",
"menu": Object {},
"parent": "/tag-types",
"path": "/tag-types/edit/:name",
"title": ":name",
"type": "protected",
},
Object {
"component": [Function],
"layout": "main",
@ -86,6 +249,33 @@ Array [
"title": "Tag types",
"type": "protected",
},
Object {
"component": [Function],
"layout": "main",
"menu": Object {},
"parent": "/tags",
"path": "/tags/create",
"title": "Create",
"type": "protected",
},
Object {
"component": [Function],
"layout": "main",
"menu": Object {},
"parent": "/addons",
"path": "/addons/create/:provider",
"title": "Create",
"type": "protected",
},
Object {
"component": [Function],
"layout": "main",
"menu": Object {},
"parent": "/addons",
"path": "/addons/edit/:id",
"title": "Edit",
"type": "protected",
},
Object {
"component": [Function],
"hidden": false,
@ -109,6 +299,46 @@ Array [
"title": "Reporting",
"type": "protected",
},
Object {
"component": [Function],
"layout": "main",
"menu": Object {
"adminSettings": true,
"advanced": true,
"mobile": true,
},
"parent": "/admin",
"path": "/admin/api",
"title": "API access",
"type": "protected",
},
Object {
"component": [Function],
"layout": "main",
"menu": Object {
"adminSettings": true,
},
"parent": "/admin",
"path": "/admin/users",
"title": "Users",
"type": "protected",
},
Object {
"component": Object {
"$$typeof": Symbol(react.memo),
"WrappedComponent": [Function],
"compare": null,
"type": [Function],
},
"layout": "main",
"menu": Object {
"adminSettings": true,
},
"parent": "/admin",
"path": "/admin/auth",
"title": "Single Sign-On",
"type": "protected",
},
Object {
"component": [Function],
"hidden": false,

View File

@ -1,7 +1,7 @@
import { baseRoutes, getRoute } from '../routes';
test('returns all baseRoutes', () => {
expect(baseRoutes).toHaveLength(11);
expect(baseRoutes).toHaveLength(35);
expect(baseRoutes).toMatchSnapshot();
});

View File

@ -429,7 +429,6 @@ export const getRoute = path => routes.find(route => route.path === path);
export const baseRoutes = routes
.filter(route => !route.hidden)
.filter(route => !route.parent);
const computeRoutes = () => {
const mainNavRoutes = baseRoutes.filter(route => route.menu.advanced);