Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
7 changes: 7 additions & 0 deletions .changeset/team-default-filter-values-mode.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
'@hyperdx/common-utils': patch
'@hyperdx/api': patch
'@hyperdx/app': patch
---

feat: Add a team-wide default (All or Exact) for the search filters "Show All Values" setting
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -111,3 +111,4 @@ packages/*/reports/
docs/superpowers/
.superpowers/
.playwright-mcp/
.agents/
1 change: 1 addition & 0 deletions packages/api/src/models/team.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ export default mongoose.model<ITeam>(
fieldMetadataDisabled: Boolean,
parallelizeWhenPossible: Boolean,
filterKeysFetchLimit: Number,
filterValuesExactByDefault: Boolean,
},
{
timestamps: true,
Expand Down
12 changes: 10 additions & 2 deletions packages/app/src/components/DBSearchPageFilters.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ import {
IconSitemap,
} from '@tabler/icons-react';

import api from '@/api';
import { IS_CLICKHOUSE_BUILD } from '@/config';
import {
useColumns,
Expand Down Expand Up @@ -1220,10 +1221,14 @@ const DBSearchPageFiltersComponent = ({
'hdx-shared-filters-expanded',
true,
);
const [showAllValues, setShowAllValues] = useLocalStorage(
const { data: me } = api.useMe();
// null = user hasn't chosen, so fall back to the team default
const [userShowAllValues, setShowAllValues] = useLocalStorage<boolean | null>(
'hdx-show-all-filter-values',
true,
null,
);
const teamShowAllValues = !me?.team?.filterValuesExactByDefault;
Comment thread
knudtty marked this conversation as resolved.
Resolved
const showAllValues = userShowAllValues ?? teamShowAllValues;
const { size, startResize } = useResizable(16, 'left');

const { data: source } = useSource({ id: sourceId });
Expand Down Expand Up @@ -1809,6 +1814,9 @@ const DBSearchPageFiltersComponent = ({
}}
showAllValues={showAllValues}
onShowAllValuesChange={setShowAllValues}
teamShowAllValues={teamShowAllValues}
isShowAllValuesOverridden={userShowAllValues != null}
onResetShowAllValues={() => setShowAllValues(null)}
/>
{onCollapse && (
<Tooltip label="Hide filters" position="bottom">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,9 @@ export function FilterSettingsPanel({
onResetSharedFilters,
showAllValues,
onShowAllValuesChange,
teamShowAllValues,
isShowAllValuesOverridden,
onResetShowAllValues,
}: {
isSharedFiltersVisible: boolean;
onSharedFiltersVisibilityChange: (visible: boolean) => void;
Expand All @@ -52,6 +55,9 @@ export function FilterSettingsPanel({
onResetSharedFilters: VoidFunction;
showAllValues: boolean;
onShowAllValuesChange: (show: boolean) => void;
teamShowAllValues: boolean;
isShowAllValuesOverridden: boolean;
onResetShowAllValues: VoidFunction;
}) {
const showResetSection = hasPersonalPins || hasSharedPins;

Expand Down Expand Up @@ -117,6 +123,18 @@ export function FilterSettingsPanel({
onChange={e => onShowAllValuesChange(e.currentTarget.checked)}
/>
</Tooltip>
<Flex justify="space-between" mt={-6} pl="sm">
<Text size="xxs" c="dimmed">
Team default: {teamShowAllValues ? 'All' : 'Exact'}
</Text>
{isShowAllValuesOverridden && (
<UnstyledButton onClick={onResetShowAllValues}>
<Text size="xxs" c="dimmed" td="underline">
Use team default
Comment thread
knudtty marked this conversation as resolved.
Resolved
</Text>
</UnstyledButton>
)}
</Flex>
{showResetSection && (
<>
<Separator size="xs" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -328,6 +328,13 @@ export default function TeamQueryConfigSection() {
displayValue={displayValueWithUnit('keys')}
description={`Default is ${DEFAULT_FILTER_KEYS_FETCH_LIMIT}`}
/>
<ClickhouseSettingForm
settingKey="filterValuesExactByDefault"
label="Default filter values"
tooltip="Default for the search page's Show All Values filter setting. All shows every known value; Exact shows only values matching the current query. Users can still override this in their filter settings."
Comment thread
knudtty marked this conversation as resolved.
Resolved
type="boolean"
displayValue={value => (value ? 'Exact' : 'All')}
/>
<ClickhouseSettingForm
settingKey="fieldMetadataDisabled"
label="Field Metadata Queries"
Expand Down
2 changes: 2 additions & 0 deletions packages/common-utils/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2692,6 +2692,7 @@ export const TeamClickHouseSettingsSchema = z.object({
metadataMaxRowsToRead: z.number().optional(),
parallelizeWhenPossible: z.boolean().optional(),
filterKeysFetchLimit: z.number().optional(),
filterValuesExactByDefault: z.boolean().optional(),
});

/** Accepts null to unset (reset to default) a setting. */
Expand All @@ -2702,6 +2703,7 @@ export const TeamClickHouseSettingsUpdateSchema = z.object({
metadataMaxRowsToRead: z.number().nullish(),
parallelizeWhenPossible: z.boolean().nullish(),
filterKeysFetchLimit: z.number().nullish(),
filterValuesExactByDefault: z.boolean().nullish(),
});
export type TeamClickHouseSettingsUpdate = z.infer<
typeof TeamClickHouseSettingsUpdateSchema
Expand Down
Loading