X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=manifold%2Fstatic%2Fjs%2Fmanifold.js;h=c6e9d41cb59e2b5736e0f90d03aa0b01cbca40d8;hb=11aa60f2a8a51cc4c875e02ac1429e8dbdc34ec6;hp=f035e1c2d541bde74e675b6ad2f176543d0058d4;hpb=b8285e0fe053a91e94dd6641e5daa3c6dd52c43e;p=unfold.git diff --git a/manifold/static/js/manifold.js b/manifold/static/js/manifold.js index f035e1c2..c6e9d41c 100644 --- a/manifold/static/js/manifold.js +++ b/manifold/static/js/manifold.js @@ -347,17 +347,19 @@ var manifold = { // Executes all async. queries // input queries are specified as a list of {'query_uuid': , 'id': } asynchroneous_exec : function (query_publish_dom_tuples) { - // start spinners - - // in case the spin stuff was not loaded, let's make sure we proceed to the exit - //try { - // if (manifold.asynchroneous_debug) - // messages.debug("Turning on spin with " + jQuery(".need-spin").length + " matches for .need-spin"); - // jQuery('.need-spin').spin(manifold.spin_presets); - //} catch (err) { messages.debug("Cannot turn on spins " + err); } +// start spinners - be robust if the spin stuff was not loaded for any reason +// turned off because each plugin is responsible for doing that through on_query_in_progress +// try { +// var subjects=$(".need-spin"); +// if (manifold.asynchroneous_debug) { +// messages.debug("Turning on spin with " + subjects.length + " matches for .need-spin"); +// $.map (subjects, function (subject) { messages.debug("need-spin: "+ subject.id);}); +// } +// subjects.spin(manifold.spin_presets); +// } catch (err) { messages.debug("Cannot turn on spins " + err); } // Loop through input array, and use publish_uuid to publish back results - jQuery.each(query_publish_dom_tuples, function(index, tuple) { + $.each(query_publish_dom_tuples, function(index, tuple) { var query=manifold.find_query(tuple.query_uuid); var query_json=JSON.stringify (query); var publish_uuid=tuple.publish_uuid; @@ -373,8 +375,8 @@ var manifold = { // not quite sure what happens if we send a string directly, as POST data is named.. // this gets reconstructed on the proxy side with ManifoldQuery.fill_from_POST - jQuery.post(manifold.proxy_url, {'json':query_json}, - manifold.success_closure(query, publish_uuid, tuple.callback /*domid*/)); + $.post(manifold.proxy_url, {'json':query_json}, + manifold.success_closure(query, publish_uuid, tuple.callback /*domid*/)); }) }, @@ -431,7 +433,7 @@ var manifold = { /* Publish an update announce */ var channel="/results/" + query.query_uuid + "/changed"; if (manifold.publish_result_debug) messages.debug(".. publish_result OLD API (3) " + channel); - jQuery.publish(channel, [result, query]); + $.publish(channel, [result, query]); if (manifold.publish_result_debug) messages.debug(".. publish_result - END (4) q=" + query.__repr()); }, @@ -451,7 +453,7 @@ var manifold = { if (manifold.publish_result_debug) messages.debug (">>>>> publish_result_rec " + query.object); if (manifold.query_expects_unique_result(query)) { /* Also publish subqueries */ - jQuery.each(query.subqueries, function(object, subquery) { + $.each(query.subqueries, function(object, subquery) { manifold.publish_result_rec(subquery, result[0][object]); /* TODO remove object from result */ }); @@ -730,6 +732,7 @@ var manifold = { if (publish_uuid) $.publish("/results/" + publish_uuid + "/failed", [data.code, data.description] ); +/* DEMO - Debug Messages desactivated $("#notifications").notify("create", "sticky", { title: 'Warning', text: data.description @@ -737,6 +740,7 @@ var manifold = { expires: false, speed: 1000 }); +*/ } if (manifold.asynchroneous_debug) messages.debug ("========== asynchroneous_success " + query.object + " -- before process_query_records"); @@ -765,7 +769,15 @@ var manifold = { raise_event_handler: function(type, query_uuid, event_type, value) { if ((type != 'query') && (type != 'record')) throw 'Incorrect type for manifold.raise_event()'; + // xxx we observe quite a lot of incoming calls with an undefined query_uuid + // this should be fixed upstream + if (query_uuid === undefined) { + messages.warning("undefined query in raise_event_handler"); + return; + } + // notify the change to objects that either listen to this channel specifically, + // or to the wildcard channel var channels = [ manifold.get_channel(type, query_uuid), manifold.get_channel(type, '*') ]; $.each(channels, function(i, channel) {