Skip to content

Commit 443d8d0

Browse files
committed
adjust colors + readme update
1 parent 1f5fbd5 commit 443d8d0

File tree

7 files changed

+177
-34
lines changed

7 files changed

+177
-34
lines changed

utility_containers/event-puller/README.md

+13
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ docker run -p 8080:8080 \
5050
-e AWS_SECRET_ACCESS_KEY=your_secret \
5151
-e AWS_REGION=your_region \
5252
-e SQS_QUEUE_URL=your_queue_url \
53+
-v $(pwd)/.env:/app/.env \ # Mount .env file with configuration
5354
bacalhau-project/event-puller:latest
5455
```
5556

@@ -102,6 +103,8 @@ npm install
102103
npm run build
103104
```
104105

106+
To configure certain aspects of the dashboard see `constants.ts`.
107+
105108
## 🔍 Known Issues and Troubleshooting
106109

107110
### SQS Message Processing Issues
@@ -162,6 +165,16 @@ When accessing the development server, use query parameters to connect to your E
162165
http://localhost:3000/?host=localhost&port=8080
163166
```
164167

168+
Format code
169+
```sh
170+
npm run format
171+
```
172+
173+
Lint code
174+
```sh
175+
npm run lint
176+
```
177+
165178
## 🧪 Testing with Sample Messages
166179

167180
```bash

utility_containers/event-puller/dashboard/app/NodeGraph.tsx

+9-9
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ function LabelNode({ data }: { data: { label: string; color: string } }) {
4747

4848
interface NodeGraphProps {
4949
isConnected: boolean;
50-
setShowConfirm: (show: boolean) => void;
50+
setOpenClearQueue: (show: boolean) => void;
5151
clearQueue: () => void;
5252
vmStates: Map<string, Message>;
5353
queueSize: number;
@@ -58,7 +58,7 @@ interface NodeGraphProps {
5858

5959
export default function NodeGraph({
6060
isConnected,
61-
setShowConfirm,
61+
setOpenClearQueue,
6262
clearQueue,
6363
vmStates,
6464
queueSize,
@@ -129,12 +129,12 @@ export default function NodeGraph({
129129
<Badge
130130
variant={isConnected ? 'default' : 'outline'}
131131
className={`${isConnected ? 'bg-green-100 text-green-800' : 'bg-red-100 text-red-800'}`}
132-
onClick={() => setShowConfirm(true)}
132+
onClick={() => setOpenClearQueue(true)}
133133
>
134134
{isConnected ? 'Connected' : 'Disconnected'}
135135
</Badge>
136136
</div>
137-
<div className="ml-auto flex items-center gap-4">
137+
<div className="ml-auto hidden items-center gap-4 md:flex">
138138
<div className="flex items-center gap-2">
139139
<span className="text-sm">Unique VMs:</span>
140140
<Badge>{vmStates.size}</Badge>
@@ -165,24 +165,24 @@ export default function NodeGraph({
165165
setHighlightedRegion={setHighlightedRegion}
166166
regions={regions}
167167
selectedNode={selectedNode}
168-
setShowConfirm={setShowConfirm}
168+
setOpenClearQueue={setOpenClearQueue}
169169
/>
170170
</aside>
171171

172172
{/* Region legend floating at the bottom */}
173-
<div className="absolute bottom-4 left-1/2 z-10 flex -translate-x-1/2 transform flex-wrap justify-center gap-3 rounded-lg bg-black/50 px-4 py-2 backdrop-blur-xl">
173+
<div className="absolute bottom-4 left-1/2 z-10 flex -translate-x-1/2 transform flex-wrap justify-center gap-3 rounded-lg bg-white/50 px-4 py-2 backdrop-blur-xl dark:bg-slate-500/50">
174174
{Object.entries(regions).map(([region, color]) => (
175175
<div key={region} className="flex items-center gap-2">
176176
<div
177177
className="h-3 w-3 rounded-full"
178178
style={{ backgroundColor: color as string }}
179179
></div>
180-
<span className="text-xs font-semibold text-gray-800 dark:text-white">{region}</span>
180+
<span className="text-xs font-semibold">{region}</span>
181181
</div>
182182
))}
183183

184184
{Object.keys(regions).length === 0 && (
185-
<span className="text-xs font-semibold text-gray-800 dark:text-white">No regions</span>
185+
<span className="text-xs font-semibold">No regions</span>
186186
)}
187187
</div>
188188

@@ -192,7 +192,7 @@ export default function NodeGraph({
192192
</div>
193193

194194
{/* Clear queue modal */}
195-
{showConfirm && <ClearQueueModal setShowConfirm={setShowConfirm} clearQueue={clearQueue} />}
195+
<ClearQueueModal open={showConfirm} setOpen={setOpenClearQueue} clearQueue={clearQueue} />
196196
</div>
197197
);
198198
}
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,38 @@
1+
import { Button } from './ui/button';
2+
import {
3+
Dialog,
4+
DialogContent,
5+
DialogDescription,
6+
DialogFooter,
7+
DialogHeader,
8+
DialogTitle,
9+
} from './ui/dialog';
10+
111
interface ClearQueueModalProps {
2-
setShowConfirm: (show: boolean) => void;
12+
open: boolean;
13+
setOpen: (show: boolean) => void;
314
clearQueue: () => void;
415
}
516

6-
export default function ClearQueueModal({ setShowConfirm, clearQueue }: ClearQueueModalProps) {
17+
export default function ClearQueueModal({ open, setOpen, clearQueue }: ClearQueueModalProps) {
718
return (
8-
<div className="fixed inset-0 z-10 flex items-center justify-center bg-black/50">
9-
<div className="w-full max-w-md rounded-lg bg-white p-6 shadow-lg">
10-
<h2 className="mb-4 text-lg font-bold">Confirm Queue Clear</h2>
11-
<p className="mb-6">Are you sure you want to clear the queue? This cannot be undone.</p>
12-
<div className="flex justify-end gap-3">
13-
<button
14-
onClick={() => setShowConfirm(false)}
15-
className="cursor-pointer rounded border border-gray-300 px-4 py-2 hover:bg-gray-100"
16-
>
19+
<Dialog open={open} onOpenChange={setOpen}>
20+
<DialogContent className="bg-background">
21+
<DialogHeader>
22+
<DialogTitle>Confirm Queue Clear</DialogTitle>
23+
<DialogDescription>
24+
Are you sure you want to clear the queue? This cannot be undone.
25+
</DialogDescription>
26+
</DialogHeader>
27+
<DialogFooter>
28+
<Button variant="outline" onClick={() => setOpen(false)}>
1729
Cancel
18-
</button>
19-
<button
20-
onClick={clearQueue}
21-
className="cursor-pointer rounded bg-red-600 px-4 py-2 text-white hover:bg-red-700"
22-
>
30+
</Button>
31+
<Button variant="destructive" onClick={clearQueue}>
2332
Clear Queue
24-
</button>
25-
</div>
26-
</div>
27-
</div>
33+
</Button>
34+
</DialogFooter>
35+
</DialogContent>
36+
</Dialog>
2837
);
2938
}

utility_containers/event-puller/dashboard/app/components/Sidebar.tsx

+3-3
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,15 @@ interface SidebarProps {
1414
setHighlightedRegion: (region: string | null) => void;
1515
regions: Record<string, string>;
1616
selectedNode: Node | null;
17-
setShowConfirm: (show: boolean) => void;
17+
setOpenClearQueue: (show: boolean) => void;
1818
}
1919

2020
export default function Sidebar({
2121
highlightedRegion,
2222
setHighlightedRegion,
2323
regions,
2424
selectedNode,
25-
setShowConfirm,
25+
setOpenClearQueue,
2626
}: SidebarProps) {
2727
return (
2828
<>
@@ -63,7 +63,7 @@ export default function Sidebar({
6363
size="sm"
6464
className="cursor-pointer"
6565
variant="destructive"
66-
onClick={() => setShowConfirm(true)}
66+
onClick={() => setOpenClearQueue(true)}
6767
>
6868
Clear Queue
6969
</Button>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,121 @@
1+
'use client';
2+
3+
import * as React from 'react';
4+
import * as DialogPrimitive from '@radix-ui/react-dialog';
5+
import { XIcon } from 'lucide-react';
6+
7+
import { cn } from '@/lib/utils';
8+
9+
function Dialog({ ...props }: React.ComponentProps<typeof DialogPrimitive.Root>) {
10+
return <DialogPrimitive.Root data-slot="dialog" {...props} />;
11+
}
12+
13+
function DialogTrigger({ ...props }: React.ComponentProps<typeof DialogPrimitive.Trigger>) {
14+
return <DialogPrimitive.Trigger data-slot="dialog-trigger" {...props} />;
15+
}
16+
17+
function DialogPortal({ ...props }: React.ComponentProps<typeof DialogPrimitive.Portal>) {
18+
return <DialogPrimitive.Portal data-slot="dialog-portal" {...props} />;
19+
}
20+
21+
function DialogClose({ ...props }: React.ComponentProps<typeof DialogPrimitive.Close>) {
22+
return <DialogPrimitive.Close data-slot="dialog-close" {...props} />;
23+
}
24+
25+
function DialogOverlay({
26+
className,
27+
...props
28+
}: React.ComponentProps<typeof DialogPrimitive.Overlay>) {
29+
return (
30+
<DialogPrimitive.Overlay
31+
data-slot="dialog-overlay"
32+
className={cn(
33+
'data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/50',
34+
className,
35+
)}
36+
{...props}
37+
/>
38+
);
39+
}
40+
41+
function DialogContent({
42+
className,
43+
children,
44+
...props
45+
}: React.ComponentProps<typeof DialogPrimitive.Content>) {
46+
return (
47+
<DialogPortal data-slot="dialog-portal">
48+
<DialogOverlay />
49+
<DialogPrimitive.Content
50+
data-slot="dialog-content"
51+
className={cn(
52+
'bg-background data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 fixed top-[50%] left-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 rounded-lg border p-6 shadow-lg duration-200 sm:max-w-lg',
53+
className,
54+
)}
55+
{...props}
56+
>
57+
{children}
58+
<DialogPrimitive.Close className="ring-offset-background focus:ring-ring data-[state=open]:bg-accent data-[state=open]:text-muted-foreground absolute top-4 right-4 rounded-xs opacity-70 transition-opacity hover:opacity-100 focus:ring-2 focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4">
59+
<XIcon />
60+
<span className="sr-only">Close</span>
61+
</DialogPrimitive.Close>
62+
</DialogPrimitive.Content>
63+
</DialogPortal>
64+
);
65+
}
66+
67+
function DialogHeader({ className, ...props }: React.ComponentProps<'div'>) {
68+
return (
69+
<div
70+
data-slot="dialog-header"
71+
className={cn('flex flex-col gap-2 text-center sm:text-left', className)}
72+
{...props}
73+
/>
74+
);
75+
}
76+
77+
function DialogFooter({ className, ...props }: React.ComponentProps<'div'>) {
78+
return (
79+
<div
80+
data-slot="dialog-footer"
81+
className={cn('flex flex-col-reverse gap-2 sm:flex-row sm:justify-end', className)}
82+
{...props}
83+
/>
84+
);
85+
}
86+
87+
function DialogTitle({ className, ...props }: React.ComponentProps<typeof DialogPrimitive.Title>) {
88+
return (
89+
<DialogPrimitive.Title
90+
data-slot="dialog-title"
91+
className={cn('text-lg leading-none font-semibold', className)}
92+
{...props}
93+
/>
94+
);
95+
}
96+
97+
function DialogDescription({
98+
className,
99+
...props
100+
}: React.ComponentProps<typeof DialogPrimitive.Description>) {
101+
return (
102+
<DialogPrimitive.Description
103+
data-slot="dialog-description"
104+
className={cn('text-muted-foreground text-sm', className)}
105+
{...props}
106+
/>
107+
);
108+
}
109+
110+
export {
111+
Dialog,
112+
DialogClose,
113+
DialogContent,
114+
DialogDescription,
115+
DialogFooter,
116+
DialogHeader,
117+
DialogOverlay,
118+
DialogPortal,
119+
DialogTitle,
120+
DialogTrigger,
121+
};

utility_containers/event-puller/dashboard/app/globals.css

+1-1
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ body {
8282
}
8383

8484
.dark {
85-
--background: var(--bg-slate-900);
85+
--background: oklch(0.13 0.03 262);
8686
--foreground: oklch(0.985 0 0);
8787
--card: oklch(0.205 0 0);
8888
--card-foreground: oklch(0.985 0 0);

utility_containers/event-puller/dashboard/app/page.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ function DashboardContent() {
126126
return (
127127
<NodeGraph
128128
isConnected={isConnected}
129-
setShowConfirm={setShowConfirm}
129+
setOpenClearQueue={setShowConfirm}
130130
clearQueue={clearQueue}
131131
vmStates={vmStates}
132132
queueSize={queueSize}

0 commit comments

Comments
 (0)