+++ /dev/null
-{% if dates %}
- <div class="table-responsive">
- <table class="table table-striped table-hover">
- <tbody>
- {% for date, builds in dates %}
- <tr>
- <td colspan="{{ colspan }}">
- <h4>
- {% module HeadingDate(date) %}
- <small>({{ len(builds) }})</small>
- </h4>
- </td>
- </tr>
- <tr>
- <th>{{ _("Build") }}</th>
- <th>{{ _("Jobs") }}</th>
- {% if show_repo %}
- <th>{{ _("Repository") }}</th>
- {% end %}
- {% if show_user %}
- <th>{{ _("User") }}</th>
- {% end %}
- {% if show_when %}
- <th>{{ _("Created") }}</th>
- {% end %}
- {% if show_repo_time %}
- <th>{{ _("In repository since") }}</th>
- {% end %}
- {% if show_can_move_forward %}
- <th>{{ _("Can be moved forward") }}</th>
- {% end %}
- </tr>
-
- {% for build in builds %}
- <tr>
- <td class="name">
- <a class="{% module BuildState(build.type, build.state) %}"
- href="/build/{{ build.uuid }}">
- {% if build.is_broken() %}
- <s>{{ build.name }}</s>
- {% else %}
- {{ build.name }}
- {% end %}
- </a>
- </td>
-
- <td>
- {% module JobsStatus(build) %}
- </td>
-
- {% if show_repo %}
- <td>
- {% if build.repo %}
- <a href="/distro/{{ build.distro.identifier }}">{{ build.distro.name }}</a> /
- <a href="/distro/{{ build.distro.identifier }}/repo/{{ build.repo.identifier }}">{{ build.repo.name }}</a>
- {% end %}
- </td>
- {% end %}
-
- {% if show_user %}
- {% if build.type == "scratch" and build.user %}
- <td>
- {% module LinkToUser(build.user) %}
- </td>
- {% elif build.type == "release" %}
- <td>{% module LinkToUser(build.pkg.maintainer) %}</td>
- {% else %}
- <td></td>
- {% end %}
- {% end %}
-
- {% if show_when %}
- <td>
- {{ format_date(build.created, relative=True) }}
- </td>
- {% end %}
-
- {% if show_repo_time %}
- <td>
- {{ format_date(build.repo_time, relative=False) }}
- </td>
- {% end %}
-
- {% if show_can_move_forward %}
- <td>
- {{ build.can_move_forward }}
- </td>
- {% end %}
- </tr>
- {% end %}
- {% end %}
- </tbody>
- </table>
- </div>
-{% else %}
- <p class="text-muted">
- {{ _("There are no builds to show at this place right now.") }}
- </p>
-{% end %}
# Bugs
"BugsList" : bugs.ListModule,
+ # Builds
"BuildsList" : builds.ListModule,
- "BuildState" : ui_modules.BuildState,
- "BuildTable" : ui_modules.BuildTableModule,
# Events
"EventsList" : events.ListModule,
# Jobs
"JobsList" : ui_modules.JobsListModule,
- "JobsStatus" : ui_modules.JobsStatusModule,
# Packages
"PackageInfo" : packages.InfoModule,
"CommitMessage" : ui_modules.CommitMessageModule,
"CommitsTable" : ui_modules.CommitsTableModule,
- "JobState" : ui_modules.JobStateModule,
"LinkToUser" : ui_modules.LinkToUserModule,
"PackageFilesTable" : ui_modules.PackageFilesTableModule,
"SourceTable" : ui_modules.SourceTableModule,
-
- "HeadingDate" : ui_modules.HeadingDateModule,
},
ui_methods = {
"extract_hostname" : self.extract_hostname,
#!/usr/bin/python
-import datetime
import markdown
import pygments
import pygments.formatters
return self.render_string("modules/commit-message.html", commit=commit)
-class JobsStatusModule(UIModule):
- def render(self, build):
- return self.render_string("modules/jobs/status.html",
- build=build, jobs=build.jobs)
-
-
class CommitsTableModule(UIModule):
def render(self, distro, source, commits, full_format=True):
return self.render_string("modules/commits-table.html",
full_format=full_format)
-class HeadingDateModule(UIModule):
- def render(self, date):
- _ = self.locale.translate
-
- # Check if this is today.
- today = datetime.date.today()
- if date == today:
- return _("Today")
-
- # Check if this was yesterday.
- yesterday = today - datetime.timedelta(days=1)
- if date == yesterday:
- return _("Yesterday")
-
- # Convert date to datetime.
- date = datetime.datetime(date.year, date.month, date.day)
-
- return self.locale.format_date(date, shorter=True, relative=False)
-
-
class PackageFilesTableModule(UIModule):
def render(self, pkg, filelist):
return self.render_string("modules/packages-files-table.html",
pkg=pkg, filelist=filelist)
-class BuildTableModule(UIModule):
- def render(self, builds, **kwargs):
- settings = dict(
- show_user = False,
- show_repo = False,
- show_repo_time = False,
- show_can_move_forward = False,
- show_when = True,
- )
- settings.update(kwargs)
-
- colspan = 2
-
- for key in settings.keys():
- if settings.get(key) == True:
- colspan = colspan + 1
-
- settings.setdefault("colspan", colspan)
-
- dates = {}
-
- for b in builds:
- try:
- dates[b.date].append(b)
- except KeyError:
- dates[b.date] = [b,]
-
- dates = sorted(list(dates.items()), reverse=True)
-
- return self.render_string("modules/build-table.html", dates=dates, **settings)
-
-
-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 JobStateModule(UIModule):
- def render(self, job, cls=None, show_arch=False, show_icon=False, plain=False):
- state = job.state
-
- _ = self.locale.translate
- classes = []
-
- classes.append("badge")
-
- icon = None
- if state == "aborted":
- text = _("Aborted")
- classes.append("badge-secondary")
- icon = "icon-warning-sign"
-
- elif state == "dispatching":
- text = _("Dispatching")
- classes.append("badge-info")
- icon = "icon-download-alt"
-
- elif state == "failed":
- text = _("Failed")
- classes.append("badge-danger")
- icon = "icon-remove"
-
- elif state == "finished":
- text = _("Finished")
- classes.append("badge-success")
- icon = "icon-ok"
-
- elif state == "pending":
- text = _("Pending")
- classes.append("badge-secondary")
- icon = "icon-time"
-
- elif state == "running":
- text = _("Running")
- classes.append("badge-info")
- icon = "icon-cogs"
-
- elif state == "uploading":
- text = _("Uploading")
- classes.append("badge-info")
- icon = "icon-upload-alt"
-
- # Return just the string, is state is unknown.
- else:
- text = _("Unknown: %s") % state
- classes.append("text-muted")
-
- if plain:
- return text
-
- if cls:
- classes.append(cls)
-
- if show_arch:
- text = job.arch
-
- if show_icon and icon:
- text = """<i class="%s"></i> %s""" % (icon, text)
-
- return """<span class="%s">%s</span>""" % (" ".join(classes), text)
-
-
class JobsListModule(UIModule):
def render(self, jobs, show_arch_only=False, show_packages=False):
return self.render_string("modules/jobs/list.html", jobs=jobs,