mirror of
https://github.com/directus/directus.git
synced 2026-04-25 03:00:53 -04:00
Handle unexpected filter formats better in system-filter ui (#10251)
Fixes #9573
This commit is contained in:
@@ -1,13 +1,16 @@
|
||||
import { get } from 'lodash';
|
||||
import { get, isPlainObject } from 'lodash';
|
||||
import { Filter } from '@directus/shared/types';
|
||||
|
||||
export function getNodeName(node: Filter): string {
|
||||
if (!node) return '';
|
||||
return Object.keys(node)[0];
|
||||
}
|
||||
|
||||
export function getField(node: Record<string, any>): string {
|
||||
const name = getNodeName(node);
|
||||
if (name.startsWith('_')) return '';
|
||||
if (!isPlainObject(node[name])) return '';
|
||||
|
||||
const subFields = getField(node[name]);
|
||||
return subFields !== '' ? `${name}.${subFields}` : name;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user