// XXX query.change_action() should become deprecated
update_query = query.clone();
update_query.action = 'update';
+ update_query.fields = [];
update_query.analyzed_query.action = 'update';
update_query.params = {};
update_query_ext = new QueryExt(update_query);
} 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];
}
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);
+
+ // 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));
+ $.post(manifold.proxy_url, {'json': query_json} , manifold.success_closure(query, null, callback));
+
+ }
},
// XXX DEPRECATED
// Has it a domain query, and has it completed ?
$.each(records, function(i, record) {
var key = manifold.metadata.get_key(query.object);
- var record_key = manifold.record_get_value(record, key);
+ if ( typeof record === "string" ){
+ var record_key = record;
+ }else{
+ var record_key = manifold.record_get_value(record, key);
+ }
manifold.query_store.set_record_state(query.query_uuid, record_key, STATE_SET, STATE_SET_IN);
});
case TYPE_LIST_OF_VALUES: // XXX Until fixed
case TYPE_LIST_OF_RECORDS:
var key, new_state, cur_query_uuid;
-
- cur_query_uuid = query.analyzed_query.subqueries[field].query_uuid;
+ if($.inArray(field,Object.keys(query.analyzed_query.subqueries)) > -1){
+ cur_query_uuid = query.analyzed_query.subqueries[field].query_uuid;
+ }
// example: slice.resource
// - update_query_orig.params.resource = resources in slice before update
var query_ext = manifold.query_store.find_query_ext(query.query_uuid);
query_ext.query_state = QUERY_STATE_DONE;
+ var tmp_query = manifold.query_store.find_analyzed_query(query.query_uuid);
+ manifold.publish_result_rec(tmp_query, records);
// Send DONE message to plugins
query.iter_subqueries(function(sq, data, parent_query) {
break;
case RUN_UPDATE:
+ query_ext.main_query_ext.update_query_ext.query.fields = [];
manifold.run_query(query_ext.main_query_ext.update_query_ext.query);
break;