diff --git a/CHANGELOG.md b/CHANGELOG.md index 8cf7f03aec3..83fe85af07a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -49,6 +49,7 @@ 1. [16435](https://github.com/influxdata/influxdb/pull/16435): Time labels are no longer squished to the left 1. [16427](https://github.com/influxdata/influxdb/pull/16427): Fixed underlying issue with disappearing queries made in Advanced Mode 1. [16439](https://github.com/influxdata/influxdb/pull/16439): Prevent negative zero and allow zero to have decimal places +1. [16376](https://github.com/influxdata/influxdb/pull/16413): Limit data loader bucket selection to non system buckets ### UI Improvements diff --git a/ui/src/dataLoaders/components/BucketsDropdown.tsx b/ui/src/dataLoaders/components/BucketsDropdown.tsx index 5f1d3262d90..7784e1e6ce4 100644 --- a/ui/src/dataLoaders/components/BucketsDropdown.tsx +++ b/ui/src/dataLoaders/components/BucketsDropdown.tsx @@ -70,11 +70,9 @@ class BucketsDropdown extends PureComponent { return [] } - const nonSystemBuckets = buckets.filter(bucket => { - if (!isSystemBucket(bucket.name)) { - return bucket - } - }) + const nonSystemBuckets = buckets.filter( + bucket => !isSystemBucket(bucket.name) + ) return nonSystemBuckets.map(b => ( { - constructor(props: AllProps) { - super(props) - this.state = { - buckets: [], - } - } - +class CollectorsWizard extends PureComponent { public componentDidMount() { - this.handleSetBucketInfo() + const {bucket, buckets} = this.props + if (!bucket && (buckets && buckets.length)) { + const {orgID, name, id} = buckets[0] + this.props.onSetBucketInfo(orgID, name, id) + } this.props.onSetCurrentStepIndex(0) } @@ -134,15 +128,6 @@ class CollectorsWizard extends PureComponent { ) } - private handleSetBucketInfo = () => { - const {bucket, buckets} = this.props - if (!bucket && (buckets && buckets.length)) { - const {orgID, name, id} = buckets[0] - - this.props.onSetBucketInfo(orgID, name, id) - } - } - private handleDismiss = () => { const {router, org} = this.props @@ -187,6 +172,11 @@ const mstp = (state: AppState): StateProps => { } = state const buckets = getAll(state, ResourceType.Buckets) + + const nonSystemBuckets = buckets.filter( + bucket => !isSystemBucket(bucket.name) + ) + const org = getOrg(state) return { @@ -197,7 +187,7 @@ const mstp = (state: AppState): StateProps => { substep, username: name, bucket, - buckets, + buckets: nonSystemBuckets, org, } } diff --git a/ui/src/onboarding/actions/index.ts b/ui/src/onboarding/actions/index.ts index 34131b7d051..ff364911ef9 100644 --- a/ui/src/onboarding/actions/index.ts +++ b/ui/src/onboarding/actions/index.ts @@ -59,12 +59,12 @@ const setOrganizationID = (orgID: string): SetOrganizationID => ({ }) interface SetBucketID { - type: 'SET_BUCKET_ID' + type: 'SET_ONBOARDING_BUCKET_ID' payload: {bucketID: string} } export const setBucketID = (bucketID: string): SetBucketID => ({ - type: 'SET_BUCKET_ID', + type: 'SET_ONBOARDING_BUCKET_ID', payload: {bucketID}, }) diff --git a/ui/src/onboarding/reducers/index.ts b/ui/src/onboarding/reducers/index.ts index edf008cecbc..bb35e3eb8e6 100644 --- a/ui/src/onboarding/reducers/index.ts +++ b/ui/src/onboarding/reducers/index.ts @@ -29,7 +29,7 @@ export default (state = INITIAL_STATE, action: Action): OnboardingState => { return {...state, stepStatuses} case 'SET_ORG_ID': return {...state, orgID: action.payload.orgID} - case 'SET_BUCKET_ID': + case 'SET_ONBOARDING_BUCKET_ID': return {...state, bucketID: action.payload.bucketID} default: return state diff --git a/ui/src/telegrafs/components/Collectors.tsx b/ui/src/telegrafs/components/Collectors.tsx index cd31a62fa48..80389eda5a2 100644 --- a/ui/src/telegrafs/components/Collectors.tsx +++ b/ui/src/telegrafs/components/Collectors.tsx @@ -24,7 +24,6 @@ import NoBucketsWarning from 'src/buckets/components/NoBucketsWarning' import GetResources from 'src/shared/components/GetResources' // Actions -import {setBucketInfo} from 'src/dataLoaders/actions/steps' import {updateTelegraf, deleteTelegraf} from 'src/telegrafs/actions/thunks' // Decorators @@ -33,12 +32,10 @@ import {ErrorHandling} from 'src/shared/decorators/errors' // Types import {Telegraf, OverlayState, AppState, Bucket, ResourceType} from 'src/types' import { - setDataLoadersType, setTelegrafConfigID, setTelegrafConfigName, clearDataLoaders, } from 'src/dataLoaders/actions/dataLoaders' -import {DataLoaderType} from 'src/types/dataLoaders' import {SortTypes} from 'src/shared/utils/sort' // Selectors @@ -52,8 +49,6 @@ interface StateProps { } interface DispatchProps { - onSetBucketInfo: typeof setBucketInfo - onSetDataLoadersType: typeof setDataLoadersType onSetTelegrafConfigID: typeof setTelegrafConfigID onSetTelegrafConfigName: typeof setTelegrafConfigName onClearDataLoaders: typeof clearDataLoaders @@ -193,20 +188,10 @@ class Collectors extends PureComponent { private handleAddCollector = () => { const { - buckets, - onSetBucketInfo, - onSetDataLoadersType, router, params: {orgID}, } = this.props - if (buckets && buckets.length) { - const {orgID, name, id} = buckets[0] - onSetBucketInfo(orgID, name, id) - } - - onSetDataLoadersType(DataLoaderType.Scraping) - router.push(`/orgs/${orgID}/load-data/telegrafs/new`) } @@ -273,8 +258,6 @@ const mstp = (state: AppState): StateProps => { } const mdtp: DispatchProps = { - onSetBucketInfo: setBucketInfo, - onSetDataLoadersType: setDataLoadersType, onSetTelegrafConfigID: setTelegrafConfigID, onSetTelegrafConfigName: setTelegrafConfigName, onClearDataLoaders: clearDataLoaders,