feat(plugins): rename ErrorIndicator to EnabledOrErrorField and enhance error handling logic

Signed-off-by: Deluan <deluan@navidrome.org>
This commit is contained in:
Deluan 2025-12-28 16:31:54 -05:00
parent 9b9920402e
commit c7d37c4e8c

View File

@ -23,15 +23,12 @@ const useStyles = makeStyles((theme) => ({
}, },
})) }))
const ErrorIndicator = () => { const EnabledOrErrorField = () => {
const record = useRecordContext() const record = useRecordContext()
const translate = useTranslate() const translate = useTranslate()
const classes = useStyles() const classes = useStyles()
if (!record.lastError) { if (record.lastError) {
return null
}
return ( return (
<Tooltip title={record.lastError}> <Tooltip title={record.lastError}>
<Chip <Chip
@ -44,6 +41,9 @@ const ErrorIndicator = () => {
) )
} }
return <ToggleEnabledSwitch source={'enabled'} />
}
const useManifest = () => { const useManifest = () => {
const record = useRecordContext() const record = useRecordContext()
return useMemo(() => { return useMemo(() => {
@ -96,8 +96,7 @@ const PluginList = (props) => {
<ManifestField source="name" /> <ManifestField source="name" />
{!isXsmall && <ManifestField source="description" />} {!isXsmall && <ManifestField source="description" />}
<ManifestField source="version" /> <ManifestField source="version" />
<ToggleEnabledSwitch source={'enabled'} /> <EnabledOrErrorField source={'enabled'} />
<ErrorIndicator source="lastError" />
<DateField source="updatedAt" sortByOrder={'DESC'} /> <DateField source="updatedAt" sortByOrder={'DESC'} />
</Datagrid> </Datagrid>
)} )}