Skip to content

Commit

Permalink
feat: removed other namespace options
Browse files Browse the repository at this point in the history
Signed-off-by: Adithya Krishna <[email protected]>
  • Loading branch information
adithyaakrishna committed Nov 6, 2024
1 parent 426c79d commit bc17c65
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 107 deletions.
64 changes: 0 additions & 64 deletions server/ui/src/components/NamespaceSelector.tsx

This file was deleted.

1 change: 1 addition & 0 deletions server/ui/src/components/tables/ComputeGraphTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ const TYPE_COLORS = {
const CELL_STYLES = { fontSize: 14, pt: 1 } as const;
const CHIP_STYLES = {
height: '16px',
width: 'fit-content',
fontSize: '0.625rem',
'& .MuiChip-label': { padding: '0 6px' },
} as const;
Expand Down
8 changes: 0 additions & 8 deletions server/ui/src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,9 @@ import {
ExecutorsPageLoader,
IndividualComputeGraphPageLoader,
IndividualInvocationPageLoader,
NamespacesPageLoader,
} from "./utils/loaders";
import {
ComputeGraphsPage,
NamespacesPage,
IndividualComputeGraphPage,
IndividualInvocationPage,
ExecutorsPage,
Expand Down Expand Up @@ -66,12 +64,6 @@ const router = createBrowserRouter(
element: <RedirectToComputeGraphs />,
errorElement: <ErrorPage />
},
{
path: "/namespaces",
element: <NamespacesPage />,
loader: NamespacesPageLoader,
errorElement: <ErrorPage />
},
{
path: "/:namespace/compute-graphs",
element: <ComputeGraphsPage />,
Expand Down
34 changes: 4 additions & 30 deletions server/ui/src/routes/root.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,63 +15,38 @@ import {
LoaderFunctionArgs,
Outlet,
redirect,
useLoaderData,
useLocation,
Link
} from 'react-router-dom';
import { Cpu, TableDocument, Setting4 } from 'iconsax-react';
import { IndexifyClient } from 'getindexify';
import { Cpu, Setting4 } from 'iconsax-react';
import { getIndexifyServiceURL } from '../utils/helpers';
import theme from '../theme';

// Components
import Footer from '../components/Footer';
import VersionDisplay from '../components/VersionDisplay';
import NamespaceSelector from '../components/NamespaceSelector';

// Constants
const DRAWER_WIDTH = 240;
const SERVICE_URL = getIndexifyServiceURL();

interface LoaderData {
namespace: string;
}

interface NavItem {
path: string;
icon: ReactElement;
label: string;
}

export async function loader({ params }: LoaderFunctionArgs) {
const response = await IndexifyClient.namespaces({
serviceUrl: SERVICE_URL,
});

const namespaceNames = response.map((repo) => repo.name);

if (!params.namespace || !namespaceNames.includes(params.namespace)) {
return redirect('/default/compute-graphs');
}

return { namespace: params.namespace || 'default' };
return redirect('/default/compute-graphs');
}

function Dashboard() {
const { namespace } = useLoaderData() as LoaderData;
const location = useLocation();

const navItems: NavItem[] = [
{
path: `/${namespace}/compute-graphs`,
path: '/default/compute-graphs',
icon: <Cpu size="20" className="drawer-logo" variant="Outline" />,
label: 'Compute Graphs'
},
{
path: '/namespaces',
icon: <TableDocument size="20" className="drawer-logo" variant="Outline" />,
label: 'Namespaces'
},
{
path: '/executors',
icon: <Setting4 size="20" className="drawer-logo" variant="Outline" />,
Expand Down Expand Up @@ -140,7 +115,6 @@ function Dashboard() {
}}
>
<List sx={{ flexGrow: 1 }}>
<NamespaceSelector />
{navItems.map(({ path, icon, label }) => (
<ListItemButton
key={path}
Expand Down Expand Up @@ -193,4 +167,4 @@ function Dashboard() {
);
}

export default Dashboard;
export default Dashboard;
5 changes: 0 additions & 5 deletions server/ui/src/utils/loaders.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,11 +84,6 @@ export async function InvocationsPageLoader({ params }: LoaderFunctionArgs) {
return { namespace, computeGraph, invocationsList }
}

export async function NamespacesPageLoader() {
const { namespaces } = await apiGet<{ namespaces: string[] }>('/namespaces')
return { namespaces }
}

export async function ExecutorsPageLoader() {
const executors = await apiGet<unknown>('/internal/executors')
return { executors }
Expand Down

0 comments on commit bc17c65

Please sign in to comment.