diff --git a/ui/src/buckets/actions/thunks.ts b/ui/src/buckets/actions/thunks.ts index 0d04fb66d9..0049ab4dac 100644 --- a/ui/src/buckets/actions/thunks.ts +++ b/ui/src/buckets/actions/thunks.ts @@ -49,6 +49,7 @@ import { removeBucketLabelFailed, } from 'src/shared/copy/notifications' import {LIMIT} from 'src/resources/constants' +import {getDemoDataBucketsFromAll} from 'src/cloud/apis/demodata' type Action = BucketAction | NotifyAction @@ -71,8 +72,10 @@ export const getBuckets = () => async ( throw new Error(resp.data.message) } + const demoDataBuckets = await getDemoDataBucketsFromAll() + const buckets = normalize( - resp.data.buckets, + [...resp.data.buckets, ...demoDataBuckets], arrayOfBuckets ) diff --git a/ui/src/buckets/components/BucketAddDataButton.scss b/ui/src/buckets/components/BucketAddDataButton.scss index a2a9a0192e..78fb29acc6 100644 --- a/ui/src/buckets/components/BucketAddDataButton.scss +++ b/ui/src/buckets/components/BucketAddDataButton.scss @@ -53,4 +53,13 @@ .system-bucket { color: mix($c-honeydew, $g13-mist); -} \ No newline at end of file +} + +.buckets-buttons-wrap { + display: flex; + box-sizing: border-box; + text-align: right; + @media screen and (max-width: 680px) { + margin: 8px auto 0; + } +} diff --git a/ui/src/buckets/components/BucketsTab.tsx b/ui/src/buckets/components/BucketsTab.tsx index 17089c90a3..e93234b4db 100644 --- a/ui/src/buckets/components/BucketsTab.tsx +++ b/ui/src/buckets/components/BucketsTab.tsx @@ -1,6 +1,6 @@ // Libraries import React, {PureComponent} from 'react' -import {isEmpty} from 'lodash' +import {isEmpty, get} from 'lodash' import {connect} from 'react-redux' // Components @@ -21,10 +21,10 @@ import SearchWidget from 'src/shared/components/search_widget/SearchWidget' import SettingsTabbedPageHeader from 'src/settings/components/SettingsTabbedPageHeader' import FilterList from 'src/shared/components/FilterList' import BucketList from 'src/buckets/components/BucketList' -import {PrettyBucket} from 'src/buckets/components/BucketCard' import CreateBucketOverlay from 'src/buckets/components/CreateBucketOverlay' import AssetLimitAlert from 'src/cloud/components/AssetLimitAlert' import BucketExplainer from 'src/buckets/components/BucketExplainer' +import DemoDataDropdown from 'src/buckets/components/DemoDataDropdown' // Actions import { @@ -36,14 +36,20 @@ import { checkBucketLimits as checkBucketLimitsAction, LimitStatus, } from 'src/cloud/actions/limits' +import { + getDemoDataBuckets as getDemoDataBucketsAction, + getDemoDataBucketMembership as getDemoDataBucketMembershipAction, +} from 'src/cloud/actions/demodata' // Utils import {prettyBuckets} from 'src/shared/utils/prettyBucket' import {extractBucketLimits} from 'src/cloud/utils/limits' import {getOrg} from 'src/organizations/selectors' import {getAll} from 'src/resources/selectors' +import {isFlagEnabled} from 'src/shared/utils/featureFlag' // Types +import {PrettyBucket} from 'src/buckets/components/BucketCard' import { OverlayState, AppState, @@ -57,6 +63,7 @@ interface StateProps { org: Organization buckets: Bucket[] limitStatus: LimitStatus + demoDataBuckets: Bucket[] } interface DispatchProps { @@ -64,6 +71,8 @@ interface DispatchProps { updateBucket: typeof updateBucket deleteBucket: typeof deleteBucket checkBucketLimits: typeof checkBucketLimitsAction + getDemoDataBuckets: typeof getDemoDataBucketsAction + getDemoDataBucketMembership: typeof getDemoDataBucketMembershipAction } interface State { @@ -96,10 +105,19 @@ class BucketsTab extends PureComponent { public componentDidMount() { this.props.checkBucketLimits() + if (isFlagEnabled('demodata')) { + this.props.getDemoDataBuckets() + } } public render() { - const {org, buckets, limitStatus} = this.props + const { + org, + buckets, + limitStatus, + demoDataBuckets, + getDemoDataBucketMembership, + } = this.props const { searchTerm, overlayState, @@ -121,15 +139,23 @@ class BucketsTab extends PureComponent { searchTerm={searchTerm} onSearch={this.handleFilterChange} /> -