Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: support internal/external navigsation better #513

Merged
merged 1 commit into from
Jun 17, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.