-
Notifications
You must be signed in to change notification settings - Fork 303
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feature(multi-bucket): add multi-bucket support to storage components #5562
Open
jordanvn
wants to merge
31
commits into
main
Choose a base branch
from
multi-bucket-support
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
31 commits
Select commit
Hold shift + click to select a range
82099b3
initial commit to add 'bucket' property to storage components
jordanvn f45e688
chore: use StorageBucket type in StorageImagePathProps
jordanvn 130914d
remove duplicate StorageBucket type declaration
jordanvn 6759502
chore: update aws-amplify version to include multi-bucket support
jordanvn 6d200a9
docs: include references to new 'bucket' prop and its usage
jordanvn 77de102
Merge branch 'main' into multi-bucket-support
jordanvn 5ea81d5
more explicitly clarifying that can be a string in docs example
jordanvn 98b51db
Merge branch 'main' into multi-bucket-support
jordanvn 79d1209
chore: changing reference of storage manager to file uploader
jordanvn 9916524
chore: updating yarn.lock
jordanvn bb0c2f7
chore: undoing unnecessary linting changes
jordanvn 0fab899
chore: moving yarn.lock from main branch parity
jordanvn 77119df
Merge branch 'main' into multi-bucket-support
jordanvn cd12258
chore: updating yarn.lock to main
jordanvn 4c6eae2
chore: add missing references to 'bucket'
jordanvn d36d03e
chore: adding tests and new example app
jordanvn f3953b6
Merge branch 'main' into multi-bucket-support
jordanvn fabf129
chore: add end of file line
jordanvn 8cbbd05
chore: add changeset
jordanvn 757226b
chore: setting more obviously fake bucket name as example
jordanvn f825df3
chore: adding link for setting up multi-bucket configuration to docs
jordanvn e96c3f3
chore: removing unnecessary type definitions
jordanvn a5c3d5e
chore: removing unnecessary type from Storage Image props
jordanvn 68c0a84
Merge branch 'main' into multi-bucket-support
jordanvn 21c0763
Merge branch 'main' into multi-bucket-support
jordanvn f6645f1
chore: adding bucket as omitted prop to gen1 props
jordanvn 5787b6c
fix(tests): updating test data to fit expected behavior
jordanvn 55a141a
Merge branch 'main' into multi-bucket-support
jordanvn 2895e9b
Merge branch 'main' into multi-bucket-support
jordanvn cc79b45
Merge branch 'main' into multi-bucket-support
jordanvn 23e7619
Merge branch 'main' into multi-bucket-support
jordanvn File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
'@aws-amplify/ui-react-storage': minor | ||
--- | ||
|
||
Support for multiple buckets added to storage image and file uploader |
15 changes: 15 additions & 0 deletions
15
docs/src/pages/[platform]/connected-components/storage/fileuploader/examples/BucketExact.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import { FileUploader } from '@aws-amplify/ui-react-storage'; | ||
|
||
export const App = () => { | ||
return ( | ||
<FileUploader | ||
acceptedFileTypes={['image/*']} | ||
bucket={{ | ||
bucketName: 'my-bucket-xxxxxxxx', | ||
region: 'us-west-2', | ||
}} | ||
path="public/" | ||
maxFileCount={1} | ||
/> | ||
); | ||
}; |
12 changes: 12 additions & 0 deletions
12
...rc/pages/[platform]/connected-components/storage/fileuploader/examples/BucketFriendly.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import { FileUploader } from '@aws-amplify/ui-react-storage'; | ||
|
||
export const App = () => { | ||
return ( | ||
<FileUploader | ||
acceptedFileTypes={['image/*']} | ||
bucket="my-bucket" | ||
path="public/" | ||
maxFileCount={1} | ||
/> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 2 additions & 0 deletions
2
examples/next/pages/ui/components/storage/storage-image/multi-bucket/amplify_outputs.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
import amplifyOutputs from '@environments/storage/gen2/amplify_outputs'; | ||
export default amplifyOutputs; |
42 changes: 42 additions & 0 deletions
42
examples/next/pages/ui/components/storage/storage-image/multi-bucket/index.page.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
import * as React from 'react'; | ||
|
||
import { Amplify } from 'aws-amplify'; | ||
import { Text, Loader } from '@aws-amplify/ui-react'; | ||
import { StorageImage } from '@aws-amplify/ui-react-storage'; | ||
import '@aws-amplify/ui-react/styles.css'; | ||
import amplifyOutputs from './amplify_outputs'; | ||
|
||
Amplify.configure(amplifyOutputs); | ||
|
||
export function StorageImageExample() { | ||
const [isFirstImgLoaded, setIsFirstImgLoaded] = React.useState(false); | ||
const [isSecondImgLoaded, setIsSecondImgLoaded] = React.useState(false); | ||
|
||
return ( | ||
<> | ||
<StorageImage | ||
alt="public cat 1" | ||
bucket="StorageEndToEnd" | ||
path="public/public-e2e.jpeg" | ||
onLoad={() => setIsFirstImgLoaded(true)} | ||
/> | ||
{isFirstImgLoaded ? ( | ||
<Text>The first public image is loaded.</Text> | ||
) : ( | ||
<Loader testId="Loader1" /> | ||
)} | ||
<StorageImage | ||
alt="public cat 2" | ||
bucket="StorageEndToEndSecondary" | ||
path={() => 'public/public-e2e.jpeg'} | ||
onLoad={() => setIsSecondImgLoaded(true)} | ||
/> | ||
{isSecondImgLoaded ? ( | ||
<Text>The second public image is loaded.</Text> | ||
) : ( | ||
<Loader testId="Loader2" /> | ||
)} | ||
</> | ||
); | ||
} | ||
export default StorageImageExample; |
13 changes: 13 additions & 0 deletions
13
...atures/ui/components/storage/storage-image/load-public-images-from-two-s3-buckets.feature
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
Feature: Load two images, each from a different S3 bucket with public access level settings | ||
|
||
Background: | ||
Given I'm running the example "ui/components/storage/storage-image/multi-bucket" | ||
|
||
@react | ||
Scenario: I successfully load two images from two buckets | ||
Then I see "Loader1" element | ||
Then I see "Loader2" element | ||
Then I see the "public cat 1" image | ||
Then I see the "public cat 2" image | ||
Then I see "The first public image is loaded." | ||
Then I see "The second public image is loaded." |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
public cat 1 is from the first bucket and public cat 2 is from the second bucket