Commit 56558b64 authored by Guilhem Saurel's avatar Guilhem Saurel
Browse files

board view

parent 3e03d2d2
Pipeline #14943 failed with stage
in 2 minutes and 46 seconds
......@@ -3,6 +3,10 @@ import logging
import re
from subprocess import check_output
import git
import httpx
from autoslug import AutoSlugField
from autoslug.utils import slugify
from django.conf import settings
from django.db import models
from django.db.models import Q
......@@ -11,11 +15,6 @@ from django.template.loader import get_template
from django.utils import timezone
from django.utils.dateparse import parse_datetime
from django.utils.safestring import mark_safe
import git
import httpx
from autoslug import AutoSlugField
from autoslug.utils import slugify
from github import Github
from gitlab import Gitlab
from ndh.models import Links, NamedModel, TimeStampedModel
......@@ -475,6 +474,18 @@ class Project(Links, NamedModel, TimeStampedModel):
link = repo.first().url + '/pipeline_schedules'
return mark_safe(f'<a href="{link}">{self.cron()}</a>')
def pipeline_result(self, branch):
repo = self.main_gitlab_repo()
build = repo.cibuild_set.filter(branch__name__endswith=branch).first()
return None if build is None else build.passed
def master_result(self):
master = self.pipeline_result('master')
return self.pipeline_result('main') if master is None else master
def devel_result(self):
return self.pipeline_result('devel')
def pipeline_results(self):
""" Show state and link to latest master & devel gitlab pipelines """
repo = self.main_gitlab_repo()
......
{% extends 'base.html' %}
{% load django_tables2 bootstrap4 %}
{% block content %}
<h1>Projects</h1>
<table class="table">
<thead>
<tr>
<th scope="col">Project</th>
<th scope="col">Master</th>
<th scope="col">Devel</th>
<th scope="col">Commits since</th>
<th scope="col">Issues</th>
<th scope="col">PR</th>
</tr>
</thead>
<tbody>
{% for project in projects %}
<tr>
<th scope="row">{{ project.get_link }}</th>
<td>{{ project.master_result|yesno:"✔,✘,?" }}</td>
<td>{{ project.devel_result|yesno:"✔,✘,?" }}</td>
<td>{{ project.commits_since }}</td>
<td>{{ project.open_issues }}
<td>{{ project.open_pr }}
</tr>
{% endfor %}
</tbody>
</table>
{% endblock %}
......@@ -21,7 +21,7 @@ router.register(r'dependency', views.DependencyViewSet)
app_name = 'rainboard'
urlpatterns = [
path('', RedirectView.as_view(pattern_name='rainboard:gepetto'), name='home'),
path('', views.BoardView.as_view(), name='home'),
path('forges', views.ForgesView.as_view(), name='forges'),
path('namespaces', views.NamespacesView.as_view(), name='namespaces'),
path('contributors', views.ContributorsView.as_view(), name='contributors'),
......
......@@ -3,8 +3,7 @@ from subprocess import PIPE, Popen, run
from django.http import Http404
from django.http.response import HttpResponse, HttpResponseRedirect, JsonResponse
from django.urls import reverse
from django.views.generic import DetailView
from django.views.generic import DetailView, TemplateView
from django_filters.views import FilterView
from django_tables2 import RequestConfig
from django_tables2.views import SingleTableMixin, SingleTableView
......@@ -236,3 +235,10 @@ class ContributorMailViewSet(AuthenticatedOrReadOnlyModelViewSet):
class DependencyViewSet(AuthenticatedOrReadOnlyModelViewSet):
queryset = models.Dependency.objects.all()
serializer_class = serializers.DependencySerializer
class BoardView(TemplateView):
template_name = 'rainboard/board.html'
def get_context_data(self, **kwargs):
return {'projects': models.Project.objects.exclude(models.BAD_ONES)}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment