IF YOU WOULD LIKE TO GET AN ACCOUNT, please write an email to s dot adaszewski at gmail dot com. User accounts are meant only to report issues and/or generate pull requests. This is a purpose-specific Git hosting for ADARED projects. Thank you for your understanding!
Kaynağa Gözat

Added ability to copy collections.

master
Stanislaw Adaszewski 4 yıl önce
ebeveyn
işleme
7ff593a834
2 değiştirilmiş dosya ile 36 ekleme ve 4 silme
  1. +25
    -0
      frontend/src/js/misc/wb-copy-collection.js
  2. +11
    -4
      frontend/src/js/page/wb-browse.js

+ 25
- 0
frontend/src/js/misc/wb-copy-collection.js Dosyayı Görüntüle

@@ -0,0 +1,25 @@
import makeArvadosRequest from 'make-arvados-request';
import arvadosTypeName from 'arvados-type-name';
function wbCopyCollection(arvHost, arvToken, uuid, newOwnerUuid) {
const typeName = arvadosTypeName(uuid);
if (typeName !== 'collection')
throw Error('Specified UUID does not refer to a collection');
let prom = makeArvadosRequest(arvHost, arvToken,
'/arvados/v1/collections/' + uuid);
prom = prom.then(xhr => {
const { name, description, properties, portable_data_hash,
manifest_text } = xhr.response;
const dup = { name: name + ' (Copied at ' + new Date().toISOString() + ')',
description, properties, portable_data_hash, manifest_text,
owner_uuid: newOwnerUuid };
return makeArvadosRequest(arvHost, arvToken,
'/arvados/v1/collections', {
'method': 'POST',
'data': JSON.stringify(dup)
});
});
return prom;
}
export default wbCopyCollection;

+ 11
- 4
frontend/src/js/page/wb-browse.js Dosyayı Görüntüle

@@ -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,


Yükleniyor…
İptal
Kaydet