summaryrefslogtreecommitdiff
path: root/public/bundle.js
diff options
context:
space:
mode:
authorJules Laplace <julescarbon@gmail.com>2018-09-20 02:52:55 +0200
committerJules Laplace <julescarbon@gmail.com>2018-09-20 02:52:55 +0200
commit3c9ccd38751501bbf5b9cd2c54dee370681fdb5b (patch)
tree31464fe818770550bd71edca8b91aed1eb708240 /public/bundle.js
parent19adbf48642085f39b9562ea6ad1e248a546373c (diff)
stub file viewer
Diffstat (limited to 'public/bundle.js')
-rw-r--r--public/bundle.js131
1 files changed, 77 insertions, 54 deletions
diff --git a/public/bundle.js b/public/bundle.js
index b6d9f12..9648ca0 100644
--- a/public/bundle.js
+++ b/public/bundle.js
@@ -2878,7 +2878,11 @@ var Browser = function (_Component) {
key: 'handlePick',
value: function handlePick(file) {
console.log(file);
- this.fetch([this.state.dir, file.name].join('/').replace('//', '/'));
+ if (file.dir) {
+ this.fetch([this.state.dir, file.name].join('/').replace('//', '/'));
+ } else {
+ this.fetchFile([this.state.dir, file.name].join('/').replace('//', '/'));
+ }
}
}, {
key: 'fetch',
@@ -2895,16 +2899,31 @@ var Browser = function (_Component) {
});
}
}, {
+ key: 'fetchFile',
+ value: function fetchFile(fn) {
+ var _this3 = this;
+
+ console.log('fetch file', fn);
+ var module = this.state.module;
+
+ this.setState({ file: null, loadingFile: true });
+ _actions2.default.socket.read_file({ module: module, fn: fn }).then(function (file) {
+ _this3.setState({ file: file, loadingFile: false });
+ });
+ }
+ }, {
key: 'render',
value: function render() {
- var _this3 = this;
+ var _this4 = this;
var app = this.props.app;
var _state = this.state,
loading = _state.loading,
dir = _state.dir,
module = _state.module,
- files = _state.files;
+ files = _state.files,
+ loadingFile = _state.loadingFile,
+ file = _state.file;
console.log(this.props, this.state);
return (0, _preact.h)(
@@ -2928,13 +2947,14 @@ var Browser = function (_Component) {
e.preventDefault();
e.stopPropagation();
console.log('picked a result', file);
- _this3.handlePick(file);
+ _this4.handlePick(file);
},
onClickParent: function onClickParent(e) {
console.log('navigate up');
- _this3.fetch(_this3.state.dir.split('/').slice(0, -1).join('') || '/');
+ _this4.fetch(_this4.state.dir.split('/').slice(0, -1).join('') || '/');
}
- })
+ }),
+ loadingFile && (0, _preact.h)(_common.Loading, null)
);
}
}]);
@@ -3779,7 +3799,7 @@ function CurrentTask(_ref) {
(0, _preact.h)('br', null),
(0, _preact.h)(
'div',
- { 'class': 'quiet' },
+ { className: 'quiet' },
last_message
)
);
@@ -3885,10 +3905,10 @@ var FileList = exports.FileList = function FileList(props) {
{ className: 'rows ' + className },
(0, _preact.h)(
'div',
- { 'class': 'row heading' },
+ { className: 'row heading' },
(0, _preact.h)(
'h4',
- { 'class': 'noFiles' },
+ { className: 'noFiles' },
'No files'
)
)
@@ -3900,7 +3920,7 @@ var FileList = exports.FileList = function FileList(props) {
{ className: 'rows ' + className },
title && (0, _preact.h)(
'div',
- { 'class': 'row heading' },
+ { className: 'row heading' },
(0, _preact.h)(
'h3',
null,
@@ -3919,7 +3939,7 @@ var FileList = exports.FileList = function FileList(props) {
{ className: 'filename', title: 'Parent Directory' },
(0, _preact.h)(
'span',
- { 'class': 'link', onClick: function onClick(e) {
+ { className: 'link', onClick: function onClick(e) {
return onClickParent && onClickParent(e);
} },
(0, _preact.h)(
@@ -3969,7 +3989,7 @@ var FileRow = exports.FileRow = function FileRow(props) {
return (0, _preact.h)(
'div',
- { 'class': className, key: key },
+ { className: className, key: key },
fields.has('name') && (0, _preact.h)(
'div',
{ className: 'filename', title: file.name || file.url },
@@ -3987,7 +4007,7 @@ var FileRow = exports.FileRow = function FileRow(props) {
name
) : (0, _preact.h)(
'span',
- { 'class': 'link', onClick: function onClick(e) {
+ { className: 'link', onClick: function onClick(e) {
return _onClick && _onClick(file, e);
} },
name
@@ -4192,7 +4212,7 @@ function FolderList(_ref) {
if (db.loading || !db.data) {
return (0, _preact.h)(
'div',
- { 'class': 'col folderList' },
+ { className: 'col folderList' },
(0, _preact.h)(_loading2.default, { progress: db.progress })
);
}
@@ -4205,7 +4225,7 @@ function FolderList(_ref) {
if (!folderList.length && emptyText) {
return (0, _preact.h)(
'div',
- { 'class': 'col folderList' },
+ { className: 'col folderList' },
emptyText
);
}
@@ -4238,7 +4258,7 @@ function FolderList(_ref) {
return (0, _preact.h)(
'div',
- { 'class': 'col folderList' },
+ { className: 'col folderList' },
(0, _preact.h)(
_group2.default,
{ title: 'Projects' },
@@ -5425,7 +5445,7 @@ var Slider = function (_Component) {
}
return (0, _preact.h)(
'div',
- { 'class': 'slider param' },
+ { className: 'slider param' },
(0, _preact.h)(
'label',
null,
@@ -5580,17 +5600,17 @@ var TaskList = function (_Component) {
}
return (0, _preact.h)(
'div',
- { 'class': 'row' },
+ { className: 'row' },
(0, _preact.h)(
'div',
- { 'class': 'activity' },
+ { className: 'activity' },
task.activity,
' ',
task.module
),
(0, _preact.h)(
'div',
- { 'class': 'dataset' },
+ { className: 'dataset' },
dataset_link
),
(0, _preact.h)(
@@ -5600,10 +5620,10 @@ var TaskList = function (_Component) {
),
(0, _preact.h)(
'div',
- { 'class': 'options' },
+ { className: 'options' },
(0, _preact.h)(
'span',
- { 'class': 'destroy', onClick: function onClick() {
+ { className: 'destroy', onClick: function onClick() {
return _this2.handleDestroy(task);
} },
'x'
@@ -5613,7 +5633,7 @@ var TaskList = function (_Component) {
});
return (0, _preact.h)(
'div',
- { 'class': 'tasklist rows' },
+ { className: 'tasklist rows' },
taskList
);
}
@@ -5850,10 +5870,10 @@ var NewView = function (_Component) {
return (0, _preact.h)(
'div',
- { 'class': 'app new-view ' + module.name },
+ { className: 'app new-view ' + module.name },
(0, _preact.h)(
'div',
- { 'class': 'heading' },
+ { className: 'heading' },
(0, _preact.h)(
'h1',
null,
@@ -5862,7 +5882,7 @@ var NewView = function (_Component) {
),
(0, _preact.h)(
'div',
- { 'class': 'col narrow' },
+ { className: 'col narrow' },
(0, _preact.h)(_dataset2.default, {
module: module,
history: history
@@ -6326,7 +6346,7 @@ var DashboardHeader = function (_Component) {
return (0, _preact.h)(
'div',
- { 'class': 'dashboardHeader heading' },
+ { className: 'dashboardHeader heading' },
(0, _preact.h)(
'h1',
null,
@@ -6617,28 +6637,28 @@ var DatasetComponent = function (_Component) {
fields = fieldSet(fields);
return (0, _preact.h)(
'div',
- { 'class': 'rows params datasets' },
+ { className: 'rows params datasets' },
(0, _preact.h)(
'div',
- { 'class': 'row row-heading dataset' },
+ { className: 'row row-heading dataset' },
fields.has('input') && (0, _preact.h)(
'div',
- { 'class': 'col' },
+ { className: 'col' },
'input'
),
fields.has('status') && (0, _preact.h)(
'div',
- { 'class': 'col' },
+ { className: 'col' },
'status'
),
fields.has('checkpoint') && (0, _preact.h)(
'div',
- { 'class': 'col' },
+ { className: 'col' },
'checkpoint'
),
fields.has('output') && (0, _preact.h)(
'div',
- { 'class': 'col' },
+ { className: 'col' },
'output'
)
),
@@ -7157,10 +7177,10 @@ function NewDatasetForm(props) {
console.log(props);
return (0, _preact.h)(
'div',
- { 'class': 'opaque' },
+ { className: 'opaque' },
(0, _preact.h)(
'div',
- { 'class': 'heading' },
+ { className: 'heading' },
(0, _preact.h)(
'h2',
null,
@@ -7171,7 +7191,7 @@ function NewDatasetForm(props) {
),
(0, _preact.h)(
'div',
- { 'class': 'params' },
+ { className: 'params' },
(0, _preact.h)(_textInput2.default, {
autofocus: true,
title: 'Name your project',
@@ -7529,7 +7549,7 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
function UploadStatus(props) {
return (0, _preact.h)(
'div',
- { 'class': 'status' },
+ { className: 'status' },
props.status
);
}
@@ -9166,10 +9186,10 @@ var MorphResults = function (_Component) {
),
(0, _preact.h)(
'div',
- { 'class': 'rows params renders' },
+ { className: 'rows params renders' },
(0, _preact.h)(
'div',
- { 'class': 'column' },
+ { className: 'column' },
(0, _preact.h)(
_common.Group,
{ title: 'From' },
@@ -10023,7 +10043,7 @@ var Pix2PixLive = function (_Component) {
}),
(0, _preact.h)(
'p',
- { 'class': 'last_message' },
+ { className: 'last_message' },
this.props.last_message
)
)
@@ -10442,10 +10462,10 @@ var Pix2pixShow = function (_Component) {
{ className: 'app pix2pix' },
(0, _preact.h)(
'div',
- { 'class': 'heading' },
+ { className: 'heading' },
(0, _preact.h)(
'div',
- { 'class': 'spaced' },
+ { className: 'spaced' },
(0, _preact.h)(
'h1',
null,
@@ -10505,38 +10525,38 @@ var Pix2pixShow = function (_Component) {
null,
(0, _preact.h)(
'div',
- { 'class': 'actions' },
+ { className: 'actions' },
(0, _preact.h)(
'span',
- { 'class': 'link', onClick: function onClick() {
+ { className: 'link', onClick: function onClick() {
return remote.train_task(dataset, pix2pix.folder_id, 1);
} },
'train'
),
(0, _preact.h)(
'span',
- { 'class': 'link', onClick: function onClick() {
+ { className: 'link', onClick: function onClick() {
return remote.train_task(dataset, pix2pix.folder_id, 5);
} },
'5x'
),
(0, _preact.h)(
'span',
- { 'class': 'link', onClick: function onClick() {
+ { className: 'link', onClick: function onClick() {
return remote.train_task(dataset, pix2pix.folder_id, 10);
} },
'10x'
),
(0, _preact.h)(
'span',
- { 'class': 'link', onClick: function onClick() {
+ { className: 'link', onClick: function onClick() {
return remote.train_task(dataset, pix2pix.folder_id, 20);
} },
'20x'
),
(0, _preact.h)(
'span',
- { 'class': 'link', onClick: function onClick() {
+ { className: 'link', onClick: function onClick() {
return remote.train_task(dataset, pix2pix.folder_id, 50);
} },
'50x'
@@ -10544,25 +10564,25 @@ var Pix2pixShow = function (_Component) {
),
dataset.isBuilt ? (0, _preact.h)(
'div',
- { 'class': 'subtext' },
+ { className: 'subtext' },
'fetched ',
(0, _preact.h)(
'span',
- { 'class': 'link', onClick: function onClick() {
+ { className: 'link', onClick: function onClick() {
return remote.clear_cache_task(dataset);
} },
'rm'
)
) : isFetching ? (0, _preact.h)(
'div',
- { 'class': 'subtext' },
+ { className: 'subtext' },
'fetching'
) : (0, _preact.h)(
'div',
- { 'class': 'subtext' },
+ { className: 'subtext' },
(0, _preact.h)(
'span',
- { 'class': 'link', onClick: function onClick() {
+ { className: 'link', onClick: function onClick() {
return remote.fetch_task(input.url, input.id, dataset.name);
} },
'fetch'
@@ -16169,7 +16189,7 @@ _socket.socket.on('status', function (data) {
Object.defineProperty(exports, "__esModule", {
value: true
});
-exports.syscall_async = exports.upload_file = exports.run_script = exports.list_sequences = exports.count_directory = exports.list_directory = exports.disk_usage = exports.run_system_command = undefined;
+exports.syscall_async = exports.read_file = exports.upload_file = exports.run_script = exports.list_sequences = exports.count_directory = exports.list_directory = exports.disk_usage = exports.run_system_command = undefined;
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
@@ -16208,6 +16228,9 @@ var run_script = exports.run_script = function run_script(opt) {
var upload_file = exports.upload_file = function upload_file(opt) {
return syscall_async('upload_file', opt);
};
+var read_file = exports.read_file = function read_file(opt) {
+ return syscall_async('read_file', opt);
+};
var syscall_async = exports.syscall_async = function syscall_async(tag, payload) {
var ttl = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 10000;