|
|
@@ -0,0 +1,71 @@ |
|
|
|
import { h, Component, createRef } from 'preact';
|
|
|
|
import WBNavbarCommon from 'wb-navbar-common';
|
|
|
|
import WBArvadosCrumbs from 'wb-arvados-crumbs';
|
|
|
|
import WBNameAndUuid from 'wb-name-and-uuid';
|
|
|
|
import WBSelect from 'wb-select';
|
|
|
|
import WBTable from 'wb-table';
|
|
|
|
import WBBrowseDialog from 'wb-browse-dialog';
|
|
|
|
import makeArvadosRequest from 'make-arvados-request';
|
|
|
|
|
|
|
|
class WBSharingPage extends Component {
|
|
|
|
constructor(...args) {
|
|
|
|
super(...args);
|
|
|
|
this.state.rows = [];
|
|
|
|
this.browseDialogRef = createRef();
|
|
|
|
}
|
|
|
|
|
|
|
|
componentDidMount() {
|
|
|
|
this.fetchData();
|
|
|
|
}
|
|
|
|
|
|
|
|
fetchData() {
|
|
|
|
const { app, uuid } = this.props;
|
|
|
|
const { arvHost, arvToken } = app.state;
|
|
|
|
let prom = makeArvadosRequest(arvHost, arvToken,
|
|
|
|
'/arvados/v1/permissions/' + encodeURIComponent(uuid));
|
|
|
|
prom = prom.then(xhr => this.setState({
|
|
|
|
'rows': this.prepareRows(xhr.response.items)
|
|
|
|
}));
|
|
|
|
}
|
|
|
|
|
|
|
|
deletePermission(uuid) {
|
|
|
|
throw Error('Not implemented');
|
|
|
|
}
|
|
|
|
|
|
|
|
prepareRows(items) {
|
|
|
|
const { app } = this.props;
|
|
|
|
return items.map(it => [
|
|
|
|
( <WBNameAndUuid app={ app } uuid={ it.tail_uuid } /> ),
|
|
|
|
( <WBSelect value={ it.name } options={ ['can_read', 'can_write', 'can_manage'] } /> ),
|
|
|
|
( <button class="btn btn-outline-danger m-1" title="Delete"
|
|
|
|
onclick={ () => this.deletePermission(it.uuid) }>
|
|
|
|
<i class="fas fa-trash"></i>
|
|
|
|
</button> )
|
|
|
|
]);
|
|
|
|
}
|
|
|
|
|
|
|
|
render({ app, uuid }, { rows }) {
|
|
|
|
return (
|
|
|
|
<div>
|
|
|
|
<WBNavbarCommon app={ app } />
|
|
|
|
|
|
|
|
<WBArvadosCrumbs app={ app } uuid={ uuid } />
|
|
|
|
|
|
|
|
<div class="my-2">
|
|
|
|
This is the sharing management page for { uuid }
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<WBTable columns={ [ 'Name', 'Permission', '' ] }
|
|
|
|
headerClasses={ [ null, null, 'w-1' ] }
|
|
|
|
rows={ rows } />
|
|
|
|
|
|
|
|
<WBBrowseDialog app={ app } ref={ this.browseDialogRef } />
|
|
|
|
|
|
|
|
<button class="btn btn-primary"
|
|
|
|
onclick={ () => this.browseDialogRef.current.show() }>Add</button>
|
|
|
|
</div>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
export default WBSharingPage;
|