From 383b0a69d1ea7f7858df61680089c1e2268ba9a1 Mon Sep 17 00:00:00 2001 From: Stephanie Yang Date: Fri, 18 Jun 2021 12:14:47 -0500 Subject: [PATCH] fix group by fields stuff --- lattice/src/App/QueryBuilder/QueryBuilder.tsx | 50 ++++++++++++++----- 1 file changed, 38 insertions(+), 12 deletions(-) diff --git a/lattice/src/App/QueryBuilder/QueryBuilder.tsx b/lattice/src/App/QueryBuilder/QueryBuilder.tsx index 7f948b1ca..1f309787a 100644 --- a/lattice/src/App/QueryBuilder/QueryBuilder.tsx +++ b/lattice/src/App/QueryBuilder/QueryBuilder.tsx @@ -454,6 +454,10 @@ export const QueryBuilder: FC = ({ ); setRowCalls([]); setOperator(undefined); + setGroupByCall({ + primary: '', + secondary: '' + }); }} /> @@ -557,12 +561,23 @@ export const QueryBuilder: FC = ({ className={css.fieldSelector} label="Primary Field" value={groupByCall.primary} - options={selectedTable.fields.map((field) => { - return { - label: `${field.name} (${field.options.type})`, - value: field.name - }; - })} + options={selectedTable.fields + .filter((f) => + [ + 'set', + 'time', + 'mutex', + 'bool', + 'int', + 'timestamp' + ].includes(f.options.type) + ) + .map((field) => { + return { + label: `${field.name} (${field.options.type})`, + value: field.name + }; + })} onChange={(value) => setGroupByCall({ ...groupByCall, @@ -576,12 +591,23 @@ export const QueryBuilder: FC = ({ label="Secondary Field (optional)" value={groupByCall.secondary} allowEmpty={true} - options={selectedTable.fields.map((field) => { - return { - label: `${field.name} (${field.options.type})`, - value: field.name - }; - })} + options={selectedTable.fields + .filter((f) => + [ + 'set', + 'time', + 'mutex', + 'bool', + 'int', + 'timestamp' + ].includes(f.options.type) + ) + .map((field) => { + return { + label: `${field.name} (${field.options.type})`, + value: field.name + }; + })} onChange={(value) => setGroupByCall({ ...groupByCall,