mirror of
https://github.com/galaxyproject/galaxy.git
synced 2026-09-24 16:30:27 +08:00
Merge branch 'dev' of https://github.com/galaxyproject/galaxy into Reports_newpage
Conflicts: lib/galaxy/webapps/reports/controllers/jobs.py templates/webapps/reports/jobs_specified_month_all.mako
This commit is contained in:
@@ -63,14 +63,14 @@ class DistScrambleCrate( ScrambleCrate ):
|
||||
|
||||
def get_platforms( self, wanted ):
|
||||
# find all the members of a group and process them
|
||||
if self.groups in wanted:
|
||||
if wanted in self.groups:
|
||||
platforms = []
|
||||
for name in self.groups[wanted].split():
|
||||
for platform in self.get_platforms( name ):
|
||||
if platform not in platforms:
|
||||
platforms.append( platform )
|
||||
return platforms
|
||||
elif self.hosts in wanted:
|
||||
elif wanted in self.hosts:
|
||||
return [ wanted ]
|
||||
else:
|
||||
raise Exception( "unknown platform: %s" % wanted )
|
||||
|
||||
@@ -12,10 +12,8 @@ from sqlalchemy import and_, not_, or_
|
||||
from galaxy import model, util
|
||||
from galaxy.web.base.controller import BaseUIController, web
|
||||
from galaxy.web.framework.helpers import grids
|
||||
from math import floor
|
||||
import pkg_resources
|
||||
pkg_resources.require( "SQLAlchemy >= 0.4" )
|
||||
import re
|
||||
from math import ceil, floor
|
||||
from galaxy.webapps.reports.controllers.query import ReportQueryBuilder
|
||||
|
||||
log = logging.getLogger( __name__ )
|
||||
@@ -275,6 +273,7 @@ class Jobs( BaseUIController, ReportQueryBuilder ):
|
||||
Queries the DB for all jobs in given month, defaults to current month.
|
||||
"""
|
||||
message = ''
|
||||
PageSpec = namedtuple('PageSpec', ['entries', 'offset', 'page', 'pages_found'])
|
||||
|
||||
params = util.Params( kwd )
|
||||
monitor_email = params.get( 'monitor_email', 'monitor@bx.psu.edu' )
|
||||
@@ -286,6 +285,22 @@ class Jobs( BaseUIController, ReportQueryBuilder ):
|
||||
arrow = specs.arrow
|
||||
_order = specs.exc_order
|
||||
|
||||
if "entries" in kwd:
|
||||
entries = int(kwd.get( 'entries' ))
|
||||
else:
|
||||
entries = 50
|
||||
limit = entries * 4
|
||||
|
||||
if "offset" in kwd:
|
||||
offset = int(kwd.get( 'offset' ))
|
||||
else:
|
||||
offset = 0
|
||||
|
||||
if "page" in kwd:
|
||||
page = int(kwd.get( 'page' ))
|
||||
else:
|
||||
page = 1
|
||||
|
||||
# In case we don't know which is the monitor user we will query for all jobs
|
||||
monitor_user_id = get_monitor_id( trans, monitor_email )
|
||||
|
||||
@@ -339,6 +354,9 @@ class Jobs( BaseUIController, ReportQueryBuilder ):
|
||||
row.date
|
||||
) )
|
||||
|
||||
pages_found = ceil(len(jobs) / float(entries))
|
||||
page_specs = PageSpec(entries, offset, page, pages_found)
|
||||
|
||||
return trans.fill_template( '/webapps/reports/jobs_specified_month_all.mako',
|
||||
order=order,
|
||||
arrow=arrow,
|
||||
@@ -346,6 +364,7 @@ class Jobs( BaseUIController, ReportQueryBuilder ):
|
||||
month_label=month_label,
|
||||
year_label=year_label,
|
||||
month=month,
|
||||
page_specs=page_specs,
|
||||
jobs=jobs,
|
||||
trends=trends,
|
||||
is_user_jobs_only=monitor_user_id,
|
||||
@@ -898,15 +917,6 @@ class Jobs( BaseUIController, ReportQueryBuilder ):
|
||||
job=job,
|
||||
message=message )
|
||||
|
||||
@web.expose
|
||||
def test( self, trans, **kwd ):
|
||||
message = ''
|
||||
order = "asc"
|
||||
|
||||
return trans.fill_template( '/webapps/reports/test.mako',
|
||||
order=order,
|
||||
message=message )
|
||||
|
||||
# ---- Utility methods -------------------------------------------------------
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,280 @@
|
||||
<%doc>
|
||||
This file defines methods for displaying information about pagination
|
||||
</%doc>
|
||||
|
||||
<%def name="get_page_url( sort_id, order, *args, **kwargs )">
|
||||
<a href="${h.url_for( controller=args[0], action=args[1], sort_id=sort_id, order=order, **kwargs )}">${kwargs.get("page")}</a>
|
||||
</%def>
|
||||
|
||||
<%!
|
||||
def get_raw_url(sort_id, order, *args, **kwargs):
|
||||
return h.url_for( controller=args[0], action=args[1], sort_id=sort_id, order=order, **kwargs )
|
||||
%>
|
||||
|
||||
<%def name="get_pages( sort_id, order, page_specs, *args, **kwargs )">
|
||||
## Creates the page buttons
|
||||
${get_page_script()}
|
||||
${get_page_css()}
|
||||
|
||||
<div id="page_selector">
|
||||
<div id="back_button">↞</div>
|
||||
%for x in range(-2,3):
|
||||
<%
|
||||
page = int(page_specs.page) + x
|
||||
pages_found = int(page_specs.pages_found)
|
||||
%>
|
||||
%if page > 0:
|
||||
%if x == 0:
|
||||
<div id="curr_button">${page}</div>
|
||||
%elif page < page_specs.page + pages_found:
|
||||
<%
|
||||
entries = page_specs.entries
|
||||
offset = page_specs.entries * (page - 1)
|
||||
%>
|
||||
%if x == -2 and page > 1:
|
||||
<div class="miss_pages">...</div>
|
||||
%endif
|
||||
<div class="page_button">${get_page_url( sort_id, order, *args, page=page, offset=offset, entries=entries )}</div>
|
||||
%if x == 2 and pages_found == 4:
|
||||
<div class="miss_pages">...</div>
|
||||
%endif
|
||||
%endif
|
||||
%endif
|
||||
%endfor
|
||||
<div id="next_button">↠</div>
|
||||
</div>
|
||||
</%def>
|
||||
|
||||
<%def name="get_entry_selector(controller, action, entries, sort_id, order)">
|
||||
<div id="entry_form" >
|
||||
<form method="post" controller=${controller} action=${action}>
|
||||
<input type="hidden" value=${sort_id} name="sort_id">
|
||||
<input type="hidden" value=${order} name="order">
|
||||
Max items:
|
||||
<input id="entries_edit"
|
||||
type="text"
|
||||
name="entries"
|
||||
value="${entries}">
|
||||
</input>
|
||||
<button id="entry_submit">Go</button>
|
||||
</form>
|
||||
</div>
|
||||
</%def>
|
||||
|
||||
<%def name="get_page_css()">
|
||||
<%doc>
|
||||
Page Styling
|
||||
</%doc>
|
||||
<style>
|
||||
#back_button, #next_button, #curr_button, .miss_pages, .page_button {
|
||||
position: relative;
|
||||
float: left;
|
||||
height: 24px;
|
||||
width: 23px;
|
||||
margin: 0 -1px 0 0;
|
||||
padding-top: 2.5px;
|
||||
border: 1px solid #bfbfbf;
|
||||
z-index: 0;
|
||||
}
|
||||
|
||||
#curr_button {
|
||||
background: #ebd9b2;
|
||||
border: 1px solid #5f6990;
|
||||
z-index: 1;
|
||||
}
|
||||
|
||||
#back_button {
|
||||
cursor: pointer;
|
||||
border-top-left-radius: 3px;
|
||||
border-bottom-left-radius: 3px;
|
||||
}
|
||||
|
||||
#next_button {
|
||||
cursor: pointer;
|
||||
border-top-right-radius: 3px;
|
||||
border-bottom-right-radius: 3px;
|
||||
}
|
||||
|
||||
#page_selector {
|
||||
cursor: default;
|
||||
position: relative;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.page_button > a {
|
||||
text-decoration: none;
|
||||
padding: 8px;
|
||||
margin: -8px;
|
||||
height: 100%;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
#formHeader > tbody > tr {
|
||||
vertical-align: middle;
|
||||
}
|
||||
</style>
|
||||
|
||||
<%doc>
|
||||
Entry Styling
|
||||
</%doc>
|
||||
<style>
|
||||
|
||||
#entries_edit {
|
||||
position: relative;
|
||||
padding: 0;
|
||||
width: 36px;
|
||||
height: 20px;
|
||||
text-align: center;
|
||||
border: 1px solid black;
|
||||
border-radius: 3px;
|
||||
z-index: 6;
|
||||
}
|
||||
|
||||
#entry_submit {
|
||||
cursor: default;
|
||||
position: relative;
|
||||
display: inline-block;
|
||||
border: 1px solid black;
|
||||
padding: 0;
|
||||
width: 22px;
|
||||
height: 22px;
|
||||
border-radius: 11px;
|
||||
background-color: #ebd9b2;
|
||||
text-align: center;
|
||||
opacity: 0.0;
|
||||
z-index: 0;
|
||||
}
|
||||
</style>
|
||||
</%def>
|
||||
|
||||
<%def name="get_page_script()">
|
||||
<script>
|
||||
$(document).ready( function(e) {
|
||||
var drop_down = false;
|
||||
|
||||
//Close the dropdown in the event of focusout() from entries edit
|
||||
$("#entries_edit").focusout( function(e) {
|
||||
var speed = 50;
|
||||
|
||||
$("#entry_submit").css("cursor", "default");
|
||||
$("#entry_submit").fadeTo(speed, 0.0);
|
||||
$(".st4").animate({top: "-=18px"}, {duration: speed, queue: false, complete: function() {
|
||||
$(".st3").animate({top: "-=18px"}, {duration: speed, queue: false, complete: function() {
|
||||
$(".st2").animate({top: "-=18px"}, {duration: speed, queue: false, complete: function() {
|
||||
$(".st1").animate({top: "-=18px"}, {duration: speed, queue: false, complete: function() {
|
||||
$(".st1").remove()
|
||||
}});
|
||||
}});
|
||||
}});
|
||||
}});
|
||||
|
||||
drop_down = false;
|
||||
});
|
||||
|
||||
//Make sure the elements stay correctly positioned
|
||||
$("#formHeader").css("margin-left", $(".colored").css("margin-left"));
|
||||
$("#formHeader").css("width", $(".colored").css("width"));
|
||||
$(window).resize( function(e) {
|
||||
$("#formHeader").css("margin-left", $(".colored").css("margin-left"));
|
||||
$("#formHeader").css("width", $(".colored").css("width"));
|
||||
|
||||
//Remove drop down for entry amount selection
|
||||
$(".st1").remove();
|
||||
$("#entry_submit").css("cursor", "default");
|
||||
$("#entry_submit").css("opacity", "0.0");
|
||||
$("#entry_submit").blur();
|
||||
|
||||
drop_down = false;
|
||||
});
|
||||
|
||||
//If there are pages to go back to, go back
|
||||
if( $("#curr_button").html() == 1) {
|
||||
$("#back_button").css( "cursor", "default" );
|
||||
$("#back_button").css( "color", "grey" );
|
||||
}
|
||||
$("#back_button").click( function(e) {
|
||||
if( $("#curr_button").html() != 1) {
|
||||
window.open( $(".page_button:first").children().attr("href"), "_self" );
|
||||
}
|
||||
});
|
||||
|
||||
//If there is a next page, go to the next page
|
||||
if( ${int(page_specs.pages_found)} == 1 ) {
|
||||
$("#next_button").css( "cursor", "default" );
|
||||
$("#next_button").css( "color", "grey" );
|
||||
}
|
||||
$("#next_button").click( function(e) {
|
||||
if( ${int(page_specs.pages_found)} > 1 ) {
|
||||
window.open( $(".page_button:last").children().attr("href"), "_self" );
|
||||
}
|
||||
});
|
||||
|
||||
//Select amount of entries per page
|
||||
$("#entry_form").on( "mousedown", ".st1", function(e) {
|
||||
e.preventDefault();
|
||||
$("#entries_edit").val( $(this).html() );
|
||||
});
|
||||
|
||||
$("#entry_form").on("mouseenter", ".st1", function(e) {
|
||||
$(this).css({
|
||||
"border-color": "black",
|
||||
"background-color": "#ebd9b2",
|
||||
})
|
||||
});
|
||||
|
||||
$("#entry_form").on("mouseleave", ".st1", function(e) {
|
||||
$(this).css({
|
||||
"border-color": "grey",
|
||||
"background-color": "white",
|
||||
})
|
||||
});
|
||||
|
||||
$("#entries_edit").click( function(e) {
|
||||
if(!drop_down) {
|
||||
//Initialize items
|
||||
$("#entries_edit").parent().append("<div class=\"st1\"\">10</div>");
|
||||
$("#entries_edit").parent().append("<div class=\"st1 st2\">25</div>");
|
||||
$("#entries_edit").parent().append("<div class=\"st1 st2 st3\">50</div>");
|
||||
$("#entries_edit").parent().append("<div class=\"st1 st2 st3 st4\">100</div>");
|
||||
|
||||
$("#entry_submit").css("cursor", "pointer");
|
||||
|
||||
var top_pos = $("#entries_edit").offset().top;
|
||||
var left_pos = $("#entries_edit").offset().left;
|
||||
$(".st1").css({
|
||||
"cursor": "pointer",
|
||||
"position": "absolute",
|
||||
"text-align": "center",
|
||||
"border": "1px solid grey",
|
||||
"background-color": "white",
|
||||
"margin-left": "3px",
|
||||
"top": top_pos,
|
||||
"left": left_pos,
|
||||
"width": "30px",
|
||||
"z-index": "4",
|
||||
});
|
||||
$(".st1").css({
|
||||
"top": $("#entries_edit").offset().top,
|
||||
});
|
||||
$(".st2").css({"z-index": "3"})
|
||||
$(".st3").css({"z-index": "2"})
|
||||
$(".st4").css({
|
||||
"z-index": "1",
|
||||
"border-bottom-left-radius": "3px",
|
||||
"border-bottom-right-radius": "3px",
|
||||
});
|
||||
|
||||
//Anitmate items
|
||||
var speed = 50;
|
||||
$("#entry_submit").fadeTo(speed, 1.0);
|
||||
$(".st1").animate({top: "+=18px"}, speed);
|
||||
$(".st2").animate({top: "+=18px"}, speed);
|
||||
$(".st3").animate({top: "+=18px"}, speed);
|
||||
$(".st4").animate({top: "+=18px"}, speed);
|
||||
}
|
||||
|
||||
drop_down = true;
|
||||
});
|
||||
});
|
||||
</script>
|
||||
</%def>
|
||||
@@ -3,8 +3,10 @@
|
||||
if sort_id == test_id:
|
||||
if order == "asc":
|
||||
tool_order = "desc"
|
||||
else:
|
||||
elif order == "desc":
|
||||
tool_order = "asc"
|
||||
else:
|
||||
tool_order = "default"
|
||||
else:
|
||||
tool_order = "default"
|
||||
%>
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
<%namespace file="/message.mako" import="render_msg" />
|
||||
<%namespace file="/spark_base.mako" import="jqs_style, make_sparkline" />
|
||||
<%namespace file="/sorting_base.mako" import="get_sort_url, get_css" />
|
||||
<%namespace file="/page_base.mako" import="get_pages, get_entry_selector" />
|
||||
|
||||
%if message:
|
||||
${render_msg( message, 'done' )}
|
||||
@@ -13,8 +14,20 @@ ${get_css()}
|
||||
<!--jobs_specified_month_all.mako-->
|
||||
<div class="toolForm">
|
||||
<div class="toolFormBody">
|
||||
<h4 align="center">Jobs for ${month_label} ${year_label}</h4>
|
||||
<h5 align="center">Click job count to see the day's details</h5>
|
||||
<table id="formHeader">
|
||||
<tr>
|
||||
<td>
|
||||
${get_pages( sort_id, order, page_specs, 'jobs', 'specified_month_all' )}
|
||||
</td>
|
||||
<td>
|
||||
<h4 align="center">Jobs for ${month_label} ${year_label}</h4>
|
||||
<h5 align="center">Click job count to see the day's details</h5>
|
||||
</td>
|
||||
<td align="right">
|
||||
${get_entry_selector("jobs", "specified_month_all", page_specs.entries, sort_id, order)}
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<table align="center" width="60%" class="colored">
|
||||
%if len( jobs ) == 0:
|
||||
<tr><td colspan="5">There are no jobs for ${month_label} ${year_label}</td></tr>
|
||||
@@ -22,37 +35,49 @@ ${get_css()}
|
||||
<tr class="header">
|
||||
<td class="quarter_width">Day</td>
|
||||
<td class="quarter_width">
|
||||
${get_sort_url(sort_id, order, 'date', 'jobs', 'specified_month_all', 'Date')}
|
||||
${get_sort_url(sort_id, order, 'date', 'jobs', 'specified_month_all', 'Date', page=page_specs.page, entries=page_specs.entries)}
|
||||
<span class='dir_arrow date'>${arrow}</span>
|
||||
</td>
|
||||
%if is_user_jobs_only:
|
||||
<td class="quarter_width">
|
||||
${get_sort_url(sort_id, order, 'total_jobs', 'jobs', 'specified_month_all', 'User Jobs')}
|
||||
${get_sort_url(sort_id, order, 'total_jobs', 'jobs', 'specified_month_all', 'User Jobs', page=page_specs.page, entries=page_specs.entries)}
|
||||
<span class='dir_arrow total_jobs'>${arrow}</span>
|
||||
</td>
|
||||
%else:
|
||||
<td class="quarter_width">
|
||||
${get_sort_url(sort_id, order, 'total_jobs', 'jobs', 'specified_month_all', 'User and Monitor Jobs')}
|
||||
${get_sort_url(sort_id, order, 'total_jobs', 'jobs', 'specified_month_all', 'User and Monitor Jobs', page=page_specs.page, entries=page_specs.entries)}
|
||||
<span class='dir_arrow total_jobs'>${arrow}</span>
|
||||
</td>
|
||||
%endif
|
||||
<td></td>
|
||||
</tr>
|
||||
<% ctr = 0 %>
|
||||
<%
|
||||
ctr = 0
|
||||
entries = 1
|
||||
%>
|
||||
%for job in jobs:
|
||||
<% key = job[1] %>
|
||||
|
||||
%if entries > page_specs.entries:
|
||||
<%break%>
|
||||
%endif
|
||||
|
||||
%if ctr % 2 == 1:
|
||||
<tr class="odd_row">
|
||||
%else:
|
||||
<tr class="tr">
|
||||
%endif
|
||||
|
||||
<td>${job[0]}</td>
|
||||
<td>${month_label} ${job[1]}, ${year_label}</td>
|
||||
<td><a href="${h.url_for( controller='jobs', action='specified_date_handler', specified_date=job[3], webapp='reports', sort_id='default', order='default' )}">${job[2]}</a></td>
|
||||
${make_sparkline(key, trends[key], "bar", "/ hour")}
|
||||
<td id="${key}"></td>
|
||||
</tr>
|
||||
<% ctr += 1 %>
|
||||
<%
|
||||
ctr += 1
|
||||
entries += 1
|
||||
%>
|
||||
%endfor
|
||||
%endif
|
||||
</table>
|
||||
|
||||
Reference in New Issue
Block a user