mirror of
https://github.com/navidrome/navidrome.git
synced 2026-05-03 06:51:16 +00:00
feat(plugins): rename ErrorIndicator to EnabledOrErrorField and enhance error handling logic
Signed-off-by: Deluan <deluan@navidrome.org>
This commit is contained in:
parent
9b9920402e
commit
c7d37c4e8c
@ -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>
|
||||||
)}
|
)}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user