-
Notifications
You must be signed in to change notification settings - Fork 343
chore: Rename references to Storage Manager in docs to File Uploader #5697
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
Changes from all commits
bcb5767
056d491
74b449d
e4fba69
984666e
6a2b316
f2ea013
251a491
e2e8c62
35b8c13
29cfacc
ac198f7
dcab39e
8c03f62
e6906d1
6b2750c
13532a8
3dc67b3
6144123
cfa7533
57425f1
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -165,6 +165,14 @@ module.exports = withNextPluginPreval({ | |
destination: '/react/components/accordion', | ||
permanent: false, | ||
}, | ||
/** | ||
* Renamed "Storage Manager" to "File Uploader" | ||
*/ | ||
{ | ||
source: '/react/connected-components/storage/storagemanager', | ||
destination: '/react/connected-components/storage/fileuploader', | ||
permanent: true, | ||
}, | ||
Comment on lines
+171
to
+175
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Will this cover redirects from the primary docs that are linking to the existing StorageManager documentation? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I believe so. This is the only endpoint linked in the primary docs. There is also a PR under review which updates the links to use the |
||
/** | ||
* Redirect traffic from CRA to Vite getting started page | ||
*/ | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,7 +7,7 @@ import ReactPropsTable from '@/components/propsTable/ReactPropsTable'; | |
import { Example, ExampleCode } from '@/components/Example'; | ||
import { Fragment } from '@/components/Fragment'; | ||
import { InstallScripts } from '@/components/InstallScripts'; | ||
import { STORAGE_MANAGER, FILE_PICKER, DROPZONE_PROPS, DISPLAY_TEXT } from './props'; | ||
import { FILE_UPLOADER, FILE_PICKER, DROPZONE_PROPS, DISPLAY_TEXT } from './props'; | ||
import { | ||
DefaultExample, | ||
ComponentOverridesExample, | ||
|
@@ -24,6 +24,19 @@ import { | |
UploadActionsExample, | ||
} from './examples' | ||
|
||
<Alert variation="info" heading="Storage Manager is renamed"> | ||
Beginning with _@aws-amplify/ui-react-storage_ version 3.3.0, the `StorageManager` | ||
component has been renamed to `FileUploader`. To migrate, upgrade to the | ||
latest version of _@aws-amplify/ui-react-storage_ and replace `StorageManager` | ||
related imports with their corresponding `FileUploader` equivalents. | ||
<br /> | ||
`StorageManager` will continue to receive official support until the next major | ||
version release of _@aws-amplify/ui-react-storage_, at which point `StorageManager` | ||
will be replaced by `FileUploader`. | ||
</Alert> | ||
|
||
<br /> | ||
|
||
<DefaultExample /> | ||
|
||
## Basic Usage | ||
|
@@ -34,13 +47,13 @@ import { | |
|
||
<AppDirectoryAlert /> | ||
|
||
To use the StorageManager component import it into your React application with the included styles. | ||
To use the FileUploader component import it into your React application with the included styles. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We should add an informational alert here that StorageManager is now FileUploader There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done. Should I still keep the "Storage Manager is deprecated" warning alert in the deprecated props section? |
||
|
||
<InstallScripts component="storage" /> | ||
|
||
<ExampleCode> | ||
```jsx | ||
import { StorageManager } from '@aws-amplify/ui-react-storage'; | ||
import { FileUploader } from '@aws-amplify/ui-react-storage'; | ||
import '@aws-amplify/ui-react/styles.css'; | ||
``` | ||
</ExampleCode> | ||
|
@@ -60,14 +73,14 @@ At a minimum you must include the `path` and `maxFileCount` props. `path` refers | |
</Example> | ||
|
||
### Private or Protected Buckets | ||
When uploading to private or protected S3 buckets, you'll need to wrap your app in the `Authenticator`, allowing the `StorageManager` component to infer the Cognito `identityId` of the currently signed-in user. This can be done directly with the `Authenticator` component or with `withAuthenticator`, as shown in [Add the Authenticator](/connected-components/authenticator#step-3-add-the-authenticator). | ||
When uploading to private or protected S3 buckets, you'll need to wrap your app in the `Authenticator`, allowing the `FileUploader` component to infer the Cognito `identityId` of the currently signed-in user. This can be done directly with the `Authenticator` component or with `withAuthenticator`, as shown in [Add the Authenticator](/connected-components/authenticator#step-3-add-the-authenticator). | ||
|
||
The example below shows configuring the StorageManager to upload to the `protected` folder under the users' identity id. | ||
The example below shows configuring the FileUploader to upload to the `protected` folder under the users' identity id. | ||
|
||
<Example> | ||
<ExampleCode> | ||
```jsx | ||
<StorageManager | ||
<FileUploader | ||
acceptedFileTypes={['image/*']} | ||
path={({ identityId }) => `protected/${identityId}/`} | ||
maxFileCount={1} | ||
|
@@ -78,6 +91,7 @@ The example below shows configuring the StorageManager to upload to the `protect | |
</Example> | ||
|
||
### Deprecated props | ||
|
||
<Accordion.Container> | ||
<Accordion.Item key={"title"} value={"title"}> | ||
<Accordion.Trigger> | ||
|
@@ -124,11 +138,11 @@ The example below shows configuring the StorageManager to upload to the `protect | |
|
||
### Props | ||
|
||
<ReactPropsTable props={STORAGE_MANAGER} /> | ||
<ReactPropsTable props={FILE_UPLOADER} /> | ||
|
||
## Manually Upload | ||
|
||
The default behavior of the Storage Manager component is to automatically start the upload after a file is selected. If you wish to change that, set the value of the `autoUpload` prop to false. | ||
The default behavior of the File Uploader component is to automatically start the upload after a file is selected. If you wish to change that, set the value of the `autoUpload` prop to false. | ||
|
||
<Example> | ||
<UploadActionsExample /> | ||
|
@@ -171,7 +185,7 @@ A resumable upload will upload the file in chunks. This allows users to pause an | |
|
||
You might want to process or modify the file(s) and/or file name(s) before they are uploaded. One common situation is you may want to ensure files uploaded are at unique keys by hashing the file contents and using that as the key rather than the filename. | ||
|
||
You can pass a `processFile` function to the StorageManager which accepts an object with `file`: [File](https://developer.mozilla.org/en-US/docs/Web/API/File), and `key`: string, and should return an object with file, key, and any other Storage configurations. The `processFile` can either return synchronously or return a Promise. This example uses a Promise to read the contents of the file and create a hash for the key. | ||
You can pass a `processFile` function to the FileUploader which accepts an object with `file`: [File](https://developer.mozilla.org/en-US/docs/Web/API/File), and `key`: string, and should return an object with file, key, and any other Storage configurations. The `processFile` can either return synchronously or return a Promise. This example uses a Promise to read the contents of the file and create a hash for the key. | ||
|
||
<Example> | ||
<HashExample /> | ||
|
@@ -190,7 +204,7 @@ You can also add any other [Amplify Storage options](https://docs.amplify.aws/re | |
|
||
## Event Handling | ||
|
||
The StorageManager component has several event handlers: `onUploadStart`, `onUploadSuccess`, `onUploadError`, and `onFileRemove` | ||
The FileUploader component has several event handlers: `onUploadStart`, `onUploadSuccess`, `onUploadError`, and `onFileRemove` | ||
|
||
<Example> | ||
<EventExample /> | ||
|
@@ -206,7 +220,7 @@ Be careful setting state in the `onUploadSuccess` because that function is bound | |
|
||
## `path` Usage | ||
|
||
The `path` prop of the `StorageManager` is prepended to the `key` value (resolved from either the file itself or the returned `key` of `processFile`) submitted to S3. Using a `'/'` as the last character of `path` allows uploading to a specific folder inside the provided `accessLevel` folder. | ||
The `path` prop of the `FileUploader` is prepended to the `key` value (resolved from either the file itself or the returned `key` of `processFile`) submitted to S3. Using a `'/'` as the last character of `path` allows uploading to a specific folder inside the provided `accessLevel` folder. | ||
|
||
<Example> | ||
<ExampleCode> | ||
|
@@ -233,12 +247,12 @@ You can add metadata by adding a `metadata` object in the return object of `proc | |
|
||
Amazon S3 transfer acceleration optimizes transfer speeds from around the world into S3 buckets. When you use Transfer Acceleration, additional data transfer charges might apply. For more information about pricing, see [Amazon S3 pricing](https://aws.amazon.com/s3/pricing/). | ||
|
||
To use transfer acceleration you first need to [enable it on your S3 bucket](https://docs.amplify.aws/react/build-a-backend/storage/extend-s3-resources/#example---enable-transfer-acceleration). Then add `useAccelerateEndpoint` on the `<StorageManager />` component. By default transfer acceleration is off. | ||
To use transfer acceleration you first need to [enable it on your S3 bucket](https://docs.amplify.aws/react/build-a-backend/storage/extend-s3-resources/#example---enable-transfer-acceleration). Then add `useAccelerateEndpoint` on the `<FileUploader />` component. By default transfer acceleration is off. | ||
|
||
<ExampleCode> | ||
|
||
```jsx | ||
<StorageManager | ||
<FileUploader | ||
acceptedFileTypes={['image/*']} | ||
maxFileCount={10} | ||
useAccelerateEndpoint | ||
|
@@ -252,7 +266,7 @@ You can also choose whether or not to use transfer acceleration at the file leve | |
<ExampleCode> | ||
|
||
```jsx | ||
<StorageManager | ||
<FileUploader | ||
acceptedFileTypes={['image/*']} | ||
maxFileCount={10} | ||
processFile={({ file, key }) => { | ||
|
@@ -271,7 +285,7 @@ You can also choose whether or not to use transfer acceleration at the file leve | |
|
||
### Text and labels | ||
|
||
All text in the StorageManager component is customizable with the `displayText` prop. | ||
All text in the FileUploader component is customizable with the `displayText` prop. | ||
|
||
<Example> | ||
<DisplayTextExample /> | ||
|
@@ -306,7 +320,7 @@ You can use the `displayText` prop to also support different languages. Use an o | |
|
||
### Component overrides | ||
|
||
Don't like how things look? Use your own components inside the StorageManager! You can pass your own components with the `components` prop. The available components to override are: `Container`, `FileList`, `FileListHeader`, `FileListFooter`, `DropZone`, and `FilePicker`. | ||
Don't like how things look? Use your own components inside the FileUploader! You can pass your own components with the `components` prop. The available components to override are: `Container`, `FileList`, `FileListHeader`, `FileListFooter`, `DropZone`, and `FilePicker`. | ||
|
||
_You can even use a completely different UI kit like MUI, Chakra, or your own design system!_ | ||
|
||
|
@@ -341,7 +355,7 @@ _You can even use a completely different UI kit like MUI, Chakra, or your own de | |
|
||
### Imperative handles | ||
|
||
The `files` state is managed within the `StorageManager` component itself. To allow for clearing the internal `files` state, `StorageManager` exposes a custom ref handle to the parent component with a `clearFiles` method. | ||
The `files` state is managed within the `FileUploader` component itself. To allow for clearing the internal `files` state, `FileUploader` exposes a custom ref handle to the parent component with a `clearFiles` method. | ||
|
||
<Example> | ||
<HandleExample /> | ||
|
@@ -364,6 +378,6 @@ The `files` state is managed within the `StorageManager` component itself. To al | |
|
||
### Target Classes | ||
|
||
If you like, you can target classes directly or use CSS variables to make changes to the look and feel of the Storage Manager. | ||
If you like, you can target classes directly or use CSS variables to make changes to the look and feel of the File Uploader. | ||
|
||
<ComponentStyleDisplay componentName="StorageManager" /> | ||
<ComponentStyleDisplay componentName="FileUploader" /> |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -830,8 +830,4 @@ The 3.x version of `@aws-amplify/ui-react-storage` has a minimum dependency of 6 | |
|
||
#### 1. public accessLevel becomes 'guest' in Storage components | ||
|
||
Starting in v6 of the Amplify JS libraries, `'public'` access level, meaning unauthentiated users can access it, became `'guest'`. The `accessLevel` property on StorageManager and StorageImage components have been updated to reflect this change. | ||
|
||
#### 2. Removal of FileUploader | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It's back! |
||
|
||
The FileUploader component was the predecessor to the [`StorageManager`](../connected-components/storage/storagemanager) component. In this major version we are removing the FileUploader component. Please use the StorageManager component which covers all of the use-cases of FileUploader and more. | ||
Starting in v6 of the Amplify JS libraries, `'public'` access level, meaning unauthentiated users can access it, became `'guest'`. The `accessLevel` property on FileUploader and StorageImage components have been updated to reflect this change. |
Uh oh!
There was an error while loading. Please reload this page.