Skip to content

Commit

Permalink
chore: support internal/external navigsation better
Browse files Browse the repository at this point in the history
Signed-off-by: Nastya <[email protected]>
  • Loading branch information
anrusina committed Jun 17, 2022
1 parent 1386b40 commit 1c93d09
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
};
Expand Down
8 changes: 4 additions & 4 deletions packages/zapp/console/src/components/Navigation/Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -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"}
]
}
```
Expand All @@ -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:

<img width="874" alt="Screen Shot 2022-06-15 at 2 01 29 PM" src="https://user-images.githubusercontent.com/55718143/173962811-a3603d6c-3fe4-4cab-b57a-4d4806c88cfc.png">


#### 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.

0 comments on commit 1c93d09

Please sign in to comment.