|
@@ -1,4 +1,5 @@ |
|
|
import { h, Component } from 'preact';
|
|
|
import { h, Component } from 'preact';
|
|
|
|
|
|
import { route } from 'preact-router';
|
|
|
import makeArvadosRequest from 'make-arvados-request';
|
|
|
import makeArvadosRequest from 'make-arvados-request';
|
|
|
import WBTable from 'wb-table';
|
|
|
import WBTable from 'wb-table';
|
|
|
import WBPagination from 'wb-pagination';
|
|
|
import WBPagination from 'wb-pagination';
|
|
@@ -9,17 +10,19 @@ class WBProjectListing extends Component { |
|
|
super(...args);
|
|
|
super(...args);
|
|
|
this.state.rows = [];
|
|
|
this.state.rows = [];
|
|
|
this.state.numPages = 0;
|
|
|
this.state.numPages = 0;
|
|
|
this.state.activePage = 0;
|
|
|
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
componentDidMount() {
|
|
|
componentDidMount() {
|
|
|
this.setActivePage(0);
|
|
|
|
|
|
|
|
|
this.fetchItems();
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
prepareRows(items) {
|
|
|
prepareRows(items) {
|
|
|
return items.map(item => [
|
|
|
return items.map(item => [
|
|
|
(<div>
|
|
|
(<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['uuid'] }</div>
|
|
|
</div>),
|
|
|
</div>),
|
|
|
item['description'],
|
|
|
item['description'],
|
|
@@ -27,8 +30,8 @@ class WBProjectListing extends Component { |
|
|
]);
|
|
|
]);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
setActivePage(i) {
|
|
|
|
|
|
this.state.activePage = i;
|
|
|
|
|
|
|
|
|
fetchItems() {
|
|
|
|
|
|
let i = this.props.activePage;
|
|
|
let filters = [
|
|
|
let filters = [
|
|
|
[ 'group_class', '=', 'project' ]
|
|
|
[ '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 (
|
|
|
return (
|
|
|
<div>
|
|
|
<div>
|
|
|
<WBTable columns={ [ 'Name', 'Description', 'Owner' ] }
|
|
|
<WBTable columns={ [ 'Name', 'Description', 'Owner' ] }
|
|
|
rows={ rows } />
|
|
|
rows={ rows } />
|
|
|
<WBPagination numPages={ numPages }
|
|
|
<WBPagination numPages={ numPages }
|
|
|
activePage={ activePage }
|
|
|
activePage={ activePage }
|
|
|
onPageChanged={ i => this.setActivePage(i) } />
|
|
|
|
|
|
|
|
|
onPageChanged={ i => onPageChanged(i) } />
|
|
|
</div>
|
|
|
</div>
|
|
|
);
|
|
|
);
|
|
|
}
|
|
|
}
|
|
|