From: Michael Tremer Date: Sun, 25 Nov 2012 14:57:02 +0000 (+0100) Subject: builds: Move jobs to the side of the log. X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=3c7e0537deef0d2dd8c9a3fb6f097e8c1062b0f7;p=people%2Fjschlag%2Fpbs.git builds: Move jobs to the side of the log. --- diff --git a/data/static/css/style.css b/data/static/css/style.css index 3f10a95..c8f1c33 100644 --- a/data/static/css/style.css +++ b/data/static/css/style.css @@ -69,3 +69,31 @@ body { .line-through { text-decoration: line-through; } + +.jobs-boxes .well { + background: #fff; +} + +.jobs-boxes h4 p { + font-weight: bold; +} + +.jobs-boxes .warning { + background-color: #fcf8e3; +} + +.jobs-boxes .error { + background-color: #f2dede; +} + +.jobs-boxes .success { + background-color: #dff0d8; +} + +.jobs-boxes .info { + background-color: #d9edf7; +} + +.jobs-boxes .well table td { + width: 50%; +} diff --git a/data/templates/build-detail.html b/data/templates/build-detail.html index 219fbf7..f7831fa 100644 --- a/data/templates/build-detail.html +++ b/data/templates/build-detail.html @@ -40,11 +40,7 @@ {% end %} -
-
-
-
-
+
{% if build.type == "release" %}
@@ -205,11 +201,7 @@
-
-
-
-
-
+
{% end %}
@@ -232,128 +224,68 @@
-
+
{% module Log(log) %}
+ +
+ {% module JobsBoxes(build) %} + +

+ {{ _("Source package") }} +

+
+
+
-
- -
- -
- - - - - - - - {% if build.pkg.requires %} - - - - - {% end %} - -
{{ _("Source package") }} - {{ build.pkg.friendly_name }} -
{{ _("Build dependencies") }} - {{ locale.list(["%(r)s" % { "r" : r } for r in build.pkg.requires]) }} -
-
-
-
- + + {{ _("Priority") }} + + + {% if build.priority >= 2 %} + {{ _("Very high") }} + {% elif build.priority == 1 %} + {{ _("High") }} + {% elif build.priority == 0 %} + {{ _("Medium") }} + {% elif build.priority == -1 %} + {{ _("Low") }} + {% elif build.priority <= -2 %} + {{ _("Very low") }} + {% end %} + + + + {% end block %} diff --git a/data/templates/modules/jobs/boxes.html b/data/templates/modules/jobs/boxes.html new file mode 100644 index 0000000..504acef --- /dev/null +++ b/data/templates/modules/jobs/boxes.html @@ -0,0 +1,33 @@ +
+ {% for j in jobs %} +
+

+ {% module JobState(j, cls="pull-right") %} + {{ j.arch.name }} +

+ + + + + + + + {% if j.builder %} + + + + + {% end %} + +
+ {{ _("Duration") }} + + {{ friendly_time(j.duration) }} +
+ {{ _("Builder") }} + + {{ j.builder.name }} +
+
+ {% end %} +
diff --git a/web/__init__.py b/web/__init__.py index b3d6d95..73be54c 100644 --- a/web/__init__.py +++ b/web/__init__.py @@ -48,6 +48,8 @@ class Application(tornado.web.Application): "ChangelogEntry" : ChangelogEntryModule, "CommitsTable" : CommitsTableModule, + "JobsBoxes" : JobsBoxesModule, + "JobState" : JobStateModule, "JobsTable" : JobsTableModule, "JobsList" : JobsListModule, "CommentsTable" : CommentsTableModule, diff --git a/web/ui_modules.py b/web/ui_modules.py index 6979fd8..3175f41 100644 --- a/web/ui_modules.py +++ b/web/ui_modules.py @@ -181,6 +181,65 @@ class BuildStateWarningsModule(UIModule): return self.render_string("modules/build-state-warnings.html", build=build) +class JobsBoxesModule(UIModule): + def render(self, build, jobs=None): + if jobs is None: + jobs = build.jobs + + return self.render_string("modules/jobs/boxes.html", + build=build, jobs=jobs) + + +class JobStateModule(UIModule): + def render(self, job, cls=None): + state = job.state + + _ = self.locale.translate + classes = [] + + if state == "aborted": + text = _("Aborted") + classes.append("muted") + + elif state == "dependency_error": + text = _("Dependency problem") + classes.append("text-warning") + + elif state == "dispatching": + text = _("Dispatching") + classes.append("text-info") + + elif state == "failed": + text = _("Failed") + classes.append("text-error") + + elif state == "finished": + text = _("Finished") + classes.append("text-success") + + elif state == "new": + text = _("New") + classes.append("muted") + + elif state == "pending": + text = _("Pending") + classes.append("muted") + + elif state == "running": + text = _("Running") + classes.append("text-info") + + # Return just the string, is state is unknown. + else: + text = _("Unknown: %s") % state + classes.append("muted") + + if cls: + classes.append(cls) + + return """

%s

""" % (" ".join(classes), text) + + class JobsTableModule(UIModule): def render(self, build, jobs=None, type="release"): if jobs is None: