Skip to content

Commit 5215eec

Browse files
authored
feat: show bucket's ID for all buckets (#3201)
* feat: added ids to automated buckets * fix: prettier * test: test takes id into account
1 parent 5568d0c commit 5215eec

File tree

2 files changed

+18
-12
lines changed

2 files changed

+18
-12
lines changed

src/buckets/components/BucketCardMeta.test.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -59,9 +59,9 @@ describe('bucket meta data card, testing that the schema type shows up properly'
5959
const card = getByTestId('resourceCard-buckets-fooabc')
6060

6161
const schemaType = getByTestId('bucket-schemaType')
62-
// should be three nodes ('system', '30 days', and 'implicit schema type')
62+
// should be three nodes ('system', '30 days', and 'implicit schema type', <id string>)
6363

64-
expect(card.childElementCount).toEqual(3)
64+
expect(card.childElementCount).toEqual(4)
6565

6666
expect(schemaType).toHaveTextContent(IMPLICIT_TEXT)
6767
})
@@ -71,8 +71,8 @@ describe('bucket meta data card, testing that the schema type shows up properly'
7171

7272
const card = getByTestId('resourceCard-buckets-fooabc')
7373

74-
// should be three nodes ('system', '30 days', 'implicit schema type')
75-
expect(card.childElementCount).toEqual(3)
74+
// should be three nodes ('system', '30 days', 'implicit schema type', <id string>)
75+
expect(card.childElementCount).toEqual(4)
7676

7777
expect(getByTestId('bucket-schemaType')).toHaveTextContent(IMPLICIT_TEXT)
7878
})

src/buckets/components/BucketCardMeta.tsx

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -57,10 +57,22 @@ const BucketCardMeta: FC<Props> = ({bucket, notify}) => {
5757
{schemaLabel}
5858
</span>
5959
)
60+
const bucketID = (
61+
<CopyToClipboard
62+
text={bucket.id}
63+
onCopy={handleCopyAttempt}
64+
key={bucket.id}
65+
>
66+
<span className="copy-bucket-id" title="Click to Copy to Clipboard">
67+
ID: {bucket.id}
68+
<span className="copy-bucket-id--helper">Copy to Clipboard</span>
69+
</span>
70+
</CopyToClipboard>
71+
)
6072

6173
const bucketInfo = CLOUD
62-
? [persistentBucketMeta, schemaBlock]
63-
: [persistentBucketMeta]
74+
? [persistentBucketMeta, schemaBlock, bucketID]
75+
: [persistentBucketMeta, bucketID]
6476

6577
if (bucket.type === 'system') {
6678
return (
@@ -79,12 +91,6 @@ const BucketCardMeta: FC<Props> = ({bucket, notify}) => {
7991
return (
8092
<ResourceCard.Meta testID={`resourceCard-buckets-${bucket.id}`}>
8193
{bucketInfo}
82-
<CopyToClipboard text={bucket.id} onCopy={handleCopyAttempt}>
83-
<span className="copy-bucket-id" title="Click to Copy to Clipboard">
84-
ID: {bucket.id}
85-
<span className="copy-bucket-id--helper">Copy to Clipboard</span>
86-
</span>
87-
</CopyToClipboard>
8894
</ResourceCard.Meta>
8995
)
9096
}

0 commit comments

Comments
 (0)