diff --git a/frontend/src/js/dialog/wb-browse-dialog-collection-list.js b/frontend/src/js/dialog/wb-browse-dialog-collection-list.js
index 3f83c5b..41d26e5 100644
--- a/frontend/src/js/dialog/wb-browse-dialog-collection-list.js
+++ b/frontend/src/js/dialog/wb-browse-dialog-collection-list.js
@@ -1,11 +1,72 @@
import { h, Component } from 'preact';
+import WBTable from 'wb-table';
+import WBPagination from 'wb-pagination';
+import makeArvadosRequest from 'make-arvados-request';
class WBBrowseDialogCollectionList extends Component {
- render() {
+ constructor(...args) {
+ super(...args);
+ this.state.rows = [];
+ }
+
+ componentDidMount() {
+ this.fetchRows();
+ }
+
+ componentWillReceiveProps(nextProps) {
+ this.props = nextProps;
+ this.fetchRows();
+ }
+
+ prepareRows(items) {
+ const { navigate, selectWhat, makeSelectionCell } = this.props;
+ return items.map(it => (selectWhat === 'directory' ? [
+ makeSelectionCell(it.uuid)
+ ] : []).concat([
+ (
+ { e.preventDefault();
+ navigate('/browse-dialog/content/' + it.uuid); } }>{ it.name }
+ ),
+ it.uuid
+ ]));
+ }
+
+ fetchRows() {
+ const { arvHost, arvToken } = this.props.app.state;
+ const { ownerUuid, textSearch, page, itemsPerPage } = this.props;
+ const filters = [];
+ if (ownerUuid)
+ filters.push(['owner_uuid', '=', ownerUuid]);
+ if (textSearch)
+ filters.push(['name', 'ilike', '%' + textSearch + '%']);
+ let prom = makeArvadosRequest(arvHost, arvToken,
+ '/arvados/v1/collections?filters=' +
+ encodeURIComponent(JSON.stringify(filters)) +
+ '&limit=' + itemsPerPage +
+ '&offset=' + (itemsPerPage * page));
+ prom = prom.then(xhr => this.setState({
+ 'rows': this.prepareRows(xhr.response.items),
+ 'numPages': Math.ceil(xhr.response.items_available / itemsPerPage)
+ }));
+ return prom;
+ }
+
+ render({ selectWhat, page, navigate }, { rows, numPages }) {
return (
-
WBBrowseDialogCollectionList
+
+
+
+ navigate({ 'bottomPage': i }) } />
+
);
}
}
+WBBrowseDialogCollectionList.defaultProps = {
+ 'itemsPerPage': 20
+};
+
export default WBBrowseDialogCollectionList;
diff --git a/frontend/src/js/dialog/wb-browse-dialog-project-list.js b/frontend/src/js/dialog/wb-browse-dialog-project-list.js
index 7ee65e9..fe0294a 100644
--- a/frontend/src/js/dialog/wb-browse-dialog-project-list.js
+++ b/frontend/src/js/dialog/wb-browse-dialog-project-list.js
@@ -20,8 +20,8 @@ class WBBrowseDialogProjectList extends Component {
}
prepareRows(items) {
- const { navigate } = this.props;
- return items.map(it => [
+ const { navigate, selectWhat, makeSelectionCell } = this.props;
+ return items.map(it => (selectWhat === 'owner' ? [ makeSelectionCell(it.uuid, 'project') ] : []).concat([
(
{
e.preventDefault();
@@ -29,7 +29,7 @@ class WBBrowseDialogProjectList extends Component {
} }>{ it.name }
),
it.uuid
- ]);
+ ]));
}
fetchSharedWithMe() {
@@ -83,10 +83,11 @@ class WBBrowseDialogProjectList extends Component {
return prom;
}
- render({ app, navigate, page }, { numPages, rows }) {
+ render({ app, navigate, page, selectWhat }, { numPages, rows }) {
return (
-
this.setState({
diff --git a/frontend/src/js/dialog/wb-browse-dialog.js b/frontend/src/js/dialog/wb-browse-dialog.js
index c557dcb..feddf26 100644
--- a/frontend/src/js/dialog/wb-browse-dialog.js
+++ b/frontend/src/js/dialog/wb-browse-dialog.js
@@ -105,6 +105,31 @@ class WBBrowseDialog extends Component {
});
}
+ makeSelectionCell(uuid) {
+ const { selectMany, id, accept } = this.props;
+ const { selected } = this.state;
+
+ return selectMany ? (
+
+ {
+ if (e.target.value === 'on')
+ this.select(uuid);
+ else
+ this.deselect(uuid);
+ } } /> { '\u00A0' }
+
+ ) : (
+
+ );
+ }
+
render({ app, id, selectMany, selectWhat }, { history, currentUrl, mode, uuid, topPage, bottomPage, textSearch }) {
return (
@@ -141,7 +166,7 @@ class WBBrowseDialog extends Component {
this.setState({
+ onChange={ e => this.navigate({
'textSearch': e.target.value,
'topPage': 0,
'bottomPage': 0}) } />
@@ -157,7 +182,9 @@ class WBBrowseDialog extends Component {
this.navigate(url) }
mode={ mode } ownerUuid={ uuid }
- page={ topPage } textSearch={ textSearch } />
+ page={ topPage } textSearch={ textSearch }
+ selectWhat={ selectWhat }
+ makeSelectionCell={ uuid => this.makeSelectionCell(uuid) } />
) : null }
@@ -174,11 +201,14 @@ class WBBrowseDialog extends Component {
selectMany={ selectMany } selectWhat={ selectWhat }/>
- ) : (mode === 'browse' || mode === 'shared-with-me') ? (
+ ) : (selectWhat !== 'owner' && mode === 'browse') ? (
Collections
-
+ this.navigate(url) }
+ ownerUuid={ uuid } selectWhat={ selectWhat }
+ makeSelectionCell={ uuid => this.makeSelectionCell(uuid) } />
) : null }
@@ -194,4 +224,8 @@ class WBBrowseDialog extends Component {
}
}
+WBBrowseDialog.defaultProps = {
+ 'accept': () => {}
+};
+
export default WBBrowseDialog;
diff --git a/frontend/src/js/page/wb-launch-workflow-page.js b/frontend/src/js/page/wb-launch-workflow-page.js
index e71fcc4..a7802ea 100644
--- a/frontend/src/js/page/wb-launch-workflow-page.js
+++ b/frontend/src/js/page/wb-launch-workflow-page.js
@@ -110,7 +110,8 @@ class WBLaunchWorkflowPage extends Component {
items={ app.state.toolboxItems } selectMany={ true }
onAccepted={ values => alert(values) } />
-
+
{ workflow ?
(