Skip to content

Commit 4dcdf7f

Browse files
authored
feat(web): add local file access indicator to instance cards (#911)
1 parent 5d124c0 commit 4dcdf7f

3 files changed

Lines changed: 48 additions & 17 deletions

File tree

web/src/components/instances/InstanceCard.tsx

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ import {
4040
Edit,
4141
Eye,
4242
EyeOff,
43+
HardDrive,
4344
MoreVertical,
4445
Power,
4546
RefreshCw,
@@ -312,6 +313,16 @@ export function InstanceCard({
312313
{instance.tlsSkipVerify ? "Skipped" : "Strict"}
313314
</span>
314315
</div>
316+
<div className="flex justify-between items-center">
317+
<span className="text-muted-foreground">Local File Access:</span>
318+
<span className={cn(
319+
"flex items-center gap-1",
320+
instance.hasLocalFilesystemAccess ? "text-primary" : "text-muted-foreground"
321+
)}>
322+
<HardDrive className="h-3 w-3" />
323+
{instance.hasLocalFilesystemAccess ? "Enabled" : "Disabled"}
324+
</span>
325+
</div>
315326
</div>
316327

317328
<InstanceErrorDisplay instance={instance} onEdit={onEdit} showEditButton={true} compact />

web/src/components/instances/InstanceSettingsButton.tsx

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,10 @@
33
* SPDX-License-Identifier: GPL-2.0-or-later
44
*/
55

6+
import { Tooltip, TooltipContent, TooltipTrigger } from "@/components/ui/tooltip"
7+
import { Cog } from "lucide-react"
68
import { useState } from "react"
7-
import { Button } from "@/components/ui/button"
8-
import { Tooltip, TooltipTrigger, TooltipContent } from "@/components/ui/tooltip"
99
import { InstancePreferencesDialog } from "./preferences/InstancePreferencesDialog"
10-
import { Cog } from "lucide-react"
1110

1211
interface InstanceSettingsButtonProps {
1312
instanceId: number
@@ -36,14 +35,20 @@ export function InstanceSettingsButton({
3635
{showButton && (
3736
<Tooltip>
3837
<TooltipTrigger asChild>
39-
<Button
40-
variant="ghost"
41-
size="icon"
42-
className="h-6 w-6 p-0"
38+
<span
39+
role="button"
40+
tabIndex={0}
41+
className="cursor-pointer"
4342
onClick={handleClick}
43+
onKeyDown={(e) => {
44+
if (e.key === "Enter" || e.key === " ") {
45+
e.preventDefault()
46+
handleClick(e as unknown as React.MouseEvent)
47+
}
48+
}}
4449
>
4550
<Cog className="h-4 w-4" />
46-
</Button>
51+
</span>
4752
</TooltipTrigger>
4853
<TooltipContent>
4954
Instance Settings

web/src/pages/Dashboard.tsx

Lines changed: 24 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,8 @@ import {
3232
} from "@/components/ui/dialog"
3333
import { Input } from "@/components/ui/input"
3434
import { Label } from "@/components/ui/label"
35-
import { Table, TableBody, TableCell, TableHead, TableHeader, TableRow } from "@/components/ui/table"
3635
import { ScrollArea } from "@/components/ui/scroll-area"
36+
import { Table, TableBody, TableCell, TableHead, TableHeader, TableRow } from "@/components/ui/table"
3737
import { Textarea } from "@/components/ui/textarea"
3838
import { Tooltip, TooltipContent, TooltipTrigger } from "@/components/ui/tooltip"
3939
import { TrackerIconImage } from "@/components/ui/tracker-icon"
@@ -266,7 +266,7 @@ function InstanceCard({
266266
</CardTitle>
267267
<ExternalLink className="h-3.5 w-3.5 text-muted-foreground shrink-0" />
268268
</Link>
269-
<div className="flex items-center gap-1 justify-end shrink-0 basis-full sm:basis-auto sm:min-w-[4.5rem]">
269+
<div className="flex items-center gap-1.5 justify-end shrink-0 basis-full sm:basis-auto sm:min-w-[4.5rem]">
270270
{instance.reannounceSettings?.enabled && (
271271
<Tooltip>
272272
<TooltipTrigger asChild>
@@ -280,29 +280,44 @@ function InstanceCard({
280280
{instance.connected && !isFirstLoad && (
281281
<Tooltip>
282282
<TooltipTrigger asChild>
283-
<Button
284-
variant="ghost"
285-
size="sm"
283+
<span
284+
role="button"
285+
tabIndex={0}
286286
onClick={(e) => {
287287
e.preventDefault()
288288
e.stopPropagation()
289-
setShowSpeedLimitDialog(true)
289+
if (!isToggling) setShowSpeedLimitDialog(true)
290290
}}
291-
disabled={isToggling}
292-
className="h-8 w-8 p-0 shrink-0"
291+
onKeyDown={(e) => {
292+
if ((e.key === "Enter" || e.key === " ") && !isToggling) {
293+
e.preventDefault()
294+
setShowSpeedLimitDialog(true)
295+
}
296+
}}
297+
className={`cursor-pointer ${isToggling ? "opacity-50" : ""}`}
293298
>
294299
{altSpeedEnabled ? (
295300
<Turtle className="h-4 w-4 text-orange-600" />
296301
) : (
297302
<Rabbit className="h-4 w-4 text-green-600" />
298303
)}
299-
</Button>
304+
</span>
300305
</TooltipTrigger>
301306
<TooltipContent>
302307
Alternative speed limits: {altSpeedEnabled ? "On" : "Off"}
303308
</TooltipContent>
304309
</Tooltip>
305310
)}
311+
{instance.hasLocalFilesystemAccess && (
312+
<Tooltip>
313+
<TooltipTrigger asChild>
314+
<HardDrive className="h-4 w-4 text-primary" />
315+
</TooltipTrigger>
316+
<TooltipContent>
317+
Local file access enabled
318+
</TooltipContent>
319+
</Tooltip>
320+
)}
306321
<InstanceSettingsButton
307322
instanceId={instance.id}
308323
instanceName={instance.name}

0 commit comments

Comments
 (0)