Skip to content

Commit

Permalink
Make notebook controller access button to link behavior
Browse files Browse the repository at this point in the history
  • Loading branch information
DaoDaoNoCode committed Aug 24, 2023
1 parent d61c590 commit 7f4fcf9
Showing 1 changed file with 6 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ export const NotebookServer: React.FC = () => {
[requestNotebookRefresh, navigate],
);

const link = notebook?.metadata.annotations?.['opendatahub.io/link'] || '#';

return (
<>
<ImpersonateAlert />
Expand All @@ -54,18 +56,17 @@ export const NotebookServer: React.FC = () => {
/>
<ActionList>
<ActionListItem
onClick={() => {
if (notebook.metadata.annotations?.['opendatahub.io/link']) {
window.location.href = notebook.metadata.annotations['opendatahub.io/link'];
} else {
onClick={(e) => {
if (link === '#') {
e.preventDefault();
notification.error(
'Error accessing notebook server',
'Failed to redirect page due to missing notebook URL, please try to refresh the page and try it again.',
);
}
}}
>
<Button data-id="return-nb-button" variant="primary">
<Button component="a" href={link} data-id="return-nb-button">
Access notebook server
</Button>
</ActionListItem>
Expand Down

0 comments on commit 7f4fcf9

Please sign in to comment.