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