]> git.ipfire.org Git - pbs.git/commitdiff
bootstrap4: add ui module BuildState
authorJonatan Schlag <jonatan.schlag@ipfire.org>
Thu, 4 Jan 2018 15:23:40 +0000 (16:23 +0100)
committerJonatan Schlag <jonatan.schlag@ipfire.org>
Thu, 4 Jan 2018 15:25:34 +0000 (16:25 +0100)
This module is ised in the build table to format the builds based on
there status.

Signed-off-by: Jonatan Schlag <jonatan.schlag@ipfire.org>
src/web/__init__.py
src/web/ui_modules.py

index e77a8c1ff59782a3a57cc8fcd648f9ceea604c14..e6fd3efd882759ab44e4a5f942cec01b2f2c7e9c 100644 (file)
@@ -56,6 +56,7 @@ class Application(tornado.web.Application):
 
                                "BuildHeadline"      : ui_modules.BuildHeadlineModule,
                                "BuildStateWarnings" : ui_modules.BuildStateWarningsModule,
+                               "BuildState"         : ui_modules.BuildState,
 
                                "BugsTable"          : ui_modules.BugsTableModule,
                                "BuildLog"           : ui_modules.BuildLogModule,
index f4be0ff07c528d6599d0eff3c8cd9cf61d05d268..4ebc4d1f1379ff2c6acb4de131a9ad88cd6b35bd 100644 (file)
@@ -222,6 +222,25 @@ class BuildStateWarningsModule(UIModule):
        def render(self, build):
                return self.render_string("modules/build-state-warnings.html", build=build)
 
+class BuildState(UIModule):
+       def render(self, build_type, build_state):
+               if build_type == "release" and build_state == "stable":
+                       return """text-success"""
+               elif build_type == "release" and build_state == "unstable":
+                       return """text-danger"""
+               elif build_type == "release" and build_state == "testing":
+                       return """text-warning"""
+               elif build_type == "release" and build_state == "obsolete":
+                       return """text-muted"""
+               elif build_type == "scratch" and build_state == "stable":
+                       return """text-success font-italic"""
+               elif build_type == "scratch" and build_state == "unstable":
+                       return """text-danger font-italic"""
+               elif build_type == "scratch" and build_state == "testing":
+                       return """text-warning font-italic"""
+               elif build_type == "scratch" and build_state == "obsolete":
+                       return """text-muted font-italic"""
+
 
 class JobsBoxesModule(UIModule):
        def render(self, build, jobs=None):