Skip to content

Commit

Permalink
feat: add link to iso volumes from image list
Browse files Browse the repository at this point in the history
Signed-off-by: David Edler <[email protected]>
  • Loading branch information
edlerd committed Apr 15, 2024
1 parent 2403f17 commit 2d9a11c
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/pages/images/ImageList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ import NotificationRow from "components/NotificationRow";
import { useDocs } from "context/useDocs";
import CustomLayout from "components/CustomLayout";
import PageHeader from "components/PageHeader";
import CustomIsoBtn from "pages/storage/actions/CustomIsoBtn";

const ImageList: FC = () => {
const docBaseLink = useDocs();
Expand Down Expand Up @@ -225,6 +226,9 @@ const ImageList: FC = () => {
/>
)}
</PageHeader.Left>
<PageHeader.BaseActions>
<CustomIsoBtn project={project} />
</PageHeader.BaseActions>
</PageHeader>
}
>
Expand Down
32 changes: 32 additions & 0 deletions src/pages/storage/actions/CustomIsoBtn.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import { FC } from "react";
import { Button, Icon } from "@canonical/react-components";
import { useNavigate } from "react-router-dom";

interface Props {
project: string;
}

const CustomIsoBtn: FC<Props> = ({ project }) => {
const navigate = useNavigate();
const href = `/ui/project/${project}/storage/custom-isos`;

const handleClick = () => (e: MouseEvent) => {
e.preventDefault();
navigate(href);
};

return (
<Button
className="u-no-margin--bottom u-float-right"
hasIcon
href={href}
onClick={handleClick}
element="a"
>
<span>Custom ISOs</span>
<Icon name="external-link" />
</Button>
);
};

export default CustomIsoBtn;

0 comments on commit 2d9a11c

Please sign in to comment.