[IMP] runbot_merge: dashboard clarity

* split out truly awaiting PRs from those waiting on an event of some
  sort
* if a staging is active but doesn't have a state yet, it should be
  considered pending not cancelled

closes #74
This commit is contained in:
Xavier Morel 2019-03-04 12:11:34 +01:00
parent b699ea7f47
commit 1f30af4345
2 changed files with 29 additions and 2 deletions

View File

@ -440,6 +440,24 @@ class PullRequests(models.Model):
" PR is linked to an other non-ready PR"
)
@property
def blocked(self):
if self.state not in ('ready', 'merged', 'closed'):
return True
if not (self.squash or self.merge_method):
return True
# can't be blocked on a co-dependent PR if it's a patch-*
if re.search(r':patch-\d+$', self.label):
return False
return bool(self.search_count([
('id', '!=', self.id),
('label', '=', self.label),
('state', '!=', 'ready'),
('priority', '!=', 0),
]))
@api.depends('head')
def _compute_statuses(self):
Commits = self.env['runbot_merge.commit']

View File

@ -53,7 +53,16 @@
<t t-if="ready_unstaged">
<h5 style="display: inline-block;">Awaiting</h5>
<ul class="list-inline" style="display: inline-block;">
<li t-foreach="ready_unstaged" t-as="pr">
<li t-foreach="ready_unstaged" t-as="pr" t-if="not pr.blocked">
<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>
</li>
</ul>
<h5 style="display: inline-block;">Blocked</h5>
<ul class="list-inline" style="display: inline-block;">
<li t-foreach="ready_unstaged" t-as="pr" t-if="pr.blocked">
<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"/>
@ -71,7 +80,7 @@
<t t-foreach="branch.staging_ids.sorted(lambda s: s.staged_at, reverse=True)[:6]" t-as="staging">
<t t-set="success" t-value="staging.state == 'success'"/>
<t t-set="failure" t-value="staging.state == 'failure'"/>
<t t-set="pending" t-value="staging.state == 'pending' and staging.active"/>
<t t-set="pending" t-value="staging.active and (not staging.state or staging.state == 'pending')"/>
<t t-set="stateclass">
<t t-if="success">bg-success</t>
<t t-if="failure">bg-danger</t>