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: improve logs, links and fonts #1713

Merged
merged 9 commits into from
Nov 7, 2023
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
@@ -1,4 +1,4 @@
// @generated by protoc-gen-connect-es v0.12.0 with parameter "target=ts"
// @generated by protoc-gen-connect-es v0.13.2 with parameter "target=ts"
// @generated from file kurtosis_enclave_manager_api.proto (package kurtosis_enclave_manager, syntax proto3)
/* eslint-disable */
// @ts-nocheck
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// @generated by protoc-gen-es v1.3.1 with parameter "target=ts"
// @generated by protoc-gen-es v1.3.3 with parameter "target=ts"
// @generated from file kurtosis_enclave_manager_api.proto (package kurtosis_enclave_manager, syntax proto3)
/* eslint-disable */
// @ts-nocheck
Expand Down
2 changes: 1 addition & 1 deletion enclave-manager/web/public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<link rel="icon" href="%PUBLIC_URL%/favicon.ico" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="theme-color" content="#000000" />
<meta name="description" content="The Kurtosis Enclave Manager Web UI." />
<meta name="description" content="Kurtosis Enclave Manager" />
<!--
Notice the use of %PUBLIC_URL% in the tags above.
It will be replaced with the URL of the `public` folder during the build.
Expand Down
22 changes: 10 additions & 12 deletions enclave-manager/web/src/client/enclaveManager/KurtosisClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,34 +29,32 @@ export abstract class KurtosisClient {
*
* This URL is primarily used to generate links to the EM UI (where the hostname is included).
* */
protected readonly parentUrl: URL;
protected readonly cloudUrl: URL;

/* Full URL of the EM UI, covering two use cases:
* In local-mode this is the same as the `parentUrl`
* In authenticated mode : https://cloud.kurtosis.com/enclave-manager/gateway/ips/1-2-3-4/ports/1234/?searchparams... (this data/url is provided as a search param when the code loads)
*
* This URL is primarily used to set the React router basename so that the router is able to ignore any leading subdirectories.
* */
protected readonly childUrl: URL;
protected readonly baseApplicationUrl: URL;

constructor(client: PromiseClient<typeof KurtosisEnclaveManagerServer>, parentUrl: URL, childUrl: URL) {
this.client = client;
this.parentUrl = parentUrl;
this.childUrl = childUrl;
this.cloudUrl = parentUrl;
this.baseApplicationUrl = childUrl;
console.log("cloudUrl", this.cloudUrl)
console.log("baseApplicationUrl", this.baseApplicationUrl)
}

abstract getHeaderOptions(): { headers?: Headers };

getParentBasePathUrl() {
return `${this.parentUrl.origin}${this.parentUrl.pathname}`;
getCloudBasePathUrl() {
return `${this.cloudUrl.origin}${this.cloudUrl.pathname}`;
}

getChildPath() {
return this.childUrl.pathname;
}

getChildUrl() {
return this.childUrl;
getBaseApplicationUrl() {
return this.baseApplicationUrl;
}

async checkHealth() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,8 @@ export const KurtosisClientProvider = ({ children }: PropsWithChildren) => {
let newClient: KurtosisClient | null = null;

if (requireAuth) {
const requestedApiHost = searchParams.get("api-host");
assertDefined(requestedApiHost, `The parameter 'requestedApiHost' is not defined`);
const requestedGatewayHost = searchParams.get("api-host");
assertDefined(requestedGatewayHost, `The parameter 'api-host' is not defined`);

// Get the parent location and path:
let parentLocationPath = paramToUrl(searchParams, "parent-location-path") || new URL(window.location.href);
Expand All @@ -83,7 +83,7 @@ export const KurtosisClientProvider = ({ children }: PropsWithChildren) => {

if (isDefined(jwtToken)) {
newClient = new AuthenticatedKurtosisClient(
requestedApiHost,
requestedGatewayHost,
jwtToken,
parentLocationPath,
childLocationPath,
Expand Down
5 changes: 3 additions & 2 deletions enclave-manager/web/src/components/Navigation.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import { Flex, IconButton, IconButtonProps, Image, Tooltip } from "@chakra-ui/react";
import { PropsWithChildren } from "react";
import { NavbarProps } from "../emui/Navbar";

export const Navigation = ({ children }: PropsWithChildren) => {
export const Navigation = ({ baseApplicationUrl, children }: PropsWithChildren & NavbarProps) => {
return (
<Flex
as={"nav"}
Expand All @@ -15,7 +16,7 @@ export const Navigation = ({ children }: PropsWithChildren) => {
p={"20px 16px"}
>
<Flex width={"40px"} height={"40px"} alignItems={"center"}>
<Image src={"/logo.png"} />
<Image src={baseApplicationUrl+"/logo.png"} />
</Flex>
<Flex flexDirection={"column"} gap={"16px"}>
{children}
Expand Down
2 changes: 1 addition & 1 deletion enclave-manager/web/src/components/ValueCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export const ValueCard = ({ title, value, copyEnabled, copyValue }: ValueCardPro
{copyEnabled && (
<CopyButton
valueToCopy={isDefined(copyValue) ? copyValue : typeof value === "string" ? value : null}
contentName={"url"}
contentName={title}
/>
)}
</Flex>
Expand Down
12 changes: 7 additions & 5 deletions enclave-manager/web/src/components/enclaves/logs/LogLine.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ export type LogLineProps = {
status?: LogStatus;
};

const logFontFamily = "Menlo, Monaco, Inconsolata, Consolas, Courier, monospace"

export const LogLine = ({ timestamp, message, status }: LogLineProps) => {
const statusToColor = (status?: LogStatus) => {
switch (status) {
Expand All @@ -30,11 +32,11 @@ export const LogLine = ({ timestamp, message, status }: LogLineProps) => {
whiteSpace={"pre-wrap"}
fontSize={"xs"}
lineHeight="2"
fontWeight={700}
fontFamily="Ubuntu Mono"
color={"white"}
fontWeight={600}
fontFamily={logFontFamily}
color={"grey"}
>
{timestamp.toLocal().toFormat("yyyy-MM-dd hh:mm:ss.SSS ZZZZ")}
{timestamp.toLocal().toFormat("yyyy-MM-dd HH:MM:ss.SSS ZZZZ")} |
</Box>
)}
<Box
Expand All @@ -43,7 +45,7 @@ export const LogLine = ({ timestamp, message, status }: LogLineProps) => {
fontSize={"xs"}
lineHeight="2"
fontWeight={400}
fontFamily="Ubuntu Mono"
fontFamily={logFontFamily}
color={statusToColor(status)}
>
{message || <i>No message</i>}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ export const ConfigureEnclaveModal = ({
[KURTOSIS_PACKAGE_PARAMS_URL_ARG]: btoa(JSON.stringify(formRef.current?.getValues())),
});

return `${kurtosisClient.getParentBasePathUrl()}?${params}`;
return `${kurtosisClient.getCloudBasePathUrl()}?${params}`;
};

const handleClose = () => {
Expand Down
21 changes: 14 additions & 7 deletions enclave-manager/web/src/components/theme/Fonts.tsx
Original file line number Diff line number Diff line change
@@ -1,17 +1,24 @@
import { Global } from "@emotion/react";

/*
* Source: https://fonts.googleapis.com/css2?family=Inter:wght@500&display=swap
* */
const Fonts = () => (
<Global
styles={`
@font-face {
font-family: "Inter";
src: url("/fonts/Inter-VariableFont_slnt,wght.ttf") format("truetype-variations");
font-weight: 125 950;
font-stretch: 75% 125%;
font-style: normal;
}
@font-face {
font-family: 'Inter';
font-stretch: 75% 125%;
font-style: normal;
font-weight: 500;
font-display: swap;
src: url(https://fonts.gstatic.com/s/inter/v13/UcCO3FwrK3iLTeHuS_fvQtMwCp50KnMw2boKoduKmMEVuI6fAZJhiJ-Ek-_EeAmM.woff2) format('woff2');
unicode-range: U+0460-052F, U+1C80-1C88, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F;
}
`}
/>
);

export default Fonts;


4 changes: 2 additions & 2 deletions enclave-manager/web/src/emui/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ const KurtosisRouter = () => {
[
{
element: (
<AppLayout Nav={<Navbar />}>
<AppLayout Nav={<Navbar baseApplicationUrl={kurtosisClient.getBaseApplicationUrl()}/>}>
<Outlet />
<CreateEnclave />
</AppLayout>
Expand All @@ -46,7 +46,7 @@ const KurtosisRouter = () => {
},
],
{
basename: kurtosisClient.getChildPath(),
basename: kurtosisClient.getBaseApplicationUrl().pathname,
},
),
[kurtosisClient],
Expand Down
14 changes: 9 additions & 5 deletions enclave-manager/web/src/emui/Navbar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,25 @@ import { FiHome, FiPackage } from "react-icons/fi";
import { Link, useLocation } from "react-router-dom";
import { NavButton, Navigation } from "../components/Navigation";

export const Navbar = () => {
export type NavbarProps ={
baseApplicationUrl: URL
}

export const Navbar = ({ baseApplicationUrl}: NavbarProps) => {
const location = useLocation();

return (
<Navigation>
<Navigation baseApplicationUrl={baseApplicationUrl}>
<Link to={"/"}>
<NavButton
label={"View enclaves"}
Icon={<FiHome />}
isActive={location.pathname === "/" || location.pathname.startsWith("/enclave")}
/>
</Link>
<Link to={"/catalog"}>
<NavButton label={"View catalog"} Icon={<FiPackage />} isActive={location.pathname.startsWith("/catalog")} />
</Link>
{/*<Link to={"/catalog"}>*/}
{/* <NavButton label={"View catalog"} Icon={<FiPackage />} isActive={location.pathname.startsWith("/catalog")} />*/}
{/*</Link>*/}
</Navigation>
);
};
6 changes: 3 additions & 3 deletions engine/server/webapp/asset-manifest.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{
"files": {
"main.js": "./static/js/main.90108866.js",
"main.js": "./static/js/main.18bfd64f.js",
"index.html": "./index.html",
"main.90108866.js.map": "./static/js/main.90108866.js.map"
"main.18bfd64f.js.map": "./static/js/main.18bfd64f.js.map"
},
"entrypoints": [
"static/js/main.90108866.js"
"static/js/main.18bfd64f.js"
]
}
2 changes: 1 addition & 1 deletion engine/server/webapp/index.html
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<!doctype html><html lang="en"><head><meta charset="utf-8"/><link rel="icon" href="./favicon.ico"/><meta name="viewport" content="width=device-width,initial-scale=1"/><meta name="theme-color" content="#000000"/><meta name="description" content="The Kurtosis Enclave Manager Web UI."/><title>Kurtosis Enclave Manager</title><script defer="defer" src="./static/js/main.90108866.js"></script></head><body><noscript>You need to enable JavaScript to run this app.</noscript><div id="root"></div></body></html>
<!doctype html><html lang="en"><head><meta charset="utf-8"/><link rel="icon" href="./favicon.ico"/><meta name="viewport" content="width=device-width,initial-scale=1"/><meta name="theme-color" content="#000000"/><meta name="description" content="Kurtosis Enclave Manager"/><title>Kurtosis Enclave Manager</title><script defer="defer" src="./static/js/main.18bfd64f.js"></script></head><body><noscript>You need to enable JavaScript to run this app.</noscript><div id="root"></div></body></html>
3 changes: 3 additions & 0 deletions engine/server/webapp/static/js/main.18bfd64f.js

Large diffs are not rendered by default.

Large diffs are not rendered by default.

3 changes: 0 additions & 3 deletions engine/server/webapp/static/js/main.90108866.js

This file was deleted.