2018-06-18 15:08:48 +07:00
<odoo >
2020-01-23 18:17:20 +07:00
<function model= "website.page" name= "write" >
<value eval= "ref('website.homepage_page')" />
<value eval= "{'active': False}" />
</function>
2020-01-21 17:21:14 +07:00
<template id= "assets_frontend" inherit_id= "web.assets_frontend" >
<xpath expr= "link[last()]" position= "after" >
<link rel= "stylesheet" type= "text/scss" href= "/runbot_merge/static/scss/runbot_merge.scss" />
</xpath>
</template>
2018-09-21 17:19:44 +07:00
2020-01-21 17:21:14 +07:00
<template id= "dashboard" name= "mergebot dashboard" >
2018-06-18 15:08:48 +07:00
<t t-call= "website.layout" >
2018-09-21 17:19:44 +07:00
<div id= "wrap" > <div class= "container-fluid" >
2020-02-07 19:47:18 +07:00
<div id= "alerts" class= "row text-center" >
2021-10-20 19:28:29 +07:00
<div class= "alert alert-light col-md-12 h6 mb-0" >
<a href= "/runbot_merge/changelog" > Changelog</a>
</div>
2020-02-07 19:47:18 +07:00
<t t-set= "stagingcron" t-value= "env(user=1).ref('runbot_merge.staging_cron')" />
2021-10-20 19:28:29 +07:00
<div t-if= "not stagingcron.active" class= "alert alert-warning col-12 mb-0" role= "alert" >
2020-02-07 19:47:18 +07:00
Staging is disabled, "ready" pull requests will not be staged.
</div>
<t t-set= "mergecron" t-value= "env(user=1).ref('runbot_merge.merge_cron')" />
2021-10-20 19:28:29 +07:00
<div t-if= "not mergecron.active" class= "alert alert-warning col-12 mb-0" role= "alert" >
2020-02-07 19:47:18 +07:00
Merging is disabled, stagings will not be disabled.
</div>
</div>
2018-09-21 17:19:44 +07:00
<section t-foreach= "projects.with_context(active_test=False)" t-as= "project" class= "row" >
2018-06-18 15:08:48 +07:00
<h1 class= "col-md-12" > <t t-esc= "project.name" /> </h1>
2018-09-21 17:19:44 +07:00
<div class= "col-md-12" >
key:
<ul class= "list-inline" >
<li class= "bg-success" > success (hopefully merged)</li>
<li class= "bg-info" > ongoing</li>
<li class= "bg-danger" > failure</li>
<li class= "bg-gray-lighter" > cancelled</li>
</ul>
</div>
2019-06-28 16:31:06 +07:00
<section t-foreach= "project.branch_ids" t-as= "branch" t-if= "branch.active" class= "col-md-12" >
2019-08-21 19:15:10 +07:00
<h2 >
<a t-attf-href= "/runbot_merge/{{branch.id}}" >
<t t-esc= "branch.name" />
</a>
</h2>
2018-06-18 15:08:48 +07:00
<t t-call= "runbot_merge.stagings" />
2019-10-07 14:26:27 +07:00
<t t-set= "splits" t-value= "branch.split_ids" />
2018-10-16 18:15:00 +07:00
<t t-set= "ready_unstaged" t-value= "
project.env['runbot_merge.pull_requests'].search([
('target', '=', branch.id),
('state', '=', 'ready'),
('staging_id', '=', False),
2019-10-07 14:26:27 +07:00
]) - splits.mapped('batch_ids.prs')
2018-10-16 18:15:00 +07:00
"/>
2019-03-06 15:46:57 +07:00
<t t-set= "ready" t-value= "ready_unstaged.filtered(lambda p: not p.blocked)" />
2019-03-11 20:51:15 +07:00
<t t-set= "blocked" t-value= "ready_unstaged.filtered(lambda p: p.blocked)" />
2019-10-07 14:26:27 +07:00
<div t-if= "splits" class= "splits bg-warning pr-awaiting" >
<h5 >
Splits
<small class= "text-muted" > will be staged next</small>
</h5>
<ul >
<li t-foreach= "splits" t-as= "split" >
<ul class= "pr-listing list-inline list-unstyled mb0" >
<li t-foreach= "split.mapped('batch_ids.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>
</li>
</ul>
</li>
</ul>
</div>
2019-03-06 15:46:57 +07:00
<div t-if= "ready" class= "pr-listing pr-awaiting bg-warning" >
<h5 > Awaiting</h5>
<ul class= "list-inline" >
<li t-foreach= "ready" t-as= "pr" >
2019-03-04 18:11:34 +07:00
<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>
2019-03-06 15:46:57 +07:00
</div>
<div t-if= "blocked" class= "pr-listing pr-blocked bg-info" >
<h5 > Blocked</h5>
<ul class= "list-inline" >
<li t-foreach= "blocked" t-as= "pr" >
2018-10-16 18:15:00 +07:00
<a t-attf-href= "https://github.com/{{ pr.repository.name }}/pull/{{ pr.number }}"
2020-01-31 21:19:32 +07:00
t-att-title="pr.blocked">
2019-06-11 16:31:24 +07:00
<t t-esc= "pr.repository.name" /> #<t t-esc= "pr.number" />
</a>
</li>
</ul>
</div>
<t t-set= "failed" t-value= "
project.env['runbot_merge.pull_requests'].search([
('target', '=', branch.id),
('state', '=', 'error'),
('staging_id', '=', False),
])
"/>
<div t-if= "failed" class= "pr-listing pr-failed bg-danger" >
<h5 > Failed</h5>
<ul class= "list-inline" >
<li t-foreach= "failed" t-as= "pr" >
<a t-attf-href= "https://github.com/{{ pr.repository.name }}/pull/{{ pr.number }}"
2018-10-16 18:15:00 +07:00
t-att-title="pr.message.split('\n')[0]">
2019-03-02 01:54:43 +07:00
<t t-esc= "pr.repository.name" /> #<t t-esc= "pr.number" />
2018-10-16 18:15:00 +07:00
</a>
</li>
</ul>
2019-03-06 15:46:57 +07:00
</div>
2018-06-18 15:08:48 +07:00
</section>
</section>
</div> </div>
</t>
</template>
<template id= "stagings" name= "mergebot branch stagings" >
2020-07-22 13:42:39 +07:00
<t t-set= "repo_statuses" t-value= "branch.project_id.repo_ids.having_branch(branch).status_ids" />
2018-09-21 17:19:44 +07:00
<ul class= "list-unstyled stagings" >
<t t-foreach= "branch.staging_ids.sorted(lambda s: s.staged_at, reverse=True)[:6]" t-as= "staging" >
2018-10-01 15:21:32 +07:00
<t t-set= "success" t-value= "staging.state == 'success'" />
<t t-set= "failure" t-value= "staging.state == 'failure'" />
2019-03-04 18:11:34 +07:00
<t t-set= "pending" t-value= "staging.active and (not staging.state or staging.state == 'pending')" />
2018-09-21 17:19:44 +07:00
<t t-set= "stateclass" >
2020-03-12 17:05:49 +07:00
<t t-if= "success" > bg-success <t t-if= "staging.active" > bg-unmerged</t> </t>
2018-10-01 15:21:32 +07:00
<t t-if= "failure" > bg-danger</t>
<t t-if= "pending" > bg-info</t>
<t t-if= "not (success or failure or pending)" > bg-gray-lighter</t>
2018-09-21 17:19:44 +07:00
</t>
2019-10-03 15:45:39 +07:00
<t t-set= "decorationclass" >
<t t-if= "staging_index >= 2" > hidden-xs</t>
2018-09-21 17:19:44 +07:00
<t t-if= "staging_index >= 4" > visible-lg-block</t>
2018-06-18 15:08:48 +07:00
</t>
2018-10-01 15:21:32 +07:00
<t t-set= "title" >
<t t-if= "staging.state == 'canceled'" > Cancelled: <t t-esc= "staging.reason" /> </t>
<t t-if= "staging.state == 'ff_failed'" > Fast Forward Failed</t>
2018-10-19 22:24:01 +07:00
<t t-if= "staging.state not in ('canceled', 'ff_failed')" > <t t-esc= "staging.reason" /> </t>
2018-10-01 15:21:32 +07:00
</t>
2019-10-03 15:45:39 +07:00
<li t-attf-class= "staging {{stateclass.strip()}} {{decorationclass.strip()}}" t-att-title= "title.strip() or None" >
2018-09-21 17:19:44 +07:00
<ul class= "list-unstyled" >
<li t-foreach= "staging.batch_ids" t-as= "batch" class= "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>
</li>
</ul>
<t t-if= "staging.heads" >
2018-10-19 22:24:01 +07:00
<div class= "dropdown" >
2021-07-01 13:56:02 +07:00
<button class= "btn btn-link dropdown-toggle" type= "button" data-toggle= "dropdown" aria-haspopup= "true" aria-expanded= "true"
t-attf-title="{{staging.staged_at}}Z">
2018-10-19 22:24:01 +07:00
Staged <span t-field= "staging.staged_at" t-options= "{'widget': 'relative'}" />
<span class= "caret" > </span>
</button>
<ul class= "dropdown-menu" >
<li groups= "runbot_merge.group_admin" >
<a t-attf-href= "/web#id={{staging.id}}&view_type=form&model=runbot_merge.stagings" target= "new" >
Open Staging
</a>
</li>
2020-07-22 13:42:39 +07:00
2020-07-29 13:42:56 +07:00
<t t-set= "statuses" t-value= "{(r, c): (s, t) for r, c, s, t in staging.statuses}" />
2020-07-22 13:42:39 +07:00
<t t-foreach= "repo_statuses._for_staging(staging)" t-as= "req" >
2020-07-29 13:42:56 +07:00
<t t-set= "st" t-value= "statuses.get((req.repo_id.name, req.context)) or ('pending', None)" />
2020-07-22 13:42:39 +07:00
<li t-att-class= "
'bg-success' if st[0] == 'success'
else 'bg-danger' if st[0] in ('error', 'failure')
else 'bg-info'"
>
<a t-att-href= "st[1]" target= "new" >
<t t-esc= "req.repo_id.name" /> : <t t-esc= "req.context" />
</a>
</li>
</t>
2018-10-19 22:24:01 +07:00
</ul>
</div>
2018-09-21 17:19:44 +07:00
</t>
</li>
</t>
2018-06-18 15:08:48 +07:00
</ul>
</template>
2019-08-21 19:15:10 +07:00
<template id= "branch_stagings" name= "mergebot stagings page" >
2020-07-22 13:42:39 +07:00
<t t-set= "repo_statuses" t-value= "branch.project_id.repo_ids.having_branch(branch).status_ids" />
2019-08-21 19:15:10 +07:00
<t t-call= "website.layout" >
<div id= "wrap" > <div class= "container-fluid" >
<section class= "row" >
<h1 class= "col-md-12" > <t t-esc= "branch.project_id.name" /> : <t t-esc= "branch.name" /> </h1>
</section>
2019-08-26 16:55:41 +07:00
<table >
<t t-foreach= "stagings" 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.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>
<t t-if= "pending" > bg-info</t>
<t t-if= "not (success or failure or pending)" >
bg-gray-lighter
</t>
2019-08-21 19:15:10 +07:00
</t>
2019-08-26 16:55:41 +07:00
<t t-set= "title" >
<t t-if= "staging.state == 'canceled'" > Cancelled:
<t t-esc= "staging.reason" />
</t>
<t t-if= "staging.state == 'ff_failed'" > Fast
Forward Failed
</t>
<t t-if= "staging.state not in ('canceled', 'ff_failed')" >
<t t-esc= "staging.reason" />
</t>
2019-08-21 19:15:10 +07:00
</t>
2019-08-26 16:55:41 +07:00
<tr t-att-class= "stateclass"
style="border-bottom: 1px solid gainsboro; vertical-align: top">
<th t-att-title= "title.strip() or None" >
<t t-if= "not staging.heads" >
<span t-field= "staging.staged_at"
2021-07-01 13:56:02 +07:00
t-options="{'format': 'yyyy-MM-dd\'T\'HH:mm:ssZ'}"/>
2019-08-26 16:55:41 +07:00
</t>
2019-10-02 16:01:53 +07:00
<div class= "dropdown" t-if= "staging.heads" >
2019-08-26 16:55:41 +07:00
<button class= "btn btn-link dropdown-toggle"
type="button"
data-toggle="dropdown"
aria-haspopup="true"
aria-expanded="true">
<span t-field= "staging.staged_at"
2021-07-01 13:56:02 +07:00
t-options="{'format': 'yyyy-MM-dd\'T\'HH:mm:ssZ'}"/>
2019-08-26 16:55:41 +07:00
<span class= "caret" > </span>
</button>
<ul class= "dropdown-menu" >
<li groups= "runbot_merge.group_admin" >
<a t-attf-href= "/web#id={{staging.id}}&view_type=form&model=runbot_merge.stagings"
target="new">
Open Staging
</a>
</li>
2020-07-29 13:42:56 +07:00
<t t-set= "statuses" t-value= "{(r, c): (s, t) for r, c, s, t in staging.statuses}" />
2020-07-22 13:42:39 +07:00
<t t-foreach= "repo_statuses._for_staging(staging)" t-as= "req" >
2020-07-29 13:42:56 +07:00
<t t-set= "st" t-value= "statuses.get((req.repo_id.name, req.context)) or ('pending', None)" />
2020-07-22 13:42:39 +07:00
<li t-att-class= "
'bg-success' if st[0] == 'success'
else 'bg-danger' if st[0] in ('error', 'failure')
else 'bg-info'"
>
<a t-att-href= "st[1]"
target="new">
<t t-esc= "req.repo_id.name" /> :
<t t-esc= "req.context" />
</a>
</li>
</t>
2019-08-26 16:55:41 +07:00
</ul>
2019-10-02 16:01:53 +07:00
</div>
2019-08-26 16:55:41 +07:00
</th>
<td >
<ul class= "list-inline list-unstyled mb0" >
<t t-foreach= "staging.batch_ids"
t-as="batch">
<t t-set= "first_pr"
t-value="batch.prs[-1]"/>
<li class= "dropdown" >
<button class= "btn btn-link dropdown-toggle"
type="button"
data-toggle="dropdown"
aria-haspopup="true"
aria-expanded="true"
t-att-title="first_pr.message.split('\n')[0]"
>
<t t-esc= "first_pr.label" />
<span class= "caret" > </span>
</button>
<ul class= "dropdown-menu" >
<li 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]"
target="new">
<t t-esc= "pr.repository.name" />
#
<t t-esc= "pr.number" />
</a>
</li>
</ul>
</li>
</t>
</ul>
</td>
</tr>
</t>
</table>
2019-08-21 19:15:10 +07:00
<t t-if= "next" >
<a t-attf-href= "/runbot_merge/{{branch.id}}?until={{next}}" >
Next >
</a>
</t>
</div> </div>
</t>
</template>
2021-10-20 19:28:29 +07:00
<template id= "changelog" name= "mergebot changelog" >
<t t-call= "website.layout" >
<div id= "wrap" > <div class= "container-fluid" >
<h1 > Changelog</h1>
<section t-foreach= "entries" t-as= "entry" >
<h3 t-if= "not entry_first" t-esc= "entry" />
<ul >
<li t-foreach= "sorted(entry_value)" t-as= "item" >
2022-03-18 21:53:49 +07:00
<t t-out= "item" />
2021-10-20 19:28:29 +07:00
</li>
</ul>
</section>
</div> </div>
</t>
</template>
2020-11-13 16:38:48 +07:00
<template id= "view_pull_request_info_merged" >
<div class= "alert alert-success" >
Merged
<t t-if= "merged_head" >
at <a t-attf-href= "https://github.com/{{pr.repository.name}}/commit/{{merged_head}}" > <t t-esc= "merged_head" /> </a>
</t>
2021-07-23 20:45:23 +07:00
<t t-set= "linked_prs" t-value= "pr._linked_prs" />
<div t-if= "linked_prs" >
Linked pull requests
<ul >
<li t-foreach= "linked_prs" t-as= "linked" >
<a t-att-href= "linked.url" t-field= "linked.display_name" />
</li>
</ul>
</div>
2020-11-13 16:38:48 +07:00
</div>
</template>
<template id= "view_pull_request_info_closed" >
<div class= "alert alert-light" >
Closed
</div>
</template>
<template id= "view_pull_request_info_error" >
<div class= "alert alert-danger" >
Error:
2021-08-30 19:40:38 +07:00
<span t-esc= "pr.with_context(active_test=False).batch_ids[-1:].staging_id.reason" >
Unable to stage PR
</span>
2020-11-13 16:38:48 +07:00
</div>
</template>
<template id= "view_pull_request_info_staging" >
<div class= "alert alert-primary" >
Staged <span t-field= "pr.staging_id.staged_at" t-options= "{'widget': 'relative'}" /> .
2021-07-23 20:45:23 +07:00
<t t-set= "linked_prs" t-value= "pr._linked_prs" />
<div t-if= "linked_prs" >
Linked pull requests
<ul >
<li t-foreach= "linked_prs" t-as= "linked" >
<a t-att-href= "linked.url" t-field= "linked.display_name" />
</li>
</ul>
</div>
2020-11-13 16:38:48 +07:00
</div>
</template>
<template id= "view_pull_request_info_open" >
<!-- nb: replicates `blocked`, maybe that should be split into various criteria? -->
<div class= "alert alert-info" >
<p t-if= "pr.blocked" class= "alert-danger" > Blocked</p>
<p t-else= "" class= "alert-success" > Ready (waiting for staging)</p>
<ul class= "todo" >
<li t-att-class= "'ok' if pr.squash or pr.merge_method else 'fail'" >
Merge method
</li>
<li t-att-class= "'ok' if pr._approved else 'fail'" >
Review
</li>
<li t-att-class= "'ok' if pr.state not in ('opened', 'approved') else ''" >
CI
<ul class= "todo" >
<t t-foreach= "pr.repository.status_ids._for_pr(pr)" t-as= "ci" >
<t t-set= "st" t-value= "statuses.get(ci.context.strip())" />
<t t-set= "result" >
<t t-if= "not st or st['state'] == 'pending'" > </t>
<t t-elif= "st['state'] in ('error', 'failure')" > fail</t>
<t t-else= "" > ok</t>
</t>
<li t-att-class= "result" >
<a t-att-href= "st.get('target_url') if st else None" > <t t-esc= "ci.context.strip()" /> </a> <t t-if= "st and st.get('description')" > : <t t-esc= "st['description']" /> </t>
</li>
</t>
</ul>
</li>
<t t-set= "linked_prs" t-value= "pr._linked_prs" />
<li t-if= "linked_prs" t-att-class= "'ok' if all(l._ready for l in linked_prs) else 'fail'" >
Linked pull requests
<ul class= "todo" >
<t t-foreach= "linked_prs" t-as= "linked" >
<li t-att-class= "'ok' if linked._ready else 'fail'" >
2020-12-03 16:47:21 +07:00
<a t-att-href= "linked.url" t-field= "linked.display_name" />
2020-11-13 16:38:48 +07:00
</li>
</t>
</ul>
</li>
</ul>
</div>
</template>
<template id= "view_pull_request" >
<t t-call= "website.layout" >
<div id= "wrap" > <div class= "container-fluid" >
2021-10-19 19:39:19 +07:00
<h1 >
<a t-att-href= "pr.github_url" t-field= "pr.display_name" >
2020-11-13 16:38:48 +07:00
</a>
2021-10-19 19:39:19 +07:00
<a t-attf-href= "/web#view_type=form&model=runbot_merge.pull_requests&id={{pr.id}}"
class="btn btn-sm btn-secondary align-top float-right"
groups="base.group_user">View in backend</a>
</h1>
2020-11-13 16:38:48 +07:00
<h6 > Created by <span t-field= "pr.author.display_name" /> </h6>
<t t-set= "tmpl" >
<t t-if= "pr.state in ('merged', 'closed', 'error')" > <t t-esc= "pr.state" /> </t>
<t t-elif= "pr.staging_id" > staging</t>
<t t-else= "" > open</t>
</t>
<t t-call= "runbot_merge.view_pull_request_info_{{tmpl.strip()}}" />
<dl class= "runbot-merge-fields" >
<dt > label</dt>
<dd > <span t-field= "pr.label" /> </dd>
<dt > head</dt>
2020-11-17 21:21:21 +07:00
<dd > <a t-attf-href= "{{pr.github_url}}/commits/{{pr.head}}" > <span t-field= "pr.head" /> </a> </dd>
2020-11-13 16:38:48 +07:00
</dl>
<p t-field= "pr.message" />
</div> </div>
</t>
</template>
2018-06-18 15:08:48 +07:00
</odoo>