mirror of
https://github.com/navidrome/navidrome.git
synced 2026-10-28 14:17:10 +01:00
lint
Signed-off-by: Deluan <deluan@navidrome.org>
This commit is contained in:
parent
5a78c6e49a
commit
daa3648b06
5 changed files with 18 additions and 13 deletions
|
|
@ -51,4 +51,4 @@ const DeleteLibraryButton = ({ record, resource, basePath, ...props }) => {
|
|||
)
|
||||
}
|
||||
|
||||
export default DeleteLibraryButton
|
||||
export default DeleteLibraryButton
|
||||
|
|
|
|||
|
|
@ -41,11 +41,11 @@ const LibraryCreate = (props) => {
|
|||
if (error.body && error.body.errors) {
|
||||
return error.body.errors
|
||||
}
|
||||
|
||||
|
||||
// Handle other structured errors from the server
|
||||
if (error.body && error.body.error) {
|
||||
const errorMsg = error.body.error
|
||||
|
||||
|
||||
// Handle database constraint violations
|
||||
if (errorMsg.includes('UNIQUE constraint failed: library.name')) {
|
||||
return { name: 'ra.validation.unique' }
|
||||
|
|
@ -53,14 +53,15 @@ const LibraryCreate = (props) => {
|
|||
if (errorMsg.includes('UNIQUE constraint failed: library.path')) {
|
||||
return { path: 'ra.validation.unique' }
|
||||
}
|
||||
|
||||
|
||||
// Show a general notification for other server errors
|
||||
notify(errorMsg, 'error')
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
// Fallback for unexpected error formats
|
||||
const fallbackMessage = error.message ||
|
||||
const fallbackMessage =
|
||||
error.message ||
|
||||
(typeof error === 'string' ? error : 'An unexpected error occurred')
|
||||
notify(fallbackMessage, 'error')
|
||||
}
|
||||
|
|
@ -78,4 +79,4 @@ const LibraryCreate = (props) => {
|
|||
)
|
||||
}
|
||||
|
||||
export default LibraryCreate
|
||||
export default LibraryCreate
|
||||
|
|
|
|||
|
|
@ -119,12 +119,11 @@ const LibraryEdit = (props) => {
|
|||
fullWidth
|
||||
disabled={isFirstLibrary}
|
||||
/>
|
||||
|
||||
<Divider className={classes.divider} fullWidth />
|
||||
|
||||
<Typography variant="h6" gutterBottom>
|
||||
Statistics
|
||||
</Typography>
|
||||
{/*eslint-disable-next-line react/no-unknown-property*/}
|
||||
<div className={classes.stats} fullWidth>
|
||||
<div>
|
||||
<Typography variant="caption" display="block" color="textSecondary">
|
||||
|
|
@ -178,6 +177,7 @@ const LibraryEdit = (props) => {
|
|||
</div>
|
||||
</div>
|
||||
<Divider className={classes.divider} fullWidth />
|
||||
{/*eslint-disable-next-line react/no-unknown-property*/}
|
||||
<div className={classes.stats} fullWidth>
|
||||
<div>
|
||||
<Typography variant="caption" display="block" color="textSecondary">
|
||||
|
|
|
|||
|
|
@ -40,11 +40,15 @@ const LibraryList = (props) => {
|
|||
<NumberField source="totalSongs" label="Songs" />
|
||||
<NumberField source="totalAlbums" label="Albums" />
|
||||
<NumberField source="totalMissingFiles" label="Missing Files" />
|
||||
<DateField source="lastScanAt" label="Last Scan" sortByOrder={'DESC'} />
|
||||
<DateField
|
||||
source="lastScanAt"
|
||||
label="Last Scan"
|
||||
sortByOrder={'DESC'}
|
||||
/>
|
||||
</Datagrid>
|
||||
)}
|
||||
</List>
|
||||
)
|
||||
}
|
||||
|
||||
export default LibraryList
|
||||
export default LibraryList
|
||||
|
|
|
|||
|
|
@ -1,9 +1,9 @@
|
|||
import LibraryList from './LibraryList'
|
||||
import LibraryEdit from './LibraryEdit'
|
||||
import LibraryCreate from './LibraryCreate'
|
||||
|
||||
|
||||
export default {
|
||||
list: LibraryList,
|
||||
edit: LibraryEdit,
|
||||
create: LibraryCreate,
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue