From 1c93d09f398d63a2522915e5c34a192aa5ec4807 Mon Sep 17 00:00:00 2001 From: Nastya <55718143+anrusina@users.noreply.github.com> Date: Fri, 17 Jun 2022 10:55:52 -0700 Subject: [PATCH] chore: support internal/external navigsation better Signed-off-by: Nastya <55718143+anrusina@users.noreply.github.com> --- .../src/components/Navigation/NavigationDropdown.tsx | 8 ++++---- packages/zapp/console/src/components/Navigation/Readme.md | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/packages/zapp/console/src/components/Navigation/NavigationDropdown.tsx b/packages/zapp/console/src/components/Navigation/NavigationDropdown.tsx index 2286ca682..3c2ade937 100644 --- a/packages/zapp/console/src/components/Navigation/NavigationDropdown.tsx +++ b/packages/zapp/console/src/components/Navigation/NavigationDropdown.tsx @@ -47,11 +47,11 @@ export const NavigationDropdown = (props: NavigationDropdownProps) => { const handleItemSelection = (item: FlyteNavItem) => { setSelectedPage(item.title); - if (item.url.startsWith('/')) { - // local navigation without BASE_URL addition - history.push(item.url); + if (item.url.startsWith('+')) { + // local navigation with BASE_URL addition + history.push(makeRoute(item.url.slice(1))); } else { - // external navigation + // treated as external navigation window.location.assign(item.url); } }; diff --git a/packages/zapp/console/src/components/Navigation/Readme.md b/packages/zapp/console/src/components/Navigation/Readme.md index dc85b0da5..d218e5039 100644 --- a/packages/zapp/console/src/components/Navigation/Readme.md +++ b/packages/zapp/console/src/components/Navigation/Readme.md @@ -25,8 +25,8 @@ Essentially FLYTE_NAVIGATION is a JSON object background:"black", // default NavBar background color items:[ {title:"Remote", url:"https://remote.site/"}, - {title:"Dashboard", url:"/projects/flytesnacks/executions?domain=development&duration=all"}, - {title:"Execution", url:"/projects/flytesnacks/domains/development/executions/awf2lx4g58htr8svwb7x?duration=all"} + {title:"Dashboard", url:"+/projects/flytesnacks/executions?domain=development&duration=all"}, + {title:"Information", url:"/information"} ] } ``` @@ -35,13 +35,13 @@ If at least one item in `items` array is present the dropdown will appear in Nav It will contain at least two items: - default "Console" item which navigates to ${BASE_URL} -- all items you have provided +- all items you have provided: + - If item's url starts with `+` sign, the navigstion would be treated as an internal one. + sign would be stripped and BASE_URL would be added to navigaiton Feel free to play around with the views in Storybook: Screen Shot 2022-06-15 at 2 01 29 PM - #### Note Please let us know in [Slack #flyte-console](https://flyte-org.slack.com/archives/CTJJLM8BY) channel if you found bugs or need more support than.