This patch adds a `getAssemblyOptions` function option to the
Transloadit plugin. This option can return an object or a Promise for an
object to configure the Transloadit assembly. The returned object can
contain `params`, a `signature`, and `fields`.
`getAssemblyOptions` is called on each file, so each file can return a
different set of options. Files that returned the same options are
bundled together and run through a single assembly. Files that return
different options will be run through different assemblies.
This means that it is now possible to make assembly parameters depend on
user input from eg. the MetaData plugin, and have different parameters
for different files. It's now also possible to generate very short-lived
signatures on the server when an upload starts.
Previously, the initial assembly data was reused in the complete event…
🙈
This patch fetches the assembly status again when the socket emits
`assembly_finished`, so we're always up to date.
Previously this code would treat any error at all as an `onBeforeUpload`
error, and show the informer. We also lost the stack trace for errors
because `err` is stringified in the handler. This is correct for
`onBeforeUpload` rejections, since they are string reasons, but not for
other errors.
Now only actual `onBeforeUpload` errors are handled that way, and fatal
upload errors end up in the StatusBar like before and in the console,
with a stack trace.
This adds a new parameter to the transloadit:upload and
transloadit:result events, containing the assembly data.
```js
uppy.on('transloadit:upload', (file, assembly) => {
console.log('an upload was completed with template id', assembly.template_id)
})
```
```js
uppy.on('transloadit:result', (stepName, result, assembly) => {
console.log(`${stepName}:`, result, 'from', assembly)
})
```
The `transloadit:assembly` event is emitted when an assembly is created.
It receives the assembly data in the first parameter, and the file IDs
of the files that it belongs to in the second parameter.
```js
uppy.on('transloadit:assembly', (assembly, fileIDs) => {
const files = fileIDs.map((id) => uppy.getState().files[id])
console.log({ assembly, files })
})
```
- Added type="button" to buttons, to prevent submitting forms
- Added `isSearchVisible`, search bar now appears after click on search
icon (up for debates ;-)
- Grid and list views, list by default
- Root directory is named by the provider title (Instagram, Dropbox),
instead of `/`
- If file size is unknown, it is not shown, as opposed to showing `?`
- Headers hidden just for now, since we only had name, and sorting by
name is not something you toggle often when selecting a file. Once we
have size and creation date there (and whatever else), let’s restore
headers