Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Docker-in-Docker (DinD) capabilities of public runners deactivated.
More info
Open sidebar
pipelet
Pipelet
Commits
b8cdb740
Commit
b8cdb740
authored
Aug 27, 2010
by
Maude Le Jeune
Browse files
buttons clear and delete ok
parent
39a329fd
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
77 additions
and
24 deletions
+77
-24
pipelet/static/tag.js
pipelet/static/tag.js
+36
-4
pipelet/web.py
pipelet/web.py
+41
-20
No files found.
pipelet/static/tag.js
View file @
b8cdb740
...
...
@@ -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
;
}
}
pipelet/web.py
View file @
b8cdb740
...
...
@@ -53,17 +53,33 @@ class Web:
self
.
name
=
name
## 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
):
...
...
@@ -86,8 +102,6 @@ class Web:
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>'
...
...
@@ -103,24 +117,24 @@ class Web:
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>'
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
inpu
t
## Date
selec
t
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>'
#<a href='"del_from_checkbox?">Delete</a><br><a align=left href="tag_from_checkbox">Tag</a><br> '
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="
#
"><small>Clear</small></a>'
html
+=
'<a class="icon tag" href="
#
"><small>Tag</small></a>'
html
+=
'<a class="icon delete" href="
#
"><small>Delete</small></a>'
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">'
...
...
@@ -149,7 +163,7 @@ 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
+=
'<INPUT type="checkbox" name="
%s" value="0">
'
%
(
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
:
...
...
@@ -258,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
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment