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

feat: emui design improvements #1892

Merged
merged 8 commits into from
Dec 5, 2023
Merged
Show file tree
Hide file tree
Changes from 6 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
@@ -1,4 +1,4 @@
// @generated by protoc-gen-es v1.4.0 with parameter "target=ts"
// @generated by protoc-gen-es v1.4.1 with parameter "target=ts"
// @generated from file kurtosis_package_indexer.proto (package kurtosis_package_indexer, syntax proto3)
/* eslint-disable */
// @ts-nocheck
Expand Down Expand Up @@ -222,6 +222,11 @@ export class KurtosisPackage extends Message<KurtosisPackage> {
*/
version = "";

/**
* @generated from field: string icon_url = 12;
*/
iconUrl = "";

constructor(data?: PartialMessage<KurtosisPackage>) {
super();
proto3.util.initPartial(data, this);
Expand All @@ -241,6 +246,7 @@ export class KurtosisPackage extends Message<KurtosisPackage> {
{ no: 9, name: "parsing_result", kind: "scalar", T: 9 /* ScalarType.STRING */ },
{ no: 10, name: "parsing_time", kind: "message", T: Timestamp },
{ no: 11, name: "version", kind: "scalar", T: 9 /* ScalarType.STRING */ },
{ no: 12, name: "icon_url", kind: "scalar", T: 9 /* ScalarType.STRING */ },
]);

static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): KurtosisPackage {
Expand Down Expand Up @@ -394,6 +400,16 @@ export class PackageRepository extends Message<PackageRepository> {
*/
rootPath = "";

/**
* @generated from field: google.protobuf.Timestamp last_commit_time = 5;
*/
lastCommitTime?: Timestamp;

/**
* @generated from field: string default_branch = 6;
*/
defaultBranch = "";

constructor(data?: PartialMessage<PackageRepository>) {
super();
proto3.util.initPartial(data, this);
Expand All @@ -406,6 +422,8 @@ export class PackageRepository extends Message<PackageRepository> {
{ no: 2, name: "owner", kind: "scalar", T: 9 /* ScalarType.STRING */ },
{ no: 3, name: "name", kind: "scalar", T: 9 /* ScalarType.STRING */ },
{ no: 4, name: "root_path", kind: "scalar", T: 9 /* ScalarType.STRING */ },
{ no: 5, name: "last_commit_time", kind: "message", T: Timestamp },
{ no: 6, name: "default_branch", kind: "scalar", T: 9 /* ScalarType.STRING */ },
]);

static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): PackageRepository {
Expand Down
4 changes: 2 additions & 2 deletions enclave-manager/web/src/components/KeyboardCommands.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Text, TextProps } from "@chakra-ui/react";

export const FindCommand = (props: TextProps) => {
let text = "^F";
let text = "Ctrl + F";

if (navigator.userAgent.indexOf("Mac") > -1) {
text = "⌘F";
Expand All @@ -15,7 +15,7 @@ export const FindCommand = (props: TextProps) => {
};

export const OmniboxCommand = (props: TextProps) => {
let text = "^K";
let text = "Ctrl + K";

if (navigator.userAgent.indexOf("Mac") > -1) {
text = "⌘K";
Expand Down
14 changes: 5 additions & 9 deletions enclave-manager/web/src/components/KurtosisBreadcrumbs.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -215,15 +215,11 @@ type KurtosisBreadcrumbItemProps = KurtosisBreadcrumb & {
};

const KurtosisBreadcrumbItem = ({ name, destination, alternatives, isLastItem }: KurtosisBreadcrumbItemProps) => {
if (isLastItem) {
return (
<Text fontSize={"xs"} fontWeight={"semibold"} p={"2px 8px"} borderRadius={"6px"} bg={"gray.650"}>
{name}
</Text>
);
}

const baseLink = (
const baseLink = isLastItem ? (
<Text fontSize={"xs"} fontWeight={"semibold"} p={"2px 8px"} borderRadius={"6px"} bg={"gray.650"}>
{name}
</Text>
) : (
<BreadcrumbLink as={Link} to={destination}>
<Button variant={"breadcrumb"} size={"xs"}>
{name}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ const theme = extendTheme({
variants: {
valueCard: {
container: {
bg: "gray.800",
bg: "gray.850",
borderRadius: "8px",
padding: "16px",
gap: "16px",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@ export const KurtosisPackageCard = ({ kurtosisPackage }: KurtosisPackageCardProp
<Image
h={"80px"}
w={"80px"}
bg={"black"}
// TODO: Use package image when supported
src={`${client.getBaseApplicationUrl()}/logo.png`}
bg={kurtosisPackage.iconUrl !== "" ? "white" : "black"}
src={kurtosisPackage.iconUrl || `${client.getBaseApplicationUrl()}/logo.png`}
fallbackSrc={`${client.getBaseApplicationUrl()}/logo.png`}
borderRadius={"6px"}
/>
<Flex flexDirection={"column"} flex={"1"} justifyContent={"space-between"}>
Expand Down
6 changes: 6 additions & 0 deletions enclave-manager/web/src/components/theme/tagsTheme.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,12 @@ export const tagTheme = defineMultiStyleConfig({
minHeight: "unset",
},
}),
progress: (props: StyleFunctionProps) => ({
container: {
bg: `${props.colorScheme}.900`,
color: `${props.colorScheme}.100`,
},
}),
solid: (props: StyleFunctionProps) => ({
container: {
color: `${props.colorScheme}.400`,
Expand Down
11 changes: 6 additions & 5 deletions enclave-manager/web/src/emui/catalog/Catalog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import { MdBookmarkAdded } from "react-icons/md";
import { GetPackagesResponse, KurtosisPackage } from "../../client/packageIndexer/api/kurtosis_package_indexer_pb";
import { AppPageLayout } from "../../components/AppLayout";
import { KurtosisPackageCardGrid } from "../../components/catalog/KurtosisPackageCardGrid";
import { OmniboxCommand } from "../../components/KeyboardCommands";
import { FindCommand } from "../../components/KeyboardCommands";
import { KurtosisAlert } from "../../components/KurtosisAlert";
import { PageTitle } from "../../components/PageTitle";
import { useKeyboardAction } from "../../components/useKeyboardAction";
Expand Down Expand Up @@ -58,7 +58,7 @@ const CatalogImpl = ({ catalog, savedPackages }: CatalogImplProps) => {
useKeyboardAction(
useMemo(
() => ({
omniFind: () => {
find: () => {
if (isDefined(searchRef.current) && searchRef.current !== document.activeElement) {
searchRef.current.focus();
}
Expand All @@ -80,17 +80,18 @@ const CatalogImpl = ({ catalog, savedPackages }: CatalogImplProps) => {
</Flex>
<Flex flexDirection={"column"} gap={"32px"}>
<Flex flex={"1"} justifyContent={"center"}>
<InputGroup variant={"solid"} width={"1192px"}>
<InputGroup variant={"solid"} width={"1192px"} color={"gray.150"}>
<InputLeftElement>
<Icon as={FiSearch} />
</InputLeftElement>
<Input
ref={searchRef}
value={searchTerm}
bgColor={"gray.850"}
onChange={(e) => setSearchTerm(e.target.value)}
placeholder={"Search"}
/>
<InputRightElement>
<InputRightElement w={"unset"}>
{isSearching ? (
<IconButton
aria-label={"Clear search"}
Expand All @@ -100,7 +101,7 @@ const CatalogImpl = ({ catalog, savedPackages }: CatalogImplProps) => {
onClick={() => setSearchTerm("")}
/>
) : (
<OmniboxCommand />
<FindCommand whiteSpace={"nowrap"} pr={"10px"} />
)}
</InputRightElement>
</InputGroup>
Expand Down
28 changes: 25 additions & 3 deletions enclave-manager/web/src/emui/catalog/package/Package.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { Box, Flex, Icon, Image, Input, InputGroup, InputRightElement, Text } from "@chakra-ui/react";
import { DateTime } from "luxon";
import { IoStar } from "react-icons/io5";
import { useParams } from "react-router-dom";
import { useKurtosisClient } from "../../../client/enclaveManager/KurtosisClientContext";
Expand All @@ -8,10 +9,12 @@ import { readablePackageName } from "../../../components/catalog/utils";
import { RunKurtosisPackageButton } from "../../../components/catalog/widgets/RunKurtosisPackageButton";
import { SaveKurtosisPackageButton } from "../../../components/catalog/widgets/SaveKurtosisPackageButton";
import { CopyButton } from "../../../components/CopyButton";
import { FormatDateTime } from "../../../components/FormatDateTime";
import { KurtosisAlert } from "../../../components/KurtosisAlert";
import { KurtosisMarkdown } from "../../../components/KurtosisMarkdown";
import { PackageSourceButton } from "../../../components/PackageSourceButton";
import { TitledCard } from "../../../components/TitledCard";
import { isDefined } from "../../../utils";
import { useKurtosisPackage } from "../CatalogContext";

export const Package = () => {
Expand Down Expand Up @@ -94,6 +97,25 @@ const PackageImpl = ({ kurtosisPackage }: PackageImplProps) => {
</Text>
</Flex>
</Flex>
<Flex gap={"16px"} flexDirection={"column"} p={"16px"}>
<Text as={"span"} color="gray.400" fontWeight={"bold"} textTransform={"uppercase"}>
Last updated
</Text>
<span>
<FormatDateTime
fontWeight={"medium"}
fontSize={"xl"}
format={"relative"}
flex={"0 1 auto"}
dateTime={
isDefined(kurtosisPackage.repositoryMetadata) &&
isDefined(kurtosisPackage.repositoryMetadata.lastCommitTime)
? DateTime.fromJSDate(kurtosisPackage.repositoryMetadata.lastCommitTime.toDate())
: null
}
/>
</span>
</Flex>
</Flex>
</Flex>
</Flex>
Expand All @@ -109,9 +131,9 @@ const PackageHeader = ({ kurtosisPackage }: PackageImplProps) => {
<Image
h={"120px"}
w={"120px"}
bg={"black"}
// TODO: Use package image when supported
src={`${client.getBaseApplicationUrl()}/logo.png`}
bg={kurtosisPackage.iconUrl !== "" ? "white" : "black"}
src={kurtosisPackage.iconUrl || `${client.getBaseApplicationUrl()}/logo.png`}
fallbackSrc={`${client.getBaseApplicationUrl()}/logo.png`}
borderRadius={"9px"}
/>
<Flex flexDirection={"column"} justifyContent={"space-between"} flex={"1"}>
Expand Down
15 changes: 10 additions & 5 deletions enclave-manager/web/src/emui/enclaves/EnclaveRoutes.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { FilesArtifactNameAndUuid, ServiceInfo } from "enclave-manager-sdk/build
import { FiPlus } from "react-icons/fi";
import { Outlet, Params } from "react-router-dom";
import { GoToEnclaveOverviewButton } from "../../components/enclaves/GotToEncalaveOverviewButton";
import { isDefined } from "../../utils";
import { RemoveFunctions } from "../../utils/types";
import { KurtosisEnclavesRouteObject } from "../types";
import { Artifact } from "./enclave/artifact/Artifact";
Expand Down Expand Up @@ -96,13 +97,13 @@ export const enclaveRoutes = (): KurtosisEnclavesRouteObject[] => [
crumb: (data: RemoveFunctions<EnclavesState>, params: Params<string>) => {
const activeTab = params.activeTab;

let routeName = activeTab?.toLowerCase() === "logs" ? "Logs" : "Overview";
if (!isDefined(activeTab) || activeTab.toLowerCase() === "overview") {
return [];
}

return {
name: routeName,
destination: `/enclave/${params.enclaveUUID}/service/${params.serviceUUID}/${
params.activeTab || "overview"
}`,
name: "Logs",
destination: `/enclave/${params.enclaveUUID}/service/${params.serviceUUID}/logs`,
};
},
},
Expand Down Expand Up @@ -170,6 +171,10 @@ export const enclaveRoutes = (): KurtosisEnclavesRouteObject[] => [
crumb: (data: RemoveFunctions<EnclavesState>, params: Params<string>) => {
const activeTab = params.activeTab;

if (!isDefined(activeTab) || activeTab.toLowerCase() === "overview") {
return [];
}

let routeName =
activeTab?.toLowerCase() === "logs"
? "Logs"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -150,8 +150,10 @@ type ProgressSummaryProps = {
const ProgressSummary = ({ progress }: ProgressSummaryProps) => {
return (
<Tag
p={"0 10px"}
variant={"progress"}
p={"0 16px"}
h={"40px"}
fontSize={"md"}
colorScheme={progress.stage === "done" ? "green" : progress.stage === "failed" ? "red" : "blue"}
>
<Flex gap={"8px"} alignItems={"center"}>
Expand Down
Loading