catalog-react: fix $in being case sensitive
Signed-off-by: Patrik Oldsberg <poldsberg@gmail.com>
This commit is contained in:
@@ -0,0 +1,5 @@
|
||||
---
|
||||
'@backstage/plugin-catalog-react': patch
|
||||
---
|
||||
|
||||
Fixed a but in the new alpha entity predicates where the `$in` operator mistakenly case sensitive.
|
||||
@@ -149,6 +149,8 @@ describe('entityPredicateToFilterFunction', () => {
|
||||
['s,w,g,a', Object.create({ kind: 'component' })],
|
||||
['', { 'metadata.tags': { $contains: 'go' } }],
|
||||
['', { 'metadata.tags.0': 'java' }],
|
||||
['s,w,g', { kind: { $in: ['component', 'group'] } }],
|
||||
['a', { $not: { kind: { $in: ['component', 'group'] } } }],
|
||||
['w,g,a', { $not: { 'metadata.tags': { $contains: 'java' } } }],
|
||||
[
|
||||
's,g',
|
||||
|
||||
@@ -15,11 +15,7 @@
|
||||
*/
|
||||
|
||||
import { JsonValue } from '@backstage/types';
|
||||
import {
|
||||
EntityPredicate,
|
||||
EntityPredicatePrimitive,
|
||||
EntityPredicateValue,
|
||||
} from './types';
|
||||
import { EntityPredicate, EntityPredicateValue } from './types';
|
||||
import { valueAtPath } from './valueAtPath';
|
||||
|
||||
/**
|
||||
@@ -92,7 +88,7 @@ function evaluatePredicateValue(
|
||||
return value.some(v => evaluateEntityPredicate(filter.$contains, v));
|
||||
}
|
||||
if ('$in' in filter) {
|
||||
return filter.$in.includes(value as EntityPredicatePrimitive);
|
||||
return filter.$in.some(search => valuesAreEqual(value, search));
|
||||
}
|
||||
if ('$exists' in filter) {
|
||||
if (filter.$exists === true) {
|
||||
|
||||
Reference in New Issue
Block a user