Skip to content

Commit 7972261

Browse files
Revert "fix: use search v2 component for traces data source & minor improveme…" (#7511)
This reverts commit d7a6607.
1 parent 3b4a8e5 commit 7972261

File tree

5 files changed

+11
-35
lines changed

5 files changed

+11
-35
lines changed

frontend/src/container/QueryBuilder/components/Query/Query.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -453,7 +453,7 @@ export const Query = memo(function Query({
453453
</Col>
454454
)}
455455
<Col flex="1" className="qb-search-container">
456-
{[DataSource.LOGS, DataSource.TRACES].includes(query.dataSource) ? (
456+
{query.dataSource === DataSource.LOGS ? (
457457
<QueryBuilderSearchV2
458458
query={query}
459459
onChange={handleChangeTagFilters}

frontend/src/container/QueryBuilder/filters/QueryBuilderSearchV2/QueryBuilderSearchDropdown.tsx

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
import './QueryBuilderSearchV2.styles.scss';
33

44
import { Typography } from 'antd';
5-
import cx from 'classnames';
65
import {
76
ArrowDown,
87
ArrowUp,
@@ -26,7 +25,6 @@ interface ICustomDropdownProps {
2625
exampleQueries: TagFilter[];
2726
onChange: (value: TagFilter) => void;
2827
currentFilterItem?: ITag;
29-
isLogsDataSource: boolean;
3028
}
3129

3230
export default function QueryBuilderSearchDropdown(
@@ -40,14 +38,11 @@ export default function QueryBuilderSearchDropdown(
4038
exampleQueries,
4139
options,
4240
onChange,
43-
isLogsDataSource,
4441
} = props;
4542
const userOs = getUserOperatingSystem();
4643
return (
4744
<>
48-
<div
49-
className={cx('content', { 'non-logs-data-source': !isLogsDataSource })}
50-
>
45+
<div className="content">
5146
{!currentFilterItem?.key ? (
5247
<div className="suggested-filters">Suggested Filters</div>
5348
) : !currentFilterItem?.op ? (

frontend/src/container/QueryBuilder/filters/QueryBuilderSearchV2/QueryBuilderSearchV2.styles.scss

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,6 @@
1111
.rc-virtual-list-holder {
1212
height: 115px;
1313
}
14-
&.non-logs-data-source {
15-
.rc-virtual-list-holder {
16-
height: 256px;
17-
}
18-
}
1914
}
2015
}
2116

frontend/src/container/QueryBuilder/filters/QueryBuilderSearchV2/QueryBuilderSearchV2.tsx

Lines changed: 4 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -689,29 +689,12 @@ function QueryBuilderSearchV2(
689689
})),
690690
);
691691
} else {
692-
setDropdownOptions([
693-
// Add user typed option if it doesn't exist in the payload
694-
...(!isEmpty(tagKey) &&
695-
!data?.payload?.attributeKeys?.some((val) => isEqual(val.key, tagKey))
696-
? [
697-
{
698-
label: tagKey,
699-
value: {
700-
key: tagKey,
701-
dataType: DataTypes.EMPTY,
702-
type: '',
703-
isColumn: false,
704-
isJSON: false,
705-
},
706-
},
707-
]
708-
: []),
709-
// Map existing attribute keys from payload
710-
...(data?.payload?.attributeKeys?.map((key) => ({
692+
setDropdownOptions(
693+
data?.payload?.attributeKeys?.map((key) => ({
711694
label: key.key,
712695
value: key,
713-
})) || []),
714-
]);
696+
})) || [],
697+
);
715698
}
716699
}
717700
if (currentState === DropdownState.OPERATOR) {
@@ -981,7 +964,6 @@ function QueryBuilderSearchV2(
981964
exampleQueries={suggestionsData?.payload?.example_queries || []}
982965
tags={tags}
983966
currentFilterItem={currentFilterItem}
984-
isLogsDataSource={isLogsDataSource}
985967
/>
986968
)}
987969
>

frontend/src/hooks/queryBuilder/useOptions.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,11 @@ export const useOptions = (
170170
(option, index, self) =>
171171
index ===
172172
self.findIndex(
173-
(o) => o.label === option.label && o.value === option.value, // to remove duplicate & empty options from list
173+
(o) =>
174+
// to remove duplicate & empty options from list
175+
o.label === option.label &&
176+
o.value === option.value &&
177+
o.dataType?.toLowerCase() === option.dataType?.toLowerCase(), // handle case sensitivity
174178
) && option.value !== '',
175179
) || []
176180
).map((option) => {

0 commit comments

Comments
 (0)