fix(backups): разделить загрузку каталогов и права действий
This commit is contained in:
1 parent
b460997cbf
commit
3dcc7c9ea6
11 files changed
+259
-91
No files matched your search
@@ -32,6 +32,8 @@ interface BackupsDataGridProps {
|
||||
onDownload: (id: string, filename: string) => void
|
||||
onRestore: (backup: Backup) => void
|
||||
onDelete: (backup: Backup) => void
|
||||
canWrite?: boolean
|
||||
canDownload?: boolean
|
||||
emptyAction?: ReactNode
|
||||
emptyTitle?: string
|
||||
emptyDescription?: string
|
||||
@@ -48,6 +50,8 @@ function BackupsDataGrid({
|
||||
onDownload,
|
||||
onRestore,
|
||||
onDelete,
|
||||
canWrite = true,
|
||||
canDownload = true,
|
||||
emptyAction,
|
||||
emptyTitle = "Нет бэкапов",
|
||||
emptyDescription = "Создайте первый бэкап вручную или настройте расписание",
|
||||
@@ -191,6 +195,7 @@ function BackupsDataGrid({
|
||||
className="size-7"
|
||||
title="Скачать"
|
||||
aria-label={`Скачать ${b.filename}`}
|
||||
disabled={!canDownload}
|
||||
onClick={() => onDownload(b.id, b.filename)}
|
||||
>
|
||||
<DownloadIcon className="size-3.5" />
|
||||
@@ -202,6 +207,7 @@ function BackupsDataGrid({
|
||||
className="size-7"
|
||||
title="Восстановить"
|
||||
aria-label={`Восстановить ${b.filename}`}
|
||||
disabled={!canWrite || !b.serverId}
|
||||
onClick={() => onRestore(b)}
|
||||
>
|
||||
<RefreshCwIcon className="size-3.5" />
|
||||
@@ -213,6 +219,7 @@ function BackupsDataGrid({
|
||||
className="size-7 text-destructive hover:text-destructive"
|
||||
title="Удалить"
|
||||
aria-label={`Удалить ${b.filename}`}
|
||||
disabled={!canWrite}
|
||||
onClick={() => onDelete(b)}
|
||||
>
|
||||
<Trash2Icon className="size-3.5" />
|
||||
@@ -228,7 +235,7 @@ function BackupsDataGrid({
|
||||
},
|
||||
},
|
||||
],
|
||||
[onDelete, onDownload, onRestore],
|
||||
[onDelete, onDownload, onRestore, canWrite, canDownload],
|
||||
)
|
||||
|
||||
const table = useTable({
|
||||
|
||||
Reference in new issue
Block a user