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,25 +23,25 @@ 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 (
|
||||||
|
<Tooltip title={record.lastError}>
|
||||||
|
<Chip
|
||||||
|
size="small"
|
||||||
|
icon={<MdError className={classes.errorIcon} />}
|
||||||
|
label={translate('resources.plugin.fields.hasError')}
|
||||||
|
className={classes.errorChip}
|
||||||
|
/>
|
||||||
|
</Tooltip>
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return <ToggleEnabledSwitch source={'enabled'} />
|
||||||
<Tooltip title={record.lastError}>
|
|
||||||
<Chip
|
|
||||||
size="small"
|
|
||||||
icon={<MdError className={classes.errorIcon} />}
|
|
||||||
label={translate('resources.plugin.fields.hasError')}
|
|
||||||
className={classes.errorChip}
|
|
||||||
/>
|
|
||||||
</Tooltip>
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const useManifest = () => {
|
const useManifest = () => {
|
||||||
@ -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