diff --git a/pkgs/clan-cli/clan_cli/webui/app.py b/pkgs/clan-cli/clan_cli/webui/app.py
index 76f5809f5..e7469d55a 100644
--- a/pkgs/clan-cli/clan_cli/webui/app.py
+++ b/pkgs/clan-cli/clan_cli/webui/app.py
@@ -1,13 +1,24 @@
from fastapi import FastAPI
from fastapi.routing import APIRoute
from fastapi.staticfiles import StaticFiles
+from fastapi.middleware.cors import CORSMiddleware
from .assets import asset_path
from .routers import health, machines, root, vms
+origins = [
+ "http://localhost:3000",
+]
def setup_app() -> FastAPI:
app = FastAPI()
+ app.add_middleware(
+ CORSMiddleware,
+ allow_origins=origins,
+ allow_credentials=True,
+ allow_methods=["*"],
+ allow_headers=["*"],
+ )
app.include_router(health.router)
app.include_router(machines.router)
app.include_router(root.router)
diff --git a/pkgs/clan-cli/clan_cli/webui/server.py b/pkgs/clan-cli/clan_cli/webui/server.py
index 7d915a743..213b2768a 100644
--- a/pkgs/clan-cli/clan_cli/webui/server.py
+++ b/pkgs/clan-cli/clan_cli/webui/server.py
@@ -55,17 +55,25 @@ def start_server(args: argparse.Namespace) -> None:
with ExitStack() as stack:
headers: list[tuple[str, str]] = []
if args.dev:
- stack.enter_context(spawn_node_dev_server(args.dev_host, args.dev_port))
+ # stack.enter_context(spawn_node_dev_server(args.dev_host, args.dev_port))
open_url = f"http://{args.dev_host}:{args.dev_port}"
host = args.dev_host
if ":" in host:
host = f"[{host}]"
headers = [
- (
- "Access-Control-Allow-Origin",
- f"http://{host}:{args.dev_port}",
- )
+ # (
+ # "Access-Control-Allow-Origin",
+ # f"http://{host}:{args.dev_port}",
+ # ),
+ # (
+ # "Access-Control-Allow-Methods",
+ # "DELETE, GET, HEAD, OPTIONS, PATCH, POST, PUT"
+ # ),
+ # (
+ # "Allow",
+ # "DELETE, GET, HEAD, OPTIONS, PATCH, POST, PUT"
+ # )
]
else:
open_url = f"http://[{args.host}]:{args.port}"
diff --git a/pkgs/clan-cli/tests/test_flake_with_core/flake.nix b/pkgs/clan-cli/tests/test_flake_with_core/flake.nix
index 0a36a1332..fab76b5b1 100644
--- a/pkgs/clan-cli/tests/test_flake_with_core/flake.nix
+++ b/pkgs/clan-cli/tests/test_flake_with_core/flake.nix
@@ -1,4 +1,7 @@
{
+ # Use this path to our repo root e.g. for UI test
+ # inputs.clan-core.url = "../../../../.";
+
# this placeholder is replaced by the path to nixpkgs
inputs.clan-core.url = "__CLAN_CORE__";
diff --git a/pkgs/ui/nix/pdefs.nix b/pkgs/ui/nix/pdefs.nix
index 5224db1ff..4e79bc93a 100644
--- a/pkgs/ui/nix/pdefs.nix
+++ b/pkgs/ui/nix/pdefs.nix
@@ -10986,6 +10986,11 @@
descriptor = "^0.4.1";
pin = "0.4.1";
};
+ pretty-bytes = {
+ descriptor = "^6.1.1";
+ pin = "6.1.1";
+ runtime = true;
+ };
react = {
descriptor = "18.2.0";
pin = "18.2.0";
@@ -13086,6 +13091,9 @@
dev = true;
key = "prettier-plugin-tailwindcss/0.4.1";
};
+ "node_modules/pretty-bytes" = {
+ key = "pretty-bytes/6.1.1";
+ };
"node_modules/printable-characters" = {
dev = true;
key = "printable-characters/1.0.42";
@@ -15195,6 +15203,19 @@
version = "0.4.1";
};
};
+ pretty-bytes = {
+ "6.1.1" = {
+ fetchInfo = {
+ narHash = "sha256-ERXqMD/9tkPebbHVL3n/9EQRz7mFs5VYO6k/wo5JDzQ=";
+ type = "tarball";
+ url = "https://registry.npmjs.org/pretty-bytes/-/pretty-bytes-6.1.1.tgz";
+ };
+ ident = "pretty-bytes";
+ ltype = "file";
+ treeInfo = { };
+ version = "6.1.1";
+ };
+ };
printable-characters = {
"1.0.42" = {
fetchInfo = {
@@ -18237,4 +18258,4 @@
};
};
};
-}
+}
\ No newline at end of file
diff --git a/pkgs/ui/orval.config.ts b/pkgs/ui/orval.config.ts
index db48112ce..b92bd3d2e 100644
--- a/pkgs/ui/orval.config.ts
+++ b/pkgs/ui/orval.config.ts
@@ -1,5 +1,5 @@
const config = {
- petstore: {
+ clan: {
output: {
mode: "tags-split",
target: "src/api",
diff --git a/pkgs/ui/package-lock.json b/pkgs/ui/package-lock.json
index 5462475ba..fc249db2b 100644
--- a/pkgs/ui/package-lock.json
+++ b/pkgs/ui/package-lock.json
@@ -22,6 +22,7 @@
"hex-rgb": "^5.0.0",
"next": "13.4.12",
"postcss": "8.4.27",
+ "pretty-bytes": "^6.1.1",
"react": "18.2.0",
"react-dom": "18.2.0",
"react-hook-form": "^7.45.4",
@@ -6810,6 +6811,17 @@
}
}
},
+ "node_modules/pretty-bytes": {
+ "version": "6.1.1",
+ "resolved": "https://registry.npmjs.org/pretty-bytes/-/pretty-bytes-6.1.1.tgz",
+ "integrity": "sha512-mQUvGU6aUFQ+rNvTIAcZuWGRT9a6f6Yrg9bHs4ImKF+HZCEK+plBvnAZYSIQztknZF2qnzNtr6F8s0+IuptdlQ==",
+ "engines": {
+ "node": "^14.13.1 || >=16.0.0"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/sindresorhus"
+ }
+ },
"node_modules/printable-characters": {
"version": "1.0.42",
"resolved": "https://registry.npmjs.org/printable-characters/-/printable-characters-1.0.42.tgz",
diff --git a/pkgs/ui/package.json b/pkgs/ui/package.json
index 6ae1b83ee..02e28cdce 100644
--- a/pkgs/ui/package.json
+++ b/pkgs/ui/package.json
@@ -26,6 +26,7 @@
"hex-rgb": "^5.0.0",
"next": "13.4.12",
"postcss": "8.4.27",
+ "pretty-bytes": "^6.1.1",
"react": "18.2.0",
"react-dom": "18.2.0",
"react-hook-form": "^7.45.4",
diff --git a/pkgs/ui/src/app/join/page.tsx b/pkgs/ui/src/app/join/page.tsx
new file mode 100644
index 000000000..660c407ae
--- /dev/null
+++ b/pkgs/ui/src/app/join/page.tsx
@@ -0,0 +1,184 @@
+"use client";
+import React, { useState } from "react";
+import { VmConfig } from "@/api/model";
+import { useVms } from "@/components/hooks/useVms";
+import prettyBytes from "pretty-bytes";
+
+import {
+ Alert,
+ AlertTitle,
+ Button,
+ Chip,
+ LinearProgress,
+ ListSubheader,
+ Switch,
+ Typography,
+} from "@mui/material";
+import { useSearchParams } from "next/navigation";
+import { toast } from "react-hot-toast";
+import { Error, Numbers } from "@mui/icons-material";
+import { createVm, inspectVm } from "@/api/default/default";
+
+interface FlakeBadgeProps {
+ flakeUrl: string;
+ flakeAttr: string;
+}
+const FlakeBadge = (props: FlakeBadgeProps) => (
+