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

* feat: enable the new where clause for logs dashboards
This commit is contained in:
Vikrant Gupta 2025-01-02 22:55:30 +05:30 committed by GitHub
parent dad72dd295
commit d48cdbfc4a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 7 additions and 14 deletions

View File

@ -82,10 +82,6 @@ export const Query = memo(function Query({
entityVersion: version, entityVersion: version,
}); });
const isLogsExplorerPage = useMemo(() => pathname === ROUTES.LOGS_EXPLORER, [
pathname,
]);
const handleChangeAggregateEvery = useCallback( const handleChangeAggregateEvery = useCallback(
(value: IBuilderQuery['stepInterval']) => { (value: IBuilderQuery['stepInterval']) => {
handleChangeQueryData('stepInterval', value); handleChangeQueryData('stepInterval', value);
@ -457,7 +453,7 @@ export const Query = memo(function Query({
</Col> </Col>
)} )}
<Col flex="1" className="qb-search-container"> <Col flex="1" className="qb-search-container">
{isLogsExplorerPage ? ( {query.dataSource === DataSource.LOGS ? (
<QueryBuilderSearchV2 <QueryBuilderSearchV2
query={query} query={query}
onChange={handleChangeTagFilters} onChange={handleChangeTagFilters}

View File

@ -9,7 +9,6 @@ import {
QUERY_BUILDER_SEARCH_VALUES, QUERY_BUILDER_SEARCH_VALUES,
} from 'constants/queryBuilder'; } from 'constants/queryBuilder';
import { DEBOUNCE_DELAY } from 'constants/queryBuilderFilterConfig'; import { DEBOUNCE_DELAY } from 'constants/queryBuilderFilterConfig';
import ROUTES from 'constants/routes';
import { LogsExplorerShortcuts } from 'constants/shortcuts/logsExplorerShortcuts'; import { LogsExplorerShortcuts } from 'constants/shortcuts/logsExplorerShortcuts';
import { useKeyboardHotkeys } from 'hooks/hotkeys/useKeyboardHotkeys'; import { useKeyboardHotkeys } from 'hooks/hotkeys/useKeyboardHotkeys';
import { WhereClauseConfig } from 'hooks/queryBuilder/useAutoComplete'; import { WhereClauseConfig } from 'hooks/queryBuilder/useAutoComplete';
@ -40,7 +39,6 @@ import {
useRef, useRef,
useState, useState,
} from 'react'; } from 'react';
import { useLocation } from 'react-router-dom';
import { import {
BaseAutocompleteData, BaseAutocompleteData,
DataTypes, DataTypes,
@ -147,9 +145,8 @@ function QueryBuilderSearchV2(
const [showAllFilters, setShowAllFilters] = useState<boolean>(false); const [showAllFilters, setShowAllFilters] = useState<boolean>(false);
const { pathname } = useLocation(); const isLogsDataSource = useMemo(() => query.dataSource === DataSource.LOGS, [
const isLogsExplorerPage = useMemo(() => pathname === ROUTES.LOGS_EXPLORER, [ query.dataSource,
pathname,
]); ]);
const memoizedSearchParams = useMemo( const memoizedSearchParams = useMemo(
@ -235,7 +232,7 @@ function QueryBuilderSearchV2(
}, },
{ {
queryKey: [searchParams], queryKey: [searchParams],
enabled: isQueryEnabled && !isLogsExplorerPage, enabled: isQueryEnabled && !isLogsDataSource,
}, },
); );
@ -250,7 +247,7 @@ function QueryBuilderSearchV2(
}, },
{ {
queryKey: [suggestionsParams], queryKey: [suggestionsParams],
enabled: isQueryEnabled && isLogsExplorerPage, enabled: isQueryEnabled && isLogsDataSource,
}, },
); );
@ -651,7 +648,7 @@ function QueryBuilderSearchV2(
useEffect(() => { useEffect(() => {
if (currentState === DropdownState.ATTRIBUTE_KEY) { if (currentState === DropdownState.ATTRIBUTE_KEY) {
const { tagKey } = getTagToken(searchValue); 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 // add the user typed option in the dropdown to select that and move ahead irrespective of the matches and all
setDropdownOptions([ setDropdownOptions([
...(!isEmpty(tagKey) && ...(!isEmpty(tagKey) &&
@ -756,7 +753,7 @@ function QueryBuilderSearchV2(
currentFilterItem?.key?.dataType, currentFilterItem?.key?.dataType,
currentState, currentState,
data?.payload?.attributeKeys, data?.payload?.attributeKeys,
isLogsExplorerPage, isLogsDataSource,
searchValue, searchValue,
suggestionsData?.payload?.attributes, suggestionsData?.payload?.attributes,
]); ]);