Skip to content

Commit bcaaa44

Browse files
fix: remove hard-coded error message for Aggregate Type error (#3932)
1 parent baaf231 commit bcaaa44

File tree

3 files changed

+2
-59
lines changed

3 files changed

+2
-59
lines changed
Lines changed: 1 addition & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,6 @@
11
// Libraries
2-
import React, {FC} from 'react'
2+
import React from 'react'
33
import {Link} from 'react-router-dom'
4-
import {Button, ComponentSize} from '@influxdata/clockface'
5-
import {useDispatch} from 'react-redux'
6-
7-
// Utils
8-
import {setFunctions} from 'src/timeMachine/actions/queryBuilder'
94

105
// Types
116
import {NotificationDismiss} from 'src/types'
@@ -20,31 +15,3 @@ export const getDeleteAccountWarningButton = (
2015
</Link>
2116
)
2217
}
23-
24-
interface AggregateTypeErrorButtonProps {
25-
onDismiss: NotificationDismiss
26-
}
27-
28-
export const AggregateTypeErrorButton: FC<AggregateTypeErrorButtonProps> = ({
29-
onDismiss,
30-
}) => {
31-
const dispatch = useDispatch()
32-
const onClick = () => {
33-
dispatch(setFunctions(['last']))
34-
onDismiss()
35-
}
36-
37-
return (
38-
<Button
39-
text="Update Aggregate Type"
40-
onClick={onClick}
41-
size={ComponentSize.ExtraSmall}
42-
/>
43-
)
44-
}
45-
46-
export const getAggregateTypeErrorButton = (
47-
onDismiss: NotificationDismiss
48-
): JSX.Element => {
49-
return <AggregateTypeErrorButton onDismiss={onDismiss} />
50-
}

src/timeMachine/actions/queries.ts

Lines changed: 1 addition & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -15,22 +15,16 @@ import {notify} from 'src/shared/actions/notifications'
1515
import {hydrateVariables} from 'src/variables/actions/thunks'
1616

1717
// Constants
18-
import {
19-
rateLimitReached,
20-
resultTooLarge,
21-
updateAggregateType,
22-
} from 'src/shared/copy/notifications'
18+
import {rateLimitReached, resultTooLarge} from 'src/shared/copy/notifications'
2319

2420
// Utils
2521
import fromFlux from 'src/shared/utils/fromFlux'
2622
import {isFlagEnabled} from 'src/shared/utils/featureFlag'
2723
import {buildUsedVarsOption} from 'src/variables/utils/buildVarsOption'
2824
import {findNodes} from 'src/shared/utils/ast'
29-
import {isAggregateTypeError} from 'src/utils/aggregateTypeErrors'
3025
import {event} from 'src/cloud/utils/reporting'
3126
import {asSimplyKeyValueVariables, hashCode} from 'src/shared/apis/queryCache'
3227
import {filterUnusedVarsBasedOnQuery} from 'src/shared/utils/filterUnusedVars'
33-
import {getAggregateTypeErrorButton} from 'src/shared/components/notifications/NotificationButtons'
3428

3529
// Types
3630
import {CancelBox} from 'src/types/promises'
@@ -44,7 +38,6 @@ import {
4438
QueryEditMode,
4539
BuilderTagsType,
4640
Variable,
47-
NotificationButtonElement,
4841
} from 'src/types'
4942

5043
// Selectors
@@ -333,16 +326,6 @@ export const executeQueries = (abortController?: AbortController) => async (
333326

334327
for (const result of results) {
335328
if (result.type === 'UNKNOWN_ERROR') {
336-
if (
337-
isAggregateTypeError(result.code, result.message) &&
338-
state.currentExplorer.isAutoFunction
339-
) {
340-
const message = `It looks like you're trying to apply a number-based aggregate function to a string, which cannot be processed. You can fix this by selecting the Aggregate Function "Last"`
341-
const buttonElement: NotificationButtonElement = onDismiss =>
342-
getAggregateTypeErrorButton(onDismiss)
343-
dispatch(notify(updateAggregateType(message, buttonElement)))
344-
}
345-
346329
throw new Error(result.message)
347330
}
348331

src/utils/aggregateTypeErrors.ts

Lines changed: 0 additions & 7 deletions
This file was deleted.

0 commit comments

Comments
 (0)