Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F62594914
_jobs.html.erb
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Tue, May 14, 05:40
Size
6 KB
Mime Type
text/html
Expires
Thu, May 16, 05:40 (2 d)
Engine
blob
Format
Raw Data
Handle
17666433
Attached To
R5853 genocrunch-2.1
_jobs.html.erb
View Options
<input type="text" id="filter-input" class='form-control filter-table' onkeyup="filterTable()" placeholder="Search">
<table id="myTable" class="table table-striped table-condensed">
<thead>
<tr>
<th title="key">Key</th>
<th title="name">Name</th>
<th title="date">Date</th>
<%
if
current_user
.
role
==
"admin"
%>
<th title="user">User</th>
<th title="type">Type</th>
<%
end
%>
<th title="status">Status</th>
<th title="input data">Data</th>
<th title="map">Map</th>
<th title="results">Results</th>
<th title="clone|edit|delete"></th>
</tr>
</thead>
<tbody>
<%
@jobs
.
compact
.
each
do
|
job
|
%>
<%
date
=
job
.
updated_at
.
year
.
to_s
[-
2
.
.
-
1
].
to_s
+
"-"
+
job
.
updated_at
.
month
.
to_s
.
rjust
(
2
,
'0'
)
+
"-"
+
job
.
updated_at
.
day
.
to_s
.
rjust
(
2
,
'0'
)
+
" "
+
job
.
updated_at
.
hour
.
to_s
.
rjust
(
2
,
'0'
)
+
":"
+
job
.
updated_at
.
min
.
to_s
.
rjust
(
2
,
'0'
)
+
" "
+
job
.
updated_at
.
zone
.
to_s
%>
<tr class="
<%=
job
.
status
==
'failed'
?
'danger'
:
''
%>
">
<td title="
<%=
job
.
key
%>
" style="font-size:
<%#
[10, 26-[10, job.name.size].max].max
%>
px;">
<div class="td-content-container
<%#
job.test? ? 'test-name' : ''
%>
">
<%=
link_to
job
.
key
,
job_path
(
job
.
key
)
%>
</div>
</td>
<td title="
<%=
job
.
name
%>
">
<div class="td-content-container
<%#
job.test? ? 'test-name' : ''
%>
">
<%=
link_to
job
.
name
,
job_path
(
job
.
key
)
%>
</div>
</td>
<td title="
<%=
date
%>
" class="date">
<%=
link_to
date
,
job_path
(
job
.
key
)
%>
</td>
<%
if
current_user
.
role
==
"admin"
%>
<td title="
<%=
(
job
.
user
)
?
job
.
user
.
username
:
'NA'
%>
">
<%=
(
job
.
user
)
?
job
.
user
.
username
:
'NA'
%>
</td>
<td>
<%=
(
Example
.
where
(
:job_key
=>
job
.
key
)
.
all
.
size
>
0
)
?
'Example'
:
'Std'
%>
</td>
<%
end
%>
<td title="
<%=
job
.
status
%>
">
<%
if
job
.
status
%>
<i class="fa
<%=
job
.
status
==
'running'
?
'fa-circle-o-notch fa-pulse'
:
job
.
status
==
'completed'
?
'fa-check icon-success'
:
job
.
status
==
'pending'
?
'fa-ellipsis-h icon-inactive'
:
'fa-exclamation-triangle icon-warning'
%>
" aria-hidden="true"></i>
<%
end
%>
</td>
<td>
<%=
link_to
raw
(
'<i class="fa fa-file-o" aria-hidden="true"></i>'
),
serve_job_path
(
job
.
key
,
:filename
=>
'input/primary_dataset.txt'
),
title
:
"primary dataset"
%>
<%
if
File
.
exist?
Pathname
.
new
(
APP_CONFIG
[
:data_dir
]
)
+
'users'
+
job
.
user_id
.
to_s
+
job
.
key
+
'input'
+
'secondary_dataset.txt'
%>
|
<%=
link_to
raw
(
'<i class="fa fa-file-o" aria-hidden="true"></i>'
),
serve_job_path
(
job
.
key
,
:filename
=>
'input/secondary_dataset.txt'
),
title
:
"secondary dataset"
%>
<%
end
%>
</td>
<td title="download mapping file">
<%=
link_to
raw
(
'<i class="fa fa-file-o" aria-hidden="true"></i>'
),
serve_job_path
(
job
.
key
,
:filename
=>
'input/map.txt'
)
%>
</td>
<td>
<%=
link_to
raw
(
'<i class="fa fa-eye" aria-hidden="true"></i>'
),
job_path
(
job
.
key
),
:title
=>
'show'
%>
<%
if
(
File
.
exist?
Pathname
.
new
(
APP_CONFIG
[
:data_dir
]
)
+
'users'
+
job
.
user_id
.
to_s
+
job
.
key
+
(
job
.
key
+
'.tar.gz'
)
.
to_s
)
and
(
![
'pending'
,
'running'
].
include?
job
.
status
)
%>
|
<%=
link_to
raw
(
'<i class="fa fa-file-archive-o" aria-hidden="true"></i>'
),
serve_job_path
(
job
.
key
,
:filename
=>
job
.
key
+
'.tar.gz'
),
:title
=>
'download archive'
%>
<%
end
%>
</td>
<%
destroy_text
=
(
[
'pending'
,
'running'
].
include?
job
.
status
)
?
'abort'
:
'delete'
%>
<td title="clone|edit|delete" style='white-space:nowrap'>
<%=
link_to
raw
(
'<i class="fa fa-clone" aria-hidden="true"></i>'
),
clone_job_path
(
job
.
key
)
%>
|
<%=
link_to
raw
(
'<i class="fa fa-pencil-square-o" aria-hidden="true"></i>'
),
edit_job_path
(
job
.
key
)
%>
|
<%
destroy_text
=
(
[
'pending'
,
'running'
].
include?
job
.
status
)
?
'abort'
:
'delete'
%>
<%=
link_to
(
job_path
(
job
.
key
),
method
:
:delete
,
data
:
{
confirm
:
'Are you sure you want to '
+
destroy_text
+
' "'
+
(
job
.
name
||
'NA'
)
+
'" ?'
})
do
%>
<i class="fa fa-trash-o" aria-hidden="true"></i>
<%
end
%>
</td>
</tr>
<%
end
%>
</tbody>
</table>
<table id="myTableStats" class="table table-condensed">
<thead>
<tr>
<th title="jobs">jobs</th>
<th title="completed"><i class="fa fa-check icon-success" aria-hidden="true"></i></th>
<th title="pending"><i class="fa fa-ellipsis-h icon-inactive" aria-hidden="true"></i></th>
<th title="running"><i class="fa fa-circle-o-notch" aria-hidden="true"></i></th>
<th title="failed"><i class="fa fa-exclamation-triangle icon-warning" aria-hidden="true"></i></th>
</tr>
</thead>
<tbody>
<tr>
<td>
<%=
@jobs
.
length
%>
</td>
<td>
<%=
@jobs
.
select
{
|
i
|
i
.
status
==
"completed"
}
.
length
%>
</td>
<td>
<%=
@jobs
.
select
{
|
i
|
i
.
status
==
"pending"
}
.
length
%>
</td>
<td>
<%=
@jobs
.
select
{
|
i
|
i
.
status
==
"running"
}
.
length
%>
</td>
<td>
<%=
@jobs
.
select
{
|
i
|
i
.
status
==
"failed"
}
.
length
%>
</td>
</tr>
</tbody>
</table>
<%=
javascript_tag
do
%>
$(document).ready(function(){
var table = $('#myTable').DataTable({
sDom: 'ltp',
"aLengthMenu": [[10, 25, 50, 100, -1],
[10, 25, 50, 100, "All"]],
"iDisplayLength" : 10,
"order": [[ 2, 'desc' ], [ 1, 'asc' ]]
});
$('#filter-input').insertAfter('#myTable_length')
});
function filterTable() {
var input = document.getElementById("filter-input"),
filter = input.value.toUpperCase(),
table = document.getElementById("myTable"),
tr = table.getElementsByTagName("tr"),
td, kept;
for (var i = 1; i < tr.length; i++) {
td = tr[i].getElementsByTagName("td");
kept = false;
for (var j = 0; j < td.length; j++) {
if (td[j].innerHTML.toUpperCase().indexOf(filter) > -1) {
tr[i].style.display = "";
kept = true;
break;
}
}
if (kept == false) {
tr[i].style.display = "none";
}
}
}
<%
end
%>
Event Timeline
Log In to Comment