mirror of
https://github.com/navidrome/navidrome.git
synced 2026-10-14 13:27:09 +02:00
Since #6160 dates follow the selected UI language, which is wrong for users who run the UI in one language but want their own region's date format. The Personal page now has a Date Format select with "Match language" (default, current behavior) and "Match browser". The choice is kept in localStorage and read by useDateLocale, which returns no locale in browser mode so Intl uses the browser's own. Six screens imported react-admin's DateField directly and so ignored the language setting (playlist, radio and missing files lists, album table, song and album info). They now use the common DateField wrapper, which also reads the record from the record context.
86 lines
2.1 KiB
JavaScript
86 lines
2.1 KiB
JavaScript
import {
|
|
DateField,
|
|
List,
|
|
Pagination,
|
|
SizeField,
|
|
getStoredPerPage,
|
|
useResourceRefresh,
|
|
} from '../common/index'
|
|
import {
|
|
Datagrid,
|
|
TextField,
|
|
downloadCSV,
|
|
Filter,
|
|
ReferenceInput,
|
|
useTranslate,
|
|
SelectInput,
|
|
} from 'react-admin'
|
|
import jsonExport from 'jsonexport/dist'
|
|
import DeleteMissingFilesButton from './DeleteMissingFilesButton.jsx'
|
|
import MissingListActions from './MissingListActions.jsx'
|
|
import React from 'react'
|
|
|
|
const exporter = (files) => {
|
|
const filesToExport = files.map((file) => {
|
|
const { path } = file
|
|
return { path }
|
|
})
|
|
jsonExport(filesToExport, { includeHeaders: false }, (err, csv) => {
|
|
downloadCSV(csv, 'navidrome_missing_files')
|
|
})
|
|
}
|
|
|
|
const MissingFilesFilter = (props) => {
|
|
const translate = useTranslate()
|
|
return (
|
|
<Filter {...props} variant={'outlined'}>
|
|
<ReferenceInput
|
|
label={translate('resources.missing.fields.libraryName')}
|
|
source="library_id"
|
|
reference="library"
|
|
sort={{ field: 'name', order: 'ASC' }}
|
|
filterToQuery={(searchText) => ({ name: [searchText] })}
|
|
alwaysOn
|
|
>
|
|
<SelectInput emptyText="-- All --" optionText="name" />
|
|
</ReferenceInput>
|
|
</Filter>
|
|
)
|
|
}
|
|
|
|
const BulkActionButtons = (props) => (
|
|
<>
|
|
<DeleteMissingFilesButton {...props} />
|
|
</>
|
|
)
|
|
|
|
const missingPerPageOptions = [50, 100, 200]
|
|
|
|
const MissingPagination = (props) => (
|
|
<Pagination rowsPerPageOptions={missingPerPageOptions} {...props} />
|
|
)
|
|
|
|
const MissingFilesList = (props) => {
|
|
useResourceRefresh('song')
|
|
return (
|
|
<List
|
|
{...props}
|
|
sort={{ field: 'updated_at', order: 'DESC' }}
|
|
exporter={exporter}
|
|
actions={<MissingListActions />}
|
|
filters={<MissingFilesFilter />}
|
|
bulkActionButtons={<BulkActionButtons />}
|
|
perPage={getStoredPerPage('missing', missingPerPageOptions)}
|
|
pagination={<MissingPagination />}
|
|
>
|
|
<Datagrid>
|
|
<TextField source={'libraryName'} />
|
|
<TextField source={'path'} />
|
|
<SizeField source={'size'} />
|
|
<DateField source={'updatedAt'} showTime />
|
|
</Datagrid>
|
|
</List>
|
|
)
|
|
}
|
|
|
|
export default MissingFilesList
|