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!
Selaa lähdekoodia

Added portable data hash detection.

master
Stanislaw Adaszewski 4 vuotta sitten
vanhempi
commit
9f18e60358
2 muutettua tiedostoa jossa 45 lisäystä ja 0 poistoa
  1. +27
    -0
      frontend/src/js/misc/detect-hashes.js
  2. +18
    -0
      frontend/src/js/page/wb-process-view.js

+ 27
- 0
frontend/src/js/misc/detect-hashes.js Näytä tiedosto

@@ -0,0 +1,27 @@
function detectHashes(obj) {
let Q = [ obj ];
let matches = {};
while (Q.length > 0) {
let item = Q.pop();
if (!item)
continue;
if (typeof(item) === 'string') {
// use regexes
let rx = /[a-f0-9]{32}\+[0-9]+/g;
for (let m = rx.exec(item); m; m = rx.exec(item))
matches[m[0]] = true;
} else if (typeof(item) === 'object') {
Object.keys(item).map(k => Q.push(item[k]));
}
}
matches = Object.keys(matches);
return matches;
}
export default detectHashes;

+ 18
- 0
frontend/src/js/page/wb-process-view.js Näytä tiedosto

@@ -5,6 +5,7 @@ import makeArvadosRequest from 'make-arvados-request';
import detectUuids from 'detect-uuids';
import arvadosTypeName from 'arvados-type-name';
import urlForObject from 'url-for-object';
import detectHashes from 'detect-hashes';
class WBProcessView extends Component {
constructor(...args) {
@@ -29,7 +30,24 @@ class WBProcessView extends Component {
});
//prom = prom.then(xhr => (cont = xhr.response));
prom = prom.then(() => {
let hashes = detectHashes([ req, cont ]);
let filters = [
[ 'portable_data_hash', 'in', hashes ]
];
return makeArvadosRequest(arvHost, arvToken,
'/arvados/v1/collections?filters=' +
encodeURIComponent(JSON.stringify(filters)));
});
prom = prom.then(xhr => {
let colUuids = xhr.response['items'].map(item => item.uuid);
let uuids = detectUuids([ req, cont ]);
let dict = {};
colUuids.map(u => (dict[u] = true));
uuids.map(u => (dict[u] = true));
return Object.keys(dict);
});
prom = prom.then(uuids => {
// let uuids = detectUuids([ req, cont ]);
let objectTypes = uuids.map(u => arvadosTypeName(u.split('-')[1]) + 's');
let objQueries = {};
objectTypes.map(t => (objQueries[t] = []));


Loading…
Peruuta
Tallenna