Docker-in-Docker (DinD) capabilities of public runners deactivated. More info

Commit a03eb935 authored by Marc Betoule's avatar Marc Betoule
Browse files

Merge branch 'newbase' of git@gitorious.org:pipelet/pipelet into newbase

parents 0fa28b7f b8cdb740
......@@ -28,6 +28,52 @@ div.list{
border:2px solid gray;
}
li.button{
margin-left:auto;
margin-right:10px;
padding:10px;
border:2px solid gray;
}
.icon{
background-position: 0% 40%;
background-repeat: no-repeat;
padding-left: 20px;
margin-right:10px;
padding-top: 2px;
padding-bottom: 3px;
}
.icon.apply{
background-image: url(/static/apply.png)
}
.icon.clear{
background-image: url(/static/clear.png)
}
.icon.tag{
background-image: url(/static/tag.gif)
}
.icon.delete{
background-image: url(/static/delete.gif)
}
.icon.log{
background-image: url(/static/log.png)
}
.icon img{
width:10px;
height:10px;
}
a{
color:blue;
font-weight: bold;
text-decoration: none;
}
a:hover { text-decoration: underline; }
#pipelist{
width:60%;
}
......@@ -40,6 +86,12 @@ h1{
font-family:Helvetica,Arial,sans-serif;
}
.text{
color: orange;
font-weight: bold;
font-family:Helvetica,Arial,sans-serif;
}
/* color codes for node status */
.done{
color: #006400;
......
......@@ -13,6 +13,8 @@
// You should have received a copy of the GNU General Public License
// along with this program; if not, see http://www.gnu.org/licenses/gpl.html
// ask for a confirmation before returning to url
function confirmation(url) {
check = confirm("Are you sure ?");
if (check == true) {
......@@ -20,11 +22,41 @@ function confirmation(url) {
}
}
function edit_tag(url) {
var check = prompt("Select an existing tag among: \n - tag1\n - tag2\n or set a new tag for this pipe","tag1");
if (check!=null) {
self.location.href=url+check;
// go to url
function navigation(url) {
self.location.href=url;
}
// remove checked segments
function del_seg (){
lst = document.getElementsByName('checkbox');
var url="delseg?segid=";
for (var i=0;i<lst.length;i++){
if(lst[i].checked){
url = url+lst[i].id+"--";
}
}
self.location.href=url;
}
// set new tag for checked segments
function edit_tag (){
var check = prompt("Select an existing tag among: \n - tag1\n - tag2\n or set a new tag for this pipe","tag1");
var url="addtag?segid=";
lst = document.getElementsByName('checkbox');
for (var i=0;i<lst.length;i++){
if(lst[i].checked){
url = url+lst[i].id+"--";
}
}
url = url+"&tag="+check;
self.location.href=url;
}
// uncheck segments
function uncheck (){
lst = document.getElementsByName('checkbox');
for (var i=0;i<lst.length;i++){
lst[i].checked=0;
}
}
......@@ -54,6 +54,32 @@ class Web:
## Pipeline data base file.
self.db_file = db_file
def get_lst_tag (self):
""" Return the list of existing tags
"""
## sql blabla
return []
def get_lst_date (self):
""" Return the list of existing dates
"""
## sql blabla
return []
@cherrypy.expose
@write_access
def addtag (self, segid, tag):
""" Add new tag to the database
"""
## sql blabla
seglst = segid.split('--')
for segid in seglst:
if segid:
## check that the tag do not exist yet for this id
pass
raise cherrypy.HTTPRedirect('/'+self.name+'/',303)
@cherrypy.expose
@read_access
def index(self, highlight=None):
......@@ -73,7 +99,45 @@ class Web:
l = conn.execute('select seg, curr_dir, seg_id, tag from segments order by curr_dir').fetchall()
html = html_tmp
html += '<h1>Pipelines in %s </h1> <a href="log?logdir=%s">logs</a> <div class="list"><ul class="mktree" id="segtree"> '%(self.name,l[0][1].split("seg")[0]+"log")
html += '<h1>Pipelines in %s </h1>'%self.name
## Filter fieldset
html += '<fieldset id="filters"><legend><span class="text">Filters</span></legend>'
html += '<table width="100%"><tr><td><table>'
## Tag checkbox
html += '<tr valign="top" id="tr_tag_id" class="filter"> <td style="width:150px;"><input id="cb_tag" type="checkbox"/><label for="cb_tag_id">Tag</label></td>'
## Tag select
lst_tag = self.get_lst_tag()
html += '<td style="width:150px;"><select id="se_tag_id">'
for t in lst_tag:
html +='<option value="%s">%s</option>'%(t[0], t)
html += '</select></td>'
## Date checkbox
html += '<tr valign="top" id="tr_date_id" class="filter"> <td style="width:150px;"><input id="cb_date" type="checkbox"/><label for="cb_date_id">Date</label></td>'
## Date select
lst_date = self.get_lst_date()
html += '<td style="width:150px;"><select id="se_date_id">'
for t in lst_date:
html +='<option value="%s">%s</option>'%(t[0], t)
html += '</select></td>'
## Buttons
html += '<tr></tr>'
html += '</table>'
html += '</td><td></td></tr></table>'
html += '<p class="buttons">'
html += '<a class="icon apply" href="#"><small>Apply</small></a>'
html += '<a class="icon clear" href="javascript:uncheck();"><small>Clear</small></a>'
html += '<a class="icon tag" href="javascript:edit_tag();"><small>Tag</small></a>'
html += '<a class="icon delete" href="javascript:del_seg();"><small>Delete</small></a>'
html += '<a class="icon log" href="log?logdir=%s"><small>Browse log</small></a>'%(l[0][1].split("seg")[0]+"log")
html +='</p></fieldset>'
html += '<br><div class="list"><ul class="mktree" id="segtree">'
indent = -1
# select a subset
......@@ -99,7 +163,8 @@ class Web:
print s
for stat in e:
ss = '<a href="product?segid=%s&status=%s" class=%s>%d</a>, '%(s[2],stat[0], stat[0], stat[1]) + ss
ss += '<a href="javascript:confirmation(\'delseg?segid=%d\')"> (delete)</a><spacer> <a href="javascript:edit_tag(\'tag?segid=%d\')"> (tag)</a>'%(s[2],s[2])
ss += '<INPUT type="checkbox" name="checkbox" id="%d"'%(s[2])
#ss += '<a href="delseg?segid=%d"> (delete)</a>'%(s[2])
diff = s[1].count('/') - indent
if diff == 1:
html += '<ul> <li id=%d ><a href="code?segid=%d">%s</a> : %s\n'%(s[2],s[2],s[0],ss)
......@@ -112,6 +177,8 @@ class Web:
indent += diff
conn.close()
html += '</li></ul>'*(indent-l[0][1].count('/')+1)
if not highlight:
html += '</div></body></html>'
return html
......@@ -190,6 +257,12 @@ class Web:
html += '</ul></div></body></html>'
return html
def del_from_checkbox ():
"""
"""
@cherrypy.expose
@write_access
def delseg(self, segid=None):
......@@ -199,16 +272,23 @@ class Web:
Parameters
----------
currdir: string, pipeline instance path.
segid: string, list of pipe id '--' separated
"""
cherrypy.log.error_log.warning('called ONCE')
if segid is not None:
conn = sqlite3.connect(self.db_file,check_same_thread=True)
with conn:
currdir = conn.execute('select curr_dir from segments where seg_id = ?',(int(segid),)).fetchone()[0]
l = conn.execute('delete from tasks where seg_id in (select seg_id from segments where segments.curr_dir like ?)',(currdir+'%',))
conn.close()
shutil.rmtree(currdir)
seglist = segid.split("--")
for segid in seglist:
if segid:
conn = sqlite3.connect(self.db_file,check_same_thread=True)
with conn:
currdir = conn.execute('select curr_dir from segments where seg_id = ?',(int(segid),)).fetchone()[0]
l = conn.execute('delete from tasks where seg_id in (select seg_id from segments where segments.curr_dir like ?)',(currdir+'%',))
conn.close()
try:
shutil.rmtree(currdir)
except:
pass
raise cherrypy.HTTPRedirect('/'+self.name+'/',303)
......@@ -244,7 +324,7 @@ class Web:
""" Print the content of the log directory.
"""
directory = logdir
html = html_tmp + '<h1> Content of %s </h1> <a href="/%s/">Back</a><div class="list"><a href="delete_log?logdir=%s">Delete logs</a><ul>'%(directory,self.name,logdir)
html = html_tmp + '<h1> Content of %s </h1> <a href="/%s/">Back</a><div class="list"><a class="icon delete" href="delete_log?logdir=%s"><small>Delete logs</small></a><ul>'%(directory,self.name,logdir)
for filename in sorted(glob(os.path.join(directory,'*')), reverse=True):
absPath = os.path.abspath(filename)
html += '<li><a href="serve_log?filename='+absPath+ '">' + os.path.basename(filename) + "</a> </li>"
......
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