-
Notifications
You must be signed in to change notification settings - Fork 59
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into gyani/service-name
- Loading branch information
Showing
45 changed files
with
691 additions
and
223 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
// !!!!!!!!!!! DO NOT UPDATE! WILL BE MANUALLY UPDATED DURING THE RELEASE PROCESS !!!!!!!!!!!!!!!!!!!!!! | ||
// This is necessary so that Kurt Core consumers (e.g. modules) will know if they're compatible with the currently-running | ||
// API container | ||
export const KURTOSIS_VERSION: string = "0.85.36" | ||
export const KURTOSIS_VERSION: string = "0.85.37" | ||
// !!!!!!!!!!! DO NOT UPDATE! WILL BE MANUALLY UPDATED DURING THE RELEASE PROCESS !!!!!!!!!!!!!!!!!!!!!! |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import { Heading, HeadingProps } from "@chakra-ui/react"; | ||
import { PropsWithChildren } from "react"; | ||
|
||
type PageTitleProps = PropsWithChildren<HeadingProps>; | ||
|
||
export const PageTitle = ({ children, ...headingProps }: PageTitleProps) => { | ||
return ( | ||
<Heading fontSize={"lg"} fontWeight={"medium"} pl={"8px"} {...headingProps}> | ||
{children} | ||
</Heading> | ||
); | ||
}; |
59 changes: 59 additions & 0 deletions
59
enclave-manager/web/src/components/catalog/KurtosisPackageCard.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
import { Flex, Icon, Image, Text } from "@chakra-ui/react"; | ||
import { IoStarSharp } from "react-icons/io5"; | ||
import { useKurtosisClient } from "../../client/enclaveManager/KurtosisClientContext"; | ||
import { KurtosisPackage } from "../../client/packageIndexer/api/kurtosis_package_indexer_pb"; | ||
import { isDefined } from "../../utils"; | ||
import { RunKurtosisPackageButton } from "./widgets/RunKurtosisPackageButton"; | ||
import { SaveKurtosisPackageButton } from "./widgets/SaveKurtosisPackageButton"; | ||
|
||
type KurtosisPackageCardProps = { kurtosisPackage: KurtosisPackage; onClick?: () => void }; | ||
|
||
export const KurtosisPackageCard = ({ kurtosisPackage }: KurtosisPackageCardProps) => { | ||
const client = useKurtosisClient(); | ||
|
||
const name = isDefined(kurtosisPackage.repositoryMetadata) | ||
? `${kurtosisPackage.repositoryMetadata.name} ${kurtosisPackage.repositoryMetadata.rootPath.split("/").join(" ")}` | ||
: kurtosisPackage.name; | ||
|
||
return ( | ||
<Flex | ||
h={"168px"} | ||
p={"0 24px"} | ||
bg={"gray.900"} | ||
borderColor={"whiteAlpha.300"} | ||
borderWidth={"1px"} | ||
borderStyle={"solid"} | ||
borderRadius={"6px"} | ||
flexDirection={"column"} | ||
gap={"16px"} | ||
justifyContent={"center"} | ||
alignItems={"center"} | ||
> | ||
<Flex h={"80px"} gap={"16px"}> | ||
<Image bg={"black"} src={`${client.getBaseApplicationUrl()}/logo.png`} borderRadius={"6px"} /> | ||
<Flex flexDirection={"column"} flex={"1"} justifyContent={"space-between"}> | ||
<Text noOfLines={2} fontSize={"lg"} textTransform={"capitalize"}> | ||
{name} | ||
</Text> | ||
<Flex justifyContent={"space-between"} fontSize={"xs"}> | ||
<Text as={"span"} textTransform={"capitalize"}> | ||
{kurtosisPackage.repositoryMetadata?.owner.replaceAll("-", " ") || "Unknown owner"} | ||
</Text> | ||
<Flex gap={"4px"} alignItems={"center"}> | ||
{kurtosisPackage.stars > 0 && ( | ||
<> | ||
<Icon color="gray.500" as={IoStarSharp} /> | ||
<Text as={"span"}>{kurtosisPackage.stars.toString()}</Text> | ||
</> | ||
)} | ||
</Flex> | ||
</Flex> | ||
</Flex> | ||
</Flex> | ||
<Flex gap={"16px"} width={"100%"}> | ||
<SaveKurtosisPackageButton kurtosisPackage={kurtosisPackage} flex={"1"} /> | ||
<RunKurtosisPackageButton kurtosisPackage={kurtosisPackage} flex={"1"} /> | ||
</Flex> | ||
</Flex> | ||
); | ||
}; |
24 changes: 24 additions & 0 deletions
24
enclave-manager/web/src/components/catalog/KurtosisPackageCardGrid.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import { Grid, GridItem } from "@chakra-ui/react"; | ||
import { memo } from "react"; | ||
import { KurtosisPackage } from "../../client/packageIndexer/api/kurtosis_package_indexer_pb"; | ||
import { KurtosisPackageCard } from "./KurtosisPackageCard"; | ||
|
||
type KurtosisPackageCardGridProps = { | ||
packages: KurtosisPackage[]; | ||
onPackageClicked?: (kurtosisPackage: KurtosisPackage) => void; | ||
}; | ||
|
||
export const KurtosisPackageCardGrid = memo(({ packages, onPackageClicked }: KurtosisPackageCardGridProps) => { | ||
return ( | ||
<Grid gridTemplateColumns={"1fr 1fr 1fr"} columnGap={"32px"} rowGap={"32px"}> | ||
{packages.map((kurtosisPackage) => ( | ||
<GridItem | ||
key={kurtosisPackage.url} | ||
onClick={onPackageClicked ? () => onPackageClicked(kurtosisPackage) : undefined} | ||
> | ||
<KurtosisPackageCard kurtosisPackage={kurtosisPackage} /> | ||
</GridItem> | ||
))} | ||
</Grid> | ||
); | ||
}); |
37 changes: 37 additions & 0 deletions
37
enclave-manager/web/src/components/catalog/widgets/RunKurtosisPackageButton.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
import { Button, ButtonProps } from "@chakra-ui/react"; | ||
import { useState } from "react"; | ||
import { FiDownload } from "react-icons/fi"; | ||
import { KurtosisPackage } from "../../../client/packageIndexer/api/kurtosis_package_indexer_pb"; | ||
import { EnclavesContextProvider } from "../../../emui/enclaves/EnclavesContext"; | ||
import { ConfigureEnclaveModal } from "../../enclaves/modals/ConfigureEnclaveModal"; | ||
|
||
type RunKurtosisPackageButtonProps = ButtonProps & { | ||
kurtosisPackage: KurtosisPackage; | ||
}; | ||
|
||
export const RunKurtosisPackageButton = ({ kurtosisPackage, ...buttonProps }: RunKurtosisPackageButtonProps) => { | ||
const [configuringEnclave, setConfiguringEnclave] = useState(false); | ||
|
||
return ( | ||
<> | ||
<Button | ||
size={"xs"} | ||
colorScheme={"kurtosisGreen"} | ||
leftIcon={<FiDownload />} | ||
onClick={() => setConfiguringEnclave(true)} | ||
{...buttonProps} | ||
> | ||
Run | ||
</Button> | ||
{configuringEnclave && ( | ||
<EnclavesContextProvider skipInitialLoad> | ||
<ConfigureEnclaveModal | ||
isOpen={true} | ||
onClose={() => setConfiguringEnclave(false)} | ||
kurtosisPackage={kurtosisPackage} | ||
/> | ||
</EnclavesContextProvider> | ||
)} | ||
</> | ||
); | ||
}; |
46 changes: 46 additions & 0 deletions
46
enclave-manager/web/src/components/catalog/widgets/SaveKurtosisPackageButton.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
import { Button, ButtonProps } from "@chakra-ui/react"; | ||
import { memo, MouseEventHandler, useCallback, useMemo } from "react"; | ||
import { MdBookmarkAdd } from "react-icons/md"; | ||
import { KurtosisPackage } from "../../../client/packageIndexer/api/kurtosis_package_indexer_pb"; | ||
import { useCatalogContext } from "../../../emui/catalog/CatalogContext"; | ||
|
||
type SaveKurtosisPackageButtonProps = ButtonProps & { | ||
kurtosisPackage: KurtosisPackage; | ||
}; | ||
|
||
export const SaveKurtosisPackageButton = ({ kurtosisPackage, ...buttonProps }: SaveKurtosisPackageButtonProps) => { | ||
const { savedPackages, togglePackageSaved } = useCatalogContext(); | ||
const isPackageSaved = useMemo( | ||
() => savedPackages.some((p) => p.name === kurtosisPackage.name), | ||
[savedPackages, kurtosisPackage], | ||
); | ||
|
||
const handleClick = useCallback(() => togglePackageSaved(kurtosisPackage), [togglePackageSaved, kurtosisPackage]); | ||
|
||
return <SaveKurtosisPackageButtonMemo isPackageSaved={isPackageSaved} onClick={handleClick} {...buttonProps} />; | ||
}; | ||
|
||
type SaveKurtosisPackageButtonMemoProps = Omit<SaveKurtosisPackageButtonProps, "kurtosisPackage"> & { | ||
isPackageSaved: boolean; | ||
onClick: MouseEventHandler; | ||
}; | ||
|
||
// this is memo'd to skip unecessary renders, which effectively doubles the performance of this component (as it is | ||
// displayed a lot. | ||
const SaveKurtosisPackageButtonMemo = memo( | ||
({ isPackageSaved, onClick, ...buttonProps }: SaveKurtosisPackageButtonMemoProps) => { | ||
return ( | ||
<Button | ||
size={"xs"} | ||
variant={"solid"} | ||
colorScheme={isPackageSaved ? "kurtosisGreen" : "darkBlue"} | ||
leftIcon={<MdBookmarkAdd />} | ||
onClick={onClick} | ||
bg={isPackageSaved ? "#18371E" : undefined} | ||
{...buttonProps} | ||
> | ||
{isPackageSaved ? "Saved" : "Save"} | ||
</Button> | ||
); | ||
}, | ||
); |
Oops, something went wrong.