Skip to content

Commit

Permalink
Disable sample by and latest on with no ts
Browse files Browse the repository at this point in the history
  • Loading branch information
insmac committed Jun 24, 2024
1 parent 3313702 commit 52c583c
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 2 deletions.
4 changes: 3 additions & 1 deletion src/components/queryBuilder/GroupBy.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ interface GroupByEditorProps {
groupBy: string[];
onGroupByChange: (groupBy: string[]) => void;
labelAndTooltip: typeof selectors.components.QueryEditor.QueryBuilder.GROUP_BY;
isDisabled: boolean;
}
export const GroupByEditor = (props: GroupByEditorProps) => {
const columns: SelectableValue[] = (props.fieldsList || []).map((f) => ({ label: f.label, value: f.name }));
Expand All @@ -34,7 +35,7 @@ export const GroupByEditor = (props: GroupByEditorProps) => {
<EditorField tooltip={tooltip} label={label}>
<MultiSelect
options={columns}
placeholder="Choose"
placeholder={props.isDisabled ? 'Table is missing designated timestamp' : 'Choose'}
isOpen={isOpen}
onOpenMenu={() => setIsOpen(true)}
onCloseMenu={() => setIsOpen(false)}
Expand All @@ -43,6 +44,7 @@ export const GroupByEditor = (props: GroupByEditorProps) => {
value={groupBy}
allowCustomValue={true}
width={50}
disabled={props.isDisabled}
/>
</EditorField>
);
Expand Down
8 changes: 7 additions & 1 deletion src/components/queryBuilder/QueryBuilder.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,7 @@ export const QueryBuilder = (props: QueryBuilderProps) => {
onGroupByChange={onGroupByChange}
fieldsList={fieldsList}
labelAndTooltip={selectors.components.QueryEditor.QueryBuilder.SAMPLE_BY}
isDisabled={builder.timeField.length === 0}
/>
</EditorRow>
)}
Expand Down Expand Up @@ -264,7 +265,11 @@ export const QueryBuilder = (props: QueryBuilderProps) => {

{builder.mode === BuilderMode.Trend && (
<EditorRow>
<SampleByFillEditor fills={builder.sampleByFill || []} onFillsChange={onFillChange} />
<SampleByFillEditor
fills={builder.sampleByFill || []}
onFillsChange={onFillChange}
isDisabled={builder.timeField.length === 0}
/>
</EditorRow>
)}

Expand All @@ -275,6 +280,7 @@ export const QueryBuilder = (props: QueryBuilderProps) => {
onGroupByChange={onGroupByChange}
fieldsList={fieldsList}
labelAndTooltip={selectors.components.QueryEditor.QueryBuilder.GROUP_BY}
isDisabled={builder.timeField.length === 0}
/>
</EditorRow>
)}
Expand Down
3 changes: 3 additions & 0 deletions src/components/queryBuilder/SampleByFillEditor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import { GroupBase, OptionsOrGroups } from 'react-select';
interface FillEditorProps {
fills: string[];
onFillsChange: (fills: string[]) => void;
isDisabled: boolean;
}

const fillModes: SelectableValue[] = [];
Expand Down Expand Up @@ -85,6 +86,8 @@ export const SampleByFillEditor = (props: FillEditorProps) => {
width={50}
isClearable={true}
hideSelectedOptions={true}
placeholder={props.isDisabled ? 'Table is missing designated timestamp' : 'Choose'}
disabled={props.isDisabled}
/>
</EditorField>
);
Expand Down

0 comments on commit 52c583c

Please sign in to comment.