Skip to content

Commit

Permalink
Add display name filter field for advanced search
Browse files Browse the repository at this point in the history
  • Loading branch information
aniketkatkar97 committed Sep 12, 2024
1 parent 5999ccf commit 970f59a
Show file tree
Hide file tree
Showing 3 changed files with 116 additions and 77 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -925,6 +925,7 @@
"regenerate-registration-token": "Regenerate registration token",
"region-name": "Region Name",
"registry": "Registry",
"regular-expression": "Regular Expression",
"reject": "Reject",
"reject-all": "Reject All",
"rejected": "Rejected",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,74 @@ import { getCombinedQueryFilterObject } from './ExplorePage/ExplorePageUtils';

class AdvancedSearchClassBase {
baseConfig = AntdConfig as BasicConfig;
configTypes: BasicConfig['types'] = {
...this.baseConfig.types,
multiselect: {
...this.baseConfig.types.multiselect,
widgets: {
...this.baseConfig.types.multiselect.widgets,
// Adds the "Contains" and "Not contains" options for fields with type multiselect
text: {
operators: ['like', 'not_like', 'regexp'],
},
},
// Limits source to user input values, not other fields
valueSources: ['value'],
},
select: {
...this.baseConfig.types.select,
widgets: {
...this.baseConfig.types.select.widgets,
text: {
operators: ['like', 'not_like', 'regexp'],
},
},
valueSources: ['value'],
},
text: {
...this.baseConfig.types.text,
valueSources: ['value'],
},
};
configWidgets: BasicConfig['widgets'] = {
...this.baseConfig.widgets,
multiselect: {
...this.baseConfig.widgets.multiselect,
showSearch: true,
showCheckboxes: true,
useAsyncSearch: true,
useLoadMore: false,
customProps: {
popupClassName: 'w-max-600',
},
},
select: {
...this.baseConfig.widgets.select,
showSearch: true,
showCheckboxes: true,
useAsyncSearch: true,
useLoadMore: false,
customProps: {
popupClassName: 'w-max-600',
},
},
text: {
...this.baseConfig.widgets.text,
},
};
configOperators = {
...this.baseConfig.operators,
like: {
...this.baseConfig.operators.like,
elasticSearchQueryType: 'wildcard',
},
regexp: {
label: t('label.regular-expression'),
labelForFormat: t('label.regular-expression'),
elasticSearchQueryType: 'regexp',
valueSources: ['value'],
},
};

mainWidgetProps = {
fullWidth: true,
Expand Down Expand Up @@ -97,7 +165,7 @@ class AdvancedSearchClassBase {
},
},

tableType: {
[EntityFields.TABLE_TYPE]: {
label: t('label.table-type'),
type: 'select',
mainWidgetProps: this.mainWidgetProps,
Expand All @@ -115,7 +183,7 @@ class AdvancedSearchClassBase {
* Fields specific to pipelines
*/
pipelineQueryBuilderFields: Fields = {
'tasks.displayName.keyword': {
[EntityFields.TASK]: {
label: t('label.task'),
type: 'select',
mainWidgetProps: this.mainWidgetProps,
Expand All @@ -133,7 +201,7 @@ class AdvancedSearchClassBase {
* Fields specific to topics
*/
topicQueryBuilderFields: Fields = {
'messageSchema.schemaFields.name.keyword': {
[EntityFields.SCHEMA_FIELD]: {
label: t('label.schema-field'),
type: 'select',
mainWidgetProps: this.mainWidgetProps,
Expand All @@ -151,7 +219,7 @@ class AdvancedSearchClassBase {
* Fields specific to API endpoints
*/
apiEndpointQueryBuilderFields: Fields = {
'requestSchema.schemaFields.name.keyword': {
[EntityFields.REQUEST_SCHEMA_FIELD]: {
label: t('label.request-schema-field'),
type: 'select',
mainWidgetProps: this.mainWidgetProps,
Expand All @@ -163,7 +231,7 @@ class AdvancedSearchClassBase {
useAsyncSearch: true,
},
},
'responseSchema.schemaFields.name.keyword': {
[EntityFields.RESPONSE_SCHEMA_FIELD]: {
label: t('label.response-schema-field'),
type: 'select',
mainWidgetProps: this.mainWidgetProps,
Expand All @@ -181,7 +249,7 @@ class AdvancedSearchClassBase {
* Fields specific to Glossary
*/
glossaryQueryBuilderFields: Fields = {
status: {
[EntityFields.GLOSSARY_TERM_STATUS]: {
label: t('label.status'),
type: 'select',
mainWidgetProps: this.mainWidgetProps,
Expand All @@ -199,7 +267,7 @@ class AdvancedSearchClassBase {
* Fields specific to dashboard
*/
dashboardQueryBuilderFields: Fields = {
'dataModels.displayName.keyword': {
[EntityFields.DATA_MODEL]: {
label: t('label.data-model'),
type: 'select',
mainWidgetProps: this.mainWidgetProps,
Expand All @@ -211,7 +279,7 @@ class AdvancedSearchClassBase {
useAsyncSearch: true,
},
},
'charts.displayName.keyword': {
[EntityFields.CHART]: {
label: t('label.chart'),
type: 'select',
mainWidgetProps: this.mainWidgetProps,
Expand All @@ -223,7 +291,7 @@ class AdvancedSearchClassBase {
useAsyncSearch: true,
},
},
'project.keyword': {
[EntityFields.PROJECT]: {
label: t('label.project'),
type: 'select',
mainWidgetProps: this.mainWidgetProps,
Expand All @@ -241,7 +309,7 @@ class AdvancedSearchClassBase {
* Fields specific to ML models
*/
mlModelQueryBuilderFields: Fields = {
'mlFeatures.name': {
[EntityFields.FEATURE]: {
label: t('label.feature'),
type: 'select',
mainWidgetProps: this.mainWidgetProps,
Expand All @@ -259,7 +327,7 @@ class AdvancedSearchClassBase {
* Fields specific to containers
*/
containerQueryBuilderFields: Fields = {
'dataModel.columns.name.keyword': {
[EntityFields.CONTAINER_COLUMN]: {
label: t('label.container-column'),
type: 'select',
mainWidgetProps: this.mainWidgetProps,
Expand All @@ -277,7 +345,7 @@ class AdvancedSearchClassBase {
* Fields specific to search indexes
*/
searchIndexQueryBuilderFields: Fields = {
'fields.name.keyword': {
[EntityFields.FIELD]: {
label: t('label.field'),
type: 'select',
mainWidgetProps: this.mainWidgetProps,
Expand All @@ -295,7 +363,7 @@ class AdvancedSearchClassBase {
* Fields specific to dashboard data models
*/
dataModelQueryBuilderFields: Fields = {
dataModelType: {
[EntityFields.DATA_MODEL_TYPE]: {
label: t('label.data-model-type'),
type: 'select',
mainWidgetProps: this.mainWidgetProps,
Expand All @@ -307,7 +375,7 @@ class AdvancedSearchClassBase {
useAsyncSearch: true,
},
},
'project.keyword': {
[EntityFields.PROJECT]: {
label: t('label.project'),
type: 'select',
mainWidgetProps: this.mainWidgetProps,
Expand All @@ -328,62 +396,9 @@ class AdvancedSearchClassBase {
public getInitialConfigWithoutFields = (isExplorePage = true) => {
const initialConfigWithoutFields: BasicConfig = {
...this.baseConfig,
types: {
...this.baseConfig.types,
multiselect: {
...this.baseConfig.types.multiselect,
widgets: {
...this.baseConfig.types.multiselect.widgets,
// Adds the "Contains" and "Not contains" options for fields with type multiselect
text: {
operators: ['like', 'not_like'],
},
},
// Limits source to user input values, not other fields
valueSources: ['value'],
},
select: {
...this.baseConfig.types.select,
widgets: {
...this.baseConfig.types.select.widgets,
text: {
operators: ['like', 'not_like'],
},
},
valueSources: ['value'],
},
text: {
...this.baseConfig.types.text,
valueSources: ['value'],
},
},
widgets: {
...this.baseConfig.widgets,
multiselect: {
...this.baseConfig.widgets.multiselect,
showSearch: true,
showCheckboxes: true,
useAsyncSearch: true,
useLoadMore: false,
},
select: {
...this.baseConfig.widgets.select,
showSearch: true,
showCheckboxes: true,
useAsyncSearch: true,
useLoadMore: false,
},
text: {
...this.baseConfig.widgets.text,
},
},
operators: {
...this.baseConfig.operators,
like: {
...this.baseConfig.operators.like,
elasticSearchQueryType: 'wildcard',
},
},
types: this.configTypes,
widgets: this.configWidgets,
operators: this.configOperators,
settings: {
...this.baseConfig.settings,
showLabels: isExplorePage,
Expand Down Expand Up @@ -427,13 +442,35 @@ class AdvancedSearchClassBase {
} = args;

return {
[EntityFields.DISPLAY_NAME_KEYWORD]: {
label: t('label.display-name'),
type: 'select',
mainWidgetProps: this.mainWidgetProps,
fieldSettings: {
asyncFetch: this.autocomplete({
searchIndex: entitySearchIndex ?? [SearchIndex.DATA_ASSET],
entityField: EntityFields.DISPLAY_NAME_KEYWORD,
}),
useAsyncSearch: true,
},
operators: [
'select_equals',
'select_not_equals',
'select_any_in',
'select_not_any_in',
'like',
'not_like',
'regexp',
],
},

deleted: {
label: t('label.deleted'),
type: 'boolean',
defaultValue: true,
},

'owners.displayName.keyword': {
[EntityFields.OWNERS]: {
label: t('label.owner'),
type: 'select',
mainWidgetProps: this.mainWidgetProps,
Expand All @@ -447,7 +484,7 @@ class AdvancedSearchClassBase {
},
},

'domain.displayName.keyword': {
[EntityFields.DOMAIN]: {
label: t('label.domain'),
type: 'select',
mainWidgetProps: this.mainWidgetProps,
Expand All @@ -461,7 +498,7 @@ class AdvancedSearchClassBase {
},
},

serviceType: {
[EntityFields.SERVICE_TYPE]: {
label: t('label.service-type'),
type: 'select',
mainWidgetProps: this.mainWidgetProps,
Expand All @@ -475,7 +512,7 @@ class AdvancedSearchClassBase {
},
},

'tags.tagFQN': {
[EntityFields.TAG]: {
label: t('label.tag-plural'),
type: 'select',
mainWidgetProps: this.mainWidgetProps,
Expand All @@ -490,7 +527,7 @@ class AdvancedSearchClassBase {
},
},

'tier.tagFQN': {
[EntityFields.TIER]: {
label: t('label.tier'),
type: 'select',
mainWidgetProps: this.mainWidgetProps,
Expand Down Expand Up @@ -540,7 +577,7 @@ class AdvancedSearchClassBase {

return !isEmpty(searchIndexWithColumns)
? {
'columns.name.keyword': {
[EntityFields.COLUMN]: {
label: t('label.column'),
type: 'select',
mainWidgetProps: this.mainWidgetProps,
Expand Down Expand Up @@ -618,7 +655,7 @@ class AdvancedSearchClassBase {
shouldAddServiceField?: boolean;
}) => {
const serviceQueryBuilderFields: Fields = {
'service.displayName.keyword': {
[EntityFields.SERVICE]: {
label: t('label.service'),
type: 'select',
mainWidgetProps: this.mainWidgetProps,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,7 @@ function determineQueryField(fieldDataType, fullFieldName, queryType) {
function buildRegexpParameters(value) {
return {
value: value,
case_insensitive: true,
};
}

Expand Down

0 comments on commit 970f59a

Please sign in to comment.