Skip to content

Commit a272598

Browse files
committed
fix(dashboard): use power-off icon for disable actions
1 parent 5b5a6e9 commit a272598

File tree

5 files changed

+11
-11
lines changed

5 files changed

+11
-11
lines changed

dashboard/src/components/groups/group-actions-menu.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { useTranslation } from 'react-i18next'
33
import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuSeparator, DropdownMenuTrigger } from '@/components/ui/dropdown-menu'
44
import { Button } from '@/components/ui/button'
55
import { AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogTitle } from '@/components/ui/alert-dialog'
6-
import { MoreVertical, Pencil, Power, Trash2 } from 'lucide-react'
6+
import { MoreVertical, Pencil, Power, PowerOff, Trash2 } from 'lucide-react'
77
import { toast } from 'sonner'
88
import { queryClient } from '@/utils/query-client'
99
import { GroupResponse, useRemoveGroup } from '@/service/api'
@@ -80,7 +80,7 @@ export default function GroupActionsMenu({ group, onEdit, onToggleStatus, classN
8080
<div className={className} onClick={e => e.stopPropagation()}>
8181
<DropdownMenu>
8282
<DropdownMenuTrigger asChild>
83-
<Button variant="ghost" size="icon" className="h-7 w-7 sm:h-8 sm:w-8">
83+
<Button type="button" variant="ghost" size="icon" className="h-7 w-7 sm:h-8 sm:w-8">
8484
<MoreVertical className="h-3.5 w-3.5 sm:h-4 sm:w-4" />
8585
</Button>
8686
</DropdownMenuTrigger>
@@ -100,7 +100,7 @@ export default function GroupActionsMenu({ group, onEdit, onToggleStatus, classN
100100
onToggleStatus(group)
101101
}}
102102
>
103-
<Power className={cn('h-4 w-4 shrink-0', dir === 'rtl' ? 'ml-2' : 'mr-2')} />
103+
{group.is_disabled ? <Power className={cn('h-4 w-4 shrink-0', dir === 'rtl' ? 'ml-2' : 'mr-2')} /> : <PowerOff className={cn('h-4 w-4 shrink-0', dir === 'rtl' ? 'ml-2' : 'mr-2')} />}
104104
<span className="min-w-0 truncate">{group.is_disabled ? t('enable') : t('disable')}</span>
105105
</DropdownMenuItem>
106106
<DropdownMenuSeparator />

dashboard/src/components/groups/group.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import { useRemoveGroup } from '@/service/api'
66
import { toast } from 'sonner'
77
import { AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogTitle } from '@/components/ui/alert-dialog'
88
import { useState } from 'react'
9-
import { MoreVertical, Pencil, Power, Trash2 } from 'lucide-react'
9+
import { MoreVertical, Pencil, Power, PowerOff, Trash2 } from 'lucide-react'
1010
import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuSeparator, DropdownMenuTrigger } from '@/components/ui/dropdown-menu'
1111
import { cn } from '@/lib/utils'
1212
import useDirDetection from '@/hooks/use-dir-detection'
@@ -109,7 +109,7 @@ export default function Group({ group, onEdit, onToggleStatus, selectionControl,
109109
onToggleStatus(group)
110110
}}
111111
>
112-
<Power className="mr-2 h-4 w-4" />
112+
{group.is_disabled ? <Power className="mr-2 h-4 w-4" /> : <PowerOff className="mr-2 h-4 w-4" />}
113113
{group.is_disabled ? t('enable') : t('disable')}
114114
</DropdownMenuItem>
115115
<DropdownMenuSeparator />

dashboard/src/components/hosts/host-actions-menu.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { useState } from 'react'
22
import { useTranslation } from 'react-i18next'
33
import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuSeparator, DropdownMenuTrigger } from '@/components/ui/dropdown-menu'
44
import { Button } from '@/components/ui/button'
5-
import { Copy, MoreVertical, Pencil, Power, Trash2 } from 'lucide-react'
5+
import { Copy, MoreVertical, Pencil, Power, PowerOff, Trash2 } from 'lucide-react'
66
import { BaseHost, modifyHost, removeHost } from '@/service/api'
77
import { toast } from 'sonner'
88
import useDirDetection from '@/hooks/use-dir-detection'
@@ -159,7 +159,7 @@ export default function HostActionsMenu({ host, onEdit, onDuplicate, onDataChang
159159
handleToggleStatus()
160160
}}
161161
>
162-
<Power className={cn('h-4 w-4', dir === 'rtl' ? 'ml-2' : 'mr-2')} />
162+
{host?.is_disabled ? <Power className={cn('h-4 w-4', dir === 'rtl' ? 'ml-2' : 'mr-2')} /> : <PowerOff className={cn('h-4 w-4', dir === 'rtl' ? 'ml-2' : 'mr-2')} />}
163163
{host?.is_disabled ? t('enable') : t('disable')}
164164
</DropdownMenuItem>
165165
<DropdownMenuSeparator />

dashboard/src/components/nodes/node-actions-menu.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { useTranslation } from 'react-i18next'
33
import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuSeparator, DropdownMenuTrigger } from '@/components/ui/dropdown-menu'
44
import { Button } from '@/components/ui/button'
55
import { AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogTitle } from '@/components/ui/alert-dialog'
6-
import { Activity, CircleFadingArrowUp, Loader2, Map, MoreVertical, Package, Pencil, Power, RefreshCcw, RotateCcw, Trash2, Wifi } from 'lucide-react'
6+
import { Activity, CircleFadingArrowUp, Loader2, Map, MoreVertical, Package, Pencil, Power, PowerOff, RefreshCcw, RotateCcw, Trash2, Wifi } from 'lucide-react'
77
import { toast } from 'sonner'
88
import { queryClient } from '@/utils/query-client'
99
import { CoresSimpleResponse, NodeResponse, useReconnectNode, useRemoveNode, useResetNodeUsage, useSyncNode, useUpdateNode } from '@/service/api'
@@ -232,7 +232,7 @@ export default function NodeActionsMenu({ node, onEdit, onToggleStatus, coresDat
232232
onToggleStatus(node)
233233
}}
234234
>
235-
<Power className="mr-2 h-4 w-4 shrink-0" />
235+
{node.status === 'disabled' ? <Power className="mr-2 h-4 w-4 shrink-0" /> : <PowerOff className="mr-2 h-4 w-4 shrink-0" />}
236236
<span className="min-w-0 truncate">{node.status === 'disabled' ? t('enable') : t('disable')}</span>
237237
</DropdownMenuItem>
238238
<DropdownMenuSeparator />

dashboard/src/components/templates/user-template-actions-menu.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { useState } from 'react'
22
import { useTranslation } from 'react-i18next'
33
import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuSeparator, DropdownMenuTrigger } from '@/components/ui/dropdown-menu'
44
import { Button } from '@/components/ui/button'
5-
import { Copy, EllipsisVertical, Pen, Power, Trash2 } from 'lucide-react'
5+
import { Copy, EllipsisVertical, Pen, Power, PowerOff, Trash2 } from 'lucide-react'
66
import useDirDetection from '@/hooks/use-dir-detection'
77
import { AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogTitle } from '@/components/ui/alert-dialog'
88
import { cn } from '@/lib/utils'
@@ -126,7 +126,7 @@ export default function UserTemplateActionsMenu({ template, onEdit, onToggleStat
126126
onToggleStatus(template)
127127
}}
128128
>
129-
<Power className="h-4 w-4" />
129+
{template.is_disabled ? <Power className="h-4 w-4" /> : <PowerOff className="h-4 w-4" />}
130130
{template.is_disabled ? t('enable') : t('disable')}
131131
</DropdownMenuItem>
132132
<DropdownMenuItem

0 commit comments

Comments
 (0)