Merge lp:~stylesen/lava-scheduler/multinode into lp:lava-scheduler/multinode

Proposed by Senthil Kumaran S
Status: Merged
Approved by: Neil Williams
Approved revision: no longer in the source branch.
Merge reported by: Neil Williams
Merged at revision: not available
Proposed branch: lp:~stylesen/lava-scheduler/multinode
Merge into: lp:lava-scheduler/multinode
Diff against target: 90 lines (+57/-1)
3 files modified
lava_scheduler_app/static/lava_scheduler_app/css/logfile.css (+10/-0)
lava_scheduler_app/templates/lava_scheduler_app/job_log_file.html (+2/-1)
lava_scheduler_app/templatetags/linenumbers.py (+45/-0)
To merge this branch: bzr merge lp:~stylesen/lava-scheduler/multinode
Reviewer Review Type Date Requested Status
Linaro Automation & Validation Pending
Review via email: mp+180109@code.launchpad.net

Description of the change

Bring up-to-date with trunk.

To post a comment you must log in.
272. By Neil Williams

Senthil Kumaran 2013-08-14 [merge] Bring up-to-date with trunk.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'lava_scheduler_app/static/lava_scheduler_app/css/logfile.css'
2--- lava_scheduler_app/static/lava_scheduler_app/css/logfile.css 2011-12-13 04:22:40 +0000
3+++ lava_scheduler_app/static/lava_scheduler_app/css/logfile.css 2013-08-14 11:51:22 +0000
4@@ -24,3 +24,13 @@
5 border-width: medium;
6 }
7
8+.line
9+{
10+ line-height: 18px;
11+ white-space: nowrap;
12+}
13+
14+div:target
15+{
16+ background-color: rgb(255, 128, 128);
17+}
18
19=== modified file 'lava_scheduler_app/templates/lava_scheduler_app/job_log_file.html'
20--- lava_scheduler_app/templates/lava_scheduler_app/job_log_file.html 2012-03-19 23:44:40 +0000
21+++ lava_scheduler_app/templates/lava_scheduler_app/job_log_file.html 2013-08-14 11:51:22 +0000
22@@ -6,6 +6,7 @@
23 {% endblock %}
24
25 {% block content %}
26+{% load linenumbers %}
27 <h2>Dispatcher log file - {{ job.id }} </h1>
28 <a href="{% url lava.scheduler.job.log_file.plain job.pk %}">Download as text file</a>
29
30@@ -15,7 +16,7 @@
31 {% if section.0 == 'console' and section.1 > 20 and not forloop.last %}
32 <a href="#entry{{ forloop.counter }}">skip {{ section.1 }} lines to next log entry &rarr;</a>
33 {% endif %}
34-<pre class="log_{{ section.0 }}">{{ section.2 }}</pre>
35+{% linenumbers section.2 forloop.counter0 section.0 %}
36 {% endfor %}
37 {% if job.status == job.RUNNING %}
38 <img id="progress" src="{{ STATIC_URL }}lava_scheduler_app/images/ajax-progress.gif"/>
39
40=== added directory 'lava_scheduler_app/templatetags'
41=== added file 'lava_scheduler_app/templatetags/__init__.py'
42=== added file 'lava_scheduler_app/templatetags/linenumbers.py'
43--- lava_scheduler_app/templatetags/linenumbers.py 1970-01-01 00:00:00 +0000
44+++ lava_scheduler_app/templatetags/linenumbers.py 2013-08-14 11:51:22 +0000
45@@ -0,0 +1,45 @@
46+from django import template
47+from django.db.models import fields
48+from django.utils.html import escape
49+from django.utils.safestring import mark_safe
50+
51+register = template.Library()
52+
53+class LineNumbers(template.Node):
54+ def __init__(self, text, prefix, style):
55+ self.text = template.Variable(text)
56+ self.prefix = template.Variable(prefix)
57+ self.style = template.Variable(style)
58+
59+ def render(self, context):
60+ text = self.text.resolve(context)
61+ prefix = self.prefix.resolve(context)
62+ style = self.style.resolve(context)
63+ ret = "<table><tr><td>"
64+ for i in range(0, len(text.splitlines())):
65+ name = "L_%s_%s" % (prefix, i)
66+ display = "Section %s.%s" % (prefix, i)
67+ ret += "<div class=\"line\"><a name=\"%s\"></a> \
68+ <a href=\"#%s\">%s</a></div>" % (name, name, display)
69+
70+ ret += "</td><td class=\"code\"><div class=\"containter\"> \
71+ <pre class=\"log_%s\">" % (style)
72+
73+ for index, line in enumerate(text.splitlines()):
74+ ret += "<div id=\"L_%s_%s\" class=\"line\"> &nbsp;%s</div>" % \
75+ (prefix,
76+ index,
77+ mark_safe(escape(line).encode('ascii', 'xmlcharrefreplace')))
78+
79+ ret += "</pre></div></td><tr></table>"
80+
81+ return ret
82+
83+@register.tag('linenumbers')
84+def do_linenumbers(parser, token):
85+ try:
86+ tag_name, text, prefix, style = token.split_contents()
87+ except ValueError:
88+ raise template.TemplateSyntaxError("%r tag requires 3 arguments" % \
89+ token.contents.split()[0])
90+ return LineNumbers(text, prefix, style)

Subscribers

People subscribed via source and target branches

to status/vote changes: