|
|
@@ -12,6 +12,8 @@ import WBRenameDialog from 'wb-rename-dialog'; |
|
|
|
import WBDeleteDialog from 'wb-delete-dialog';
|
|
|
|
import WBNewProjectDialog from 'wb-new-project-dialog';
|
|
|
|
import wbMoveObject from 'wb-move-object';
|
|
|
|
import wbCopyCollection from 'wb-copy-collection';
|
|
|
|
import arvadosTypeName from 'arvados-type-name';
|
|
|
|
|
|
|
|
class WBBrowseProjectTabs extends Component {
|
|
|
|
render({ ownerUuid, selected, newProjectDialogRef, projectListingRef,
|
|
|
@@ -26,7 +28,8 @@ class WBBrowseProjectTabs extends Component { |
|
|
|
( ownerUuid && Object.keys(selected).length > 0 ) ?
|
|
|
|
{ 'name': ( <span><i class="fas fa-compress-arrows-alt text-warning"></i> Move Here</span> ),
|
|
|
|
'onClick': moveHere } : null,
|
|
|
|
( ownerUuid && Object.keys(selected).length > 0 ) ?
|
|
|
|
( ownerUuid && (uuids => uuids.length > 0 && uuids.length ===
|
|
|
|
uuids.map(arvadosTypeName).filter(a => (a === 'collection')).length )(Object.keys(selected)) ) ?
|
|
|
|
{ 'name': ( <span><i class="fas fa-file-import text-warning"></i> Copy Here</span> ),
|
|
|
|
'onClick': copyHere } : null
|
|
|
|
] } />
|
|
|
@@ -106,22 +109,26 @@ class WBBrowse extends Component { |
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
moveHere() {
|
|
|
|
moveOrCopyOp(op) {
|
|
|
|
const { ownerUuid, app } = this.props;
|
|
|
|
const { selected } = this.state;
|
|
|
|
const { arvHost, arvToken } = app.state;
|
|
|
|
let prom = new Promise(accept => accept());
|
|
|
|
const uuids = Object.keys(selected);
|
|
|
|
for (let i = 0; i < uuids.length; i++) {
|
|
|
|
prom = prom.then(() => wbMoveObject(arvHost, arvToken, uuids[i], ownerUuid));
|
|
|
|
prom = prom.then(() => op(arvHost, arvToken, uuids[i], ownerUuid));
|
|
|
|
prom = prom.then(() => ( delete selected[uuids[i]] ));
|
|
|
|
prom = prom.catch(() => {});
|
|
|
|
}
|
|
|
|
prom = prom.then(() => this.setState({}));
|
|
|
|
}
|
|
|
|
|
|
|
|
copyHere() {
|
|
|
|
moveHere() {
|
|
|
|
this.moveOrCopyOp(wbMoveObject);
|
|
|
|
}
|
|
|
|
|
|
|
|
copyHere() {
|
|
|
|
this.moveOrCopyOp(wbCopyCollection);
|
|
|
|
}
|
|
|
|
|
|
|
|
render({ mode, ownerUuid, activePage, app,
|
|
|
|