mirror of
https://github.com/odoo/runbot.git
synced 2025-03-15 23:45:44 +07:00
[ADD] runbot_merge: trivial dashboard
This commit is contained in:
parent
6494ea6cb0
commit
3b0a794c7b
@ -1,9 +1,10 @@
|
||||
{
|
||||
'name': 'merge bot',
|
||||
'depends': ['contacts'],
|
||||
'depends': ['contacts', 'website'],
|
||||
'data': [
|
||||
'data/merge_cron.xml',
|
||||
'views/res_partner.xml',
|
||||
'views/mergebot.xml',
|
||||
'views/templates.xml',
|
||||
]
|
||||
}
|
||||
|
@ -7,6 +7,8 @@ import werkzeug.exceptions
|
||||
|
||||
from odoo.http import Controller, request, route
|
||||
|
||||
from . import dashboard
|
||||
|
||||
_logger = logging.getLogger(__name__)
|
||||
|
||||
class MergebotController(Controller):
|
10
runbot_merge/controllers/dashboard.py
Normal file
10
runbot_merge/controllers/dashboard.py
Normal file
@ -0,0 +1,10 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
from odoo.http import Controller, route, request
|
||||
|
||||
|
||||
class MergebotDashboard(Controller):
|
||||
@route('/runbot_merge', auth="public", type="http", website=True)
|
||||
def dashboard(self):
|
||||
return request.render('runbot_merge.dashboard', {
|
||||
'projects': request.env['runbot_merge.project'].sudo().search([]),
|
||||
})
|
@ -343,6 +343,11 @@ class Branch(models.Model):
|
||||
)
|
||||
staging_ids = fields.One2many('runbot_merge.stagings', 'target')
|
||||
|
||||
prs = fields.One2many('runbot_merge.pull_requests', 'target', domain=[
|
||||
('state', '!=', 'closed'),
|
||||
('state', '!=', 'merged'),
|
||||
])
|
||||
|
||||
def _auto_init(self):
|
||||
res = super(Branch, self)._auto_init()
|
||||
tools.create_unique_index(
|
||||
@ -380,7 +385,7 @@ class PullRequests(models.Model):
|
||||
message = fields.Text(required=True)
|
||||
squash = fields.Boolean(default=False)
|
||||
|
||||
delegates = fields.Many2many('res.partner', help="Delegate reviewers, not intrisically reviewers but can review this PR")
|
||||
delegates = fields.Many2many('res.partner', help="Delegate reviewers, not intrinsically reviewers but can review this PR")
|
||||
priority = fields.Selection([
|
||||
(0, 'Urgent'),
|
||||
(1, 'Pressing'),
|
||||
|
36
runbot_merge/views/templates.xml
Normal file
36
runbot_merge/views/templates.xml
Normal file
@ -0,0 +1,36 @@
|
||||
<odoo>
|
||||
<template id="dashboard" name="mergebot dashboard">
|
||||
<t t-call="website.layout">
|
||||
<div id="wrap"><div class="container">
|
||||
<section t-foreach="projects" t-as="project" class="row">
|
||||
<h1 class="col-md-12"><t t-esc="project.name"/></h1>
|
||||
<section t-foreach="project.branch_ids" t-as="branch" class="col-md-12">
|
||||
<h2><t t-esc="branch.name"/></h2>
|
||||
<t t-call="runbot_merge.stagings"/>
|
||||
</section>
|
||||
</section>
|
||||
</div></div>
|
||||
</t>
|
||||
</template>
|
||||
<template id="stagings" name="mergebot branch stagings">
|
||||
<ul class="row list-unstyled">
|
||||
<li t-foreach="branch.staging_ids.sorted(lambda s: not s.heads)"
|
||||
t-as="staging"
|
||||
t-attf-class="col-md-3 {{'bg-info' if staging.heads else ''}}">
|
||||
<ul class="list-unstyled">
|
||||
<li t-foreach="staging.batch_ids" t-as="batch">
|
||||
<t t-esc="batch.prs[:1].label"/>
|
||||
<t t-foreach="batch.prs" t-as="pr">
|
||||
<a t-attf-href="https://github.com/{{ pr.repository.name }}/pull/{{ pr.number }}"
|
||||
t-att-title="pr.message.split('\n')[0]"
|
||||
><t t-esc="pr.repository.name"/>#<t t-esc="pr.number"/></a><t t-if="not pr_last">,</t>
|
||||
</t>
|
||||
</li>
|
||||
</ul>
|
||||
<t t-if="staging.heads">
|
||||
Staged at: <t t-esc="staging.staged_at" t-options="{'widget': 'datetime'}"/>
|
||||
</t>
|
||||
</li>
|
||||
</ul>
|
||||
</template>
|
||||
</odoo>
|
Loading…
Reference in New Issue
Block a user