diff --git a/gui/app/layout.tsx b/gui/app/layout.tsx index 74315670..6612b1ba 100644 --- a/gui/app/layout.tsx +++ b/gui/app/layout.tsx @@ -18,8 +18,8 @@ const fontIbm = IBM_Plex_Sans_Condensed({ }); export const metadata = { - title: "Create Next App", - description: "Generated by create next app", + title: "ChainFlow dashboard", + description: "", }; export default function RootLayout({ diff --git a/gui/app/page.module.scss b/gui/app/page.module.scss new file mode 100644 index 00000000..371ae868 --- /dev/null +++ b/gui/app/page.module.scss @@ -0,0 +1,22 @@ +.container { + flex: 1 0 auto; + display: flex; + flex-flow: column; + gap: 8px; +} + +.dashboard { + display: grid; + gap: 16px; + grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); +} + +.definition { + display: block; + padding: 8px 0; + font-size: 14px; +} + +.list { + margin: -16px; +} diff --git a/gui/app/page.tsx b/gui/app/page.tsx index c79877fe..7c2497c4 100644 --- a/gui/app/page.tsx +++ b/gui/app/page.tsx @@ -1,7 +1,63 @@ -import { FC } from "react"; +import Panel from "@/src/components/Panel"; +import styles from "./page.module.scss"; +import { + getDefinitionStats, + getDefinitions, + getInstances, + getTasks, +} from "@/src/utils/processUtils"; +import Box from "@/src/components/Box"; -const HomePage: FC = () => { - return

chainflow

; -}; +export default async function TasksPage() { + const { stats, tasks, definitions, instances } = await getData(); -export default HomePage; + return ( +
+
+

Dashboard

+
+
+
+
+ + + + + + + + + + + + {stats.map((stat, idx) => ( + + + + + + + ))} + +
DefinitionInstancesFailed JobsIncidents
+ {stat.definition.name} + {stat.instances}{stat.failedJobs}{stat.incidents.length}
+
+ + + {tasks.filter((task) => !task.assignee).length} of {tasks.length}{" "} + unassigned + + +
+
+
+ ); +} + +async function getData() { + return { + stats: await getDefinitionStats(), + tasks: await getTasks(), + }; +} diff --git a/gui/app/processes/[id]/[instanceId]/page.module.scss b/gui/app/processes/[id]/[instanceId]/page.module.scss index 3d30649d..7f3834bb 100644 --- a/gui/app/processes/[id]/[instanceId]/page.module.scss +++ b/gui/app/processes/[id]/[instanceId]/page.module.scss @@ -85,12 +85,4 @@ .variables { flex: 0 0 auto; - - &Table { - border-spacing: 4px; - } - - &TH { - text-align: left; - } } diff --git a/gui/app/processes/[id]/[instanceId]/page.tsx b/gui/app/processes/[id]/[instanceId]/page.tsx index 09e35738..1e110122 100644 --- a/gui/app/processes/[id]/[instanceId]/page.tsx +++ b/gui/app/processes/[id]/[instanceId]/page.tsx @@ -52,23 +52,28 @@ export default async function InstancePage({
-
- - + +
+ + + + + + + + {Object.entries(variables).map(([varKey, varValue]) => { return ( - - - - + + + + ); })}
NameTypeValue
{varKey}{varValue.type} - {JSON.stringify(varValue.value)} -
{varKey}{varValue.type}{`${varValue.value}`}
-
+
@@ -79,6 +84,6 @@ async function getData(id: string) { return { instance: await getInstance(id), variables: await getVariables(id), - tasks: await getTasks(null, null, id), + tasks: await getTasks(null, id), }; } diff --git a/gui/app/processes/[id]/page.module.scss b/gui/app/processes/[id]/page.module.scss index eaf48dd7..873224de 100644 --- a/gui/app/processes/[id]/page.module.scss +++ b/gui/app/processes/[id]/page.module.scss @@ -53,16 +53,15 @@ &TR { display: flex; flex-flow: column; - gap: 2px; - } - - &TH { - display: block; - text-align: left; + padding: 8px 16px; + gap: 4px; } + &TH, &TD { display: block; + text-align: left; + padding: 0 !important; } } @@ -82,10 +81,6 @@ .instances { flex: 0 0 auto; - &Table { - border-spacing: 4px; - } - &TH { text-align: left; } diff --git a/gui/app/processes/[id]/page.tsx b/gui/app/processes/[id]/page.tsx index c219f490..f350166a 100644 --- a/gui/app/processes/[id]/page.tsx +++ b/gui/app/processes/[id]/page.tsx @@ -48,34 +48,36 @@ export default async function InstancesPage({ title="Instances" tools={ + + ))} + +
diff --git a/gui/src/components/Navigation/Navigation.module.scss b/gui/src/components/Navigation/Navigation.module.scss index a2e7003f..890a3923 100644 --- a/gui/src/components/Navigation/Navigation.module.scss +++ b/gui/src/components/Navigation/Navigation.module.scss @@ -67,6 +67,10 @@ color: #22d49f; } } + + &.active { + border-right-color: #22d49f; + } } .sections { diff --git a/gui/src/components/Navigation/Navigation.tsx b/gui/src/components/Navigation/Navigation.tsx index 611c5703..4af9abfd 100644 --- a/gui/src/components/Navigation/Navigation.tsx +++ b/gui/src/components/Navigation/Navigation.tsx @@ -1,3 +1,5 @@ +"use client"; + import { FC } from "react"; import styles from "./Navigation.module.scss"; import Link from "next/link"; @@ -5,8 +7,11 @@ import { FaDatabase, FaHome, FaProjectDiagram, FaList } from "react-icons/fa"; import { FaCodeBranch, FaUser } from "react-icons/fa6"; import clsx from "clsx"; import ConnectButton from "@/src/components/ConnectButton"; +import { usePathname } from "next/navigation"; export const Navigation: FC = () => { + const pathname = usePathname(); + return (
@@ -17,7 +22,12 @@ export const Navigation: FC = () => {