X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=manifoldapi%2Fstatic%2Fjs%2Fmanifold.js;h=517ab6934447db9d7c9cd47f7e76f71783e75be9;hb=c5a0d103009ca686fd83ca215dab439da87e52b5;hp=b25647b72f815cb961b92482d674a480b5430676;hpb=b229e18758028cd4381b5fc44e393d029c672b8b;p=unfold.git diff --git a/manifoldapi/static/js/manifold.js b/manifoldapi/static/js/manifold.js index b25647b7..517ab693 100644 --- a/manifoldapi/static/js/manifold.js +++ b/manifoldapi/static/js/manifold.js @@ -737,6 +737,12 @@ var manifold = { } else { console.log('Unknown field'); } + // FIX if the record contains a string instead of a key:value + // example: select resource, slice_hrn from slice where slice_hrn=='xxx' + // Result will be {slice_hrn:'xxx', resource:'urn+zzz'} + // We don't have this resource:{urn:'urn+zzz'} + } else if(typeof(record) === 'string'){ + return record; } else { return record[fields]; } @@ -974,18 +980,44 @@ var manifold = { var query_ext = manifold.query_store.find_query_ext(query.query_uuid); query_ext.query_state = QUERY_STATE_INPROGRESS; - var query_json = JSON.stringify(query); + /* + If the Query object concerns SFA AM objects, iterate on each AM platform + Loop per platform, allows a progressive loading per AM platform + Update is run on all platforms at the same time to get a final answer, we don't manage partial answers yet... + */ + // Removed slice from the per platform query - it's quick enough... + if((query.object == 'resource' || query.object == 'lease') && query.action != "update"){ + var obj = query.object; + $.post("/rest/platform/", function( data ) { + $.each(data, function(index, p) { + query.object = p.platform+":"+obj; + var query_json = JSON.stringify(query); + + // Inform plugins about the progress + query.iter_subqueries(function (sq) { + var sq_query_ext = manifold.query_store.find_analyzed_query_ext(sq.query_uuid); + sq_query_ext.query_state = QUERY_STATE_INPROGRESS; + manifold.raise_record_event(sq.query_uuid, IN_PROGRESS); + }); - // Inform plugins about the progress - query.iter_subqueries(function (sq) { - var sq_query_ext = manifold.query_store.find_analyzed_query_ext(sq.query_uuid); - sq_query_ext.query_state = QUERY_STATE_INPROGRESS; + $.post(manifold.proxy_url, {'json': query_json} , manifold.success_closure(query, null, callback)); - manifold.raise_record_event(sq.query_uuid, IN_PROGRESS); - }); + }); + }); + }else{ + var query_json = JSON.stringify(query); - $.post(manifold.proxy_url, {'json': query_json} , manifold.success_closure(query, null, callback)); + // Inform plugins about the progress + query.iter_subqueries(function (sq) { + var sq_query_ext = manifold.query_store.find_analyzed_query_ext(sq.query_uuid); + sq_query_ext.query_state = QUERY_STATE_INPROGRESS; + manifold.raise_record_event(sq.query_uuid, IN_PROGRESS); + }); + + $.post(manifold.proxy_url, {'json': query_json} , manifold.success_closure(query, null, callback)); + + } }, // XXX DEPRECATED