feat(ui): add remove all missing files functionality (#4108)

* Add remove all missing files feature

* test: update mediafile_repository tests for missing files deletion

Signed-off-by: Deluan <deluan@navidrome.org>

---------

Signed-off-by: Deluan <deluan@navidrome.org>
This commit is contained in:
Deluan Quintão
2025-05-22 22:28:10 -04:00
committed by GitHub
parent 992c78376c
commit 3ccc02f375
8 changed files with 119 additions and 17 deletions

View File

@@ -29,13 +29,14 @@ const useStyles = makeStyles(
)
const DeleteMissingFilesButton = (props) => {
const { selectedIds, className } = props
const { selectedIds, className, deleteAll = false } = props
const [open, setOpen] = useState(false)
const unselectAll = useUnselectAll()
const refresh = useRefresh()
const notify = useNotify()
const [deleteMany, { loading }] = useDeleteMany('missing', selectedIds, {
const ids = deleteAll ? [] : selectedIds
const [deleteMany, { loading }] = useDeleteMany('missing', ids, {
onSuccess: () => {
notify('resources.missing.notifications.removed')
refresh()
@@ -57,7 +58,11 @@ const DeleteMissingFilesButton = (props) => {
<>
<Button
onClick={handleClick}
label="ra.action.remove"
label={
deleteAll
? 'resources.missing.actions.remove_all'
: 'ra.action.remove'
}
key="button"
className={clsx('ra-delete-button', classes.deleteButton, className)}
>
@@ -66,8 +71,16 @@ const DeleteMissingFilesButton = (props) => {
<Confirm
isOpen={open}
loading={loading}
title="message.remove_missing_title"
content="message.remove_missing_content"
title={
deleteAll
? 'message.remove_all_missing_title'
: 'message.remove_missing_title'
}
content={
deleteAll
? 'message.remove_all_missing_content'
: 'message.remove_missing_content'
}
onConfirm={handleConfirm}
onClose={handleDialogClose}
/>