Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MINOR: remove chart from explore tree and ingestionPipeline from quick filter #17273

Merged
merged 5 commits into from
Aug 7, 2024
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,12 @@ const ExploreTree = ({ onFieldValueSelect }: ExploreTreeProps) => {
});

const aggregations = getAggregations(res.aggregations);
const buckets = aggregations[bucketToFind].buckets;
const buckets = aggregations[bucketToFind].buckets.filter(
(item) =>
!searchClassBase
.notIncludeAggregationExploreTree()
.includes(item.key)
);
const isServiceType = bucketToFind === EntityFields.SERVICE_TYPE;
const isEntityType = bucketToFind === EntityFields.ENTITY_TYPE;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ export const SUPPORTED_EMPTY_FILTER_FIELDS = [
EntityFields.TAG,
];

export const NOT_INCLUDE_AGGREGATION_QUICK_FILTER = ['ingestionPipeline'];

// as it is used only in unit tests it's not needed for translation
export const tableSortingFields: SortingField[] = [
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import { SearchIndex } from '../enums/search.enum';
import {
getChartsOptions,
getColumnsOptions,
getOptionsFromAggregationBucket,
getSchemaFieldOptions,
getSearchDropdownLabels,
getSearchLabel,
Expand All @@ -25,6 +26,7 @@ import {
} from './AdvancedSearchUtils';
import {
highlightedItemLabel,
mockBucketOptions,
mockGetChartsOptionsData,
mockGetChartsOptionsDataWithoutDN,
mockGetChartsOptionsDataWithoutNameDN,
Expand Down Expand Up @@ -203,4 +205,14 @@ describe('AdvancedSearchUtils tests', () => {

expect(resultGetChartsOptions).toBe('chart text');
});

it('Function getOptionsFromAggregationBucket should return options which not include ingestionPipeline', () => {
const resultGetOptionsWithoutPipeline =
getOptionsFromAggregationBucket(mockBucketOptions);

expect(resultGetOptionsWithoutPipeline).toStrictEqual([
{ count: 1, key: 'pipeline', label: 'pipeline' },
{ count: 3, key: 'chart', label: 'chart' },
]);
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ import {
GLOSSARY_ASSETS_DROPDOWN_ITEMS,
LINEAGE_DROPDOWN_ITEMS,
} from '../constants/AdvancedSearch.constants';
import { NOT_INCLUDE_AGGREGATION_QUICK_FILTER } from '../constants/explore.constants';
import { AdvancedFields } from '../enums/AdvancedSearch.enum';
import { SearchIndex } from '../enums/search.enum';
import {
Expand Down Expand Up @@ -395,11 +396,13 @@ export const getOptionsFromAggregationBucket = (buckets: Bucket[]) => {
return [];
}

return buckets.map((option) => ({
key: option.key,
label: option.key,
count: option.doc_count ?? 0,
}));
return buckets
.filter((item) => !NOT_INCLUDE_AGGREGATION_QUICK_FILTER.includes(item.key))
.map((option) => ({
key: option.key,
label: option.key,
count: option.doc_count ?? 0,
}));
};

export const getTierOptions: () => Promise<AsyncFetchListValues> = async () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -570,6 +570,10 @@ class SearchClassBase {
};
}
}

public notIncludeAggregationExploreTree() {
return ['chart'];
}
}

const searchClassBase = new SearchClassBase();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
* limitations under the License.
*/

import { Bucket } from 'Models';
import { SearchIndex } from '../../enums/search.enum';
import {
DatabaseServiceType,
Expand Down Expand Up @@ -414,3 +415,21 @@ export const mockGetChartsOptionsDataWithoutNameDN: SuggestOption<
],
},
};

export const mockBucketOptions: Bucket[] = [
{
key: 'pipeline',
doc_count: 1,
label: 'pipeline',
},
{
key: 'ingestionPipeline',
doc_count: 2,
label: 'ingestionPipeline',
},
{
key: 'chart',
doc_count: 3,
label: 'chart',
},
];
Loading