Skip to content

Commit

Permalink
fix: add navigation to kurtosis enclave manager (#1458)
Browse files Browse the repository at this point in the history
User cans navigate to home from any page;; i have added a home logo on
top left corner of the enclave manager ui.
  • Loading branch information
Peeeekay authored Oct 3, 2023
1 parent 1d0b05f commit f27a00a
Show file tree
Hide file tree
Showing 13 changed files with 78 additions and 53 deletions.
80 changes: 46 additions & 34 deletions engine/frontend/src/component/Home.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import {createBrowserRouter, Route, RouterProvider} from 'react-router-dom';
import {useAppContext} from "../context/AppState";
import LoadingOverlay from "./LoadingOverflow";
import CreateEnclave from "./CreateEnclave";
import {createRoutesFromElements} from "react-router";
import {createRoutesFromElements, Outlet} from "react-router";

const queryParamToBool = (value) => {
return ((value + '').toLowerCase() === 'true')
Expand All @@ -33,6 +33,18 @@ const makeUrl = () => {
if (path.charAt(0) !== "/") path = path + "/"
return path;
}

const Layout = () => {
return (
<>
<TitleBar/>
<div className="flex h-[calc(100vh-4rem)]">
<Outlet/>
</div>
</>
)
}

const Home = () => {
const [enclaves, setEnclaves] = useState([])
const [enclaveLoading, setEnclaveLoading] = useState(false)
Expand Down Expand Up @@ -149,35 +161,38 @@ const Home = () => {

const routes = (
<>
<Route exact
path="/enclaves"
element={checkAuth(<Enclaves enclaves={enclaves}
isLoading={enclaveLoading}
handleDeleteClick={handleDeleteClick}
/>
)}
/>
<Route exact
path="/enclave/*"
element={checkAuth(<CreateEnclave addEnclave={addEnclave}/>)}
/>
<Route path="/enclaves/:name"
element={checkAuth(<EnclaveInfo enclaves={enclaves}/>)}
/>
<Route path="/enclaves/:name/services/:uuid/*"
element={checkAuth(<ServiceInfo/>)}
/>
<Route path="/enclaves/:name/files/:fileArtifactName"
element={checkAuth(<FileArtifactInfo enclaves={enclaves}/>)}
/>
<Route exact
path="/catalog/*"
element={checkAuth(<PackageCatalogRouter addEnclave={addEnclave}/>)}
/>
<Route
path="/"
element={checkAuth(<Main totalEnclaves={enclaves.length}/>)}
/>
<Route path="/" element={checkAuth(<Layout/>)}>
<Route
path="/enclaves"
element={<Enclaves
enclaves={enclaves}
isLoading={enclaveLoading}
handleDeleteClick={handleDeleteClick}
/>
}
/>
<Route
path="/enclave/*"
element={<CreateEnclave addEnclave={addEnclave}/>}
/>
<Route path="/enclaves/:name"
element={<EnclaveInfo enclaves={enclaves}/>}
/>
<Route path="/enclaves/:name/services/:uuid/*"
element={<ServiceInfo/>}
/>
<Route path="/enclaves/:name/files/:fileArtifactName"
element={<FileArtifactInfo enclaves={enclaves}/>}
/>
<Route
path="/catalog/*"
element={<PackageCatalogRouter addEnclave={addEnclave}/>}
/>
<Route exact
path="/"
element={<Main totalEnclaves={enclaves.length}/>}
/>
</Route>
</>
)

Expand All @@ -190,10 +205,7 @@ const Home = () => {

return (
<div className="h-screen flex flex-col bg-[#171923]">
<TitleBar/>
<div className="flex h-[calc(100vh-4rem)]">
<RouterProvider router={router}/>
</div>
<RouterProvider router={router} />
</div>
);
}
Expand Down
1 change: 0 additions & 1 deletion engine/frontend/src/component/PackageCatalogRouter.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import {createEnclave} from "../api/enclave";
import {useState} from "react";
import {useAppContext} from "../context/AppState";


const PackageCatalogRouter = ({addEnclave}) => {
const navigate = useNavigate()
const {appData} = useAppContext()
Expand Down
1 change: 0 additions & 1 deletion engine/frontend/src/component/RightPanel.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import Heading from "./Heading";
import { useNavigate } from "react-router";

const RightPanel = ({isServiceInfo, enclaveName}) => {
Expand Down
21 changes: 18 additions & 3 deletions engine/frontend/src/component/TitleBar.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,25 @@
import { Center, SimpleGrid, Heading, Text, Box } from '@chakra-ui/react';
import React from 'react';
import { Link } from "react-router-dom";

const TitleBar = () => {
return (
<div className="h-[4rem] sticky top-0 py-4 px-8 bg-[#171923] text-center">
<h1 className="text-3xl font-bold text-[#24BA27]">Kurtosis Enclave Manager</h1>
</div>
<SimpleGrid columns={3} spacing={1} paddingBottom={5}>
<Link to="/">
<Box
height={"40px"}
justify={'flex-start'}>
<svg class="w-6 h-6 text-gray-800 dark:text-white" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 20 20">
<path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M3 8v10a1 1 0 0 0 1 1h4v-5a1 1 0 0 1 1-1h2a1 1 0 0 1 1 1v5h4a1 1 0 0 0 1-1V8M1 10l9-9 9 9"/>
</svg>
</Box>
</Link>
<Heading color={"#24BA27"}>
<Center>
<Text> Kurtosis Enclave Manager </Text>
</Center>
</Heading>
</SimpleGrid>
);
};

Expand Down
12 changes: 6 additions & 6 deletions engine/server/webapp/asset-manifest.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
{
"files": {
"main.css": "./static/css/main.d26dfda9.css",
"main.js": "./static/js/main.53dc80c0.js",
"main.css": "./static/css/main.c490ddc6.css",
"main.js": "./static/js/main.2a215aca.js",
"index.html": "./index.html",
"main.d26dfda9.css.map": "./static/css/main.d26dfda9.css.map",
"main.53dc80c0.js.map": "./static/js/main.53dc80c0.js.map"
"main.c490ddc6.css.map": "./static/css/main.c490ddc6.css.map",
"main.2a215aca.js.map": "./static/js/main.2a215aca.js.map"
},
"entrypoints": [
"static/css/main.d26dfda9.css",
"static/js/main.53dc80c0.js"
"static/css/main.c490ddc6.css",
"static/js/main.2a215aca.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"/><meta name="viewport" content="width=device-width,initial-scale=1"/><meta name="theme-color" content="#000000"/><title>Kurtosis Enclave Manager</title><script defer="defer" src="./static/js/main.53dc80c0.js"></script><link href="./static/css/main.d26dfda9.css" rel="stylesheet"></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"/><meta name="viewport" content="width=device-width,initial-scale=1"/><meta name="theme-color" content="#000000"/><title>Kurtosis Enclave Manager</title><script defer="defer" src="./static/js/main.2a215aca.js"></script><link href="./static/css/main.c490ddc6.css" rel="stylesheet"></head><body><noscript>You need to enable JavaScript to run this app.</noscript><div id="root"></div></body></html>

Large diffs are not rendered by default.

Large diffs are not rendered by default.

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

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions engine/server/webapp/static/js/main.2a215aca.js.map

Large diffs are not rendered by default.

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

This file was deleted.

1 change: 0 additions & 1 deletion engine/server/webapp/static/js/main.53dc80c0.js.map

This file was deleted.

0 comments on commit f27a00a

Please sign in to comment.