Commit graph

1241 commits

Author SHA1 Message Date
Renée Kooi
9681f2c43b
core: settle() tests 2017-09-25 12:29:42 +02:00
Renée Kooi
4d93e0ac85
tus,xhrupload: Replace promise-settle with own version 2017-09-25 12:29:42 +02:00
Renée Kooi
ef3480ac26
tus,xhrupload: Reject upload() if all file uploads failed. 2017-09-25 12:22:35 +02:00
Renée Kooi
2856767926
react: rm empty line 2017-09-22 23:10:35 +02:00
Renée Kooi
2aa8f9ee01
core: rm rejection when execCommand did not work 2017-09-22 23:09:33 +02:00
Renée Kooi
cd7b035976
core: Still accept a string as user-provided rejections 2017-09-22 23:09:33 +02:00
Renée Kooi
662393483c
Lint fixes 2017-09-22 23:09:33 +02:00
Renée Kooi
8a3b411409
Always reject Promises with Error instances 2017-09-22 23:09:33 +02:00
Renée Kooi
ecefc7eed7
test: Return Promise assertions from test 2017-09-22 23:09:33 +02:00
Renée Kooi
edddc8f724
Update tests after React PR merge 2017-09-22 22:42:03 +02:00
Renée Kooi
9af6b2fea6 Merge pull request #170 from goto-bus-stop/feature/react
High-level React Components
2017-09-22 16:36:58 +02:00
Renée Kooi
858cef92b2 Merge pull request #359 from gavboulton/plugin-base
Add default methods to Plugin base class
2017-09-22 12:42:41 +02:00
Renée Kooi
671ab0b2cf Merge pull request #358 from goto-bus-stop/feature/rm-blobs-on-complete
restore: Remove files from cache when their upload finished
2017-09-22 11:57:15 +02:00
Renée Kooi
1f51fedb47 Merge pull request #356 from goto-bus-stop/chore/dead-code
Clean up unused code
2017-09-21 20:59:51 +02:00
Gavin Boulton
3ea73b1a7d Add default methods to Plugin base class
Add `render` and `addTarget` methods that throw by default. These methods should have a sub-class implementation when a plugin wants to mounts on a DOM element or on another plugin's target.
2017-09-21 16:52:54 +01:00
Renée Kooi
180bf38ad0
restore: Remove files from cache when upload finished. 2017-09-21 14:25:14 +02:00
Renée Kooi
50193b7df3
restore: Omit completed uploads from saved file state
This makes sure that if an upload has finished, and the user refreshes
the page, the old files won't be sitting there in the completed state.

Files that have finished uploading but were part of a "batch" of files
that hasn't finished uploading are also kept.
2017-09-21 14:21:00 +02:00
Artur Paikin
24ec154180 update Plugin tests to reflect that replaceTargetContent is undefined by default now 2017-09-20 17:48:32 -04:00
Artur Paikin
c99943629a see if not using setting this.opts.replaceTargetContent will fix tests
related to #354
2017-09-20 17:11:55 -04:00
Artur Paikin
ebf7f60e6a Merge pull request #354 from gavboulton/plugin-tests
Add Plugin class unit tests
2017-09-20 16:03:19 -04:00
Gavin Boulton
b3371bacc0 Add Plugin class unit tests
The `replaceTargetContent` option wasn't being set correctly, this has been updated.

The `mount` method uses a `render` method (which is not set in the Plugin) so I've had to manually add this to the instance for the tests.
2017-09-20 11:31:35 +01:00
Renée Kooi
c59f70bb3b
Remove unused scss files 2017-09-20 11:24:00 +02:00
Renée Kooi
0c32877d54
Remove unused utils 2017-09-20 11:22:50 +02:00
Renée Kooi
08e11d9fc5
restore: Clean up blobs that are not related to a file in state
This patch makes sure only blobs that are referenced by the localStorage
state are actually restored. Blobs that are returned from the persistent
serviceWorker or IndexedDB stores, but aren't referenced by the `files`
state object restored from localStorage, will be deleted.

Should fix #348.
Part of #342, but we need to do more before we can call that fixed :)
2017-09-20 10:49:55 +02:00
Artur Paikin
685f701d0c Merge pull request #351 from transloadit/fix/restorefiles-with-id
restore: Fix restorefiles with id
2017-09-19 12:16:17 -04:00
Artur Paikin
674fe15f31 fix state update event 2017-09-18 18:24:34 -04:00
Artur Paikin
11002c8d43 Merge pull request #341 from sunil-shrestha/fix/clearCurrentUploads
set the newState before emiting "core:state-update" .
2017-09-18 18:04:24 -04:00
Artur Paikin
16734976a7 We don’t need to repeat id here, since the key is id?
@goto-bus-stop I might be missing something though
2017-09-18 17:11:21 -04:00
Artur Paikin
ef1c3306c6 Flatten payload params 2017-09-18 17:09:47 -04:00
Renée Kooi
def40d5ee2
react: Add <StatusBar /> 2017-09-18 16:00:20 +02:00
Renée Kooi
151a46d288
react: 🙈 DragDropPlugin → ProgressBarPlugin 2017-09-18 15:58:50 +02:00
Renée Kooi
5098da7cd1
dashboard: Fix StatusBar plugin ID 2017-09-18 15:04:01 +02:00
Renée Kooi
949540c03c
react: Fix Dashboard plugin IDs 2017-09-18 15:02:50 +02:00
Renée Kooi
0f1f8f156f
docs: Document Dashboard closeModalOnClickOutside, hideUploadButton. 2017-09-18 14:42:52 +02:00
Renée Kooi
c124f82765
react: Fix close request event handler name in <DashboardModal /> 2017-09-18 14:40:34 +02:00
Renée Kooi
4a3341d0b9
react: rename react folder from uppy-react → react 2017-09-18 14:40:33 +02:00
Renée Kooi
3c3407e0f9
react: revert UppyWrapper version of <DashboardModal /> 2017-09-18 14:40:33 +02:00
Renée Kooi
aaae797a0f
react: revert UppyWrapper version of <ProgressBar /> 2017-09-18 14:40:33 +02:00
Renée Kooi
ce5d19bb35
react: revert UppyWrapper version of DragDrop 2017-09-18 14:40:33 +02:00
Renée Kooi
6cf3f45bc3
react: All the <Dashboard /> propTypes 2017-09-18 14:40:32 +02:00
Renée Kooi
cfe636d849
react: Add dashboard plugin inside component again. add plugins option. 2017-09-18 14:40:32 +02:00
Renée Kooi
62522b68fd
plugin: Allow targeting a plugin instance rather than a constructor. 2017-09-18 14:40:32 +02:00
Renée Kooi
d330c26813
react: Different way to do React components
This is a different approach to React components suggested by @arturi.
Instead of the components adding and removing plugins when mounting and
unmounting, plugins are configured at the start, and the components act
as slots for the plugins to actually mount in. Because all plugins are
still being configured up front here, we don't have to change how the
provider `target:` options work, they can install themselves into eg.
the Dashboard plugin immediately.

The core of this approach is the `UppyWrapper` component, which takes an
Uppy instance and a plugin ID, and mounts the plugin inside itself. The
other components only provide a default plugin ID.

The one change required in Uppy itself for this to work is to the
`mount()` functions: now, `mount()` configures `this.target` on the
plugins. If plugins do not have a `target:` option, they do not mount on
install. Some DOM code also had to be moved into the `mount()` function
for the DragDrop component instead of staying in `install()`, but I
think it makes sense.

(Still have to work out how to make the `DashboardModal` component's
`onRequestClose` option work.)
2017-09-18 14:40:32 +02:00
Renée Kooi
92cf9ab8f9
plugin: remove .focus() 2017-09-18 14:40:32 +02:00
Renée Kooi
eae8512531
dashboard: uninstall internal StatusBar and Informer plugins on remove 2017-09-18 14:40:31 +02:00
Renée Kooi
bd506d8425
dashboard: auto-discover previously added provider plugins 2017-09-18 14:40:31 +02:00
Renée Kooi
9174abf855
core: make mount()ing an unknown plugin a noop 2017-09-18 14:40:31 +02:00
Renée Kooi
36365b90f9
core: Avoid instantiating target plugin in mount(). 2017-09-18 14:40:31 +02:00
Renée Kooi
abeb01882a
react: Pass through component props to plugin options 2017-09-18 14:40:31 +02:00
Renée Kooi
5c842703ce
Implement onRequestClose in main Dashboard plugin. 2017-09-18 14:40:30 +02:00