fix(ui): internal scope filter + dark-theme cards в Связи
This commit is contained in:
@@ -22,7 +22,14 @@ import {
|
|||||||
export const dictionariesQuery = queryOptions({
|
export const dictionariesQuery = queryOptions({
|
||||||
queryKey: ['dictionaries'] as const,
|
queryKey: ['dictionaries'] as const,
|
||||||
queryFn: async (): Promise<DictionaryDefinition[]> => {
|
queryFn: async (): Promise<DictionaryDefinition[]> => {
|
||||||
const { data } = await apiClient.get<DictionaryDefinition[]>('/dictionaries')
|
// Backend по default возвращает только PUBLIC scope (~user feedback:
|
||||||
|
// «куда опять internal словари делись»). Передаём весь triplet —
|
||||||
|
// server-side всё равно отфильтрует по реальным scope permissions
|
||||||
|
// юзера, и invisible scopes просто не вернутся. Это match'ит то что
|
||||||
|
// useRecords / catalog row делает per-record (см. строку ~65).
|
||||||
|
const { data } = await apiClient.get<DictionaryDefinition[]>('/dictionaries', {
|
||||||
|
params: { as_scope: 'PUBLIC,INTERNAL,RESTRICTED' },
|
||||||
|
})
|
||||||
return data
|
return data
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
@@ -31,7 +38,12 @@ export const dictionaryDetailQuery = (name: string) =>
|
|||||||
queryOptions({
|
queryOptions({
|
||||||
queryKey: ['dictionary', name] as const,
|
queryKey: ['dictionary', name] as const,
|
||||||
queryFn: async (): Promise<DictionaryDetail> => {
|
queryFn: async (): Promise<DictionaryDetail> => {
|
||||||
const { data } = await apiClient.get<DictionaryDetail>(`/dictionaries/${name}`)
|
// Same as listing — pass all scopes; server-side filter применит
|
||||||
|
// user permissions. Без этого INTERNAL dict вернёт 404 даже для
|
||||||
|
// авторизованного юзера с INTERNAL access.
|
||||||
|
const { data } = await apiClient.get<DictionaryDetail>(`/dictionaries/${name}`, {
|
||||||
|
params: { as_scope: 'PUBLIC,INTERNAL,RESTRICTED' },
|
||||||
|
})
|
||||||
return data
|
return data
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -48,7 +48,7 @@ export const DictionaryDependentsPanel = ({ dictionaryName }: Props) => {
|
|||||||
{data.map((d) => (
|
{data.map((d) => (
|
||||||
<li
|
<li
|
||||||
key={`${d.sourceDict}.${d.sourceField}`}
|
key={`${d.sourceDict}.${d.sourceField}`}
|
||||||
className="flex items-center gap-2 px-2.5 py-1.5 rounded-sm border border-line bg-white text-cell"
|
className="flex items-center gap-2 px-2.5 py-1.5 rounded-sm border border-line bg-surface text-cell"
|
||||||
>
|
>
|
||||||
<Link
|
<Link
|
||||||
to="/dictionaries/$name"
|
to="/dictionaries/$name"
|
||||||
|
|||||||
@@ -54,7 +54,7 @@ const NeighborCard = ({
|
|||||||
to="/dictionaries/$name"
|
to="/dictionaries/$name"
|
||||||
params={{ name: dict.name }}
|
params={{ name: dict.name }}
|
||||||
search={{ tab: 'relations' }}
|
search={{ tab: 'relations' }}
|
||||||
className={`group block bg-white border border-line rounded-lg p-3 transition hover:shadow-hover hover:border-accent/40 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 ${
|
className={`group block bg-surface border border-line rounded-lg p-3 transition hover:shadow-hover hover:border-accent/40 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 ${
|
||||||
side === 'left' ? 'text-right' : 'text-left'
|
side === 'left' ? 'text-right' : 'text-left'
|
||||||
}`}
|
}`}
|
||||||
>
|
>
|
||||||
@@ -156,7 +156,7 @@ export function DictionaryHubView({ detail }: { detail: DictionaryDetail }) {
|
|||||||
{/* Center: focused dict (large card) */}
|
{/* Center: focused dict (large card) */}
|
||||||
<div className="md:order-2 order-1 relative">
|
<div className="md:order-2 order-1 relative">
|
||||||
<div
|
<div
|
||||||
className="relative bg-white rounded-xl p-5 border-2 border-accent"
|
className="relative bg-surface rounded-xl p-5 border-2 border-accent"
|
||||||
style={{ boxShadow: '0 18px 36px -22px rgba(20,30,140,.5)' }}
|
style={{ boxShadow: '0 18px 36px -22px rgba(20,30,140,.5)' }}
|
||||||
>
|
>
|
||||||
<div className="flex items-start gap-2 mb-2 flex-wrap">
|
<div className="flex items-start gap-2 mb-2 flex-wrap">
|
||||||
|
|||||||
Reference in New Issue
Block a user