/* If the query has not been analyzed, then we analyze it */
if (query.analyzed_query == null) {
query.analyze_subqueries();
/* If the query has not been analyzed, then we analyze it */
if (query.analyzed_query == null) {
query.analyze_subqueries();
// trigger a query asynchroneously
proxy_url : '/manifold/proxy/json/',
// trigger a query asynchroneously
proxy_url : '/manifold/proxy/json/',
/**
* \brief We use js function closure to be able to pass the query (array)
* to the callback function used when data is received
*/
/**
* \brief We use js function closure to be able to pass the query (array)
* to the callback function used when data is received
*/
return function(data, textStatus) {
manifold.asynchroneous_success(data, query, publish_uuid, callback /*domid*/);
}
},
return function(data, textStatus) {
manifold.asynchroneous_success(data, query, publish_uuid, callback /*domid*/);
}
},
// 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
// 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*/));
+ jQuery.post(manifold.proxy_url, {'json':query_json},
+ manifold.success_closure(query, publish_uuid, tuple.callback /*domid*/));
*/
forward: function(query, callback /*domid*/) {
var query_json = JSON.stringify(query);
*/
forward: function(query, callback /*domid*/) {
var query_json = JSON.stringify(query);
- $.post(manifold.proxy_url, {'json': query_json} , manifold.success_closure(query, query.query_uuid, callback/*domid*/));
+ $.post(manifold.proxy_url, {'json': query_json} ,
+ manifold.success_closure(query, query.query_uuid, callback/*domid*/));
$.each(result, function(i, record) {
manifold.raise_record_event(query.query_uuid, NEW_RECORD, record);
$.each(result, function(i, record) {
manifold.raise_record_event(query.query_uuid, NEW_RECORD, record);
manifold.raise_record_event(query.query_uuid, DONE);
// OLD PLUGIN API BELOW
/* Publish an update announce */
var channel="/results/" + query.query_uuid + "/changed";
manifold.raise_record_event(query.query_uuid, DONE);
// OLD PLUGIN API BELOW
/* Publish an update announce */
var channel="/results/" + query.query_uuid + "/changed";
* otherwise, publish the main object as well as subqueries
* XXX how much recursive are we ?
*/
* otherwise, publish the main object as well as subqueries
* XXX how much recursive are we ?
*/
if (manifold.query_expects_unique_result(query)) {
/* Also publish subqueries */
jQuery.each(query.subqueries, function(object, subquery) {
if (manifold.query_expects_unique_result(query)) {
/* Also publish subqueries */
jQuery.each(query.subqueries, function(object, subquery) {
this.setup_update_query(query, records);
/* Publish full results */
this.setup_update_query(query, records);
/* Publish full results */
* diff's. This means we need to move the publish functionalities in the
* previous 'process_get_query_records' function.
*/
* diff's. This means we need to move the publish functionalities in the
* previous 'process_get_query_records' function.
*/
// First issue: we request everything, and not only what we modify, so will will have to ignore some fields
var query_uuid = query.query_uuid;
var query_ext = manifold.query_store.find_analyzed_query_ext(query_uuid);
// First issue: we request everything, and not only what we modify, so will will have to ignore some fields
var query_uuid = query.query_uuid;
var query_ext = manifold.query_store.find_analyzed_query_ext(query_uuid);
if (query.action == 'get') {
this.process_get_query_records(query, records);
} else if (query.action == 'update') {
if (query.action == 'get') {
this.process_get_query_records(query, records);
} else if (query.action == 'update') {
// e.g. an updater wants to publish its result as if from the original (get) query
asynchroneous_success : function (data, query, publish_uuid, callback /*domid*/) {
// xxx should have a nicer declaration of that enum in sync with the python code somehow
// e.g. an updater wants to publish its result as if from the original (get) query
asynchroneous_success : function (data, query, publish_uuid, callback /*domid*/) {
// xxx should have a nicer declaration of that enum in sync with the python code somehow
- if (!!callback) { callback(data); return; }
+ if (!!callback) {
+ callback(data);
+ if (manifold.asynchroneous_debug) {
+ duration=new Date()-start;
+ messages.debug ("<<<<<<<<<< asynchroneous_success " + query.object + " -- callback ended " + duration + " ms");
+ }
+ return;
+ }
if (data.code == 2) { // ERROR
// We need to make sense of error codes here
alert("Your session has expired, please log in again");
window.location="/logout/";
if (data.code == 2) { // ERROR
// We need to make sense of error codes here
alert("Your session has expired, please log in again");
window.location="/logout/";
//tmp_query = manifold.find_query(query.query_uuid);
//manifold.publish_result_rec(tmp_query.analyzed_query, result);
}
//tmp_query = manifold.find_query(query.query_uuid);
//manifold.publish_result_rec(tmp_query.analyzed_query, result);
}
},
/**************************************************************************
* Plugin API helpers
**************************************************************************/
},
/**************************************************************************
* Plugin API helpers
**************************************************************************/
- raise_event_handler: function(type, query_uuid, event_type, value)
- {
+ raise_event_handler: function(type, query_uuid, event_type, value) {
if ((type != 'query') && (type != 'record'))
throw 'Incorrect type for manifold.raise_event()';
var channels = [ manifold.get_channel(type, query_uuid), manifold.get_channel(type, '*') ];
$.each(channels, function(i, channel) {
if ((type != 'query') && (type != 'record'))
throw 'Incorrect type for manifold.raise_event()';
var channels = [ manifold.get_channel(type, query_uuid), manifold.get_channel(type, '*') ];
$.each(channels, function(i, channel) {
manifold.raise_event_handler('query', query_uuid, event_type, value);
},
manifold.raise_event_handler('query', query_uuid, event_type, value);
},
manifold.raise_event_handler('record', query_uuid, event_type, value);
},
manifold.raise_event_handler('record', query_uuid, event_type, value);
},
// Query uuid has been updated with the key of a new element
query_ext = manifold.query_store.find_analyzed_query_ext(query_uuid);
query = query_ext.query;
// Query uuid has been updated with the key of a new element
query_ext = manifold.query_store.find_analyzed_query_ext(query_uuid);
query = query_ext.query;
// NOTE : we have to modify all child queries
// NOTE : parts of a query might not be started (eg slice.measurements, how to handle ?)
// NOTE : we have to modify all child queries
// NOTE : parts of a query might not be started (eg slice.measurements, how to handle ?)
- // if everything is done right, update_query should not be null. It is updated when we received results from the get query
+ // if everything is done right, update_query should not be null.
+ // It is updated when we received results from the get query
// object = the same as get
// filter = key : update a single object for now
// fields = the same as get
// object = the same as get
// filter = key : update a single object for now
// fields = the same as get