Commit 558238ce authored by marc's avatar marc
Browse files

database.js : accept run and patient id in url

default.py : get_data/get_analysis > convert patient/run id into sample_set_id
parent ff74921f
......@@ -557,7 +557,10 @@ Database.prototype = {
}
var url = document.documentURI.split('?')[0]
var new_location = url+"?sample_set_id="+args.sample_set_id+"&config="+args.config
if (typeof args.sample_set_id != "undefined")
var new_location = url+"?sample_set_id="+args.sample_set_id+"&config="+args.config
if (typeof args.patient != "undefined")
var new_location = url+"?patient="+args.patient+"&config="+args.config
window.history.pushState('plop', 'plop', new_location);
$.ajax({
......
......@@ -37,11 +37,13 @@ Model_loader.prototype = {
* */
start: function() {
var self = this;
var dataURL = ""
var analysisURL = ""
var sample_set_id = -1
var dbconfig = -1
var custom_list = []
var dataURL = "";
var analysisURL = "";
var sample_set_id = -1;
var patient = -1;
var run = -1;
var dbconfig = -1;
var custom_list = [];
/** Process arguments in conf.js */
if (typeof config != 'undefined' && typeof config.autoload != 'undefined')
......@@ -60,6 +62,8 @@ Model_loader.prototype = {
if (tmp2[0] == 'data') dataURL = tmp2[1]
if (tmp2[0] == 'analysis') analysisURL = tmp2[1]
if (tmp2[0] == 'sample_set_id') sample_set_id = tmp2[1]
if (tmp2[0] == 'patient') patient = tmp2[1]
if (tmp2[0] == 'run') run = tmp2[1]
if (tmp2[0] == 'config') dbconfig = tmp2[1]
if (tmp2[0] == 'custom') {
custom_split = tmp2[1].split(',')
......@@ -86,6 +90,16 @@ Model_loader.prototype = {
//wait 1sec to check ssl
setTimeout(function () { db.load_data( {"sample_set_id" : sample_set_id , "config" : dbconfig } , "") }, 1000);
}
else if (patient != "-1" && dbconfig != "-1"){
//wait 1sec to check ssl
setTimeout(function () { db.load_data( {"patient" : patient , "config" : dbconfig } , "") }, 1000);
}
else if (run != "-1" && dbconfig != "-1"){
//wait 1sec to check ssl
setTimeout(function () { db.load_data( {"run" : run , "config" : dbconfig } , "") }, 1000);
}
else if (custom_list.length>0){
//wait 1sec to check ssl
......
......@@ -189,7 +189,7 @@ def checkProcess():
#########################################################################
## return .data file
# need sample_set, config
# need sample_set/patient, config
# need sample_set admin or read permission
def get_data():
from subprocess import Popen, PIPE, STDOUT
......@@ -203,7 +203,13 @@ def get_data():
return gluon.contrib.simplejson.dumps(res, separators=(',',':'))
error = ""
if "patient" in request.vars :
request.vars["sample_set_id"] = db.patient[request.vars["patient"]].sample_set_id
if "run" in request.vars :
request.vars["sample_set_id"] = db.run[request.vars["run"]].sample_set_id
if not "sample_set_id" in request.vars :
error += "id sampleset file needed, "
else :
......@@ -376,6 +382,12 @@ def get_custom_data():
def get_analysis():
error = ""
if "patient" in request.vars :
request.vars["sample_set_id"] = db.patient[request.vars["patient"]].sample_set_id
if "run" in request.vars :
request.vars["sample_set_id"] = db.run[request.vars["run"]].sample_set_id
if not "sample_set_id" in request.vars :
error += "id sample_set file needed, "
if not auth.can_view_sample_set(request.vars["sample_set_id"]):
......
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