mirror of
https://github.com/navidrome/navidrome.git
synced 2026-11-12 05:08:45 +01:00
feat(plugins): surface the valid agent names in logs and the Plugins UI (#5910)
The agent name used in the `Agents` config option comes from the .ndp file name, not from the manifest. The Plugins UI showed the ID but never said what it was for, so renaming a plugin file silently breaks the config with only a Debug-level "Unknown agent ignored" line to go on. Add a caption under the ID in the Plugins UI, and list the accepted names alongside the rejected one in that log line. Related to navidrome/apple-music-plugin#14
This commit is contained in:
parent
59448e9283
commit
b134f16fd5
7 changed files with 81 additions and 2 deletions
|
|
@ -123,6 +123,13 @@ export const InfoCard = ({ record, manifest, classes, translate, isSmall }) => (
|
|||
isSmall={isSmall}
|
||||
>
|
||||
{record.id}
|
||||
<Typography
|
||||
variant="caption"
|
||||
color="textSecondary"
|
||||
className={classes.fieldHelp}
|
||||
>
|
||||
{translate('resources.plugin.messages.idHelp')}
|
||||
</Typography>
|
||||
</InfoRow>
|
||||
|
||||
{manifest?.name && (
|
||||
|
|
@ -201,7 +208,7 @@ export const InfoCard = ({ record, manifest, classes, translate, isSmall }) => (
|
|||
<Typography
|
||||
variant="caption"
|
||||
color="textSecondary"
|
||||
style={{ marginTop: 4, display: 'block' }}
|
||||
className={classes.fieldHelp}
|
||||
>
|
||||
{translate('resources.plugin.messages.clickPermissions')}
|
||||
</Typography>
|
||||
|
|
|
|||
41
ui/src/plugin/InfoCard.test.jsx
Normal file
41
ui/src/plugin/InfoCard.test.jsx
Normal file
|
|
@ -0,0 +1,41 @@
|
|||
import React from 'react'
|
||||
import { render, screen } from '@testing-library/react'
|
||||
import { describe, it, expect, vi } from 'vitest'
|
||||
|
||||
vi.mock('../common', () => ({
|
||||
DateField: ({ source }) => <span data-testid={`date-${source}`} />,
|
||||
}))
|
||||
|
||||
const { InfoCard } = await import('./InfoCard')
|
||||
|
||||
const record = {
|
||||
id: 'apple-music',
|
||||
path: '/data/plugins/apple-music.ndp',
|
||||
updatedAt: '2026-01-01T00:00:00Z',
|
||||
createdAt: '2026-01-01T00:00:00Z',
|
||||
}
|
||||
|
||||
const renderCard = () =>
|
||||
render(
|
||||
<InfoCard
|
||||
record={record}
|
||||
manifest={{ name: 'Apple Music Metadata Agent' }}
|
||||
classes={{}}
|
||||
translate={(key) => key}
|
||||
isSmall={false}
|
||||
/>,
|
||||
)
|
||||
|
||||
describe('InfoCard', () => {
|
||||
it('shows the plugin ID', () => {
|
||||
renderCard()
|
||||
expect(screen.getByText('apple-music')).toBeInTheDocument()
|
||||
})
|
||||
|
||||
it('explains that the ID is the name used in config options', () => {
|
||||
renderCard()
|
||||
expect(
|
||||
screen.getByText('resources.plugin.messages.idHelp'),
|
||||
).toBeInTheDocument()
|
||||
})
|
||||
})
|
||||
|
|
@ -45,6 +45,10 @@ export const usePluginShowStyles = makeStyles(
|
|||
fontSize: '0.85rem',
|
||||
wordBreak: 'break-all',
|
||||
},
|
||||
fieldHelp: {
|
||||
marginTop: theme.spacing(0.5),
|
||||
display: 'block',
|
||||
},
|
||||
permissionsContainer: {
|
||||
display: 'flex',
|
||||
flexWrap: 'wrap',
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue