@@ -18,9 +18,10 @@ import StatusIndicator from 'src/buckets/components/csvUploader/StatusIndicator'
1818// Utils
1919import { event } from 'src/cloud/utils/reporting'
2020import { getErrorMessage } from 'src/utils/api'
21- import { getOrg } from 'src/organizations/selectors'
21+ import { getOrg , isOrgIOx } from 'src/organizations/selectors'
2222import { reportErrorThroughHoneyBadger } from 'src/shared/utils/errors'
2323import { runQuery } from 'src/shared/apis/query'
24+ import { RunQueryResponse } from 'src/types/queries'
2425
2526// Selectors
2627import {
@@ -32,14 +33,15 @@ import {notify} from 'src/shared/actions/notifications'
3233// Types
3334import { RemoteDataState } from 'src/types'
3435
35- const CsvMethod : FC = ( ) => {
36+ export const CsvMethod : FC = ( ) => {
3637 const [ uploadState , setUploadState ] = useState ( RemoteDataState . NotStarted )
3738 const [ uploadError , setUploadError ] = useState ( '' )
3839
3940 const { bucket} = useContext ( WriteDataDetailsContext )
4041 const orgId = useSelector ( getOrg ) ?. id
4142 const history = useHistory ( )
4243 const org = useSelector ( getOrg )
44+ const orgIsIOx = useSelector ( isOrgIOx )
4345
4446 const dispatch = useDispatch ( )
4547
@@ -96,24 +98,32 @@ const CsvMethod: FC = () => {
9698 controller . current
9799 ) . promise
98100
99- if ( resp . type === ' SUCCESS' ) {
101+ if ( resp . type === RunQueryResponse . SUCCESS ) {
100102 setUploadState ( RemoteDataState . Done )
101103 return
102104 }
103- if ( resp . type === ' RATE_LIMIT_ERROR' ) {
105+ if ( resp . type === RunQueryResponse . RATE_LIMIT_ERROR ) {
104106 setUploadState ( RemoteDataState . Error )
105- setUploadError ( 'Failed due to plan limits: read cardinality reached' )
107+ if ( orgIsIOx ) {
108+ setUploadError (
109+ 'Failed due to request exceeding read or write limits of plan'
110+ )
111+ } else {
112+ setUploadError (
113+ 'Failed due to request exceeding read, write, or cardinality limits of plan'
114+ )
115+ }
106116 return
107117 }
108- if ( resp . type === ' UNKNOWN_ERROR' ) {
118+ if ( resp . type === RunQueryResponse . UNKNOWN_ERROR ) {
109119 const error = getErrorMessage ( resp )
110120 throw new Error ( error )
111121 }
112122 } catch ( error ) {
113123 handleError ( error )
114124 }
115125 } ,
116- [ handleError , org ?. id ]
126+ [ handleError , org ?. id , orgIsIOx ]
117127 )
118128
119129 const handleSeeUploadedData = ( ) => {
@@ -173,5 +183,3 @@ const CsvMethod: FC = () => {
173183 </ Panel >
174184 )
175185}
176-
177- export default CsvMethod
0 commit comments