style(widgets): apply formatter to dashboard and addon files

This commit is contained in:
Developer
2026-06-22 08:05:44 +00:00
parent ed7a7a5ce0
commit 09eb76bf0f
5 changed files with 24 additions and 73 deletions
+2 -2
View File
@@ -16,8 +16,8 @@ export function GrafanaAddonPage() {
</CardHeader>
<CardContent className="flex flex-col gap-3">
<p className="text-sm text-muted-foreground">
Open the full Grafana instance for dashboards, metrics, and
log exploration.
Open the full Grafana instance for dashboards, metrics, and log
exploration.
</p>
<Button asChild>
<a
+2 -2
View File
@@ -15,8 +15,8 @@ export function SshTasksAddonPage() {
</CardHeader>
<CardContent className="flex flex-col gap-3">
<p className="text-sm text-muted-foreground">
Create, edit, and run saved shell or Python tasks against local
or remote machines.
Create, edit, and run saved shell or Python tasks against local or
remote machines.
</p>
<Button onClick={() => navigate("/actions")}>
<Terminal className="mr-2 h-4 w-4" />
+15 -53
View File
@@ -18,13 +18,7 @@ import {
} from "@/components/ui/select";
import { Badge } from "@/components/ui/badge";
import { Alert, AlertDescription } from "@/components/ui/alert";
import {
ChevronDown,
ChevronUp,
Pencil,
Plus,
Trash2,
} from "lucide-react";
import { ChevronDown, ChevronUp, Pencil, Plus, Trash2 } from "lucide-react";
import {
useDeleteWidgetInstance,
useSaveWidgetInstance,
@@ -114,9 +108,7 @@ function WidgetConfigFields({
>
<Select
value={String(value)}
onValueChange={(v) =>
onChange({ ...config, [field.key]: v })
}
onValueChange={(v) => onChange({ ...config, [field.key]: v })}
>
<SelectTrigger id={field.key}>
<SelectValue />
@@ -124,11 +116,7 @@ function WidgetConfigFields({
<SelectContent>
<SelectItem value="">Default</SelectItem>
{machines
.filter(
(m) =>
m.enabled &&
m.services.includes("jellyfin"),
)
.filter((m) => m.enabled && m.services.includes("jellyfin"))
.map((m) => (
<SelectItem key={m.id} value={m.id}>
{m.name}
@@ -140,10 +128,7 @@ function WidgetConfigFields({
);
}
if (
definition.widgetType === "ssh-task" &&
field.key === "task_id"
) {
if (definition.widgetType === "ssh-task" && field.key === "task_id") {
return (
<Field
key={field.key}
@@ -153,9 +138,7 @@ function WidgetConfigFields({
>
<Select
value={String(value)}
onValueChange={(v) =>
onChange({ ...config, [field.key]: v })
}
onValueChange={(v) => onChange({ ...config, [field.key]: v })}
>
<SelectTrigger id={field.key}>
<SelectValue />
@@ -342,9 +325,7 @@ export function WidgetConfigDialog({ open, onClose }: Props) {
setDraft({
...draft,
sort_order:
e.target.value === ""
? 0
: Number(e.target.value),
e.target.value === "" ? 0 : Number(e.target.value),
})
}
/>
@@ -387,9 +368,7 @@ export function WidgetConfigDialog({ open, onClose }: Props) {
) : (
<div className="flex flex-col gap-2">
{sortedInstances.map((instance, index) => {
const typeDef = getWidgetDefinition(
instance.widget_type,
);
const typeDef = getWidgetDefinition(instance.widget_type);
return (
<div
key={instance.id}
@@ -397,16 +376,12 @@ export function WidgetConfigDialog({ open, onClose }: Props) {
>
<div className="flex flex-1 flex-col gap-1">
<div className="flex items-center gap-2">
<span className="font-medium">
{instance.title}
</span>
<span className="font-medium">{instance.title}</span>
<Badge variant="outline">
{typeDef?.name ?? instance.widget_type}
</Badge>
{!instance.enabled ? (
<Badge variant="secondary">
disabled
</Badge>
<Badge variant="secondary">disabled</Badge>
) : null}
</div>
</div>
@@ -416,9 +391,7 @@ export function WidgetConfigDialog({ open, onClose }: Props) {
size="icon"
className="h-8 w-8"
disabled={index === 0}
onClick={() =>
moveInstance(index, -1)
}
onClick={() => moveInstance(index, -1)}
>
<ChevronUp className="h-4 w-4" />
</Button>
@@ -426,30 +399,21 @@ export function WidgetConfigDialog({ open, onClose }: Props) {
variant="ghost"
size="icon"
className="h-8 w-8"
disabled={
index ===
sortedInstances.length - 1
}
onClick={() =>
moveInstance(index, 1)
}
disabled={index === sortedInstances.length - 1}
onClick={() => moveInstance(index, 1)}
>
<ChevronDown className="h-4 w-4" />
</Button>
<Switch
checked={instance.enabled}
onCheckedChange={() =>
toggleEnabled(instance)
}
onCheckedChange={() => toggleEnabled(instance)}
aria-label={`Toggle ${instance.title}`}
/>
<Button
variant="ghost"
size="icon"
className="h-8 w-8"
onClick={() =>
startEdit(instance)
}
onClick={() => startEdit(instance)}
>
<Pencil className="h-4 w-4" />
</Button>
@@ -457,9 +421,7 @@ export function WidgetConfigDialog({ open, onClose }: Props) {
variant="ghost"
size="icon"
className="h-8 w-8 text-destructive"
onClick={() =>
removeInstance(instance)
}
onClick={() => removeInstance(instance)}
>
<Trash2 className="h-4 w-4" />
</Button>
+1 -3
View File
@@ -19,9 +19,7 @@ export function AddonPage() {
if (!Page) {
return (
<Alert>
<AlertDescription>
Addon "{addonId}" is not installed.
</AlertDescription>
<AlertDescription>Addon "{addonId}" is not installed.</AlertDescription>
</Alert>
);
}
+4 -13
View File
@@ -139,9 +139,7 @@ function ShortcutDialog({
<Input
id="shortcut-icon"
value={draft.icon}
onChange={(e) =>
onChange({ ...draft, icon: e.target.value })
}
onChange={(e) => onChange({ ...draft, icon: e.target.value })}
/>
</Field>
</div>
@@ -183,9 +181,7 @@ function ShortcutDialog({
<Input
id="shortcut-url"
value={draft.url}
onChange={(e) =>
onChange({ ...draft, url: e.target.value })
}
onChange={(e) => onChange({ ...draft, url: e.target.value })}
/>
</Field>
) : draft.shortcut_type === "action" ? (
@@ -237,9 +233,7 @@ function ShortcutDialog({
<Input
id="shortcut-notes"
value={draft.notes}
onChange={(e) =>
onChange({ ...draft, notes: e.target.value })
}
onChange={(e) => onChange({ ...draft, notes: e.target.value })}
/>
</Field>
<div className="flex items-center gap-2">
@@ -385,10 +379,7 @@ export function Dashboard() {
description="Quick links to websites today, with room for action and user shortcuts later."
action={
<div className="flex gap-2">
<Button
variant="outline"
onClick={() => setWidgetDialogOpen(true)}
>
<Button variant="outline" onClick={() => setWidgetDialogOpen(true)}>
Edit dashboard
</Button>
<Button variant="outline" onClick={openCreateShortcut}>