runbot/runbot/templates/commit.xml
Xavier-Do 9a3c11b09f [IMP] runbot: use custom layout and improve views
Runbot layout modifies the website/portal base layout to remove navbar,
footer, overides some custom styles. A lot of assets are loaded but not
used. The only real usefull elements are base assets (bootstrap, ...)
and the login button.

Migrating to the next version of odoo is usually painfull because some
xpath may break, extra element added, or some style change may break the
page, needing to add more and more xpath, css rules, ... for very little
benefits.

This cleanup creates a custom base layout for runbot independant from
base odoo templates.

Also add a breadcrumb, navigation arrow, and improve batch links
2022-01-11 09:11:48 +01:00

126 lines
4.7 KiB
XML

<odoo>
<data>
<template id="runbot.commit_status_state_td">
<!-- Must be called with a `state` variable !-->
<td t-if="state=='pending'">
<i class="fa fa-circle text-warning"/>
&amp;nbsp;
<t t-esc="state"/>
</td>
<td t-if="state=='success'">
<i class="fa fa-check text-success"/>
&amp;nbsp;
<t t-esc="state"/>
</td>
<td t-if="state in ('failure', 'error')">
<i class="fa fa-times text-danger"/>
&amp;nbsp;
<t t-esc="state"/>
</td>
</template>
<template id="runbot.commit">
<t t-call='runbot.layout'>
<div class="row">
<!-- Commit base informations -->
<div class="col-md-6">
<table class="table table-stripped">
<tr>
<td>Name</td>
<td>
<t t-esc="commit.name"/>
<div class="btn-group" role="group">
<a t-att-href="'' if not reflogs else 'https://%s/commit/%s' % (reflogs[0].branch_id.remote_id.base_url, commit.name)" class="btn btn-sm text-left" title="View Commit on Github"><i class="fa fa-github"/></a>
<a groups="runbot.group_runbot_admin" class="btn btn-sm fa fa-list text-left" t-attf-href="/web/#id={{commit.id}}&amp;view_type=form&amp;model=runbot.commit" target="new" title="View Commit in Backend"/>
</div>
</td>
</tr>
<tr>
<td>Repo</td>
<td t-esc="commit.repo_id.name"/>
</tr>
<tr>
<td>Subject</td>
<td t-esc="commit.subject"/>
</tr>
<tr>
<td>Date</td>
<td t-esc="commit.date"/>
</tr>
<tr>
<td>Author</td>
<td>
<t t-esc="commit.author"/>
<small t-esc="commit.author_email"/>
</td>
</tr>
<tr t-if="commit.author != commit.committer">
<td>Commiter</td>
<td>
<t t-esc="commit.committer"/>
<small t-esc="commit.committer_email"/>
</td>
</tr>
</table>
</div>
<!-- Status -->
<div class="col-md-4">
<h3>Last Status</h3>
<table class="table table-sm table-borderless">
<tr t-foreach='last_status_by_context' t-as='context'>
<t t-set="status" t-value="last_status_by_context[context]"/>
<td t-esc="status.sent_date and status.sent_date.strftime('%Y-%m-%d %H:%M:%S') or '—'"/>
<td t-esc="context"/>
<t t-call="runbot.commit_status_state_td">
<t t-set="state" t-value="status.state"/>
</t>
<td>
<a t-att-href="status.target_url">
build
<t t-if="status.target_url" t-esc="status.target_url.split('/')[-1]" />
</a>
</td>
<td groups="base.group_user">
<a t-attf-href="/runbot/commit/resend/{{status.id}}" title="Resend github status">
<i class="fa fa-repeat"/>
</a>
</td>
</tr>
</table>
</div>
</div>
<div class="row">
<div class="col-md-6">
<h3>Branch presence history</h3>
<table class="table table-stripped">
<tr t-foreach='reflogs' t-as='reflog'>
<td t-esc="reflog.date"/>
<td t-esc="reflog.branch_id.remote_id.short_name"/>
<td><a t-attf-href="/runbot/branch/{{reflog.branch_id.id}}" t-esc="reflog.branch_id.name" title="View Branch Details"/></td>
</tr>
</table>
</div>
<div class="col-md-6">
<h3>Status history</h3>
<table class="table table-stripped">
<tr t-foreach='status_list' t-as='status'>
<td t-esc="status.sent_date and status.sent_date.strftime('%Y-%m-%d %H:%M:%S') or '—'"/>
<td t-esc="status.context"/>
<t t-call="runbot.commit_status_state_td">
<t t-set="state" t-value="status.state"/>
</t>
<td>
<a t-attf-href="/runbot/build/{{status.build_id.id}}">
build
<t t-esc="status.build_id.id" />
</a>
</td>
</tr>
</table>
</div>
</div>
</t>
</template>
</data>
</odoo>