mirror of
				https://github.com/Unleash/unleash.git
				synced 2025-10-27 11:02:16 +01:00 
			
		
		
		
	fix: do not filter parent routes for main nav
This commit is contained in:
		
							parent
							
								
									11f1ca7393
								
							
						
					
					
						commit
						d1baea385d
					
				| @ -2,6 +2,15 @@ | |||||||
| 
 | 
 | ||||||
| exports[`returns all baseRoutes 1`] = ` | exports[`returns all baseRoutes 1`] = ` | ||||||
| Array [ | Array [ | ||||||
|  |   Object { | ||||||
|  |     "component": [Function], | ||||||
|  |     "layout": "main", | ||||||
|  |     "menu": Object {}, | ||||||
|  |     "parent": "/features", | ||||||
|  |     "path": "/features/:activeTab/:name", | ||||||
|  |     "title": ":name", | ||||||
|  |     "type": "protected", | ||||||
|  |   }, | ||||||
|   Object { |   Object { | ||||||
|     "component": [Function], |     "component": [Function], | ||||||
|     "layout": "main", |     "layout": "main", | ||||||
| @ -12,6 +21,24 @@ Array [ | |||||||
|     "title": "Feature Toggles", |     "title": "Feature Toggles", | ||||||
|     "type": "protected", |     "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 { |   Object { | ||||||
|     "component": [Function], |     "component": [Function], | ||||||
|     "layout": "main", |     "layout": "main", | ||||||
| @ -23,6 +50,15 @@ Array [ | |||||||
|     "title": "Strategies", |     "title": "Strategies", | ||||||
|     "type": "protected", |     "type": "protected", | ||||||
|   }, |   }, | ||||||
|  |   Object { | ||||||
|  |     "component": [Function], | ||||||
|  |     "layout": "main", | ||||||
|  |     "menu": Object {}, | ||||||
|  |     "parent": "/history", | ||||||
|  |     "path": "/history/:toggleName", | ||||||
|  |     "title": ":toggleName", | ||||||
|  |     "type": "protected", | ||||||
|  |   }, | ||||||
|   Object { |   Object { | ||||||
|     "component": [Function], |     "component": [Function], | ||||||
|     "layout": "main", |     "layout": "main", | ||||||
| @ -33,6 +69,15 @@ Array [ | |||||||
|     "title": "Event History", |     "title": "Event History", | ||||||
|     "type": "protected", |     "type": "protected", | ||||||
|   }, |   }, | ||||||
|  |   Object { | ||||||
|  |     "component": [Function], | ||||||
|  |     "layout": "main", | ||||||
|  |     "menu": Object {}, | ||||||
|  |     "parent": "/archive", | ||||||
|  |     "path": "/projects/:id/archived/:name/:activeTab", | ||||||
|  |     "title": ":name", | ||||||
|  |     "type": "protected", | ||||||
|  |   }, | ||||||
|   Object { |   Object { | ||||||
|     "component": [Function], |     "component": [Function], | ||||||
|     "layout": "main", |     "layout": "main", | ||||||
| @ -41,6 +86,15 @@ Array [ | |||||||
|     "title": "Archived Toggles", |     "title": "Archived Toggles", | ||||||
|     "type": "protected", |     "type": "protected", | ||||||
|   }, |   }, | ||||||
|  |   Object { | ||||||
|  |     "component": [Function], | ||||||
|  |     "layout": "main", | ||||||
|  |     "menu": Object {}, | ||||||
|  |     "parent": "/applications", | ||||||
|  |     "path": "/applications/:name", | ||||||
|  |     "title": ":name", | ||||||
|  |     "type": "protected", | ||||||
|  |   }, | ||||||
|   Object { |   Object { | ||||||
|     "component": [Function], |     "component": [Function], | ||||||
|     "layout": "main", |     "layout": "main", | ||||||
| @ -52,6 +106,24 @@ Array [ | |||||||
|     "title": "Applications", |     "title": "Applications", | ||||||
|     "type": "protected", |     "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 { |   Object { | ||||||
|     "component": [Function], |     "component": [Function], | ||||||
|     "flag": "C", |     "flag": "C", | ||||||
| @ -64,6 +136,79 @@ Array [ | |||||||
|     "title": "Context Fields", |     "title": "Context Fields", | ||||||
|     "type": "protected", |     "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 { |   Object { | ||||||
|     "component": [Function], |     "component": [Function], | ||||||
|     "flag": "P", |     "flag": "P", | ||||||
| @ -75,6 +220,24 @@ Array [ | |||||||
|     "title": "Projects", |     "title": "Projects", | ||||||
|     "type": "protected", |     "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 { |   Object { | ||||||
|     "component": [Function], |     "component": [Function], | ||||||
|     "layout": "main", |     "layout": "main", | ||||||
| @ -86,6 +249,33 @@ Array [ | |||||||
|     "title": "Tag types", |     "title": "Tag types", | ||||||
|     "type": "protected", |     "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 { |   Object { | ||||||
|     "component": [Function], |     "component": [Function], | ||||||
|     "hidden": false, |     "hidden": false, | ||||||
| @ -109,6 +299,46 @@ Array [ | |||||||
|     "title": "Reporting", |     "title": "Reporting", | ||||||
|     "type": "protected", |     "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 { |   Object { | ||||||
|     "component": [Function], |     "component": [Function], | ||||||
|     "hidden": false, |     "hidden": false, | ||||||
|  | |||||||
| @ -1,7 +1,7 @@ | |||||||
| import { baseRoutes, getRoute } from '../routes'; | import { baseRoutes, getRoute } from '../routes'; | ||||||
| 
 | 
 | ||||||
| test('returns all baseRoutes', () => { | test('returns all baseRoutes', () => { | ||||||
|     expect(baseRoutes).toHaveLength(11); |     expect(baseRoutes).toHaveLength(35); | ||||||
|     expect(baseRoutes).toMatchSnapshot(); |     expect(baseRoutes).toMatchSnapshot(); | ||||||
| }); | }); | ||||||
| 
 | 
 | ||||||
|  | |||||||
| @ -429,7 +429,6 @@ export const getRoute = path => routes.find(route => route.path === path); | |||||||
| 
 | 
 | ||||||
| export const baseRoutes = routes | export const baseRoutes = routes | ||||||
|     .filter(route => !route.hidden) |     .filter(route => !route.hidden) | ||||||
|     .filter(route => !route.parent); |  | ||||||
| 
 | 
 | ||||||
| const computeRoutes = () => { | const computeRoutes = () => { | ||||||
|     const mainNavRoutes = baseRoutes.filter(route => route.menu.advanced); |     const mainNavRoutes = baseRoutes.filter(route => route.menu.advanced); | ||||||
|  | |||||||
		Loading…
	
		Reference in New Issue
	
	Block a user