2019-08-23 21:16:30 +07:00
<odoo >
2022-06-30 19:33:18 +07:00
<template id= "alerts" inherit_id= "runbot_merge.alerts" >
2020-02-07 19:47:18 +07:00
<xpath expr= "//div[@id='alerts']" >
<t t-set= "fpcron" t-value= "env(user=1).ref('forwardport.port_forward')" />
<div t-if= "not fpcron.active" class= "alert alert-warning col-12" role= "alert" >
Forward-port is disabled, merged pull requests will not be forward-ported.
</div>
</xpath>
2021-07-28 18:57:58 +07:00
<!-- key block (hopefully) -->
<xpath expr= "//div[@id='alerts']" position= "inside" >
<t t-if= "env['runbot_merge.pull_requests'].check_access_rights('read', False)" >
<t t-set= "outstanding" t-value= "env['runbot_merge.pull_requests'].search_count([
2023-07-06 15:28:52 +07:00
('state', 'in', ['opened', 'validated', 'approved', 'ready', 'error']),
2023-08-14 13:00:56 +07:00
('source_id.merge_date', '< ', datetime.datetime.now() - relativedelta(days=7)),
2021-07-28 18:57:58 +07:00
])"/>
2021-10-20 19:28:29 +07:00
<div t-if= "outstanding != 0" class= "alert col-md-12 alert-warning mb-0" >
2021-07-28 18:57:58 +07:00
<a href= "/forwardport/outstanding" >
2023-08-14 13:00:56 +07:00
<t t-esc= "outstanding" /> outstanding forward-ports (>1 week)
2021-07-28 18:57:58 +07:00
</a>
</div>
</t>
</xpath>
</template>
<template id= "pr_background" >
<t t-if= "p.state == 'merged'" > bg-success</t>
<t t-elif= "p.state == 'closed'" > bg-light</t>
<t t-elif= "p.state == 'error'" > bg-danger</t>
<t t-else= "" > bg-warning</t>
</template>
2023-07-05 20:11:40 +07:00
<template id= "outstanding" name= "Outstanding forward ports" >
<t t-call= "website.layout" >
<div id= "wrap" class= "oe_structure oe_empty" > <div class= "container-fluid" >
<div class= "alert bg-light outstanding-partners" >
<t t-foreach= "groups" t-as= "group" >
<span >
<t t-if= "group == current_group" >
<span class= "bg-primary" t-out= "group.display_name" />
<a t-att-href= "link()" class= "btn fa fa-times p-0" />
</t>
<t t-else= "" >
<a t-att-href= "link(group=group.id, partner=0)" t-out= "group.display_name" />
2021-10-19 19:39:19 +07:00
</t>
2023-07-05 20:11:40 +07:00
</span>
</t>
</div>
<div class= "alert bg-light outstanding-partners" >
<t t-foreach= "culprits" t-as= "culprit" >
<t t-set= "approved" t-value= "outstanding_per_reviewer[culprit]" />
<t t-set= "created" t-value= "outstanding_per_author[culprit]" />
<a t-att-href= "link(partner=culprit.id)"
t-attf-title="approved {{approved}}, created {{created}}"
><t t-out= "culprit.display_name" /> :
<t t-if= "approved" t-out= "approved" />
<t t-if= "approved and created" > + </t>
<t t-if= "created" t-out= "created" />
</a>
</t>
</div>
<t t-if= "not single" >
by
<span class= "btn-group btn-group-toggle" >
<a t-att-href= "link(authors=1, reviewers=1)"
t-attf-class="btn btn-sm btn-secondary {{'active' if authors and reviewers else ''}}">
both
</a>
<a t-att-href= "link(authors=1, reviewers=0)"
t-attf-class="btn btn-sm btn-secondary {{'active' if authors and not reviewers else ''}}">
creators
</a>
<a t-att-href= "link(reviewers=1, authors=0)"
t-attf-class="btn btn-sm btn-secondary {{'active' if reviewers and not authors else ''}}">
reviewers
</a>
</span>
2021-07-28 18:57:58 +07:00
</t>
2023-07-05 20:11:40 +07:00
<h1 > List of pull requests with outstanding forward ports</h1>
<h2 t-if= "single" >
for <span t-field= "single.display_name" t-attf-title= "@{{single.github_login}}" />
<a t-att-href= "link(partner=0)" title= "All Users" class= "btn fa fa-times" />
<span class= "btn-group btn-group-toggle" >
<a t-att-href= "link(authors=1, reviewers=1)"
t-attf-class="btn btn-sm btn-secondary {{'active' if authors and reviewers else ''}}">
both
</a>
<a t-att-href= "link(authors=1, reviewers=0)"
t-attf-class="btn btn-sm btn-secondary {{'active' if authors and not reviewers else ''}}">
created
</a>
<a t-att-href= "link(reviewers=1, authors=0)"
t-attf-class="btn btn-sm btn-secondary {{'active' if reviewers and not authors else ''}}">
reviewed
</a>
</span>
</h2>
<dl > <t t-foreach= "outstanding" t-as= "x" >
<t t-set= "source" t-value= "x['source']" />
<t t-if= "not single or source.reviewed_by == single or source.author == single" >
<dt >
<a t-att-href= "source.url" > <span t-field= "source.display_name" /> </a>
created by <span t-field= "source.author.display_name"
t-attf-title="@{{source.author.github_login}}"/>
merged <span t-field= "source.merge_date"
t-options="{'widget': 'relative'}"
t-att-title="source.merge_date"/>
by <span t-field= "source.reviewed_by.display_name"
t-attf-title="@{{source.reviewed_by.github_login}}"/>
</dt>
<dd >
Outstanding forward-ports:
<ul >
<li t-foreach= "x['prs']" t-as= "p" >
<a t-att-href= "p.url" > <span t-field= "p.display_name" /> </a>
(<span t-field= "p.state" /> )
targeting <span t-field= "p.target.name" />
</li>
</ul>
</dd>
</t>
</t> </dl>
</div> </div>
</t>
</template>
2021-07-28 18:57:58 +07:00
<template id= "view_pull_request" inherit_id= "runbot_merge.view_pull_request" >
<xpath expr= "//dl[hasclass('runbot-merge-fields')]" position= "inside" >
<t t-if= "pr.state == 'merged'" >
<dt > merged</dt>
<dd >
<span t-field= "pr.merge_date" t-options= "{'widget': 'relative'}"
t-att-title="pr.merge_date"/>
2021-10-19 19:39:19 +07:00
by <span t-field= "pr.reviewed_by.display_name"
t-attf-title="@{{pr.reviewed_by.github_login}}"/>
2021-07-28 18:57:58 +07:00
</dd>
</t>
<t t-if= "pr.source_id" >
<dt > forward-port of</dt>
<dd >
<a t-att-href= "pr.source_id.url" >
<span t-field= "pr.source_id.display_name" />
</a>
2022-06-29 16:09:55 +07:00
<span t-if= "not pr.parent_id"
class="badge badge-danger user-select-none"
title="A detached PR behaves like a non-forward-port, it has to be approved via the mergebot, this is usually caused by the forward-port having been in conflict or updated.">
2023-01-19 20:23:41 +07:00
DETACHED (<span t-out= "pr.detach_reason" style= "white-space: pre-wrap;" /> )
2022-06-29 16:09:55 +07:00
</span>
2021-07-28 18:57:58 +07:00
</dd>
</t>
<t t-if= "pr.forwardport_ids" >
<dt > forward-ports</dt>
<dd > <ul >
<t t-foreach= "pr.forwardport_ids" t-as= "p" >
<t t-set= "bgsignal" > <t t-call= "forwardport.pr_background" /> </t>
<li t-att-class= "bgsignal" >
<a t-att-href= "p.url" > <span t-field= "p.display_name" /> </a>
targeting <span t-field= "p.target.name" />
</li>
</t>
</ul> </dd>
</t>
</xpath>
2020-02-07 19:47:18 +07:00
</template>
2019-08-23 21:16:30 +07:00
<record model= "ir.ui.view" id= "project" >
<field name= "name" > Show forwardport project fields</field>
<field name= "inherit_id" ref= "runbot_merge.runbot_merge_form_project" />
<field name= "model" > runbot_merge.project</field>
<field name= "arch" type= "xml" >
<xpath expr= "//sheet/group[2]" position= "after" >
<group string= "Forwardport Configuration" >
<group >
<field string= "Token" name= "fp_github_token" />
</group>
<group >
2023-08-22 13:01:38 +07:00
<field string= "Bot Name" name= "fp_github_name" readonly= "0" />
<field string= "Bot Email" name= "fp_github_email" readonly= "0" />
2019-08-23 21:16:30 +07:00
</group>
</group>
</xpath>
<xpath expr= "//field[@name='repo_ids']/tree" position= "inside" >
<field string= "FP remote" name= "fp_remote_target"
help="Repository where forward port branches will be created"
/>
</xpath>
</field>
</record>
2021-08-03 19:04:38 +07:00
<record model= "ir.ui.view" id= "repository" >
<field name= "name" > Show forwardport repository fields</field>
<field name= "inherit_id" ref= "runbot_merge.form_repository" />
<field name= "model" > runbot_merge.repository</field>
<field name= "arch" type= "xml" >
<field name= "branch_filter" position= "after" >
<field string= "FP remote" name= "fp_remote_target"
help="Repository where forward port branches will be created"/>
</field>
</field>
</record>
2019-08-23 21:16:30 +07:00
<record model= "ir.ui.view" id= "pr" >
<field name= "name" > Show forwardport PR fields</field>
<field name= "inherit_id" ref= "runbot_merge.runbot_merge_form_prs" />
<field name= "model" > runbot_merge.pull_requests</field>
<field name= "arch" type= "xml" >
2022-06-07 20:49:52 +07:00
<xpath expr= "//field[@name='state']" position= "after" >
<field name= "merge_date" attrs= "{'invisible': [('state', '!=', 'merged')]}" />
</xpath>
2019-08-23 21:16:30 +07:00
<xpath expr= "//sheet/group[2]" position= "after" >
2020-07-13 18:15:03 +07:00
<separator string= "Forward Port" attrs= "{'invisible': [('source_id', '=', False)]}" />
<group attrs= "{'invisible': [('source_id', '!=', False)]}" >
<group >
<field string= "Policy" name= "fw_policy" />
</group>
</group>
2019-08-23 21:16:30 +07:00
<group attrs= "{'invisible': [('source_id', '=', False)]}" >
<group >
<field string= "Original PR" name= "source_id" />
</group>
<group attrs= "{'invisible': [('parent_id', '=', False)]}" >
<field name= "parent_id" />
</group>
<group colspan= "4" attrs= "{'invisible': [('parent_id', '!=', False)]}" >
2023-01-19 20:23:41 +07:00
<field string= "Detached because" name= "detach_reason" readonly= "1" />
2019-08-23 21:16:30 +07:00
</group>
<group >
<field string= "Forward ported up to" name= "limit_id" />
</group>
</group>
</xpath>
</field>
</record>
</odoo>