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.

master
Stanislaw Adaszewski 4 роки тому
джерело
коміт
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 }


Завантаження…
Відмінити
Зберегти