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

feat: enable the new where clause for all the log based queries #6671

Merged
merged 3 commits into from
Jan 2, 2025
Merged
Show file tree
Hide file tree
Changes from 2 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 @@ -82,10 +82,6 @@ export const Query = memo(function Query({
entityVersion: version,
});

const isLogsExplorerPage = useMemo(() => pathname === ROUTES.LOGS_EXPLORER, [
pathname,
]);

const handleChangeAggregateEvery = useCallback(
(value: IBuilderQuery['stepInterval']) => {
handleChangeQueryData('stepInterval', value);
Expand Down Expand Up @@ -457,7 +453,7 @@ export const Query = memo(function Query({
</Col>
)}
<Col flex="1" className="qb-search-container">
{isLogsExplorerPage ? (
{query.dataSource === DataSource.LOGS ? (
<QueryBuilderSearchV2
query={query}
onChange={handleChangeTagFilters}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import {
QUERY_BUILDER_SEARCH_VALUES,
} from 'constants/queryBuilder';
import { DEBOUNCE_DELAY } from 'constants/queryBuilderFilterConfig';
import ROUTES from 'constants/routes';
import { LogsExplorerShortcuts } from 'constants/shortcuts/logsExplorerShortcuts';
import { useKeyboardHotkeys } from 'hooks/hotkeys/useKeyboardHotkeys';
import { WhereClauseConfig } from 'hooks/queryBuilder/useAutoComplete';
Expand Down Expand Up @@ -40,7 +39,6 @@ import {
useRef,
useState,
} from 'react';
import { useLocation } from 'react-router-dom';
import {
BaseAutocompleteData,
DataTypes,
Expand Down Expand Up @@ -147,9 +145,8 @@ function QueryBuilderSearchV2(

const [showAllFilters, setShowAllFilters] = useState<boolean>(false);

const { pathname } = useLocation();
const isLogsExplorerPage = useMemo(() => pathname === ROUTES.LOGS_EXPLORER, [
pathname,
const isLogsDataSource = useMemo(() => query.dataSource === DataSource.LOGS, [
query.dataSource,
]);

const memoizedSearchParams = useMemo(
Expand Down Expand Up @@ -235,7 +232,7 @@ function QueryBuilderSearchV2(
},
{
queryKey: [searchParams],
enabled: isQueryEnabled && !isLogsExplorerPage,
enabled: isQueryEnabled && !isLogsDataSource,
},
);

Expand All @@ -250,7 +247,7 @@ function QueryBuilderSearchV2(
},
{
queryKey: [suggestionsParams],
enabled: isQueryEnabled && isLogsExplorerPage,
enabled: isQueryEnabled && isLogsDataSource,
},
);

Expand Down Expand Up @@ -651,7 +648,7 @@ function QueryBuilderSearchV2(
useEffect(() => {
if (currentState === DropdownState.ATTRIBUTE_KEY) {
const { tagKey } = getTagToken(searchValue);
if (isLogsExplorerPage) {
if (isLogsDataSource) {
// add the user typed option in the dropdown to select that and move ahead irrespective of the matches and all
setDropdownOptions([
...(!isEmpty(tagKey) &&
Expand Down Expand Up @@ -756,7 +753,7 @@ function QueryBuilderSearchV2(
currentFilterItem?.key?.dataType,
currentState,
data?.payload?.attributeKeys,
isLogsExplorerPage,
isLogsDataSource,
searchValue,
suggestionsData?.payload?.attributes,
]);
Expand Down
Loading