IF YOU WOULD LIKE TO GET AN ACCOUNT, please write an email to s dot adaszewski at gmail dot com. User accounts are meant only to report issues and/or generate pull requests. This is a purpose-specific Git hosting for ADARED projects. Thank you for your understanding!
Browse Source

Clumsy attempt at fetchSharedWithMe().

pull/1/head
parent
commit
e425b631a9
2 changed files with 78 additions and 5 deletions
  1. +69
    -2
      frontend/src/js/dialog/wb-browse-dialog-project-list.js
  2. +9
    -3
      frontend/src/js/dialog/wb-browse-dialog.js

+ 69
- 2
frontend/src/js/dialog/wb-browse-dialog-project-list.js View File

@@ -33,7 +33,74 @@ class WBBrowseDialogProjectList extends Component {
}
fetchSharedWithMe() {
const { arvHost, arvToken, currentUser } = this.props.app.state;
/*const filters = [
[ '' ]
];*/
const filters = [
[ 'tail_uuid', '=', currentUser.uuid ],
[ 'link_class', '=', 'permission' ],
[ 'head_uuid', 'is_a', 'arvados#group']
];
let prom = makeArvadosRequest(arvHost, arvToken,
'/arvados/v1/links?filters=' +
encodeURIComponent(JSON.stringify(filters)));
const uuids = {};
prom = prom.then(xhr => {
let prom_1 = new Promise(accept => accept());
const { items_available, limit } = xhr.response;
for (let i = 0; i < items_available; i += limit) {
prom_1 = prom_1.then(() => makeArvadosRequest(arvHost, arvToken,
'/arvados/v1/links?filters=' +
encodeURIComponent(JSON.stringify(filters)) +
'&limit=' + limit +
'&offset=' + i));
prom_1 = prom_1.then(xhr =>
xhr.response.items.map(it => (uuids[it.head_uuid] = true)));
}
return prom_1;
});
prom = prom.then(() => {
const filters_1 = [
['uuid', 'in', Object.keys(uuids)],
['group_class', '=', 'project']
];
return makeArvadosRequest(arvHost, arvToken,
'/arvados/v1/groups?filters=' +
encodeURIComponent(JSON.stringify(filters_1)));
});
let res = [];
prom = prom.then(xhr => {
const filters_1 = [
['uuid', 'in', Object.keys(uuids)],
['group_class', '=', 'project']
];
let prom_1 = new Promise(accept => accept());
const { items_available, limit } = xhr.response;
for (let i = 0; i < items_available; i += limit) {
prom_1 = prom_1.then(() => makeArvadosRequest(arvHost, arvToken,
'/arvados/v1/groups?filters=' +
encodeURIComponent(JSON.stringify(filters_1)) +
'&limit=' + limit +
'&offset=' + i));
prom_1 = prom_1.then(xhr => (res = res.concat(xhr.response.items)));
}
return prom_1;
});
const { page, itemsPerPage } = this.props;
prom = prom.then(() => {
res.sort((a, b) => a.name.localeCompare(b.name));
return {
'response': {
'items': res.slice(page * itemsPerPage,
page * itemsPerPage + itemsPerPage),
'items_available': res.length
}
};
});
return prom;
// prom = prom.then(xhr => xhr.items.filter(it => (it.group_class === 'project')));
// prom = prom.then(items => )
}
fetchOwned() {
@@ -71,7 +138,7 @@ class WBBrowseDialogProjectList extends Component {
return prom;
}
render({ app, navigate }, { ownerUuid, textSearch, page, numPages, rows }) {
render({ app, navigate, page }, { numPages, rows }) {
return (
<div>
<WBTable columns={ ['Name', 'UUID'] }


+ 9
- 3
frontend/src/js/dialog/wb-browse-dialog.js View File

@@ -127,9 +127,15 @@ class WBBrowseDialog extends Component {
<a href="#" class="btn btn-outline-primary mr-2"
onclick={ e => { e.preventDefault();
this.navigate('/browse-dialog/browse/' + app.state.currentUser.uuid); } }>Home</a>
<a href="#" class="btn btn-outline-primary mr-2">All Projects</a>
<a href="#" class="btn btn-outline-primary mr-2">All Users</a>
<a href="#" class="btn btn-outline-primary mr-2">Shared with Me</a>
<a href="#" class="btn btn-outline-primary mr-2"
onclick={ e => { e.preventDefault();
this.navigate('/browse-dialog/browse'); } }>All Projects</a>
<a href="#" class="btn btn-outline-primary mr-2"
onclick={ e => { e.preventDefault();
this.navigate('/browse-dialog/users'); } }>All Users</a>
<a href="#" class="btn btn-outline-primary mr-2"
onclick={ e => { e.preventDefault();
this.navigate('/browse-dialog/shared-with-me'); } }>Shared with Me</a>
</div>
<div class="input-group mb-3">


Loading…
Cancel
Save