From 5dfeb0ad82d6b07684b2831fb6963a794cee2ff2 Mon Sep 17 00:00:00 2001 From: alexpaxton Date: Thu, 4 Jun 2020 15:12:14 -0700 Subject: [PATCH] feat(ui): expose bucketid (#18319) * refactor: extract bucket card actions and meta into separate components * feat: allow bucket ID to be copied * chore: cleanup * chore: update changelog * feat: add copiable ID to demo data bucket cards --- CHANGELOG.md | 4 + ui/src/buckets/components/BucketCard.tsx | 158 ++---------------- .../buckets/components/BucketCardActions.tsx | 146 ++++++++++++++++ ui/src/buckets/components/BucketCardMeta.scss | 20 +++ ui/src/buckets/components/BucketCardMeta.tsx | 87 ++++++++++ .../buckets/components/DemoDataBucketCard.tsx | 31 ++++ ui/src/style/chronograf.scss | 1 + 7 files changed, 303 insertions(+), 144 deletions(-) create mode 100644 ui/src/buckets/components/BucketCardActions.tsx create mode 100644 ui/src/buckets/components/BucketCardMeta.scss create mode 100644 ui/src/buckets/components/BucketCardMeta.tsx diff --git a/CHANGELOG.md b/CHANGELOG.md index 88699caae2..370f934f14 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,10 @@ 1. [18335](https://github.com/influxdata/influxdb/pull/18335): Disable failing when providing an unexpected error to influx CLI 1. [18345](https://github.com/influxdata/influxdb/pull/18345): Have influx delete cmd respect the config +### UI Improvements + +1. [18319](https://github.com/influxdata/influxdb/pull/18319): Display bucket ID in bucket list and enable 1 click copying + ## v2.0.0-beta.11 [2020-05-26] ### Features diff --git a/ui/src/buckets/components/BucketCard.tsx b/ui/src/buckets/components/BucketCard.tsx index a7daadb622..e409034f84 100644 --- a/ui/src/buckets/components/BucketCard.tsx +++ b/ui/src/buckets/components/BucketCard.tsx @@ -1,40 +1,19 @@ // Libraries import React, {FC} from 'react' import {withRouter, WithRouterProps} from 'react-router' -import {connect} from 'react-redux' import _ from 'lodash' // Components -import { - Button, - ResourceCard, - FlexBox, - FlexDirection, - ComponentSize, -} from '@influxdata/clockface' +import {ResourceCard} from '@influxdata/clockface' import BucketContextMenu from 'src/buckets/components/BucketContextMenu' -import BucketAddDataButton from 'src/buckets/components/BucketAddDataButton' -import InlineLabels from 'src/shared/components/inlineLabels/InlineLabels' -import {FeatureFlag} from 'src/shared/utils/featureFlag' +import BucketCardMeta from 'src/buckets/components/BucketCardMeta' +import BucketCardActions from 'src/buckets/components/BucketCardActions' // Constants import {isSystemBucket} from 'src/buckets/constants/index' -// Actions -import {addBucketLabel, deleteBucketLabel} from 'src/buckets/actions/thunks' -import {setBucketInfo} from 'src/dataLoaders/actions/steps' -import {setDataLoadersType} from 'src/dataLoaders/actions/dataLoaders' - // Types -import {Label, OwnBucket} from 'src/types' -import {DataLoaderType} from 'src/types/dataLoaders' - -interface DispatchProps { - onAddBucketLabel: typeof addBucketLabel - onDeleteBucketLabel: typeof deleteBucketLabel - onSetDataLoadersBucket: typeof setBucketInfo - onSetDataLoadersType: typeof setDataLoadersType -} +import {OwnBucket} from 'src/types' interface Props { bucket: OwnBucket @@ -44,123 +23,18 @@ interface Props { onFilterChange: (searchTerm: string) => void } -const BucketCard: FC = ({ +const BucketCard: FC = ({ bucket, onDeleteBucket, onFilterChange, - onAddBucketLabel, - onDeleteBucketLabel, onDeleteData, router, params: {orgID}, - onSetDataLoadersBucket, - onSetDataLoadersType, }) => { - const handleAddLabel = (label: Label) => { - onAddBucketLabel(bucket.id, label) - } - - const handleRemoveLabel = (label: Label) => { - onDeleteBucketLabel(bucket.id, label) - } - - const handleClickSettings = () => { - router.push(`/orgs/${orgID}/load-data/buckets/${bucket.id}/edit`) - } - const handleNameClick = () => { router.push(`/orgs/${orgID}/data-explorer?bucket=${bucket.name}`) } - const handleAddCollector = () => { - onSetDataLoadersBucket(orgID, bucket.name, bucket.id) - - onSetDataLoadersType(DataLoaderType.Streaming) - router.push(`/orgs/${orgID}/load-data/buckets/${bucket.id}/telegrafs/new`) - } - - const handleAddLineProtocol = () => { - onSetDataLoadersBucket(orgID, bucket.name, bucket.id) - - onSetDataLoadersType(DataLoaderType.LineProtocol) - router.push( - `/orgs/${orgID}/load-data/buckets/${bucket.id}/line-protocols/new` - ) - } - - const handleAddClientLibrary = (): void => { - onSetDataLoadersBucket(orgID, bucket.name, bucket.id) - onSetDataLoadersType(DataLoaderType.ClientLibrary) - - router.push(`/orgs/${orgID}/load-data/client-libraries`) - } - - const handleAddScraper = () => { - onSetDataLoadersBucket(orgID, bucket.name, bucket.id) - - onSetDataLoadersType(DataLoaderType.Scraping) - router.push(`/orgs/${orgID}/load-data/buckets/${bucket.id}/scrapers/new`) - } - - const actionButtons = ( - - - -