Selaa lähdekoodia

core: Rename `selecter` to `acquire`

Kevin van Zonneveld 9 vuotta sitten
vanhempi
commit
9b8595943a

+ 1 - 1
CHANGELOG.md

@@ -42,7 +42,6 @@ Ideas that will be planned and find their way into a release at one point
 
 
 - [ ] build: sourcemaps for everything (compiled es6->es5 module as well as bundle) (@arturi)
 - [ ] build: sourcemaps for everything (compiled es6->es5 module as well as bundle) (@arturi)
 - [ ] core: clean up package.json. We've accumulated duplication and weirdness by hacking just for our current problem without keeping a wider view of what was already there (@arturi)
 - [ ] core: clean up package.json. We've accumulated duplication and weirdness by hacking just for our current problem without keeping a wider view of what was already there (@arturi)
-- [ ] core: Rename `selecter` to `getter` or `acquire` (@kvz)
 - [ ] core: Try to make Uppy work with React (add basic example) to remain aware of possible issues (@hedgerh), look at https://github.com/akiran/react-slick
 - [ ] core: Try to make Uppy work with React (add basic example) to remain aware of possible issues (@hedgerh), look at https://github.com/akiran/react-slick
 - [ ] google: Add basic Google Drive plugin example (working both in Modal, as without, via `target: "div#on-my-page"` (@hedgerh)
 - [ ] google: Add basic Google Drive plugin example (working both in Modal, as without, via `target: "div#on-my-page"` (@hedgerh)
 - [ ] meta: Create an Uppy logo (@vvolfy)
 - [ ] meta: Create an Uppy logo (@vvolfy)
@@ -54,6 +53,7 @@ Ideas that will be planned and find their way into a release at one point
 - [ ] website: Decide on tagline(s) (@kvz, @hedgerh, @arturi, @tim-kos)
 - [ ] website: Decide on tagline(s) (@kvz, @hedgerh, @arturi, @tim-kos)
 - [ ] website: Polish taglines (@arturi)
 - [ ] website: Polish taglines (@arturi)
 - [ ] website: scrollbars on code samples (@arturi)
 - [ ] website: scrollbars on code samples (@arturi)
+- [x] core: Rename `selecter` to `getter` or `acquire` (@kvz)
 - [x] complete: `Complete` Plugin of type/stage: `presenter`. "You have successfully uploaded `3 files`". Button: Close modal. (@arturi)
 - [x] complete: `Complete` Plugin of type/stage: `presenter`. "You have successfully uploaded `3 files`". Button: Close modal. (@arturi)
 - [x] dragdrop: (error) handling when you press Upload with no files (@arturi)
 - [x] dragdrop: (error) handling when you press Upload with no files (@arturi)
 - [x] modal: `UppyModal [type=submit] { display: none }`, use Modal's own Proceed button to progress to next stage (@arturi)
 - [x] modal: `UppyModal [type=submit] { display: none }`, use Modal's own Proceed button to progress to next stage (@arturi)

+ 3 - 3
src/core/Core.js

@@ -21,7 +21,7 @@ export default class Core {
     this.opts = Object.assign({}, defaultOptions, opts)
     this.opts = Object.assign({}, defaultOptions, opts)
 
 
     // Dictates in what order different plugin types are ran:
     // Dictates in what order different plugin types are ran:
-    this.types = [ 'presetter', 'view', 'progress', 'selecter', 'uploader', 'presenter' ]
+    this.types = [ 'presetter', 'view', 'progress', 'acquire', 'uploader', 'presenter' ]
 
 
     this.type = 'core'
     this.type = 'core'
 
 
@@ -146,7 +146,7 @@ export default class Core {
 
 
 /**
 /**
  * Runs a waterfall of runType plugin packs, like so:
  * Runs a waterfall of runType plugin packs, like so:
- * All preseters(data) --> All selecters(data) --> All uploaders(data) --> done
+ * All preseters(data) --> All acquires(data) --> All uploaders(data) --> done
  */
  */
   run () {
   run () {
     this.log({
     this.log({
@@ -155,7 +155,7 @@ export default class Core {
     })
     })
 
 
     // Forse set `autoProceed` option to false if there are multiple selector Plugins active
     // Forse set `autoProceed` option to false if there are multiple selector Plugins active
-    if (this.plugins.selecter && this.plugins.selecter.length > 1) {
+    if (this.plugins.acquire && this.plugins.acquire.length > 1) {
       this.opts.autoProceed = false
       this.opts.autoProceed = false
     }
     }
 
 

+ 1 - 1
src/plugins/DragDrop.js

@@ -8,7 +8,7 @@ import Plugin from './Plugin'
 export default class DragDrop extends Plugin {
 export default class DragDrop extends Plugin {
   constructor (core, opts) {
   constructor (core, opts) {
     super(core, opts)
     super(core, opts)
-    this.type = 'selecter'
+    this.type = 'acquire'
     this.name = 'Drag & Drop'
     this.name = 'Drag & Drop'
     this.icon = `
     this.icon = `
       <svg class="UppyModalTab-icon" width="28" height="28" viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg">
       <svg class="UppyModalTab-icon" width="28" height="28" viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg">

+ 1 - 1
src/plugins/Dropbox.js

@@ -3,7 +3,7 @@ import Plugin from './Plugin'
 export default class Dropbox extends Plugin {
 export default class Dropbox extends Plugin {
   constructor (core, opts) {
   constructor (core, opts) {
     super(core, opts)
     super(core, opts)
-    this.type = 'selecter'
+    this.type = 'acquire'
     this.authenticate = this.authenticate.bind(this)
     this.authenticate = this.authenticate.bind(this)
     this.connect = this.connect.bind(this)
     this.connect = this.connect.bind(this)
     this.render = this.render.bind(this)
     this.render = this.render.bind(this)

+ 1 - 1
src/plugins/Dummy.js

@@ -7,7 +7,7 @@ import Plugin from './Plugin'
 export default class Dummy extends Plugin {
 export default class Dummy extends Plugin {
   constructor (core, opts) {
   constructor (core, opts) {
     super(core, opts)
     super(core, opts)
-    this.type = 'selecter'
+    this.type = 'acquire'
     this.name = 'Dummy'
     this.name = 'Dummy'
 
 
     // set default options
     // set default options

+ 1 - 1
src/plugins/Formtag.js

@@ -3,7 +3,7 @@ import Plugin from './Plugin'
 export default class Formtag extends Plugin {
 export default class Formtag extends Plugin {
   constructor (core, opts) {
   constructor (core, opts) {
     super(core, opts)
     super(core, opts)
-    this.type = 'selecter'
+    this.type = 'acquire'
   }
   }
 
 
   run (results) {
   run (results) {

+ 1 - 1
src/plugins/GoogleDrive.js

@@ -4,7 +4,7 @@ import Plugin from './Plugin'
 export default class Google extends Plugin {
 export default class Google extends Plugin {
   constructor (core, opts) {
   constructor (core, opts) {
     super(core, opts)
     super(core, opts)
-    this.type = 'selecter'
+    this.type = 'acquire'
     this.files = []
     this.files = []
     this.authUrl = 'http://localhost:3020/connect/google'
     this.authUrl = 'http://localhost:3020/connect/google'
     // set default options
     // set default options

+ 2 - 2
src/plugins/Modal.js

@@ -43,7 +43,7 @@ export default class Modal extends Plugin {
         return '.UppyModal-progressBarContainer'
         return '.UppyModal-progressBarContainer'
       case 'presenter':
       case 'presenter':
         return '.UppyModal-presenter'
         return '.UppyModal-presenter'
-      case 'selecter':
+      case 'acquire':
 
 
         // add tab panel, where plugin will render
         // add tab panel, where plugin will render
         const modalContent = document.querySelector('.UppyModalContent')
         const modalContent = document.querySelector('.UppyModalContent')
@@ -77,7 +77,7 @@ export default class Modal extends Plugin {
 
 
         return `.${this.opts.panelSelectorPrefix}--${callerPluginId}`
         return `.${this.opts.panelSelectorPrefix}--${callerPluginId}`
       default:
       default:
-        let msg = 'Error: Modal can only be used by plugins of types: selecter, progress'
+        let msg = 'Error: Modal can only be used by plugins of types: acquire, progress'
         this.core.log(msg)
         this.core.log(msg)
         break
         break
     }
     }

+ 6 - 6
test/core.spec.js

@@ -10,7 +10,7 @@ test('core', function (t) {
 })
 })
 
 
 test('use plugins', function (t) {
 test('use plugins', function (t) {
-  const SelecterPlugin = require('./mocks/plugin-selecter1.js')
+  const SelecterPlugin = require('./mocks/plugin-acquire1.js')
   const uppy = new Uppy()
   const uppy = new Uppy()
   uppy
   uppy
     .use(SelecterPlugin)
     .use(SelecterPlugin)
@@ -20,7 +20,7 @@ test('use plugins', function (t) {
 })
 })
 
 
 test('noDuplicates', function (t) {
 test('noDuplicates', function (t) {
-  const Selecter1Plugin = require('./mocks/plugin-selecter1.js')
+  const Selecter1Plugin = require('./mocks/plugin-acquire1.js')
   const uppyTwoSelecters = new Uppy()
   const uppyTwoSelecters = new Uppy()
 
 
   uppyTwoSelecters.use(Selecter1Plugin)
   uppyTwoSelecters.use(Selecter1Plugin)
@@ -31,8 +31,8 @@ test('noDuplicates', function (t) {
 })
 })
 
 
 test('autoProceed', function (t) {
 test('autoProceed', function (t) {
-  const Selecter1Plugin = require('./mocks/plugin-selecter1.js')
-  const Selecter2Plugin = require('./mocks/plugin-selecter2.js')
+  const Selecter1Plugin = require('./mocks/plugin-acquire1.js')
+  const Selecter2Plugin = require('./mocks/plugin-acquire2.js')
 
 
   const uppyOneSelecter = new Uppy()
   const uppyOneSelecter = new Uppy()
   uppyOneSelecter
   uppyOneSelecter
@@ -45,7 +45,7 @@ test('autoProceed', function (t) {
     .use(Selecter2Plugin)
     .use(Selecter2Plugin)
     .run()
     .run()
 
 
-  t.equal(uppyOneSelecter.opts.autoProceed, true, 'should autoProceed if only one selecter is used')
-  t.equal(uppyTwoSelecters.opts.autoProceed, false, 'should not autoProceed if more than one selecter is used')
+  t.equal(uppyOneSelecter.opts.autoProceed, true, 'should autoProceed if only one acquire is used')
+  t.equal(uppyTwoSelecters.opts.autoProceed, false, 'should not autoProceed if more than one acquire is used')
   t.end()
   t.end()
 })
 })

+ 1 - 1
test/mocks/plugin-selecter1.js → test/mocks/plugin-acquire1.js

@@ -3,7 +3,7 @@ const Plugin = require('../../src/plugins/Plugin.js')
 export default class TestSelector1 extends Plugin {
 export default class TestSelector1 extends Plugin {
   constructor (core, opts) {
   constructor (core, opts) {
     super(core, opts)
     super(core, opts)
-    this.type = 'selecter'
+    this.type = 'acquire'
     this.name = this.constructor.name
     this.name = this.constructor.name
   }
   }
 
 

+ 1 - 1
test/mocks/plugin-selecter2.js → test/mocks/plugin-acquire2.js

@@ -3,7 +3,7 @@ const Plugin = require('../../src/plugins/Plugin.js')
 export default class TestSelector2 extends Plugin {
 export default class TestSelector2 extends Plugin {
   constructor (core, opts) {
   constructor (core, opts) {
     super(core, opts)
     super(core, opts)
-    this.type = 'selecter'
+    this.type = 'acquire'
     this.name = this.constructor.name
     this.name = this.constructor.name
   }
   }
 
 

+ 1 - 1
website/src/_data/plugins.yml

@@ -1,6 +1,6 @@
 dragdrop:
 dragdrop:
   title      : Drag & Drop
   title      : Drag & Drop
   official   : true
   official   : true
-  type       : selecter
+  type       : acquire
   url        : https://github.com/transloadit/uppy/blob/master/src/plugins/DragDrop.js
   url        : https://github.com/transloadit/uppy/blob/master/src/plugins/DragDrop.js
   description: The official Drag & Drop plugin for Uppy.
   description: The official Drag & Drop plugin for Uppy.

+ 1 - 1
website/src/api/architecture.md

@@ -25,7 +25,7 @@ const files = uppy
 1. Core class `Uppy` accepts object `options` (with general options), and exposes methods `.use` for adding plugins and `.set` for setting options.
 1. Core class `Uppy` accepts object `options` (with general options), and exposes methods `.use` for adding plugins and `.set` for setting options.
 2. We create a new instance of `Uppy` and call `.use` on it, passing the plugins and their options.
 2. We create a new instance of `Uppy` and call `.use` on it, passing the plugins and their options.
 3. Then `run` is called to get things going.
 3. Then `run` is called to get things going.
-4. Plugins have types: `presetter`, `selecter` and `uploader` (more could be added in the future). When `use` is called, each plugin’s `run` method is added to an array of corresponding types, `methods`.
+4. Plugins have types: `presetter`, `acquire` and `uploader` (more could be added in the future). When `use` is called, each plugin’s `run` method is added to an array of corresponding types, `methods`.
 5. Ok, now the tricky part. Core’s method `run` iterates over plugin types in a waterfall manner — each `runTypes`  runs its `method`s in parallel and returns an array of results (files) to the next plugin type in the waterfall. This way we first get all the of files from `DragDrop`, `Dropbox`, `Instagram` and other inputs — then parse them somehow — and then upload:
 5. Ok, now the tricky part. Core’s method `run` iterates over plugin types in a waterfall manner — each `runTypes`  runs its `method`s in parallel and returns an array of results (files) to the next plugin type in the waterfall. This way we first get all the of files from `DragDrop`, `Dropbox`, `Instagram` and other inputs — then parse them somehow — and then upload:
 
 
 ![waterfall of parallels](/images/uppy-core-plugins-architecture.jpg)
 ![waterfall of parallels](/images/uppy-core-plugins-architecture.jpg)

+ 1 - 1
website/src/api/docs.md

@@ -21,7 +21,7 @@ Main Uppy core
 [src/core/Core.js:82-97](https://github.com/transloadit/uppy/blob/ec529a2c93080223d5334b1216569da967147da7/src/core/Core.js#L82-L97 "Source code on GitHub")
 [src/core/Core.js:82-97](https://github.com/transloadit/uppy/blob/ec529a2c93080223d5334b1216569da967147da7/src/core/Core.js#L82-L97 "Source code on GitHub")
 
 
 Runs a waterfall of runType plugin packs, like so:
 Runs a waterfall of runType plugin packs, like so:
-All preseters(data) --> All selecters(data) --> All uploaders(data) --> done
+All preseters(data) --> All acquires(data) --> All uploaders(data) --> done
 
 
 ### runType
 ### runType
 
 

+ 5 - 5
website/themes/uppy/source/js/uppy.js

@@ -1912,7 +1912,7 @@ var Core = (function () {
     _classCallCheck(this, Core);
     _classCallCheck(this, Core);
 
 
     // Dictates in what order different plugin types are ran:
     // Dictates in what order different plugin types are ran:
-    this.types = ['presetter', 'selecter', 'uploader'];
+    this.types = ['presetter', 'acquire', 'uploader'];
 
 
     this.type = 'core';
     this.type = 'core';
 
 
@@ -1969,7 +1969,7 @@ var Core = (function () {
 
 
     /**
     /**
     * Runs a waterfall of runType plugin packs, like so:
     * Runs a waterfall of runType plugin packs, like so:
-    * All preseters(data) --> All selecters(data) --> All uploaders(data) --> done
+    * All preseters(data) --> All acquires(data) --> All uploaders(data) --> done
     */
     */
   }, {
   }, {
     key: 'run',
     key: 'run',
@@ -2152,7 +2152,7 @@ var DragDrop = (function (_Plugin) {
     _classCallCheck(this, DragDrop);
     _classCallCheck(this, DragDrop);
 
 
     _get(Object.getPrototypeOf(DragDrop.prototype), 'constructor', this).call(this, core, opts);
     _get(Object.getPrototypeOf(DragDrop.prototype), 'constructor', this).call(this, core, opts);
-    this.type = 'selecter';
+    this.type = 'acquire';
 
 
     // set default options
     // set default options
     var defaultOptions = {
     var defaultOptions = {
@@ -2336,7 +2336,7 @@ var Dropbox = (function (_Plugin) {
     _classCallCheck(this, Dropbox);
     _classCallCheck(this, Dropbox);
 
 
     _get(Object.getPrototypeOf(Dropbox.prototype), 'constructor', this).call(this, core, opts);
     _get(Object.getPrototypeOf(Dropbox.prototype), 'constructor', this).call(this, core, opts);
-    this.type = 'selecter';
+    this.type = 'acquire';
     this.authenticate = this.authenticate.bind(this);
     this.authenticate = this.authenticate.bind(this);
     this.connect = this.connect.bind(this);
     this.connect = this.connect.bind(this);
     this.render = this.render.bind(this);
     this.render = this.render.bind(this);
@@ -2467,7 +2467,7 @@ var Formtag = (function (_Plugin) {
     _classCallCheck(this, Formtag);
     _classCallCheck(this, Formtag);
 
 
     _get(Object.getPrototypeOf(Formtag.prototype), 'constructor', this).call(this, core, opts);
     _get(Object.getPrototypeOf(Formtag.prototype), 'constructor', this).call(this, core, opts);
-    this.type = 'selecter';
+    this.type = 'acquire';
   }
   }
 
 
   _createClass(Formtag, [{
   _createClass(Formtag, [{