Commit c4afac2b authored by Maude Le Jeune's avatar Maude Le Jeune
Browse files

search by seg

remains bug double name in seg list
parent 8872357c
......@@ -31,3 +31,115 @@ __version__='ebb3b8c227a1cd5c28490e7d4ec3e1700b2a8c29'
__version__='ebb3b8c227a1cd5c28490e7d4ec3e1700b2a8c29'
__version__='ebb3b8c227a1cd5c28490e7d4ec3e1700b2a8c29'
__version__='8872357cc9d6a5db8e94ab9cf31fb58aef45caed'
__version__='8872357cc9d6a5db8e94ab9cf31fb58aef45caed'
__version__='8872357cc9d6a5db8e94ab9cf31fb58aef45caed'
__version__='8872357cc9d6a5db8e94ab9cf31fb58aef45caed'
__version__='8872357cc9d6a5db8e94ab9cf31fb58aef45caed'
__version__='8872357cc9d6a5db8e94ab9cf31fb58aef45caed'
__version__='8872357cc9d6a5db8e94ab9cf31fb58aef45caed'
__version__='8872357cc9d6a5db8e94ab9cf31fb58aef45caed'
__version__='8872357cc9d6a5db8e94ab9cf31fb58aef45caed'
__version__='8872357cc9d6a5db8e94ab9cf31fb58aef45caed'
__version__='8872357cc9d6a5db8e94ab9cf31fb58aef45caed'
__version__='8872357cc9d6a5db8e94ab9cf31fb58aef45caed'
__version__='8872357cc9d6a5db8e94ab9cf31fb58aef45caed'
__version__='8872357cc9d6a5db8e94ab9cf31fb58aef45caed'
__version__='8872357cc9d6a5db8e94ab9cf31fb58aef45caed'
__version__='8872357cc9d6a5db8e94ab9cf31fb58aef45caed'
__version__='8872357cc9d6a5db8e94ab9cf31fb58aef45caed'
__version__='8872357cc9d6a5db8e94ab9cf31fb58aef45caed'
__version__='8872357cc9d6a5db8e94ab9cf31fb58aef45caed'
__version__='8872357cc9d6a5db8e94ab9cf31fb58aef45caed'
__version__='8872357cc9d6a5db8e94ab9cf31fb58aef45caed'
__version__='8872357cc9d6a5db8e94ab9cf31fb58aef45caed'
__version__='8872357cc9d6a5db8e94ab9cf31fb58aef45caed'
__version__='8872357cc9d6a5db8e94ab9cf31fb58aef45caed'
__version__='8872357cc9d6a5db8e94ab9cf31fb58aef45caed'
__version__='8872357cc9d6a5db8e94ab9cf31fb58aef45caed'
__version__='8872357cc9d6a5db8e94ab9cf31fb58aef45caed'
__version__='8872357cc9d6a5db8e94ab9cf31fb58aef45caed'
__version__='8872357cc9d6a5db8e94ab9cf31fb58aef45caed'
__version__='8872357cc9d6a5db8e94ab9cf31fb58aef45caed'
__version__='8872357cc9d6a5db8e94ab9cf31fb58aef45caed'
__version__='8872357cc9d6a5db8e94ab9cf31fb58aef45caed'
__version__='8872357cc9d6a5db8e94ab9cf31fb58aef45caed'
__version__='8872357cc9d6a5db8e94ab9cf31fb58aef45caed'
__version__='8872357cc9d6a5db8e94ab9cf31fb58aef45caed'
__version__='8872357cc9d6a5db8e94ab9cf31fb58aef45caed'
__version__='8872357cc9d6a5db8e94ab9cf31fb58aef45caed'
__version__='8872357cc9d6a5db8e94ab9cf31fb58aef45caed'
__version__='8872357cc9d6a5db8e94ab9cf31fb58aef45caed'
__version__='8872357cc9d6a5db8e94ab9cf31fb58aef45caed'
__version__='8872357cc9d6a5db8e94ab9cf31fb58aef45caed'
__version__='8872357cc9d6a5db8e94ab9cf31fb58aef45caed'
__version__='8872357cc9d6a5db8e94ab9cf31fb58aef45caed'
__version__='8872357cc9d6a5db8e94ab9cf31fb58aef45caed'
__version__='8872357cc9d6a5db8e94ab9cf31fb58aef45caed'
__version__='8872357cc9d6a5db8e94ab9cf31fb58aef45caed'
__version__='8872357cc9d6a5db8e94ab9cf31fb58aef45caed'
__version__='8872357cc9d6a5db8e94ab9cf31fb58aef45caed'
__version__='8872357cc9d6a5db8e94ab9cf31fb58aef45caed'
__version__='8872357cc9d6a5db8e94ab9cf31fb58aef45caed'
__version__='8872357cc9d6a5db8e94ab9cf31fb58aef45caed'
__version__='8872357cc9d6a5db8e94ab9cf31fb58aef45caed'
__version__='8872357cc9d6a5db8e94ab9cf31fb58aef45caed'
__version__='8872357cc9d6a5db8e94ab9cf31fb58aef45caed'
__version__='8872357cc9d6a5db8e94ab9cf31fb58aef45caed'
__version__='8872357cc9d6a5db8e94ab9cf31fb58aef45caed'
......@@ -23,7 +23,7 @@ import glob
import cherrypy
import auth
from pipelet.web import TreeView
from copy import copy
class PBView(TreeView):
""" A pipeline Web interface dedicated to Polarbear experiment
......@@ -34,9 +34,27 @@ class PBView(TreeView):
def __init__ (self,db_file, name):
TreeView.__init__(self, db_file, name)
self.js_file += ["../static/pb.js"]
self.lst_ids = self.get_ids()
self.lst_mjd,self.lst_patch,self.lst_obs = self.get_mjd()
self.lst_obj = []#'DataFolder', 'GainFolder', 'MapFolder', 'CoaddedMap', 'JKFolder']
def get_ids (self):
conn = sqlite3.connect(self.db_file,check_same_thread=True)
conn.text_factory=str
with conn:
l1 = conn.execute('select seg_id,seg,param from segments where seg="stimtau"').fetchall()
l2 = conn.execute('select seg_id,seg,param from segments where seg="gatherstim"').fetchall()
conn.close()
ll = []
for e in l1+l2:
if e[2] is not None:#len(e[2])>41:
ll.append (e[1]+'@'+e[2][-41:])
else:
ll.append(e[1]+'@'+str(e[0]))
self.selected_id = l1[0][0]
self.selected_seg= l1[0][1]
self.selected_idtxt= ll[0]
return ll
def get_mjd (self):
conn = sqlite3.connect(self.db_file,check_same_thread=True)
conn.text_factory=str
......@@ -61,14 +79,16 @@ class PBView(TreeView):
lst_patch= list(set(lst_patch))
lst_dir = list(set(lst_dir))
return (lst_mjd,lst_patch, lst_dir)
@cherrypy.expose
@auth.pipeauth.read_access()
def get_folder (self, mjd):
conn = sqlite3.connect(self.db_file,check_same_thread=True)
conn.text_factory=str
segid = self.selected_id
with conn:
l = conn.execute('select seg_id from segments where seg="stimtau"').fetchall()
segid = l[0][0]
#l = conn.execute('select seg_id from segments where seg="stimtau"').fetchall()
#segid = l[0][0]
sqlr = 'select input,str_input from tasks where seg_id=%s and status="done" and input like "XXX%sXXX"'%(segid,mjd)
sqlr = sqlr.replace("XXX", "%")
l = conn.execute(sqlr).fetchall()
......@@ -78,6 +98,27 @@ class PBView(TreeView):
self.selected_mjd = mjd
raise cherrypy.HTTPRedirect('/'+self.name+'/',303)
@cherrypy.expose
@auth.pipeauth.read_access()
def set_id (self, idtxt):
conn = sqlite3.connect(self.db_file,check_same_thread=True)
conn.text_factory=str
segid = self.selected_id
searchid = idtxt.split("@")[-1]
searchseg = idtxt.split("@")[0]
with conn:
sqlr = 'select seg_id,seg from segments where param like "XXX%sXXX" and seg="%s"'%(searchid[2:-1],searchseg)
sqlr = sqlr.replace("XXX", "%")
l = conn.execute(sqlr).fetchone()
conn.close()
self.selected_idtxt = idtxt
if idtxt not in self.lst_ids:
self.lst_ids.append(idtxt)
self.selected_id = l[0]
self.selected_seg = l[1]
raise cherrypy.HTTPRedirect('/'+self.name+'/',303)
def filter_panel (self, l):
""" Return an html string containing the filter panel
......@@ -88,12 +129,16 @@ class PBView(TreeView):
html += '<table width="100%">'
## Object chkbox
html += '<tr valign="top" id="tr_obj_id" class="filter"> <td style="width:150px;"><input id="cb_obj" type="checkbox"/><label></label></td>'
html += '<tr valign="top" id="tr_seg_id" class="filter"> <td style="width:150px;"><input id="cb_seg" type="checkbox"/><label></label></td>'
## Object select
html += '<td style="width:50px;"><select id="se_obj_id">'
for t in self.lst_obj:
html +='<option value="%s">%s</option>'%(t, t)
html += '<td style="width:50px;"><select id="se_seg_id" onchange=javascript:updateid();>'
for t in self.lst_ids:
if t==self.selected_idtxt:
html +='<option selected value="%s">%s</option>'%(self.selected_idtxt,self.selected_idtxt)
else:
html +='<option value="%s">%s</option>'%(t, t)
html += '</select></td>'
## Input chkbox
......@@ -105,10 +150,14 @@ class PBView(TreeView):
html += '<td style="width:50px;"><select id="se_%s_id" onchange=javascript:updatemjd();>'%k
else:
html += '<td style="width:50px;"><select id="se_%s_id">'%k
for t in v[0]:
html +='<option value="%s">%s</option>'%(t, t)
vlist = copy(v[0])
if hasattr(self, 'selected_mjd') and k=="mjd":
html +='<option selected value="%s">%s</option>'%(self.selected_mjd, self.selected_mjd)
vlist.remove(self.selected_mjd)
for t in vlist:#v[0]:
html +='<option value="%s">%s</option>'%(t, t)
html += '</select></td>'
## Buttons
......@@ -129,11 +178,11 @@ class PBView(TreeView):
conn = sqlite3.connect(self.db_file,check_same_thread=True)
conn.text_factory=str
if folder != "None" and mjd != "None":
if self.selected_seg=='stimtau':#folder != "None" and mjd != "None":
foldernum = int(folder.replace("stim", ""))
with conn:
l = conn.execute('select seg_id,curr_dir from segments where seg=?',("stimtau",)).fetchall()
l = conn.execute('select seg_id,curr_dir from segments where seg_id=?',(self.selected_id,)).fetchall()
segid = l[0][0]
currdir = l[0][1]
sqlr = 'select str_input,task_id from tasks where seg_id="%s" and status="done" and input like "XXX%sXXX%sXXX"'%(segid,pickle.dumps(foldernum)[:-1], mjd)
......@@ -158,9 +207,9 @@ class PBView(TreeView):
# directory = r.replace("../",'')
# html = self.pipedir(segid=segid, directory=directory)
else:
elif self.selected_seg=='gatherstim':
with conn:
l = conn.execute('select seg_id,curr_dir from segments where seg=?',("gatherstim",)).fetchall()
l = conn.execute('select seg_id,curr_dir from segments where seg_id=?',(self.selected_id,)).fetchall()
segid = l[0][0]
currdir = l[0][1]
sqlr = 'select str_input from tasks where seg_id="%s" and status="done"'%(segid)
......
......@@ -18,19 +18,19 @@ function ssearch(){
var cb1 = document.getElementById('cb_mjd') ;
var is1 = cb1.checked;
var mjd = "None";
if (is1)
{
//if (is1)
//{
var seltag = document.getElementById('se_mjd_id') ;
mjd = seltag.options[seltag.selectedIndex].text;
}
//}
var cb2 = document.getElementById('cb_folder') ;
var is2 = cb2.checked;
var folder = "None";
if (is2)
{
//if (is2)
//{
var seldate = document.getElementById('se_folder_id') ;
folder = seldate.options[seldate.selectedIndex].text;
}
//}
var url = "search?mjd="+mjd+"&folder="+folder;
//var url = "blala";
self.location.href=url;
......@@ -40,4 +40,10 @@ function updatemjd () {
var seltag = document.getElementById('se_mjd_id') ;
var mjd = seltag.options[seltag.selectedIndex].text;
self.location.href="get_folder?mjd="+mjd;
}
function updateid () {
var seltag = document.getElementById('se_seg_id') ;
var seg = seltag.options[seltag.selectedIndex].text;
self.location.href="set_id?idtxt="+seg;
}
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