mirror of
https://github.com/navidrome/navidrome.git
synced 2025-06-03 17:11:08 +03:00
feat(ui): add missing filter for admin users in album, artist, and song lists
Signed-off-by: Deluan <deluan@navidrome.org>
This commit is contained in:
parent
5ade9344ff
commit
c98e4d02cb
@ -33,7 +33,8 @@
|
|||||||
"participants": "Outros Participantes",
|
"participants": "Outros Participantes",
|
||||||
"tags": "Outras Tags",
|
"tags": "Outras Tags",
|
||||||
"mappedTags": "Tags mapeadas",
|
"mappedTags": "Tags mapeadas",
|
||||||
"rawTags": "Tags originais"
|
"rawTags": "Tags originais",
|
||||||
|
"missing": "Ausente"
|
||||||
},
|
},
|
||||||
"actions": {
|
"actions": {
|
||||||
"addToQueue": "Adicionar à fila",
|
"addToQueue": "Adicionar à fila",
|
||||||
@ -72,7 +73,8 @@
|
|||||||
"releaseType": "Tipo",
|
"releaseType": "Tipo",
|
||||||
"grouping": "Agrupamento",
|
"grouping": "Agrupamento",
|
||||||
"media": "Mídia",
|
"media": "Mídia",
|
||||||
"mood": "Mood"
|
"mood": "Mood",
|
||||||
|
"missing": "Ausente"
|
||||||
},
|
},
|
||||||
"actions": {
|
"actions": {
|
||||||
"playAll": "Tocar",
|
"playAll": "Tocar",
|
||||||
@ -104,7 +106,8 @@
|
|||||||
"rating": "Classificação",
|
"rating": "Classificação",
|
||||||
"genre": "Gênero",
|
"genre": "Gênero",
|
||||||
"size": "Tamanho",
|
"size": "Tamanho",
|
||||||
"role": "Role"
|
"role": "Role",
|
||||||
|
"missing": "Ausente"
|
||||||
},
|
},
|
||||||
"roles": {
|
"roles": {
|
||||||
"albumartist": "Artista do Álbum |||| Artistas do Álbum",
|
"albumartist": "Artista do Álbum |||| Artistas do Álbum",
|
||||||
|
@ -10,6 +10,7 @@ import {
|
|||||||
ReferenceArrayInput,
|
ReferenceArrayInput,
|
||||||
ReferenceInput,
|
ReferenceInput,
|
||||||
SearchInput,
|
SearchInput,
|
||||||
|
usePermissions,
|
||||||
useRefresh,
|
useRefresh,
|
||||||
useTranslate,
|
useTranslate,
|
||||||
useVersion,
|
useVersion,
|
||||||
@ -44,6 +45,8 @@ const useStyles = makeStyles({
|
|||||||
const AlbumFilter = (props) => {
|
const AlbumFilter = (props) => {
|
||||||
const classes = useStyles()
|
const classes = useStyles()
|
||||||
const translate = useTranslate()
|
const translate = useTranslate()
|
||||||
|
const { permissions } = usePermissions()
|
||||||
|
const isAdmin = permissions === 'admin'
|
||||||
return (
|
return (
|
||||||
<Filter {...props} variant={'outlined'}>
|
<Filter {...props} variant={'outlined'}>
|
||||||
<SearchInput id="search" source="name" alwaysOn />
|
<SearchInput id="search" source="name" alwaysOn />
|
||||||
@ -153,6 +156,7 @@ const AlbumFilter = (props) => {
|
|||||||
defaultValue={true}
|
defaultValue={true}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
|
{isAdmin && <NullableBooleanInput source="missing" />}
|
||||||
</Filter>
|
</Filter>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
@ -11,6 +11,8 @@ import {
|
|||||||
SelectInput,
|
SelectInput,
|
||||||
TextField,
|
TextField,
|
||||||
useTranslate,
|
useTranslate,
|
||||||
|
NullableBooleanInput,
|
||||||
|
usePermissions,
|
||||||
} from 'react-admin'
|
} from 'react-admin'
|
||||||
import { useMediaQuery, withWidth } from '@material-ui/core'
|
import { useMediaQuery, withWidth } from '@material-ui/core'
|
||||||
import FavoriteIcon from '@material-ui/icons/Favorite'
|
import FavoriteIcon from '@material-ui/icons/Favorite'
|
||||||
@ -63,6 +65,8 @@ const useStyles = makeStyles({
|
|||||||
|
|
||||||
const ArtistFilter = (props) => {
|
const ArtistFilter = (props) => {
|
||||||
const translate = useTranslate()
|
const translate = useTranslate()
|
||||||
|
const { permissions } = usePermissions()
|
||||||
|
const isAdmin = permissions === 'admin'
|
||||||
const rolesObj = en?.resources?.artist?.roles
|
const rolesObj = en?.resources?.artist?.roles
|
||||||
const roles = Object.keys(rolesObj).reduce((acc, role) => {
|
const roles = Object.keys(rolesObj).reduce((acc, role) => {
|
||||||
acc.push({
|
acc.push({
|
||||||
@ -85,6 +89,7 @@ const ArtistFilter = (props) => {
|
|||||||
defaultValue={true}
|
defaultValue={true}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
|
{isAdmin && <NullableBooleanInput source="missing" />}
|
||||||
</Filter>
|
</Filter>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
@ -34,7 +34,8 @@
|
|||||||
"participants": "Additional participants",
|
"participants": "Additional participants",
|
||||||
"tags": "Additional Tags",
|
"tags": "Additional Tags",
|
||||||
"mappedTags": "Mapped tags",
|
"mappedTags": "Mapped tags",
|
||||||
"rawTags": "Raw tags"
|
"rawTags": "Raw tags",
|
||||||
|
"missing": "Missing"
|
||||||
},
|
},
|
||||||
"actions": {
|
"actions": {
|
||||||
"addToQueue": "Play Later",
|
"addToQueue": "Play Later",
|
||||||
@ -73,7 +74,8 @@
|
|||||||
"releaseType": "Type",
|
"releaseType": "Type",
|
||||||
"grouping": "Grouping",
|
"grouping": "Grouping",
|
||||||
"media": "Media",
|
"media": "Media",
|
||||||
"mood": "Mood"
|
"mood": "Mood",
|
||||||
|
"missing": "Missing"
|
||||||
},
|
},
|
||||||
"actions": {
|
"actions": {
|
||||||
"playAll": "Play",
|
"playAll": "Play",
|
||||||
@ -105,7 +107,8 @@
|
|||||||
"playCount": "Plays",
|
"playCount": "Plays",
|
||||||
"rating": "Rating",
|
"rating": "Rating",
|
||||||
"genre": "Genre",
|
"genre": "Genre",
|
||||||
"role": "Role"
|
"role": "Role",
|
||||||
|
"missing": "Missing"
|
||||||
},
|
},
|
||||||
"roles": {
|
"roles": {
|
||||||
"albumartist": "Album Artist |||| Album Artists",
|
"albumartist": "Album Artist |||| Album Artists",
|
||||||
|
@ -8,6 +8,8 @@ import {
|
|||||||
SearchInput,
|
SearchInput,
|
||||||
TextField,
|
TextField,
|
||||||
useTranslate,
|
useTranslate,
|
||||||
|
NullableBooleanInput,
|
||||||
|
usePermissions,
|
||||||
} from 'react-admin'
|
} from 'react-admin'
|
||||||
import { useMediaQuery } from '@material-ui/core'
|
import { useMediaQuery } from '@material-ui/core'
|
||||||
import FavoriteIcon from '@material-ui/icons/Favorite'
|
import FavoriteIcon from '@material-ui/icons/Favorite'
|
||||||
@ -67,6 +69,8 @@ const useStyles = makeStyles({
|
|||||||
const SongFilter = (props) => {
|
const SongFilter = (props) => {
|
||||||
const classes = useStyles()
|
const classes = useStyles()
|
||||||
const translate = useTranslate()
|
const translate = useTranslate()
|
||||||
|
const { permissions } = usePermissions()
|
||||||
|
const isAdmin = permissions === 'admin'
|
||||||
return (
|
return (
|
||||||
<Filter {...props} variant={'outlined'}>
|
<Filter {...props} variant={'outlined'}>
|
||||||
<SearchInput source="title" alwaysOn />
|
<SearchInput source="title" alwaysOn />
|
||||||
@ -121,6 +125,7 @@ const SongFilter = (props) => {
|
|||||||
defaultValue={true}
|
defaultValue={true}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
|
{isAdmin && <NullableBooleanInput source="missing" />}
|
||||||
</Filter>
|
</Filter>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
@ -24,6 +24,7 @@ export const SongListActions = ({
|
|||||||
const isNotSmall = useMediaQuery((theme) => theme.breakpoints.up('sm'))
|
const isNotSmall = useMediaQuery((theme) => theme.breakpoints.up('sm'))
|
||||||
return (
|
return (
|
||||||
<TopToolbar className={className} {...sanitizeListRestProps(rest)}>
|
<TopToolbar className={className} {...sanitizeListRestProps(rest)}>
|
||||||
|
<ShuffleAllButton filters={filterValues} />
|
||||||
{filters &&
|
{filters &&
|
||||||
cloneElement(filters, {
|
cloneElement(filters, {
|
||||||
resource,
|
resource,
|
||||||
@ -32,7 +33,6 @@ export const SongListActions = ({
|
|||||||
filterValues,
|
filterValues,
|
||||||
context: 'button',
|
context: 'button',
|
||||||
})}
|
})}
|
||||||
<ShuffleAllButton filters={filterValues} />
|
|
||||||
{isNotSmall && <ToggleFieldsMenu resource="song" />}
|
{isNotSmall && <ToggleFieldsMenu resource="song" />}
|
||||||
</TopToolbar>
|
</TopToolbar>
|
||||||
)
|
)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user