summaryrefslogtreecommitdiff
path: root/public/bundle.js
diff options
context:
space:
mode:
Diffstat (limited to 'public/bundle.js')
-rw-r--r--public/bundle.js94
1 files changed, 33 insertions, 61 deletions
diff --git a/public/bundle.js b/public/bundle.js
index eaffdde..9a2bb86 100644
--- a/public/bundle.js
+++ b/public/bundle.js
@@ -2658,69 +2658,28 @@ var Dataset = function (_Component) {
function Dataset(props) {
_classCallCheck(this, Dataset);
- var _this = _possibleConstructorReturn(this, (Dataset.__proto__ || Object.getPrototypeOf(Dataset)).call(this));
-
- _this.handleName = _this.handleName.bind(_this);
- _this.handleUpload = _this.handleUpload.bind(_this);
- _this.handleURL = _this.handleURL.bind(_this);
- _this.pickFile = _this.pickFile.bind(_this);
- return _this;
+ return _possibleConstructorReturn(this, (Dataset.__proto__ || Object.getPrototypeOf(Dataset)).call(this));
}
_createClass(Dataset, [{
- key: 'handleName',
- value: function handleName(name) {
+ key: 'render',
+ value: function render() {
var _props = this.props,
+ loading = _props.loading,
+ status = _props.status,
+ error = _props.error,
module = _props.module,
+ title = _props.title,
folder = _props.folder,
- actions = _props.actions;
-
- actions.dataset.createOrUpdateFolder(module, folder);
- }
- }, {
- key: 'handleUpload',
- value: function handleUpload(file) {
- var _props2 = this.props,
- module = _props2.module,
- folder = _props2.folder,
- actions = _props2.actions;
-
- actions.dataset.uploadFile(module, folder, file);
- }
- }, {
- key: 'handleURL',
- value: function handleURL(url) {
- var _props3 = this.props,
- module = _props3.module,
- folder = _props3.folder,
- actions = _props3.actions;
-
- actions.dataset.fetchURL(module, folder, url);
- }
- }, {
- key: 'pickFile',
- value: function pickFile(file) {
- console.log('pick', file);
- this.props.onPick && this.props.onPick(file);
- }
- }, {
- key: 'render',
- value: function render() {
- var _props4 = this.props,
- loading = _props4.loading,
- status = _props4.status,
- error = _props4.error,
- module = _props4.module,
- title = _props4.title,
- folder = _props4.folder,
- files = _props4.files,
- canRename = _props4.canRename,
- canUpload = _props4.canUpload,
- canAddURL = _props4.canAddURL,
- canDeleteFile = _props4.canDeleteFile,
- linkFiles = _props4.linkFiles,
- fileOptions = _props4.fileOptions,
- pickFile = _props4.pickFile;
+ files = _props.files,
+ canRename = _props.canRename,
+ canUpload = _props.canUpload,
+ canAddURL = _props.canAddURL,
+ canDeleteFile = _props.canDeleteFile,
+ linkFiles = _props.linkFiles,
+ fileOptions = _props.fileOptions,
+ pickFile = _props.pickFile,
+ onPick = _props.onPick;
// sort files??
return (0, _preact.h)(
@@ -2752,7 +2711,9 @@ var Dataset = function (_Component) {
title: 'Files',
files: files,
options: fileOptions,
- onClick: pickFile,
+ onClick: function onClick() {
+ return onPick && onPick(file);
+ },
canDelete: canDeleteFile,
linkFiles: linkFiles
})
@@ -2760,12 +2721,23 @@ var Dataset = function (_Component) {
);
}
}, {
+ key: 'curry',
+ value: function curry(action) {
+ var _props2 = this.props,
+ module = _props2.module,
+ folder = _props2.folder;
+
+ return function (param) {
+ return action(module, folder, param);
+ };
+ }
+ }, {
key: 'renderFolderNameInput',
value: function renderFolderNameInput(name) {
return (0, _preact.h)(_textInput2.default, {
title: 'Dataset name',
value: name,
- onSave: this.handleName
+ onSave: this.curry(this.props.actions.dataset.createOrUpdateFolder)
});
}
}, {
@@ -2774,7 +2746,7 @@ var Dataset = function (_Component) {
return (0, _preact.h)(_fileUpload2.default, {
title: 'Upload a file',
mime: 'image.*',
- onUpload: this.handleUpload
+ onUpload: this.curry(this.props.actions.dataset.uploadFile)
});
}
}, {
@@ -2783,7 +2755,7 @@ var Dataset = function (_Component) {
return (0, _preact.h)(_textInput2.default, {
title: 'Fetch a URL',
placeholder: 'http://',
- onSave: this.handleURL
+ onSave: this.curry(this.props.actions.dataset.handleURL)
});
}
}]);