Minor: fixed failing query entity cypress (#17261)

* Minor: fixed failing query entity cypress

* fixed failing cypress
This commit is contained in:
Shailesh Parmar 2024-08-05 19:06:39 +05:30 committed by GitHub
parent 9fcbf6a5b9
commit 1b6b48e7be
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 17 additions and 9 deletions

View File

@ -61,6 +61,7 @@ import {
updateQueryVote,
} from '../../../rest/queryAPI';
import { searchQuery } from '../../../rest/searchAPI';
import { getEntityName } from '../../../utils/EntityUtils';
import { DEFAULT_ENTITY_PERMISSION } from '../../../utils/PermissionsUtils';
import {
createQueryFilter,
@ -288,11 +289,16 @@ const TableQueries: FC<TableQueriesProp> = ({
};
const fetchTags = async (searchText = WILD_CARD_CHAR) => {
return fetchFilterOptions(
const data = await fetchFilterOptions(
searchText,
'disabled:false AND !classification.name:Tier',
SearchIndex.TAG
);
return data.hits.hits.map((hit) => ({
key: hit._source.fullyQualifiedName ?? hit._source.name,
label: getEntityName(hit._source),
}));
};
const setTagsDefaultOption = () => {
@ -343,10 +349,15 @@ const TableQueries: FC<TableQueriesProp> = ({
};
const fetchOwner = async (searchText = WILD_CARD_CHAR) => {
return fetchFilterOptions(searchText, 'isBot:false', [
const data = await fetchFilterOptions(searchText, 'isBot:false', [
SearchIndex.USER,
SearchIndex.TEAM,
]);
return data.hits.hits.map((hit) => ({
key: hit._source.name,
label: getEntityName(hit._source),
}));
};
const setOwnerDefaultOption = () => {

View File

@ -17,7 +17,6 @@ import { SearchDropdownOption } from '../../components/SearchDropdown/SearchDrop
import { PAGE_SIZE_BASE } from '../../constants/constants';
import { SearchIndex } from '../../enums/search.enum';
import { searchQuery } from '../../rest/searchAPI';
import { getEntityName } from '../EntityUtils';
export const createQueryFilter = ({
tableId,
@ -46,7 +45,9 @@ export const createQueryFilter = ({
{
bool: {
should: owners.map((data) => ({
term: { 'owners.displayName.keyword': data.key },
term: {
'owners.name': data.key,
},
})),
},
},
@ -102,10 +103,6 @@ export const fetchFilterOptions = async (
pageSize: PAGE_SIZE_BASE,
searchIndex,
});
const options = response.hits.hits.map((hit) => ({
key: hit._source.fullyQualifiedName ?? hit._source.name,
label: getEntityName(hit._source),
}));
return options;
return response;
};