|
|
@@ -1,4 +1,5 @@ |
|
|
|
import { h, Component } from 'preact';
|
|
|
|
import { route } from 'preact-router';
|
|
|
|
import makeArvadosRequest from 'make-arvados-request';
|
|
|
|
import WBTable from 'wb-table';
|
|
|
|
import WBPagination from 'wb-pagination';
|
|
|
@@ -9,17 +10,19 @@ class WBProjectListing extends Component { |
|
|
|
super(...args);
|
|
|
|
this.state.rows = [];
|
|
|
|
this.state.numPages = 0;
|
|
|
|
this.state.activePage = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
componentDidMount() {
|
|
|
|
this.setActivePage(0);
|
|
|
|
this.fetchItems();
|
|
|
|
}
|
|
|
|
|
|
|
|
prepareRows(items) {
|
|
|
|
return items.map(item => [
|
|
|
|
(<div>
|
|
|
|
<div>{ item['name'] }</div>
|
|
|
|
<div>
|
|
|
|
<a href="#"
|
|
|
|
onclick={ e => { e.preventDefault(); route('/browse/' + item['uuid']) }}>{ item['name'] }</a>
|
|
|
|
</div>
|
|
|
|
<div>{ item['uuid'] }</div>
|
|
|
|
</div>),
|
|
|
|
item['description'],
|
|
|
@@ -27,8 +30,8 @@ class WBProjectListing extends Component { |
|
|
|
]);
|
|
|
|
}
|
|
|
|
|
|
|
|
setActivePage(i) {
|
|
|
|
this.state.activePage = i;
|
|
|
|
fetchItems() {
|
|
|
|
let i = this.props.activePage;
|
|
|
|
let filters = [
|
|
|
|
[ 'group_class', '=', 'project' ]
|
|
|
|
];
|
|
|
@@ -45,14 +48,20 @@ class WBProjectListing extends Component { |
|
|
|
}));
|
|
|
|
}
|
|
|
|
|
|
|
|
render({ arvHost, arvToken, ownerUuid }, { rows, numPages, activePage }) {
|
|
|
|
componentWillReceiveProps(nextProps, nextState) {
|
|
|
|
// this.setState({ 'rows': [] }); // .rows = [];
|
|
|
|
this.props = nextProps;
|
|
|
|
this.fetchItems();
|
|
|
|
}
|
|
|
|
|
|
|
|
render({ arvHost, arvToken, ownerUuid, activePage, onPageChanged }, { rows, numPages }) {
|
|
|
|
return (
|
|
|
|
<div>
|
|
|
|
<WBTable columns={ [ 'Name', 'Description', 'Owner' ] }
|
|
|
|
rows={ rows } />
|
|
|
|
<WBPagination numPages={ numPages }
|
|
|
|
activePage={ activePage }
|
|
|
|
onPageChanged={ i => this.setActivePage(i) } />
|
|
|
|
onPageChanged={ i => onPageChanged(i) } />
|
|
|
|
</div>
|
|
|
|
);
|
|
|
|
}
|
|
|
|