summaryrefslogtreecommitdiff
path: root/public/bundle.js
diff options
context:
space:
mode:
Diffstat (limited to 'public/bundle.js')
-rw-r--r--public/bundle.js789
1 files changed, 628 insertions, 161 deletions
diff --git a/public/bundle.js b/public/bundle.js
index c3fcabb..9ff406d 100644
--- a/public/bundle.js
+++ b/public/bundle.js
@@ -71,6 +71,58 @@
/************************************************************************/
/******/ ({
+/***/ "./app/client/actions.js":
+/*!*******************************!*\
+ !*** ./app/client/actions.js ***!
+ \*******************************/
+/*! no static exports found */
+/***/ (function(module, exports, __webpack_require__) {
+
+"use strict";
+
+
+Object.defineProperty(exports, "__esModule", {
+ value: true
+});
+
+var _redux = __webpack_require__(/*! redux */ "./node_modules/redux/es/redux.js");
+
+var _api = __webpack_require__(/*! ./api */ "./app/client/api/index.js");
+
+var _task = __webpack_require__(/*! ./task/task.actions */ "./app/client/task/task.actions.js");
+
+var taskActions = _interopRequireWildcard(_task);
+
+var _live = __webpack_require__(/*! ./live/live.actions */ "./app/client/live/live.actions.js");
+
+var liveActions = _interopRequireWildcard(_live);
+
+var _system = __webpack_require__(/*! ./system/system.actions */ "./app/client/system/system.actions.js");
+
+var systemActions = _interopRequireWildcard(_system);
+
+var _socket = __webpack_require__(/*! ./socket/socket.actions */ "./app/client/socket/socket.actions.js");
+
+var socketActions = _interopRequireWildcard(_socket);
+
+var _dataset = __webpack_require__(/*! ./dataset/dataset.actions */ "./app/client/dataset/dataset.actions.js");
+
+var datasetActions = _interopRequireWildcard(_dataset);
+
+var _store = __webpack_require__(/*! ./store */ "./app/client/store.js");
+
+function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
+
+exports.default = Object.keys(_api.actions).map(function (a) {
+ return [a, _api.actions[a]];
+}).concat([['task', taskActions], ['live', liveActions], ['system', systemActions], ['dataset', datasetActions]]).map(function (p) {
+ return [p[0], (0, _redux.bindActionCreators)(p[1], _store.dispatch)];
+}).concat([['socket', socketActions]]).reduce(function (a, b) {
+ return (a[b[0]] = b[1]) && a;
+}, {});
+
+/***/ }),
+
/***/ "./app/client/api/crud.actions.js":
/*!****************************************!*\
!*** ./app/client/api/crud.actions.js ***!
@@ -113,11 +165,15 @@ function crud_actions(type) {
var crud_action = exports.crud_action = function crud_action(type, method, fn) {
return function (q) {
return function (dispatch) {
- dispatch({ type: (0, _crud2.as_type)(type, method + '_loading') });
- fn(q).then(function (data) {
- dispatch({ type: (0, _crud2.as_type)(type, method), data: data });
- }).catch(function (e) {
- dispatch({ type: (0, _crud2.as_type)(type, method + '_error') });
+ return new Promise(function (resolve, reject) {
+ dispatch({ type: (0, _crud2.as_type)(type, method + '_loading') });
+ fn(q).then(function (data) {
+ dispatch({ type: (0, _crud2.as_type)(type, method), data: data });
+ resolve(data);
+ }).catch(function (e) {
+ dispatch({ type: (0, _crud2.as_type)(type, method + '_error') });
+ reject(e);
+ });
});
};
};
@@ -342,12 +398,14 @@ function crud_upload(type, fd, data, dispatch) {
type: (0, _crud.as_type)(type, 'upload_error'),
error: 'upload failed'
}, type, id));
+ reject(e);
return;
}
dispatch && dispatch(_defineProperty({
type: (0, _crud.as_type)(type, 'upload_complete'),
data: data
}, type, id));
+ resolve(data);
}
function uploadFailed(evt) {
@@ -355,6 +413,7 @@ function crud_upload(type, fd, data, dispatch) {
type: (0, _crud.as_type)(type, 'upload_error'),
error: 'upload failed'
}, type, id));
+ reject(evt);
}
function uploadCancelled(evt) {
@@ -362,6 +421,7 @@ function crud_upload(type, fd, data, dispatch) {
type: (0, _crud.as_type)(type, 'upload_error'),
error: 'upload cancelled'
}, type, id));
+ reject(evt);
}
});
}
@@ -936,9 +996,12 @@ var FileList = function (_Component) {
linkFiles = _props.linkFiles,
_onClick = _props.onClick;
+ if (!files.length) return null;
var fields = this.props.fields || defaultFields;
var fileList = files.map(function (file) {
var size = util.hush_size(file.size);
+ var date = file.created_at;
+ var username = file.username || "";
return (0, _preact.h)(
'div',
{ 'class': 'row file', key: file.name },
@@ -957,15 +1020,25 @@ var FileList = function (_Component) {
file.name || file.url
)
),
+ fields.has('age') && (0, _preact.h)(
+ 'div',
+ { className: "age " + util.carbon_date(date) },
+ util.get_age(date)
+ ),
+ fields.has('username') && (0, _preact.h)(
+ 'div',
+ { className: "username" },
+ username
+ ),
fields.has('date') && (0, _preact.h)(
'div',
- { className: "date " + util.carbon_date(file.created_at) },
- (0, _moment2.default)(file.created_at).format("YYYY-MM-DD")
+ { className: "date " + util.carbon_date(date) },
+ (0, _moment2.default)(date).format("YYYY-MM-DD")
),
fields.has('datetime') && (0, _preact.h)(
'div',
- { className: "datetime " + util.carbon_date(file.created_at) },
- (0, _moment2.default)(file.created_at).format("YYYY-MM-DD h:mm a")
+ { className: "datetime " + util.carbon_date(date) },
+ (0, _moment2.default)(date).format("YYYY-MM-DD h:mm a")
),
fields.has('size') && (0, _preact.h)(
'div',
@@ -2190,11 +2263,8 @@ var DashboardHeader = function (_Component) {
}, {
key: 'render',
value: function render() {
- var _props = this.props,
- currentTask = _props.currentTask,
- site = _props.site;
+ var site = this.props.site;
- var eta = (currentTask.epochs - currentTask.epoch) * 180 / 60 + " minutes";
return (0, _preact.h)(
'div',
{ 'class': 'dashboardHeader heading' },
@@ -2203,29 +2273,60 @@ var DashboardHeader = function (_Component) {
null,
site.name
),
- 'Currently ',
- util.gerund(currentTask.activity),
- ' ',
- currentTask.module,
- ' on ',
- currentTask.dataset,
- (0, _preact.h)('br', null),
- 'Epoch: ',
- currentTask.epoch,
- ' / ',
- currentTask.epochs,
- ', ETA ',
- eta,
- (0, _preact.h)('br', null),
- (0, _preact.h)('br', null),
- 'Want to play live? ',
- (0, _preact.h)(
- 'button',
- null,
- 'Pause at the end of this epoch'
- )
+ this.renderGPUStatus()
);
}
+ }, {
+ key: 'renderGPUStatus',
+ value: function renderGPUStatus() {
+ var runner = this.props.runner;
+
+ var gpu = runner.cpu;
+ if (gpu.status === 'IDLE') {
+ return null;
+ }
+ var task = gpu.task;
+ var eta = (task.epochs - (task.epoch || 0)) * 180 / 60 + " minutes";
+ var activityPhrase = void 0,
+ liveMessage = void 0;
+ if (task.activity === 'live') {
+ return (0, _preact.h)(
+ 'div',
+ null,
+ 'Currently running ',
+ task.module,
+ ' live on "',
+ task.dataset,
+ '"'
+ );
+ } else {
+ return (0, _preact.h)(
+ 'div',
+ null,
+ 'Currently ',
+ util.gerund(task.activity),
+ ' ',
+ task.module,
+ ' on ',
+ task.dataset,
+ (0, _preact.h)('br', null),
+ 'Epoch: ',
+ task.epoch,
+ ' / ',
+ task.epochs,
+ ', ETA ',
+ eta,
+ (0, _preact.h)('br', null),
+ (0, _preact.h)('br', null),
+ 'Want to play live? ',
+ (0, _preact.h)(
+ 'button',
+ null,
+ 'Pause at the end of this epoch'
+ )
+ );
+ }
+ }
}]);
return DashboardHeader;
@@ -2233,6 +2334,7 @@ var DashboardHeader = function (_Component) {
var mapStateToProps = function mapStateToProps(state) {
return {
+ runner: state.system.runner,
currentTask: state.task.currentTask,
site: state.system.site
};
@@ -2363,6 +2465,44 @@ exports.default = (0, _reactRedux.connect)(mapStateToProps, mapDispatchToProps)(
/***/ }),
+/***/ "./app/client/dataset/dataset.actions.js":
+/*!***********************************************!*\
+ !*** ./app/client/dataset/dataset.actions.js ***!
+ \***********************************************/
+/*! no static exports found */
+/***/ (function(module, exports, __webpack_require__) {
+
+"use strict";
+
+
+Object.defineProperty(exports, "__esModule", {
+ value: true
+});
+exports.fetchURL = exports.uploadFiles = undefined;
+
+var _types = __webpack_require__(/*! ../types */ "./app/client/types.js");
+
+var _types2 = _interopRequireDefault(_types);
+
+function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
+
+var uploadFiles = exports.uploadFiles = function uploadFiles(files) {
+ return { type: _types2.default.dataset.upload_files };
+}; // import socket from '../socket'
+var fetchURL = exports.fetchURL = function fetchURL(url) {
+ return { type: _types2.default.dataset.fetch_url };
+};
+
+// export const uploadFiles = (files) => {
+// return dispatch => {
+// // return { type: types.dataset.upload_files }
+// }
+// }
+
+// export const fetchURL = (url) => { type: types.dataset.fetch_url }
+
+/***/ }),
+
/***/ "./app/client/dataset/dataset.component.js":
/*!*************************************************!*\
!*** ./app/client/dataset/dataset.component.js ***!
@@ -2641,8 +2781,6 @@ Object.defineProperty(exports, "__esModule", {
value: true
});
-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; };
-
var _types = __webpack_require__(/*! ../types */ "./app/client/types.js");
var _types2 = _interopRequireDefault(_types);
@@ -2659,100 +2797,37 @@ var datasetReducer = function datasetReducer() {
var state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : datasetInitialState;
var action = arguments[1];
- console.log(action);
switch (action.type) {
- case _types2.default.socket.connect:
- return _extends({}, state);
- case _types2.default.task.task_begin:
- return _extends({}, state);
- case _types2.default.task.task_finish:
- return _extends({}, state);
-
- case _types2.default.folder.index:
- return _extends({}, state, {
- folders: action.data,
- folder: action.data[0]
- });
- case _types2.default.folder.update:
- return state;
- case _types2.default.file.index:
- return _extends({}, state, {
- files: action.data
- });
-
case _types2.default.folder.upload_loading:
- return _extends({}, state, {
- upload: {
- loading: true,
- status: 'Loading...'
- }
- });
+ return {
+ error: null,
+ loading: true,
+ status: 'Loading...'
+ };
case _types2.default.folder.upload_error:
- return _extends({}, state, {
- upload: {
- loading: false,
- status: 'Error uploading :('
- }
- });
+ return {
+ error: null,
+ loading: false,
+ status: 'Error uploading :('
+ };
case _types2.default.folder.upload_progress:
- console.log(action);
- return _extends({}, state, {
- upload: {
- loading: true,
- status: 'Upload progress ' + action.percent + '%'
- }
- });
+ return {
+ error: null,
+ loading: true,
+ status: 'Upload progress ' + action.percent + '%'
+ };
case _types2.default.folder.upload_waiting:
- console.log(action);
- return _extends({}, state, {
- upload: {
- loading: true,
- status: 'Waiting for server to finish processing...'
- }
- });
+ return {
+ error: null,
+ loading: true,
+ status: 'Waiting for server to finish processing...'
+ };
case _types2.default.file.create_loading:
- return _extends({}, state, {
- upload: {
- loading: true,
- status: 'Creating file...'
- }
- });
- case _types2.default.file.create:
- console.log('booo');
- if (state.folder.id === action.data.folder_id) {
- return _extends({}, state, {
- files: [action.data].concat(state.files),
- upload: {
- loading: false,
- status: 'File created'
- }
- });
- } else {
- return _extends({}, state, {
- upload: {
- loading: false,
- status: 'created'
- }
- });
- }
- case _types2.default.folder.upload_complete:
- console.log(action);
- if (state.folder.id === action.folder) {
- return _extends({}, state, {
- files: [action.files].concat(state.files),
- upload: {
- loading: false,
- status: 'Upload complete'
- }
- });
- } else {
- return _extends({}, state, {
- upload: {
- loading: false,
- status: 'Upload complete'
- }
- });
- }
+ return {
+ error: null,
+ loading: true,
+ status: 'Creating file...'
+ };
case _types2.default.socket.status:
return datasetSocket(state, action.data);
default:
@@ -4281,6 +4356,75 @@ exports.default = {
/***/ }),
+/***/ "./app/client/modules/samplernn/samplernn.actions.js":
+/*!***********************************************************!*\
+ !*** ./app/client/modules/samplernn/samplernn.actions.js ***!
+ \***********************************************************/
+/*! no static exports found */
+/***/ (function(module, exports, __webpack_require__) {
+
+"use strict";
+
+
+Object.defineProperty(exports, "__esModule", {
+ value: true
+});
+exports.fetch_url = exports.load_directories = undefined;
+
+var _socket = __webpack_require__(/*! ../../socket */ "./app/client/socket/index.js");
+
+var _socket2 = _interopRequireDefault(_socket);
+
+var _types = __webpack_require__(/*! ../../types */ "./app/client/types.js");
+
+var _types2 = _interopRequireDefault(_types);
+
+var _actions = __webpack_require__(/*! ../../actions */ "./app/client/actions.js");
+
+var _actions2 = _interopRequireDefault(_actions);
+
+function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
+
+// bindActionCreators(actions.folder, dispatch),
+// bindActionCreators(actions.file, dispatch),
+// bindActionCreators(taskActions, dispatch),
+// bindActionCreators(systemActions, dispatch),
+
+var load_directories = exports.load_directories = function load_directories() {
+ return function (dispatch) {
+ // load datasets
+ // load directories from server
+ console.log(_actions2.default);
+ _actions2.default.folder.index({ module: 'samplernn' }).then(function (folders) {
+ console.log('got folders');
+ });
+ _actions2.default.file.index({ module: 'samplernn' }).then(function (files) {
+ console.log('got files');
+ });
+ _actions2.default.socket.list_directory({ module: 'samplernn', dir: 'results' }).then(function (dirs) {
+ console.log('got results');
+ });
+ _actions2.default.socket.list_directory({ module: 'samplernn', dir: 'datasets' }).then(function (dirs) {
+ console.log('got datasets');
+ });
+ };
+};
+
+var fetch_url = exports.fetch_url = function fetch_url(url) {
+ return function (dispatch) {
+ console.log(url);
+ _actions2.default.task.start_task({
+ activity: 'fetch',
+ module: 'samplernn',
+ dataset: 'test',
+ epochs: 1,
+ opt: { url: url }
+ }, { preempt: true, watch: true });
+ };
+};
+
+/***/ }),
+
/***/ "./app/client/modules/samplernn/samplernn.datasets.js":
/*!************************************************************!*\
!*** ./app/client/modules/samplernn/samplernn.datasets.js ***!
@@ -4303,15 +4447,9 @@ var _redux = __webpack_require__(/*! redux */ "./node_modules/redux/es/redux.js"
var _reactRedux = __webpack_require__(/*! react-redux */ "./node_modules/react-redux/es/index.js");
-var _api = __webpack_require__(/*! ../../api */ "./app/client/api/index.js");
-
-var _task = __webpack_require__(/*! ../../task/task.actions */ "./app/client/task/task.actions.js");
-
-var taskActions = _interopRequireWildcard(_task);
-
-var _system = __webpack_require__(/*! ../../system/system.actions */ "./app/client/system/system.actions.js");
+var _samplernn = __webpack_require__(/*! ./samplernn.actions */ "./app/client/modules/samplernn/samplernn.actions.js");
-var systemActions = _interopRequireWildcard(_system);
+var samplernnActions = _interopRequireWildcard(_samplernn);
var _dataset = __webpack_require__(/*! ../../dataset/dataset.component */ "./app/client/dataset/dataset.component.js");
@@ -4357,13 +4495,11 @@ var SampleRNNDatasets = function (_Component) {
function SampleRNNDatasets(props) {
_classCallCheck(this, SampleRNNDatasets);
- // fetch file list
var _this = _possibleConstructorReturn(this, (SampleRNNDatasets.__proto__ || Object.getPrototypeOf(SampleRNNDatasets)).call(this));
_this.fileOptions = _this.fileOptions.bind(_this);
_this.pickFile = _this.pickFile.bind(_this);
- props.actions.folder.index({ module: 'samplernn' });
- props.actions.file.index({ module: 'samplernn' });
+ props.actions.load_directories();
return _this;
}
@@ -4377,7 +4513,7 @@ var SampleRNNDatasets = function (_Component) {
value: function fileOptions(file) {
var _this2 = this;
- console.log(file);
+ // console.log(file)
if (file.activity === 'url' && !file.dataset) {
if (this.props.runner.cpu.status !== 'IDLE') {
return (0, _preact.h)(
@@ -4415,23 +4551,14 @@ var SampleRNNDatasets = function (_Component) {
}
}, {
key: 'fetchURL',
- value: function fetchURL(url) {
- console.log(url);
- this.props.actions.task.start_task({
- activity: 'fetch',
- module: 'samplernn',
- dataset: 'test',
- epochs: 1,
- opt: { url: url }
- }, { preempt: true, watch: true });
- }
+ value: function fetchURL(url) {}
}, {
key: 'render',
value: function render() {
var samplernn = this.props.samplernn;
-
- console.log(samplernn.upload);
+ // console.log(samplernn.upload)
// sort files??
+
var module = {
name: 'samplernn',
datatype: 'audio'
@@ -4477,12 +4604,7 @@ var mapStateToProps = function mapStateToProps(state) {
var mapDispatchToProps = function mapDispatchToProps(dispatch, ownProps) {
return {
- actions: {
- folder: (0, _redux.bindActionCreators)(_api.actions.folder, dispatch),
- file: (0, _redux.bindActionCreators)(_api.actions.file, dispatch),
- task: (0, _redux.bindActionCreators)(taskActions, dispatch),
- system: (0, _redux.bindActionCreators)(systemActions, dispatch)
- }
+ actions: (0, _redux.bindActionCreators)(samplernnActions, dispatch)
};
};
@@ -4515,6 +4637,7 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
var samplernnInitialState = {
loading: false,
error: null,
+ folder: {},
folders: [],
datasets: [],
results: [],
@@ -4532,12 +4655,45 @@ var samplernnReducer = function samplernnReducer() {
var state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : samplernnInitialState;
var action = arguments[1];
- console.log(action);
switch (action.type) {
+ case _types2.default.socket.connect:
+ return _extends({}, state);
case _types2.default.task.task_begin:
return _extends({}, state);
case _types2.default.task.task_finish:
return _extends({}, state);
+ case _types2.default.folder.index:
+ return _extends({}, state, {
+ folders: action.data,
+ folder: action.data[0]
+ });
+ case _types2.default.folder.update:
+ return state;
+
+ case _types2.default.file.index:
+ return _extends({}, state, {
+ files: action.data
+ });
+
+ case _types2.default.file.create:
+ if (state.folder.id === action.data.folder_id) {
+ return _extends({}, state, {
+ files: [action.data].concat(state.files)
+ });
+ }
+ return state;
+
+ case _types2.default.folder.upload_complete:
+ if (state.folder.id === action.folder) {
+ return _extends({}, state, {
+ files: [action.files].concat(state.files)
+ });
+ }
+ return state;
+
+ case _types2.default.system.list_directory:
+ console.log('list directory', action.data);
+ return _extends({}, state);
case _types2.default.socket.status:
return samplernnSocket(state, action.data);
@@ -4549,6 +4705,8 @@ var samplernnReducer = function samplernnReducer() {
var samplernnSocket = function samplernnSocket(state, action) {
console.log(action);
switch (action.key) {
+ case 'list_directory':
+ return state;
default:
return state;
}
@@ -4622,6 +4780,27 @@ _socket.socket.on('status', function (data) {
/***/ }),
+/***/ "./app/client/socket/socket.actions.js":
+/*!*********************************************!*\
+ !*** ./app/client/socket/socket.actions.js ***!
+ \*********************************************/
+/*! no static exports found */
+/***/ (function(module, exports, __webpack_require__) {
+
+"use strict";
+
+
+Object.defineProperty(exports, "__esModule", {
+ value: true
+});
+exports.list_directory = undefined;
+
+var _socket = __webpack_require__(/*! ./socket.system */ "./app/client/socket/socket.system.js");
+
+var list_directory = exports.list_directory = _socket.list_directory_async;
+
+/***/ }),
+
/***/ "./app/client/socket/socket.connection.js":
/*!************************************************!*\
!*** ./app/client/socket/socket.connection.js ***!
@@ -4833,7 +5012,10 @@ function set_param(key, value) {
Object.defineProperty(exports, "__esModule", {
value: true
});
+exports.syscall_async = undefined;
exports.run_system_command = run_system_command;
+exports.list_directory = list_directory;
+exports.list_directory_async = list_directory_async;
var _store = __webpack_require__(/*! ../store */ "./app/client/store.js");
@@ -4841,6 +5023,10 @@ var _types = __webpack_require__(/*! ../types */ "./app/client/types.js");
var _types2 = _interopRequireDefault(_types);
+var _v = __webpack_require__(/*! uuid/v1 */ "./node_modules/uuid/v1.js");
+
+var _v2 = _interopRequireDefault(_v);
+
var _socket = __webpack_require__(/*! ./socket.connection */ "./app/client/socket/socket.connection.js");
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
@@ -4870,11 +5056,18 @@ _socket.socket.on('system_res', function (data) {
type: data.rpc_connected ? _types2.default.system.rpc_connected : _types2.default.system.rpc_disconnected,
runner: data.runner
});
- case 'command_output':
- return (0, _store.dispatch)({
- type: _types2.default.system.command_output,
- data: data
- });
+ // case 'run_system_command':
+ // return dispatch({
+ // type: types.system.command_output,
+ // data: data,
+ // })
+ // case 'list_directory':
+ // return dispatch({
+ // type: types.system.list_directory,
+ // data: data,
+ // })
+ // break
+ default:
break;
}
});
@@ -4886,6 +5079,38 @@ function run_system_command(cmd) {
});
}
+function list_directory(opt) {
+ _socket.socket.emit('system', {
+ cmd: 'list_directory',
+ payload: opt
+ });
+}
+
+function list_directory_async(opt) {
+ return syscall_async('list_directory', opt);
+}
+
+var syscall_async = exports.syscall_async = function syscall_async(tag, payload) {
+ var ttl = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 10000;
+
+ return new Promise(function (resolve, reject) {
+ var uuid = (0, _v2.default)();
+ var timeout = setTimeout(function () {
+ _socket.socket.off('system_res', cb);
+ reject('timeout');
+ }, ttl);
+ var cb = function cb(data) {
+ if (data.uuid === uuid) {
+ clearTimeout(timeout);
+ _socket.socket.off('system_res', cb);
+ resolve(data);
+ }
+ };
+ _socket.socket.emit('system', { cmd: tag, payload: payload, uuid: uuid });
+ _socket.socket.on('system_res', cb);
+ });
+};
+
/***/ }),
/***/ "./app/client/socket/socket.task.js":
@@ -5065,7 +5290,7 @@ var dispatch = exports.dispatch = store.dispatch;
Object.defineProperty(exports, "__esModule", {
value: true
});
-exports.changeTool = exports.run = undefined;
+exports.changeTool = exports.listDirectory = exports.run = undefined;
var _socket = __webpack_require__(/*! ../socket */ "./app/client/socket/index.js");
@@ -5082,6 +5307,11 @@ var run = exports.run = function run(cmd) {
return { type: _types2.default.system.running_command, cmd: cmd };
};
+var listDirectory = exports.listDirectory = function listDirectory(opt) {
+ _socket2.default.system.list_directory(opt);
+ return { type: _types2.default.system.listing_directory, opt: opt };
+};
+
var changeTool = exports.changeTool = function changeTool(tool) {
return { type: _types2.default.app.change_tool, tool: tool };
};
@@ -5843,6 +6073,8 @@ exports.default = (_system$app$folder$fi = {
relay_disconnected: 'SYSTEM_RELAY_DISCONNECTED',
rpc_connected: 'SYSTEM_RPC_CONNECTED',
rpc_disconnected: 'SYSTEM_RPC_DISCONNECTED',
+ list_directory: 'SYSTEM_LIST_DIRECTORY',
+ listing_directory: 'SYSTEM_LISTING_DIRECTORY',
stdout: 'SYSTEM_STDOUT',
stderr: 'SYSTEM_STDERR'
},
@@ -5929,6 +6161,7 @@ exports.hush_views = hush_views;
exports.hush_threads = hush_threads;
exports.hush_size = hush_size;
exports.hush_null = hush_null;
+exports.get_age = get_age;
exports.courtesy_s = courtesy_s;
var is_iphone = exports.is_iphone = !!(navigator.userAgent.match(/iPhone/i) || navigator.userAgent.match(/iPod/i));
var is_ipad = exports.is_ipad = !!navigator.userAgent.match(/iPad/i);
@@ -6075,6 +6308,43 @@ function hush_null(n, unit, no_bold) {
return ["new", s];
}
}
+function get_age(t) {
+ var age = Math.abs(+Date.now() - new Date(t)) / 1000;
+ var r = Math.floor;
+ var m;
+ if (age < 5) {
+ return "now";
+ }
+ if (age < 60) {
+ return r(age) + "s";
+ }
+ age /= 60;
+ if (age < 60) {
+ return r(age) + "m";
+ }
+ m = r(age % 60);
+ age /= 60;
+ if (m > 0 && age < 2) {
+ return r(age) + "h" + m + "m";
+ }
+ if (age < 24) {
+ return r(age) + "h";
+ }
+ age /= 24;
+ if (age < 7) {
+ return r(age) + "d";
+ }
+ age /= 7;
+ if (age < 12) {
+ return r(age) + "w";
+ }
+ age /= 4;
+ if (age < 12) {
+ return r(age) + "m";
+ }
+ age /= 12;
+ return r(age) + "y";
+}
function courtesy_s(n, s) {
return n == 1 ? "" : s || "s";
}
@@ -33588,6 +33858,203 @@ function symbolObservablePonyfill(root) {
/***/ }),
+/***/ "./node_modules/uuid/lib/bytesToUuid.js":
+/*!**********************************************!*\
+ !*** ./node_modules/uuid/lib/bytesToUuid.js ***!
+ \**********************************************/
+/*! no static exports found */
+/***/ (function(module, exports) {
+
+/**
+ * Convert array of 16 byte values to UUID string format of the form:
+ * XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX
+ */
+var byteToHex = [];
+for (var i = 0; i < 256; ++i) {
+ byteToHex[i] = (i + 0x100).toString(16).substr(1);
+}
+
+function bytesToUuid(buf, offset) {
+ var i = offset || 0;
+ var bth = byteToHex;
+ return bth[buf[i++]] + bth[buf[i++]] +
+ bth[buf[i++]] + bth[buf[i++]] + '-' +
+ bth[buf[i++]] + bth[buf[i++]] + '-' +
+ bth[buf[i++]] + bth[buf[i++]] + '-' +
+ bth[buf[i++]] + bth[buf[i++]] + '-' +
+ bth[buf[i++]] + bth[buf[i++]] +
+ bth[buf[i++]] + bth[buf[i++]] +
+ bth[buf[i++]] + bth[buf[i++]];
+}
+
+module.exports = bytesToUuid;
+
+
+/***/ }),
+
+/***/ "./node_modules/uuid/lib/rng-browser.js":
+/*!**********************************************!*\
+ !*** ./node_modules/uuid/lib/rng-browser.js ***!
+ \**********************************************/
+/*! no static exports found */
+/***/ (function(module, exports) {
+
+// Unique ID creation requires a high quality random # generator. In the
+// browser this is a little complicated due to unknown quality of Math.random()
+// and inconsistent support for the `crypto` API. We do the best we can via
+// feature-detection
+
+// getRandomValues needs to be invoked in a context where "this" is a Crypto implementation.
+var getRandomValues = (typeof(crypto) != 'undefined' && crypto.getRandomValues.bind(crypto)) ||
+ (typeof(msCrypto) != 'undefined' && msCrypto.getRandomValues.bind(msCrypto));
+if (getRandomValues) {
+ // WHATWG crypto RNG - http://wiki.whatwg.org/wiki/Crypto
+ var rnds8 = new Uint8Array(16); // eslint-disable-line no-undef
+
+ module.exports = function whatwgRNG() {
+ getRandomValues(rnds8);
+ return rnds8;
+ };
+} else {
+ // Math.random()-based (RNG)
+ //
+ // If all else fails, use Math.random(). It's fast, but is of unspecified
+ // quality.
+ var rnds = new Array(16);
+
+ module.exports = function mathRNG() {
+ for (var i = 0, r; i < 16; i++) {
+ if ((i & 0x03) === 0) r = Math.random() * 0x100000000;
+ rnds[i] = r >>> ((i & 0x03) << 3) & 0xff;
+ }
+
+ return rnds;
+ };
+}
+
+
+/***/ }),
+
+/***/ "./node_modules/uuid/v1.js":
+/*!*********************************!*\
+ !*** ./node_modules/uuid/v1.js ***!
+ \*********************************/
+/*! no static exports found */
+/***/ (function(module, exports, __webpack_require__) {
+
+var rng = __webpack_require__(/*! ./lib/rng */ "./node_modules/uuid/lib/rng-browser.js");
+var bytesToUuid = __webpack_require__(/*! ./lib/bytesToUuid */ "./node_modules/uuid/lib/bytesToUuid.js");
+
+// **`v1()` - Generate time-based UUID**
+//
+// Inspired by https://github.com/LiosK/UUID.js
+// and http://docs.python.org/library/uuid.html
+
+var _nodeId;
+var _clockseq;
+
+// Previous uuid creation time
+var _lastMSecs = 0;
+var _lastNSecs = 0;
+
+// See https://github.com/broofa/node-uuid for API details
+function v1(options, buf, offset) {
+ var i = buf && offset || 0;
+ var b = buf || [];
+
+ options = options || {};
+ var node = options.node || _nodeId;
+ var clockseq = options.clockseq !== undefined ? options.clockseq : _clockseq;
+
+ // node and clockseq need to be initialized to random values if they're not
+ // specified. We do this lazily to minimize issues related to insufficient
+ // system entropy. See #189
+ if (node == null || clockseq == null) {
+ var seedBytes = rng();
+ if (node == null) {
+ // Per 4.5, create and 48-bit node id, (47 random bits + multicast bit = 1)
+ node = _nodeId = [
+ seedBytes[0] | 0x01,
+ seedBytes[1], seedBytes[2], seedBytes[3], seedBytes[4], seedBytes[5]
+ ];
+ }
+ if (clockseq == null) {
+ // Per 4.2.2, randomize (14 bit) clockseq
+ clockseq = _clockseq = (seedBytes[6] << 8 | seedBytes[7]) & 0x3fff;
+ }
+ }
+
+ // UUID timestamps are 100 nano-second units since the Gregorian epoch,
+ // (1582-10-15 00:00). JSNumbers aren't precise enough for this, so
+ // time is handled internally as 'msecs' (integer milliseconds) and 'nsecs'
+ // (100-nanoseconds offset from msecs) since unix epoch, 1970-01-01 00:00.
+ var msecs = options.msecs !== undefined ? options.msecs : new Date().getTime();
+
+ // Per 4.2.1.2, use count of uuid's generated during the current clock
+ // cycle to simulate higher resolution clock
+ var nsecs = options.nsecs !== undefined ? options.nsecs : _lastNSecs + 1;
+
+ // Time since last uuid creation (in msecs)
+ var dt = (msecs - _lastMSecs) + (nsecs - _lastNSecs)/10000;
+
+ // Per 4.2.1.2, Bump clockseq on clock regression
+ if (dt < 0 && options.clockseq === undefined) {
+ clockseq = clockseq + 1 & 0x3fff;
+ }
+
+ // Reset nsecs if clock regresses (new clockseq) or we've moved onto a new
+ // time interval
+ if ((dt < 0 || msecs > _lastMSecs) && options.nsecs === undefined) {
+ nsecs = 0;
+ }
+
+ // Per 4.2.1.2 Throw error if too many uuids are requested
+ if (nsecs >= 10000) {
+ throw new Error('uuid.v1(): Can\'t create more than 10M uuids/sec');
+ }
+
+ _lastMSecs = msecs;
+ _lastNSecs = nsecs;
+ _clockseq = clockseq;
+
+ // Per 4.1.4 - Convert from unix epoch to Gregorian epoch
+ msecs += 12219292800000;
+
+ // `time_low`
+ var tl = ((msecs & 0xfffffff) * 10000 + nsecs) % 0x100000000;
+ b[i++] = tl >>> 24 & 0xff;
+ b[i++] = tl >>> 16 & 0xff;
+ b[i++] = tl >>> 8 & 0xff;
+ b[i++] = tl & 0xff;
+
+ // `time_mid`
+ var tmh = (msecs / 0x100000000 * 10000) & 0xfffffff;
+ b[i++] = tmh >>> 8 & 0xff;
+ b[i++] = tmh & 0xff;
+
+ // `time_high_and_version`
+ b[i++] = tmh >>> 24 & 0xf | 0x10; // include version
+ b[i++] = tmh >>> 16 & 0xff;
+
+ // `clock_seq_hi_and_reserved` (Per 4.2.2 - include variant)
+ b[i++] = clockseq >>> 8 | 0x80;
+
+ // `clock_seq_low`
+ b[i++] = clockseq & 0xff;
+
+ // `node`
+ for (var n = 0; n < 6; ++n) {
+ b[i + n] = node[n];
+ }
+
+ return buf ? buf : bytesToUuid(b);
+}
+
+module.exports = v1;
+
+
+/***/ }),
+
/***/ "./node_modules/value-equal/index.js":
/*!*******************************************!*\
!*** ./node_modules/value-equal/index.js ***!