[IMP] runbot_merge: cleanup PR backend

Shove a bunch of stuff in notebook tabs, add a few
affordances (e.g. github and frontend links, links from m2m), surface
a few missing fields.

Hopefully makes the backend form both easier to navigate and easier to
administrate from.
This commit is contained in:
Xavier Morel 2024-04-25 12:04:26 +02:00
parent 232aa271b0
commit 3c3100adfe
3 changed files with 108 additions and 50 deletions

View File

@ -393,12 +393,18 @@ class PullRequests(models.Model):
batch_id = fields.Many2one('runbot_merge.batch', index=True)
staging_id = fields.Many2one('runbot_merge.stagings', compute='_compute_staging', store=True)
staging_ids = fields.Many2many('runbot_merge.stagings', string="Stagings", compute='_compute_stagings', context={"active_test": False})
@api.depends('batch_id.staging_ids.active')
def _compute_staging(self):
for p in self:
p.staging_id = p.batch_id.staging_ids.filtered('active')
@api.depends('batch_id.staging_ids')
def _compute_stagings(self):
for p in self:
p.staging_ids = p.batch_id.staging_ids
commits_map = fields.Char(help="JSON-encoded mapping of PR commits to actually integrated commits. The integration head (either a merge commit or the PR's topmost) is mapped from the 'empty' pr commit (the key is an empty string, because you can't put a null key in json maps).", default='{}')
link_warned = fields.Boolean(

View File

@ -23,6 +23,7 @@
<group colspan="4">
<field name="all_prs" nolabel="1" readonly="1">
<tree>
<button type="object" name="get_formview_action" icon="fa-external-link"/>
<field name="display_name"/>
<field name="repository"/>
<field name="state"/>
@ -34,6 +35,7 @@
<group colspan="4">
<field name="genealogy_ids" nolabel="1" readonly="1">
<tree decoration-muted="id == parent.id">
<button type="object" name="get_formview_action" icon="fa-external-link"/>
<field name="name"/>
<field name="target"/>
<field name="all_prs" widget="many2many_tags"/>
@ -45,6 +47,7 @@
<group colspan="4">
<field name="staging_ids" nolabel="1" readonly="1">
<tree>
<button type="object" name="get_formview_action" icon="fa-external-link"/>
<field name="staged_at"/>
<field name="state"/>
<field name="reason"/>

View File

@ -123,7 +123,11 @@
<field name="model">runbot_merge.pull_requests</field>
<field name="arch" type="xml">
<form>
<header/>
<div class="o_form_statusbar">
<span class="o_statusbar_buttons">
<field name="github_url" widget="url" class="btn btn-secondary" text="Github"/>
<field name="url" widget="url" class="btn btn-secondary" text="Frontend"/></span>
</div>
<sheet>
<div class="oe_title">
<h1>
@ -140,67 +144,112 @@
</h2>
</div>
<!-- main PR metadata -->
<group>
<group name="metadata" colspan="2">
<group name="metadata">
<group>
<field name="batch_id"/>
<field name="target"/>
</group>
<group>
<field name="author"/>
<field name="head"/>
</group>
<group name="merging">
<field name="merge_method"/>
<field name="squash"/>
<field name="draft"/>
<field name="priority"/>
<field name="skipchecks" widget="boolean_toggle"/>
<field name="cancel_staging" widget="boolean_toggle"/>
<field name="limit_id"/>
</group>
</group>
<notebook>
<page name="state" string="State">
<group>
<group>
<field name="reviewed_by"/>
<field name="closed"/>
<field name="error"/>
</group>
<group>
<field name="status"/>
<details colspan="4">
<summary>Commit Statuses</summary>
<field name="statuses"/>
</details>
<details colspan="4">
<summary>Overrides</summary>
<field name="overrides"/>
</details>
</group>
</group>
<group>
<group colspan="4">
<field name="blocked"/>
</group>
</group>
</page>
<page name="configuration" string="Configuration">
<group>
<group>
<field name="merge_method"/>
<field name="squash"/>
<field name="draft"/>
<field name="limit_id"/>
</group>
<group>
<field name="priority"/>
<field name="skipchecks" widget="boolean_toggle"/>
<field name="cancel_staging" widget="boolean_toggle"/>
</group>
</group>
<group string="Delegates">
<group colspan="4">
<field name="delegates" nolabel="1">
<tree>
<button type="object" name="get_formview_action" icon="fa-external-link"/>
<field name="name"/>
<field name="github_login"/>
</tree>
</field>
</group>
</group>
</page>
<page name="stagings" string="Staging History">
<group>
<group colspan="4">
<field name="staging_ids" nolabel="1" readonly="1">
<tree>
<button type="object" name="get_formview_action" icon="fa-external-link"/>
<field name="staged_at"/>
<field name="state"/>
<field name="reason"/>
</tree>
</field>
</group>
</group>
</page>
<page name="porting" string="Forward-Porting">
<group>
<group>
<field string="Original PR" name="source_id"/>
<field name="parent_id"/>
<field
attrs="{'invisible': [('parent_id', '=', False), ('source_id', '!=', False)]}"
string="Detached because" name="detach_reason" readonly="1"/>
</group>
</group>
<group>
<group colspan="4">
<field name="forwardport_ids" nolabel="1" readonly="True">
<tree>
<button type="object" name="get_formview_action" icon="fa-external-link"/>
<field name="target" string="Branch"/>
<field name="number"/>
</tree>
</field>
</group>
</group>
</page>
</notebook>
<!-- influencers -->
<group string="State">
<group colspan="4">
<field name="reviewed_by"/>
<field name="error"/>
<field name="closed"/>
<field name="status"/>
<field name="overrides"/>
<field name="statuses"/>
</group>
</group>
<group string="Forward Porting">
<group>
<field string="Original PR" name="source_id"/>
<field name="parent_id"/>
<field
attrs="{'invisible': [('parent_id', '=', False), ('source_id', '!=', False)]}"
string="Detached because" name="detach_reason" readonly="1"/>
</group>
<group>
<field name="forwardport_ids" nolabel="1" readonly="True">
<tree>
<field name="target" string="Branch"/>
<field name="number"/>
</tree>
</field>
</group>
</group>
<group string="Message">
<group colspan="4">
<field name="message" nolabel="1"/>
</group>
</group>
<group string="Delegates">
<group colspan="4">
<field name="delegates" nolabel="1">
<tree>
<button type="object" name="get_formview_action" icon="fa-external-link"/>
<field name="name"/>
<field name="github_login"/>
</tree>
</field>
</group>
</group>
</sheet>
<div class="oe_chatter">
<field name="message_follower_ids" widget="mail_followers"/>