Skip to content

Commit

Permalink
feature(cloudcmd) add ability to show progress on move (#157)
Browse files Browse the repository at this point in the history
  • Loading branch information
coderaiser committed May 8, 2018
1 parent c793082 commit 83bcd07
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 46 deletions.
5 changes: 5 additions & 0 deletions client/modules/operation/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,11 @@ function OperationProto(operation, data) {
.then(setListeners(callback));
};

moveFn = (data, callback) => {
operator.move(data.from, data.to, data.names)
.then(setListeners(callback));
};

extractFn = (data, callback) => {
operator.extract(data.from, data.to)
.then(setListeners({noContinue: true}, callback));
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,8 @@
},
"subdomain": "cloudcmd",
"dependencies": {
"@cloudcmd/fileop": "^1.0.1",
"@cloudcmd/fileop": "^1.1.0",
"@cloudcmd/move-files": "^1.0.0",
"@cloudcmd/read-files-sync": "^1.0.0",
"apart": "^1.0.1",
"chalk": "^2.0.1",
Expand Down
6 changes: 4 additions & 2 deletions server/rest/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ const json = require('jonny/legacy');
const ponse = require('ponse');

const copymitter = require('copymitter');
const moveFiles = require('./move-files');
const moveFiles = require('@cloudcmd/move-files');

const swap = wraptile((fn, a, b) => fn(b, a));
const isWin32 = process.platform === 'win32';
Expand Down Expand Up @@ -182,7 +182,9 @@ function onPUT(name, body, callback) {
const to = root(files.to);
const names = files.names;

moveFiles({from, to, names}, fn);
moveFiles(from, to, names)
.on('error', fn)
.on('end', fn);
break;
} case 'cp':
if (!files.from || !files.names || !files.to)
Expand Down
43 changes: 0 additions & 43 deletions server/rest/move-files.js

This file was deleted.

0 comments on commit 83bcd07

Please sign in to comment.