Skip to content

Commit 716ce93

Browse files
committed
✨ Add in parens to logic category
1 parent 1d66996 commit 716ce93

File tree

6 files changed

+16
-12
lines changed

6 files changed

+16
-12
lines changed

static/app/components/searchQueryBuilder/hooks/useQueryBuilderState.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@ type UpdateAggregateArgsAction = {
204204
};
205205

206206
type UpdateLogicOperatorAction = {
207-
token: TokenResult<Token.LOGIC_BOOLEAN>;
207+
token: TokenResult<Token.LOGIC_BOOLEAN | Token.L_PAREN | Token.R_PAREN>;
208208
type: 'UPDATE_LOGIC_OPERATOR';
209209
value: string;
210210
};

static/app/components/searchQueryBuilder/index.spec.tsx

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -716,30 +716,26 @@ describe('SearchQueryBuilder', () => {
716716
});
717717
});
718718

719-
describe('conditionals category', () => {
720-
it('does not render conditionals category when on first input', async () => {
719+
describe('logic category', () => {
720+
it('does not render logic category when on first input', async () => {
721721
render(<SearchQueryBuilder {...defaultProps} initialQuery="" />, {
722722
organization: {features: ['search-query-builder-conditionals-combobox-menus']},
723723
});
724724

725725
await userEvent.click(getLastInput());
726726
expect(await screen.findByRole('button', {name: 'All'})).toBeInTheDocument();
727727

728-
expect(
729-
screen.queryByRole('button', {name: 'Conditionals'})
730-
).not.toBeInTheDocument();
728+
expect(screen.queryByRole('button', {name: 'Logic'})).not.toBeInTheDocument();
731729
});
732730

733-
it('renders conditionals category when not on first input', async () => {
731+
it('renders logic category when not on first input', async () => {
734732
render(<SearchQueryBuilder {...defaultProps} initialQuery="span.op:test" />, {
735733
organization: {features: ['search-query-builder-conditionals-combobox-menus']},
736734
});
737735

738736
await userEvent.click(getLastInput());
739737
// Should show conditionals button
740-
expect(
741-
await screen.findByRole('button', {name: 'Conditionals'})
742-
).toBeInTheDocument();
738+
expect(await screen.findByRole('button', {name: 'Logic'})).toBeInTheDocument();
743739
});
744740
});
745741
});

static/app/components/searchQueryBuilder/tokens/boolean.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,8 @@ function FilterDelete({token, state, item}: SearchQueryBuilderBooleanProps) {
9191
const LOGIC_OPERATOR_OPTIONS = [
9292
{value: 'AND', label: 'AND'},
9393
{value: 'OR', label: 'OR'},
94+
{value: '(', label: '('},
95+
{value: ')', label: ')'},
9496
];
9597

9698
function SearchQueryBuilderBooleanSelect({

static/app/components/searchQueryBuilder/tokens/filterKeyListBox/types.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ export interface AskSeerConsentItem extends SelectOptionWithKey<string> {
6060

6161
export interface LogicFilterItem extends SelectOptionWithKey<string> {
6262
type: 'logic-filter';
63-
value: 'AND' | 'OR';
63+
value: 'AND' | 'OR' | '(' | ')';
6464
}
6565

6666
export type SearchKeyItem =

static/app/components/searchQueryBuilder/tokens/filterKeyListBox/useFilterKeyListBox.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -203,6 +203,8 @@ function useFilterKeySections({
203203
const conditionalFilterItems = [
204204
createLogicFilterItem({value: 'AND'}),
205205
createLogicFilterItem({value: 'OR'}),
206+
createLogicFilterItem({value: '('}),
207+
createLogicFilterItem({value: ')'}),
206208
];
207209

208210
interface UseFilterKeyListBoxArgs {

static/app/components/searchQueryBuilder/tokens/filterKeyListBox/utils.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -249,7 +249,11 @@ export function createAskSeerConsentItem(): AskSeerConsentItem {
249249
};
250250
}
251251

252-
export function createLogicFilterItem({value}: {value: 'AND' | 'OR'}): LogicFilterItem {
252+
export function createLogicFilterItem({
253+
value,
254+
}: {
255+
value: 'AND' | 'OR' | '(' | ')';
256+
}): LogicFilterItem {
253257
return {
254258
key: getEscapedKey(value),
255259
type: 'logic-filter' as const,

0 commit comments

Comments
 (0)