From: Loic Baron Date: Fri, 2 Jan 2015 13:18:54 +0000 (+0100) Subject: Progressive loading per platform for SFA AM Queries (slice, resource, lease) X-Git-Tag: myslice-1.2~2 X-Git-Url: http://git.onelab.eu/?p=myslice.git;a=commitdiff_plain;h=d872f626aac4a56a193845cd40e3527e3f975bc3 Progressive loading per platform for SFA AM Queries (slice, resource, lease) --- diff --git a/manifoldapi/static/js/manifold.js b/manifoldapi/static/js/manifold.js index b25647b7..49098f91 100644 --- a/manifoldapi/static/js/manifold.js +++ b/manifoldapi/static/js/manifold.js @@ -974,18 +974,42 @@ 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 + This allows a progressive loading per AM platform + */ + if(query.object == 'resource' || query.object == 'lease' || query.object == 'slice'){ + 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 diff --git a/portal/static/js/institution.js b/portal/static/js/institution.js index 173021f9..2b2cfa3d 100644 --- a/portal/static/js/institution.js +++ b/portal/static/js/institution.js @@ -57,7 +57,6 @@ $(document).ready(function() { /* In Javascript getMonth() gives month[0] = january, month[1] = february, and so on... */ var month = now.getMonth()+2; var one_month_later = now.getFullYear()+"-"+month+"-"+now.getDate()+" "+now.getHours()+":"+now.getMinutes()+":"+now.getSeconds(); - console.log(one_month_later); $('input:checkbox.slice').each(function (index) { if(this.checked){ var record_id = this.id; diff --git a/portal/static/js/myslice.js b/portal/static/js/myslice.js index 34a35166..1ccc1c1a 100644 --- a/portal/static/js/myslice.js +++ b/portal/static/js/myslice.js @@ -124,20 +124,28 @@ var myslice = { // myslice.user is in LocalStorage if(typeof(slices) != "undefined"){ /* + This allows progressive loading per AM platform Launch queries to get the resources and leases in Manifold Cache + XXX platform:object + TODO support cache for prefixed objects + XXX Disabled until it's supported on Manifold side */ - $.post("/rest/resource/", function( data ) { - }); - $.post("/rest/lease/", function( data ) { - }); + /* + $.post("/rest/platform/", function( data ) { + $.each(data, function(index, p) { + $.post("/rest/"+p.platform+":resource/", function( data ) { + }); + $.post("/rest/"+p.platform+":lease/", function( data ) { + }); + $.each( slices, function(i, val) { + // Launch a Query for each slice to get it in Manifold Cache + $.post("/rest/"+p.platform+":slice/", { 'filters': { 'slice_hrn' : val } }, function(data) { + }); + }); - $.each( slices, function(i, val) { - /* - Launch a Query for each slice to get resources and leases in Manifold Cache - */ - $.post("/rest/slice/", { 'filters': { 'slice_hrn' : val } }, function(data) { }); }); + */ } }, diff --git a/portal/templates/onelab/onelab_home-view.html b/portal/templates/onelab/onelab_home-view.html index 08670c87..4e8b22c8 100644 --- a/portal/templates/onelab/onelab_home-view.html +++ b/portal/templates/onelab/onelab_home-view.html @@ -240,7 +240,7 @@ }); -{# widget "_widget-monitor.html" #} +{% widget "_widget-monitor.html" %} {# widget "_widget-stats-top-slices.html" #} {% endblock %} diff --git a/portal/templates/onelab/onelab_institution.html b/portal/templates/onelab/onelab_institution.html index bd361de2..4dcaf1b2 100644 --- a/portal/templates/onelab/onelab_institution.html +++ b/portal/templates/onelab/onelab_institution.html @@ -103,7 +103,6 @@ $(document).ready(function() { }else{ nodes_length=val.nodes.length; } - console.log(val); if(val.users=="undefined" || val.users==null){ users_length=0; }else{