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!
瀏覽代碼

Added ability to move objects.

pull/1/head
父節點
當前提交
a1c966a332
共有 2 個檔案被更改,包括 61 行新增8 行删除
  1. +13
    -0
      frontend/src/js/misc/wb-move-object.js
  2. +48
    -8
      frontend/src/js/page/wb-browse.js

+ 13
- 0
frontend/src/js/misc/wb-move-object.js 查看文件

@@ -0,0 +1,13 @@
import makeArvadosRequest from 'make-arvados-request';
import arvadosTypeName from 'arvados-type-name';
function wbMoveObject(arvHost, arvToken, uuid, newOwnerUuid) {
const typeName = arvadosTypeName(uuid);
return makeArvadosRequest(arvHost, arvToken,
'/arvados/v1/' + typeName + 's/' +
uuid, { 'method': 'PUT', 'data': JSON.stringify({
'owner_uuid': newOwnerUuid
}) });
}
export default wbMoveObject;

+ 48
- 8
frontend/src/js/page/wb-browse.js 查看文件

@@ -11,6 +11,28 @@ import WBWorkflowListing from 'wb-workflow-listing';
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';
class WBBrowseProjectTabs extends Component {
render({ ownerUuid, selected, newProjectDialogRef, projectListingRef,
moveHere, copyHere }) {
return (
<WBTabs tabs={ [
{ 'name': 'Projects', 'isActive': true },
ownerUuid ? { 'name': ( <span><i class="fas fa-plus-square text-success"></i> New Project</span> ),
'onClick': () => newProjectDialogRef.current.show(ownerUuid,
() => projectListingRef.current.fetchItems() ) } : null,
( 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 ) ?
{ 'name': ( <span><i class="fas fa-file-import text-warning"></i> Copy Here</span> ),
'onClick': copyHere } : null
] } />
);
}
}
class WBBrowse extends Component {
constructor(...args) {
@@ -19,6 +41,7 @@ class WBBrowse extends Component {
this.deleteDialogRef = createRef();
this.newProjectDialogRef = createRef();
this.projectListingRef = createRef();
this.projectTabsRef = createRef();
this.state.selected = {};
}
@@ -73,17 +96,36 @@ class WBBrowse extends Component {
<div>
<input type="checkbox" checked={ (uuid in selected) }
onChange={ e => {
if (e.target.value === 'on')
if (e.target.checked)
selected[uuid] = true;
else
delete selected[uuid];
this.projectTabsRef.current.setState({});
} } /> { '\u00A0' }
</div>
);
}
moveHere() {
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(() => ( delete selected[uuids[i]] ));
prom = prom.catch(() => {});
}
prom = prom.then(() => this.setState({}));
}
copyHere() {
}
render({ mode, ownerUuid, activePage, app,
objTypeTab, collectionPage, processPage, workflowPage }) {
objTypeTab, collectionPage, processPage, workflowPage }, { selected }) {
return (
<div>
@@ -99,12 +141,10 @@ class WBBrowse extends Component {
<WBArvadosCrumbs mode={ mode } uuid={ ownerUuid } app={ app } />
<WBTabs tabs={ [
{ 'name': 'Projects', 'isActive': true },
ownerUuid ? { 'name': ( <span><i class="fas fa-plus-square text-success"></i> New Project</span> ),
'onClick': () => this.newProjectDialogRef.current.show(ownerUuid,
() => this.projectListingRef.current.fetchItems() ) } : null
] } />
<WBBrowseProjectTabs ref={ this.projectTabsRef } ownerUuid={ ownerUuid }
selected={ selected } newProjectDialogRef={ this.newProjectDialogRef }
projectListingRef={ this.projectListingRef } moveHere={ () => this.moveHere() }
copyHere={ () => this.copyHere() } />
<WBProjectListing ref={ this.projectListingRef }
app={ app }


Loading…
取消
儲存