]> git.ipfire.org Git - pbs.git/commitdiff
web: Create a new bug list
authorMichael Tremer <michael.tremer@ipfire.org>
Fri, 24 Jun 2022 14:09:23 +0000 (14:09 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Fri, 24 Jun 2022 14:09:23 +0000 (14:09 +0000)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
Makefile.am
src/buildservice/bugtracker.py
src/templates/bugs/modules/list.html [new file with mode: 0644]
src/templates/package-detail-list.html
src/web/__init__.py
src/web/bugs.py [new file with mode: 0644]

index 73033c18d2fb053639ebb93dbaed2368d00f4d3b..71031c08138f30cfc9c157e6f636c080600f54b2 100644 (file)
@@ -127,6 +127,7 @@ web_PYTHON = \
        src/web/__init__.py \
        src/web/auth.py \
        src/web/base.py \
+       src/web/bugs.py \
        src/web/builders.py \
        src/web/builds.py \
        src/web/distributions.py \
@@ -190,6 +191,13 @@ dist_templates_DATA = \
 
 templatesdir = $(datadir)/templates
 
+templates_bugsdir = $(templatesdir)/bugs
+
+dist_templates_bugs_modules_DATA = \
+       src/templates/bugs/modules/list.html
+
+templates_bugs_modulesdir = $(templates_bugsdir)/modules
+
 dist_templates_builders_DATA = \
        src/templates/builders/delete.html \
        src/templates/builders/detail.html \
index 0ced1904329600c96cba40693833ca2d3272022e..f78b9005449f8ea0ca3c571a7d6f5c8045df4bfc 100644 (file)
@@ -154,6 +154,12 @@ class Bug(base.Object):
        def init(self, data):
                self.data = data
 
+       def __repr__(self):
+               return "<%s #%s>" % (self.__class__.__name__, self.id)
+
+       def __str__(self):
+               return "#%s" % self.id
+
        def __eq__(self, other):
                if isinstance(other, self.__class__):
                        return self.id == other.id
diff --git a/src/templates/bugs/modules/list.html b/src/templates/bugs/modules/list.html
new file mode 100644 (file)
index 0000000..378b87d
--- /dev/null
@@ -0,0 +1,23 @@
+<table>
+       <tbody>
+               {% for bug in bugs %}
+                       <tr>
+                               <th scope="row">
+                                       <a href="{{ bug.url }}">{{ bug }}</a>
+                               </th>
+
+                               <td>
+                                       {{ bug.summary }}
+
+                                       <br>
+
+                                       {{ bug.status }} {% if bug.resolution %}{{ bug.resolution }}{% end %}
+
+                                       {% if bug.assignee %}
+                                               &dash; {% module LinkToUser(bug.assignee) %}
+                                       {% end %}
+                               </td>
+                       </tr>
+               {% end %}
+       </tbody>
+</table>
index 40b3e8db68d68afcfb3b16a41d9ca452805e5f24..ee7be16618accecaca2b942c911b65de7139c521 100644 (file)
        {% end %}
 
        {% if bugs %}
-               <div class="row">
-                       <div class="col-12 col-sm-12 col-md-6 col-lg-6 col-xl-6">
-                               <h4>
-                                       {{ _("Open bugs") }}
-                               </h4>
-                       </div>
-                       <div class="col-12 col-sm-12 col-md-6 col-lg-6 col-xl-6">
-                               <div class="btn-group">
-                                       <a class="btn btn-secondary" href="{{ backend.bugzilla.enter_url(package.name) }}" target="_blank">
-                                               {{ _("File new bug") }}
-                                       </a>
-                                       <a class="btn btn-secondary" href="{{ backend.bugzilla.list_url(package.name) }}" target="_blank">
-                                               {{ _("Show all bugs") }}
-                                       </a>
-                               </div>
-                       </div>
-               </div>
-               <div class="row">
-                       <div class="col-12 col-sm-12 col-md-12 col-lg-12 col-xl-12">
-                               {% module BugsTable(package, bugs) %}
-                       </div>
-               </div>
+               <h5>{{ _("Open Bugs In This Package") }}</h5>
+
+               {% module BugsList(bugs) %}
+
+               <a class="secondary button expanded" href="{{ backend.bugzilla.list_url(package.name) }}">
+                       {{ _("Show All Bugs") }}
+               </a>
+
+               <a class="success button expanded" href="{{ backend.bugzilla.enter_url(package.name) }}">
+                       {{ _("File A New Bug") }}
+               </a>
        {% end %}
 {% end block %}
index 1476b3b8d0b1fb16735fbe2a3e802fdf70166da8..9646abf03233bfa1f2f972cc0c4d5ed2a9cad1df 100644 (file)
@@ -12,6 +12,7 @@ from ..constants import *
 
 # Import all handlers
 from . import auth
+from . import bugs
 from . import builders
 from . import builds
 from . import distributions
@@ -43,6 +44,9 @@ class Application(tornado.web.Application):
                                "LogEntry"           : ui_modules.LogEntryModule,
                                "LogEntryComment"    : ui_modules.LogEntryCommentModule,
 
+                               # Bugs
+                               "BugsList"           : bugs.ListModule,
+
                                "BuildHeadline"      : ui_modules.BuildHeadlineModule,
                                "BuildsList"         : builds.ListModule,
                                "BuildStateWarnings" : ui_modules.BuildStateWarningsModule,
diff --git a/src/web/bugs.py b/src/web/bugs.py
new file mode 100644 (file)
index 0000000..4b065a7
--- /dev/null
@@ -0,0 +1,28 @@
+#!/usr/bin/python3
+###############################################################################
+#                                                                             #
+# Pakfire - The IPFire package management system                              #
+# Copyright (C) 2022 Pakfire development team                                 #
+#                                                                             #
+# This program is free software: you can redistribute it and/or modify        #
+# it under the terms of the GNU General Public License as published by        #
+# the Free Software Foundation, either version 3 of the License, or           #
+# (at your option) any later version.                                         #
+#                                                                             #
+# This program is distributed in the hope that it will be useful,             #
+# but WITHOUT ANY WARRANTY; without even the implied warranty of              #
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the               #
+# GNU General Public License for more details.                                #
+#                                                                             #
+# You should have received a copy of the GNU General Public License           #
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.       #
+#                                                                             #
+###############################################################################
+
+import tornado.web
+
+from . import ui_modules
+
+class ListModule(ui_modules.UIModule):
+       def render(self, bugs):
+               return self.render_string("bugs/modules/list.html", bugs=bugs)