mirror of
https://github.com/open-metadata/OpenMetadata.git
synced 2025-08-31 20:51:26 +00:00
fix empty rule state in query builder (#18481)
This commit is contained in:
parent
854c3d6cca
commit
5c3ad966a1
@ -103,7 +103,7 @@ const QueryBuilderWidget: FC<WidgetProps> = ({
|
||||
onTreeUpdate(nTree, nConfig);
|
||||
|
||||
if (outputType === QueryBuilderOutputType.ELASTICSEARCH) {
|
||||
const data = elasticSearchFormat(nTree, config) ?? {};
|
||||
const data = elasticSearchFormat(nTree, config) ?? '';
|
||||
const qFilter = {
|
||||
query: data,
|
||||
};
|
||||
@ -111,7 +111,7 @@ const QueryBuilderWidget: FC<WidgetProps> = ({
|
||||
debouncedFetchEntityCount(qFilter);
|
||||
}
|
||||
|
||||
onChange(JSON.stringify(qFilter));
|
||||
onChange(!isEmpty(data) ? JSON.stringify(qFilter) : '');
|
||||
} else {
|
||||
const data = QbUtils.jsonLogicFormat(nTree, config);
|
||||
onChange(JSON.stringify(data.logic ?? '{}'));
|
||||
@ -125,13 +125,14 @@ const QueryBuilderWidget: FC<WidgetProps> = ({
|
||||
useEffect(() => {
|
||||
if (!isEmpty(value)) {
|
||||
if (outputType === QueryBuilderOutputType.ELASTICSEARCH) {
|
||||
const tree = QbUtils.checkTree(
|
||||
QbUtils.loadTree(
|
||||
getJsonTreeFromQueryFilter(JSON.parse(value || '')) as JsonTree
|
||||
),
|
||||
config
|
||||
);
|
||||
onTreeUpdate(tree, config);
|
||||
const parsedTree = getJsonTreeFromQueryFilter(
|
||||
JSON.parse(value || '')
|
||||
) as JsonTree;
|
||||
|
||||
if (Object.keys(parsedTree).length > 0) {
|
||||
const tree = QbUtils.checkTree(QbUtils.loadTree(parsedTree), config);
|
||||
onTreeUpdate(tree, config);
|
||||
}
|
||||
} else {
|
||||
const tree = QbUtils.loadFromJsonLogic(JSON.parse(value || ''), config);
|
||||
if (tree) {
|
||||
|
@ -176,4 +176,8 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.rule-container:first-child .action--DELETE {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user