Skip to content

Commit

Permalink
feat: enable the new where clause for all the log based queries (#6671)
Browse files Browse the repository at this point in the history
* feat: enable the new where clause for logs dashboards
  • Loading branch information
vikrantgupta25 authored Jan 2, 2025
1 parent dad72dd commit d48cdbf
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 14 deletions.
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

0 comments on commit d48cdbf

Please sign in to comment.