minor fixes

This commit is contained in:
karanh37 2025-09-26 16:14:52 +05:30
parent fe11aa22d1
commit 56a44c5463
5 changed files with 16 additions and 15 deletions

View File

@ -123,7 +123,7 @@ const DataProductListPage = () => {
}); });
const { pageHeader } = usePageHeader({ const { pageHeader } = usePageHeader({
titleKey: 'label.data-product', titleKey: 'label.data-product-plural',
descriptionMessageKey: 'message.data-product-description', descriptionMessageKey: 'message.data-product-description',
createPermission: true, createPermission: true,
addButtonLabelKey: 'label.add-data-product', addButtonLabelKey: 'label.add-data-product',

View File

@ -122,7 +122,7 @@ const DomainListPage = () => {
}); });
const { pageHeader } = usePageHeader({ const { pageHeader } = usePageHeader({
titleKey: 'label.domain', titleKey: 'label.domain-plural',
descriptionMessageKey: 'message.domain-description', descriptionMessageKey: 'message.domain-description',
createPermission: true, createPermission: true,
addButtonLabelKey: 'label.add-domain', addButtonLabelKey: 'label.add-domain',

View File

@ -32,11 +32,9 @@ const MUIDomainSelect: FC<MUIDomainSelectProps> = ({
multiple = false, multiple = false,
value, value,
onChange, onChange,
showAllDomains = true,
hasPermission = true, hasPermission = true,
onBlur, onBlur,
onFocus, onFocus,
className,
'data-testid': dataTestId, 'data-testid': dataTestId,
}) => { }) => {
const convertDomainToTreeNode = useCallback( const convertDomainToTreeNode = useCallback(
@ -61,7 +59,7 @@ const MUIDomainSelect: FC<MUIDomainSelectProps> = ({
hasChildren, hasChildren,
lazyLoad: false, lazyLoad: false,
children: hasChildren children: hasChildren
? (domain as Domain).children?.map(convertDomainToTreeNode) ? domain.children?.map(convertDomainToTreeNode)
: undefined, : undefined,
allowSelection: hasPermission, allowSelection: hasPermission,
}; };
@ -72,10 +70,8 @@ const MUIDomainSelect: FC<MUIDomainSelectProps> = ({
const fetchData = useCallback( const fetchData = useCallback(
async ({ async ({
searchTerm, searchTerm,
parentId,
}: { }: {
searchTerm?: string; searchTerm?: string;
parentId?: string;
}): Promise<TreeDataResponse> => { }): Promise<TreeDataResponse> => {
try { try {
if (searchTerm) { if (searchTerm) {

View File

@ -13,6 +13,7 @@
import { AxiosError } from 'axios'; import { AxiosError } from 'axios';
import { useCallback, useState } from 'react'; import { useCallback, useState } from 'react';
import { EntityFields } from '../../../../enums/AdvancedSearch.enum';
import { SearchIndex } from '../../../../enums/search.enum'; import { SearchIndex } from '../../../../enums/search.enum';
import { Aggregations } from '../../../../interface/search.interface'; import { Aggregations } from '../../../../interface/search.interface';
import { searchQuery } from '../../../../rest/searchAPI'; import { searchQuery } from '../../../../rest/searchAPI';
@ -60,7 +61,7 @@ export const useDataFetching = <T extends { id: string }>(
// Build Elasticsearch query from filters // Build Elasticsearch query from filters
const buildESQuery = useCallback( const buildESQuery = useCallback(
(filters: Record<string, string[]>): any => { (filters: Record<string, string[]>): Record<string, unknown> => {
// Parse baseFilter if it exists // Parse baseFilter if it exists
let query = baseFilter ? JSON.parse(baseFilter) : null; let query = baseFilter ? JSON.parse(baseFilter) : null;
@ -88,19 +89,28 @@ export const useDataFetching = <T extends { id: string }>(
// Add filters to the must array // Add filters to the must array
Object.entries(filters).forEach(([filterKey, values]) => { Object.entries(filters).forEach(([filterKey, values]) => {
// TODO : Explicit type casting, need to revisit once backend has
// two separate fields for glossary and tags
const filterUpdatedKey = [
EntityFields.GLOSSARY_TERMS,
EntityFields.CLASSIFICATION_TAGS,
].includes(filterKey as EntityFields)
? EntityFields.TAG
: filterKey;
if (values && values.length > 0) { if (values && values.length > 0) {
if (values.length === 1) { if (values.length === 1) {
// Single value - use term query // Single value - use term query
query.query.bool.must.push({ query.query.bool.must.push({
term: { term: {
[filterKey]: values[0], [filterUpdatedKey]: values[0],
}, },
}); });
} else { } else {
// Multiple values - use terms query // Multiple values - use terms query
query.query.bool.must.push({ query.query.bool.must.push({
terms: { terms: {
[filterKey]: values, [filterUpdatedKey]: values,
}, },
}); });
} }

View File

@ -19,7 +19,6 @@ export const DATAPRODUCT_DEFAULT_QUICK_FILTERS = [
EntityFields.DOMAINS, EntityFields.DOMAINS,
EntityFields.CLASSIFICATION_TAGS, EntityFields.CLASSIFICATION_TAGS,
EntityFields.GLOSSARY_TERMS, EntityFields.GLOSSARY_TERMS,
EntityFields.DOMAIN_TYPE,
]; ];
export const DATAPRODUCT_FILTERS = [ export const DATAPRODUCT_FILTERS = [
@ -39,8 +38,4 @@ export const DATAPRODUCT_FILTERS = [
label: i18n.t('label.glossary-term-plural'), label: i18n.t('label.glossary-term-plural'),
key: EntityFields.GLOSSARY_TERMS, key: EntityFields.GLOSSARY_TERMS,
}, },
{
label: i18n.t('label.domain-type'),
key: EntityFields.DOMAIN_TYPE,
},
]; ];