feat(dashboard-v2): tasks page from table-filter template
This commit is contained in:
6 files changed
+4245
-4
No files matched your search
@@ -14,6 +14,7 @@
|
||||
"@astryxdesign/theme-neutral": "0.7.4",
|
||||
"@heroicons/react": "^2.2.0",
|
||||
"@stylexjs/stylex": "^0.19.0",
|
||||
"lucide-react": "^1.18.0",
|
||||
"@tanstack/react-query": "^5.0.0",
|
||||
"react": "^19.1.0",
|
||||
"react-dom": "^19.1.0"
|
||||
@@ -22,6 +23,7 @@
|
||||
"@astryxdesign/cli": "0.7.4",
|
||||
"@types/react": "^19.1.0",
|
||||
"@types/react-dom": "^19.1.0",
|
||||
"@stylexjs/rollup-plugin": "^0.19.0",
|
||||
"@vitejs/plugin-react": "^5.0.0",
|
||||
"typescript": "~6.0.3",
|
||||
"vite": "^8.3.0"
|
||||
|
||||
Generated
+52
-1
@@ -181,6 +181,9 @@ importers:
|
||||
'@tanstack/react-query':
|
||||
specifier: ^5.0.0
|
||||
version: 5.104.5(@types/react@19.3.0)(react@19.3.1)
|
||||
lucide-react:
|
||||
specifier: ^1.18.0
|
||||
version: 1.61.0(@types/react@19.3.0)(react@19.3.1)
|
||||
react:
|
||||
specifier: ^19.1.0
|
||||
version: 19.3.1
|
||||
@@ -191,6 +194,9 @@ importers:
|
||||
'@astryxdesign/cli':
|
||||
specifier: 0.7.4
|
||||
version: 0.7.4(@astryxdesign/core@0.7.4(@stylexjs/stylex@0.19.1)(react-dom@19.3.1(react@19.3.1))(react@19.3.1))(@astryxdesign/theme-neutral@0.7.4(@astryxdesign/core@0.7.4(@stylexjs/stylex@0.19.1)(react-dom@19.3.1(react@19.3.1))(react@19.3.1))(@types/react@19.3.0)(react@19.3.1))
|
||||
'@stylexjs/rollup-plugin':
|
||||
specifier: ^0.19.0
|
||||
version: 0.19.1
|
||||
'@types/react':
|
||||
specifier: ^19.1.0
|
||||
version: 19.3.0
|
||||
@@ -439,6 +445,9 @@ packages:
|
||||
resolution: {integrity: sha512-Vj1jF3cPfxg7OAfoI7QnVKLoILlm2JF9pnVHrX8qx7AHMiYWT+NDAA7jChlNgRS4WTLc/fD1lXLmPixluj+3Gg==}
|
||||
engines: {node: '>=6.9.0'}
|
||||
|
||||
'@dual-bundle/import-meta-resolve@4.2.1':
|
||||
resolution: {integrity: sha512-id+7YRUgoUX6CgV0DtuhirQWodeeA7Lf4i2x71JS/vtA5pRb/hIGWlw+G6MeXvsM+MXrz0VAydTGElX1rAfgPg==}
|
||||
|
||||
'@formatjs/fast-memoize@3.1.7':
|
||||
resolution: {integrity: sha512-zXfhLpvA6T7+efdt9JLbBwZ00tT7NsBMDVnDu8rpHeNNv8KfRZAMo2gkG0k9lK/Nzc//3kJ9pImsfuJxk3KhUA==}
|
||||
|
||||
@@ -574,6 +583,15 @@ packages:
|
||||
'@rolldown/pluginutils@1.0.1':
|
||||
resolution: {integrity: sha512-2j9bGt5Jh8hj+vPtgzPtl72j0yRxHAyumoo6TNfAjsLB04UtpSvPbPcDcBMxz7n+9CYB0c1GxQFxYRg2jimqGw==}
|
||||
|
||||
'@stylexjs/babel-plugin@0.19.1':
|
||||
resolution: {integrity: sha512-Ig3crX6MuGWDEAx+f89aLxTQUWVeEc2Aco2moIdcObyvo7hZJgU26rxJN3k7geFjhi+5dfna6TNR8iTRK0PQGA==}
|
||||
|
||||
'@stylexjs/rollup-plugin@0.19.1':
|
||||
resolution: {integrity: sha512-+f9Ktlq3CqXq6dqcbF3PmHkrqiPZ4kirvVBlFnOF0wBD1Ws+0tC3QcGBqQmp7cw9SjqH5EVJPGBO15xap//kKA==}
|
||||
|
||||
'@stylexjs/shared@0.19.1':
|
||||
resolution: {integrity: sha512-oFBtW0NPNLJOT1gLweWRNKrIJHjJMwOmSV7fgd6ewok4fwb/Nh95PEaYGKu+ZONk0nNghjLFfOwiIsxJdvh3TQ==}
|
||||
|
||||
'@stylexjs/stylex@0.19.1':
|
||||
resolution: {integrity: sha512-JwNFm0MOYPqi+M4Ax5Un4ZxfZp4HEAX2sAWetZ88KALFcv1eEiHNJs75oO3V3U7RVWnzfkiM8i9eBowC3hqgUw==}
|
||||
|
||||
@@ -931,6 +949,9 @@ packages:
|
||||
resolution: {integrity: sha512-wWBro/7hJ40ye6TPiXkUQoXKCw23xSsjriUvqd7Uls9Sso3oLiON1flc18cCdnjgCRXw4fBVqUJJeOdDTh3P3g==}
|
||||
engines: {node: '>=4'}
|
||||
|
||||
postcss-value-parser@4.2.0:
|
||||
resolution: {integrity: sha512-1NNCs6uurfkVbeXG4S8JFT9t19m45ICnif8zWLd5oPSZ50QnwMfK+H3jv408d4jw/7Bttv5axS5IiHoLaVNHeQ==}
|
||||
|
||||
postcss@8.5.31:
|
||||
resolution: {integrity: sha512-YUbWYCgErwnMAVkjUnYa+KlMBzGpHwiIt/DE7f0G33AuX2LH9UcTk6KgWxd3zRU+pN3u/C+Xl3EnMLM4Hea7Sg==}
|
||||
engines: {node: ^10 || ^12 || >=14}
|
||||
@@ -1184,7 +1205,7 @@ snapshots:
|
||||
'@babel/helper-module-imports@7.29.7':
|
||||
dependencies:
|
||||
'@babel/traverse': 7.29.10
|
||||
'@babel/types': 7.29.8
|
||||
'@babel/types': 7.29.11
|
||||
transitivePeerDependencies:
|
||||
- supports-color
|
||||
|
||||
@@ -1372,6 +1393,8 @@ snapshots:
|
||||
'@babel/helper-string-parser': 7.29.11
|
||||
'@babel/helper-validator-identifier': 7.29.7
|
||||
|
||||
'@dual-bundle/import-meta-resolve@4.2.1': {}
|
||||
|
||||
'@formatjs/fast-memoize@3.1.7': {}
|
||||
|
||||
'@formatjs/icu-messageformat-parser@3.5.18':
|
||||
@@ -1454,6 +1477,32 @@ snapshots:
|
||||
|
||||
'@rolldown/pluginutils@1.0.1': {}
|
||||
|
||||
'@stylexjs/babel-plugin@0.19.1':
|
||||
dependencies:
|
||||
'@babel/core': 7.29.7
|
||||
'@babel/helper-module-imports': 7.29.7
|
||||
'@babel/traverse': 7.29.10
|
||||
'@babel/types': 7.29.11
|
||||
'@dual-bundle/import-meta-resolve': 4.2.1
|
||||
'@stylexjs/shared': 0.19.1
|
||||
'@stylexjs/stylex': 0.19.1
|
||||
postcss-value-parser: 4.2.0
|
||||
transitivePeerDependencies:
|
||||
- supports-color
|
||||
|
||||
'@stylexjs/rollup-plugin@0.19.1':
|
||||
dependencies:
|
||||
'@babel/core': 7.29.7
|
||||
'@babel/plugin-syntax-flow': 7.29.7(@babel/core@7.29.7)
|
||||
'@babel/plugin-syntax-jsx': 7.29.7(@babel/core@7.29.7)
|
||||
'@babel/plugin-syntax-typescript': 7.29.7(@babel/core@7.29.7)
|
||||
'@stylexjs/babel-plugin': 0.19.1
|
||||
lightningcss: 1.33.0
|
||||
transitivePeerDependencies:
|
||||
- supports-color
|
||||
|
||||
'@stylexjs/shared@0.19.1': {}
|
||||
|
||||
'@stylexjs/stylex@0.19.1':
|
||||
dependencies:
|
||||
css-mediaquery: 0.1.2
|
||||
@@ -1749,6 +1798,8 @@ snapshots:
|
||||
cssesc: 3.0.0
|
||||
util-deprecate: 1.0.2
|
||||
|
||||
postcss-value-parser@4.2.0: {}
|
||||
|
||||
postcss@8.5.31:
|
||||
dependencies:
|
||||
nanoid: 3.3.20
|
||||
|
||||
@@ -1,12 +1,35 @@
|
||||
import { Suspense, lazy, useState } from "react";
|
||||
|
||||
import { AppShell } from "@astryxdesign/core/AppShell";
|
||||
import { HStack } from "@astryxdesign/core/Layout";
|
||||
import { SideNav, SideNavHeading, SideNavItem } from "@astryxdesign/core/SideNav";
|
||||
import { Center } from "@astryxdesign/core/Center";
|
||||
import { Text } from "@astryxdesign/core/Text";
|
||||
import {
|
||||
ClipboardDocumentListIcon,
|
||||
ServerStackIcon,
|
||||
} from "@heroicons/react/24/outline";
|
||||
|
||||
import StatusPage from "./pages/StatusPage.tsx";
|
||||
import { ArchieMark } from "./components/ArchieLogo.tsx";
|
||||
import LoginPage from "./pages/LoginPage.tsx";
|
||||
import { useSession } from "./session.tsx";
|
||||
|
||||
const StatusPage = lazy(() => import("./pages/StatusPage.tsx"));
|
||||
const TasksPage = lazy(() => import("./pages/TasksPage.tsx"));
|
||||
|
||||
function PageFallback(): React.JSX.Element {
|
||||
return (
|
||||
<Center axis="both" padding={6}>
|
||||
<Text type="body">Loading…</Text>
|
||||
</Center>
|
||||
);
|
||||
}
|
||||
|
||||
type Page = "tasks" | "status";
|
||||
|
||||
export default function App() {
|
||||
const { state } = useSession();
|
||||
const [page, setPage] = useState<Page>("tasks");
|
||||
|
||||
if (state === "unknown") {
|
||||
return (
|
||||
@@ -25,5 +48,37 @@ export default function App() {
|
||||
);
|
||||
}
|
||||
if (state === "guest") return <LoginPage />;
|
||||
return <StatusPage />;
|
||||
|
||||
return (
|
||||
<AppShell
|
||||
contentPadding={0}
|
||||
sideNav={
|
||||
<SideNav
|
||||
header={
|
||||
<HStack gap={2} vAlign="center">
|
||||
<ArchieMark size={20} />
|
||||
<SideNavHeading heading="Archie" />
|
||||
</HStack>
|
||||
}
|
||||
>
|
||||
<SideNavItem
|
||||
label="Tasks"
|
||||
icon={ClipboardDocumentListIcon}
|
||||
isSelected={page === "tasks"}
|
||||
onClick={() => setPage("tasks")}
|
||||
/>
|
||||
<SideNavItem
|
||||
label="Status"
|
||||
icon={ServerStackIcon}
|
||||
isSelected={page === "status"}
|
||||
onClick={() => setPage("status")}
|
||||
/>
|
||||
</SideNav>
|
||||
}
|
||||
>
|
||||
<Suspense fallback={<PageFallback />}>
|
||||
{page === "tasks" ? <TasksPage /> : <StatusPage />}
|
||||
</Suspense>
|
||||
</AppShell>
|
||||
);
|
||||
}
|
||||
@@ -96,8 +96,63 @@ export interface AuthStatus {
|
||||
instance?: string;
|
||||
}
|
||||
|
||||
export interface StatusMeta {
|
||||
id: string;
|
||||
label: string;
|
||||
kind: "ok" | "warn" | "danger" | "info" | "idle";
|
||||
needs_attention?: boolean;
|
||||
}
|
||||
|
||||
export interface TaskMeta {
|
||||
statuses?: StatusMeta[];
|
||||
}
|
||||
|
||||
export interface Task {
|
||||
id: number | string;
|
||||
title?: string;
|
||||
owner?: string;
|
||||
repo?: string;
|
||||
status?: string;
|
||||
workflow?: string;
|
||||
attempt?: number;
|
||||
branch?: string;
|
||||
plan?: string;
|
||||
park_reason?: string;
|
||||
created_at?: string;
|
||||
updated_at?: string;
|
||||
issue_url?: string;
|
||||
pr_url?: string;
|
||||
actions?: string[];
|
||||
}
|
||||
|
||||
export interface TaskPageParams {
|
||||
status?: string;
|
||||
workflow?: string;
|
||||
limit?: number;
|
||||
cursor?: string | null;
|
||||
}
|
||||
|
||||
export const api = {
|
||||
authStatus: () => request<AuthStatus>("/api/auth/status"),
|
||||
taskMeta: () => request<TaskMeta>("/api/task-meta"),
|
||||
// taskPage reads one page of tasks; next is the cursor for the page
|
||||
// after it, or null when this page was the last.
|
||||
taskPage: async (params: TaskPageParams) => {
|
||||
const q = new URLSearchParams();
|
||||
if (params.status) q.set("status", params.status);
|
||||
if (params.workflow) q.set("workflow", params.workflow);
|
||||
q.set("limit", String(params.limit ?? 100));
|
||||
if (params.cursor) q.set("cursor", params.cursor);
|
||||
const res = await fetch(`/api/tasks?${q}`, {
|
||||
headers: { Accept: "application/json" },
|
||||
signal: AbortSignal.timeout(DEFAULT_TIMEOUT_MS),
|
||||
});
|
||||
if (!res.ok) throw new ApiError(await errorMessage(res), res.status);
|
||||
return {
|
||||
tasks: (await res.json()) as Task[],
|
||||
next: res.headers.get("X-Next-Cursor"),
|
||||
};
|
||||
},
|
||||
services: () => request<Service[]>("/api/services"),
|
||||
version: () => request<{ components: ComponentVersion[] }>("/api/version"),
|
||||
signIn: (email: string, password: string) =>
|
||||
|
||||
File diff suppressed because it is too large.
Load diff
@@ -1,8 +1,37 @@
|
||||
import stylex from "@stylexjs/rollup-plugin";
|
||||
import react from "@vitejs/plugin-react";
|
||||
import type { Plugin } from "vite";
|
||||
import { defineConfig } from "vite";
|
||||
|
||||
// The plugin string-matches file contents for StyleX imports, which also
|
||||
// matches stylesheets, and then feeds them to Babel. Guard it to code.
|
||||
function stylexJsOnly(): Plugin {
|
||||
const inner = stylex({
|
||||
fileName: "stylex.css",
|
||||
unstable_moduleResolution: { type: "commonJS" },
|
||||
}) as unknown as {
|
||||
transform: (code: string, id: string) => unknown;
|
||||
[key: string]: unknown;
|
||||
};
|
||||
const transform = inner.transform;
|
||||
return {
|
||||
...inner,
|
||||
transform(this: unknown, code: string, id: string) {
|
||||
if (id.split("?", 1)[0].endsWith(".css")) {
|
||||
return null;
|
||||
}
|
||||
return Reflect.apply(transform, this, [code, id]);
|
||||
},
|
||||
} as unknown as Plugin;
|
||||
}
|
||||
|
||||
export default defineConfig({
|
||||
plugins: [react()],
|
||||
plugins: [
|
||||
// Compiles the StyleX the table-filter template carries. CommonJS
|
||||
// module resolution so the theme file resolves across packages.
|
||||
stylexJsOnly(),
|
||||
react(),
|
||||
],
|
||||
server: {
|
||||
// The Vue dashboard owns 5173; v2 runs beside it during the migration.
|
||||
// strictPort fails loudly instead of silently moving to another port.
|
||||
|
||||
Reference in new issue
Block a user