Commit b22e9e4d authored by Marc Duez's avatar Marc Duez

database.js : remove request function and use call instead

parent 081a201c
......@@ -224,38 +224,6 @@ Database.prototype = {
reload: function(){
this.callUrl(this.url)
},
/* appel une fonction du serveur
* idem que call() mais la réponse n'est pas une page html a afficher
* mais simplement une confirmation que la requete a été entendu
*/
request: function (controller_name, args) {
var self = this;
var arg = "?";
for (var key in args) {
arg += "" + key + "=" + args[key] + "&";
}
//envoye de la requete ajax
$.ajax({
type: "POST",
timeout: 2000,
crossDomain: true,
url: self.db_address + controller_name + arg,
xhrFields: {withCredentials: true},
success: function (result) {
popupMsg(result);
},
error: function (request, status, error) {
if (status === "timeout") {
popupMsg("timeout");
} else {
self.call("patient/index")
}
}
});
},
/*récupére et initialise le browser avec un fichier .data
* args => format json ( parametre attendu > patient_id, config_id)
......
......@@ -94,7 +94,9 @@ def run_request():
scheduler.queue_task('run', [request.vars["sequence_file_id"],request.vars["config_id"], data_id, fuse_id]
, repeats = 1, timeout = 6000)
res = {"success": "true" , "msg": "request added" }
res = {"redirect": "patient/info",
"args" : { "id" : id_patient },
"message": "request added"}
return gluon.contrib.simplejson.dumps(res, separators=(',',':'))
else :
......
......@@ -93,7 +93,8 @@ patient = db.patient[request.vars["id"]]
<td class="column_sep"></td>
<td> {{if row.data_file.id == None :}}
<span class="button" onclick="db.request('default/run_request', { 'sequence_file_id' : '{{=row.sequence_file.id}}' , 'config_id' : {{=config_id}} } )"> run >> </span>
<span class="button" onclick="db.call('default/run_request', { 'sequence_file_id' : '{{=row.sequence_file.id}}',
'config_id' : {{=config_id}} } )"> run >> </span>
{{else:}}
{{=row.data_file.status}}
{{pass}}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment