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>
2022-06-08 20:43:28 +07:00
<template id= "link-pr" name= "create a link to `pr`" >
2024-09-27 19:13:43 +07:00
<t t-set= "title"
t-value="pr.message.split('\n', 1)[0] if pr.repository.group_id < = env.user.groups_id else ''"/>
2022-06-08 20:43:28 +07:00
<t t-set= "title" >
2024-09-27 19:13:43 +07:00
<t t-if= "title and pr.blocked" >
<t t-out= "title" /> : <t t-out= "pr.blocked" />
2024-06-20 18:49:17 +07:00
</t>
<t t-else= "" >
2024-09-27 19:13:43 +07:00
<t t-out= "pr.blocked or title" />
2024-06-20 18:49:17 +07:00
</t>
</t>
2022-06-08 20:43:28 +07:00
<a t-attf-href= "https://github.com/{{ pr.repository.name }}/pull/{{ pr.number }}"
2024-09-27 19:13:43 +07:00
t-att-title="title.strip()"
2022-06-08 20:43:28 +07:00
t-att-target="target or None"
2022-11-29 16:02:18 +07:00
t-att-class="classes or None"
2024-12-05 21:56:00 +07:00
><t t-out= "pr.display_name" /> </a>
2022-06-08 20:43:28 +07:00
</template>
[IMP] runbot_merge: better styling for missing statuses on stagings
Before this, until the first status for a required context the status
would appear as pending, but would be have oddly (e.g. not clickable).
Update the style of such statuses for clarity:
- use a light background to show them as inactive
- use the `wait` cursor to show their status as oddball (and not clickable)
Setting this styling on the link (or even `li`) doesn't seem to work,
so set it on the `ul`, the actual active links will set the relevant
"active" cursor instead, which seems to work fine.
While at it, extract the status menu to its own template and unify the
disparate bits, mainly in that both the main dashboard and the
per-branch list display the staging instant in UTC on hover: before,
the main dashboard would display a relative delta and provide the
UTC-formatted instant on hover, but the branch would only show a zoned
ISO-8601 instant.
While adjusting is easy, it's unnecessary, we can easily provide the UTC
staging instant there).
2022-06-28 14:52:24 +07:00
<template id= "staging-statuses" name= "dropdown statuses list of stagings" >
<div class= "dropdown" t-if= "staging.heads" >
<button class= "btn btn-link dropdown-toggle"
type="button"
aria-haspopup="true"
2024-12-02 14:14:20 +07:00
data-bs-toggle="dropdown"
aria-expanded="false"
2024-05-30 20:11:38 +07:00
t-attf-title="Staged at {{staging.staged_at}}Z for {{round(staging.staging_duration)}}s"
[IMP] runbot_merge: better styling for missing statuses on stagings
Before this, until the first status for a required context the status
would appear as pending, but would be have oddly (e.g. not clickable).
Update the style of such statuses for clarity:
- use a light background to show them as inactive
- use the `wait` cursor to show their status as oddball (and not clickable)
Setting this styling on the link (or even `li`) doesn't seem to work,
so set it on the `ul`, the actual active links will set the relevant
"active" cursor instead, which seems to work fine.
While at it, extract the status menu to its own template and unify the
disparate bits, mainly in that both the main dashboard and the
per-branch list display the staging instant in UTC on hover: before,
the main dashboard would display a relative delta and provide the
UTC-formatted instant on hover, but the branch would only show a zoned
ISO-8601 instant.
While adjusting is easy, it's unnecessary, we can easily provide the UTC
staging instant there).
2022-06-28 14:52:24 +07:00
>
2022-11-30 20:25:12 +07:00
<t t-out= "0" />
[IMP] runbot_merge: better styling for missing statuses on stagings
Before this, until the first status for a required context the status
would appear as pending, but would be have oddly (e.g. not clickable).
Update the style of such statuses for clarity:
- use a light background to show them as inactive
- use the `wait` cursor to show their status as oddball (and not clickable)
Setting this styling on the link (or even `li`) doesn't seem to work,
so set it on the `ul`, the actual active links will set the relevant
"active" cursor instead, which seems to work fine.
While at it, extract the status menu to its own template and unify the
disparate bits, mainly in that both the main dashboard and the
per-branch list display the staging instant in UTC on hover: before,
the main dashboard would display a relative delta and provide the
UTC-formatted instant on hover, but the branch would only show a zoned
ISO-8601 instant.
While adjusting is easy, it's unnecessary, we can easily provide the UTC
staging instant there).
2022-06-28 14:52:24 +07:00
<span class= "caret" > </span>
</button>
2022-11-30 18:44:25 +07:00
<div class= "dropdown-menu staging-statuses" >
<a groups= "runbot_merge.group_admin"
class="dropdown-item" role="menuitem"
t-attf-href="/web#id={{staging.id}}& view_type=form& model=runbot_merge.stagings"
target="new">
Open Staging
</a>
[IMP] runbot_merge: better styling for missing statuses on stagings
Before this, until the first status for a required context the status
would appear as pending, but would be have oddly (e.g. not clickable).
Update the style of such statuses for clarity:
- use a light background to show them as inactive
- use the `wait` cursor to show their status as oddball (and not clickable)
Setting this styling on the link (or even `li`) doesn't seem to work,
so set it on the `ul`, the actual active links will set the relevant
"active" cursor instead, which seems to work fine.
While at it, extract the status menu to its own template and unify the
disparate bits, mainly in that both the main dashboard and the
per-branch list display the staging instant in UTC on hover: before,
the main dashboard would display a relative delta and provide the
UTC-formatted instant on hover, but the branch would only show a zoned
ISO-8601 instant.
While adjusting is easy, it's unnecessary, we can easily provide the UTC
staging instant there).
2022-06-28 14:52:24 +07:00
<t t-set= "statuses" t-value= "{(r, c): (s, t) for r, c, s, t in staging.statuses}" />
<t t-foreach= "repo_statuses._for_staging(staging)" t-as= "req" >
<t t-set= "st" t-value= "statuses.get((req.repo_id.name, req.context)) or (None, None)" />
2022-11-29 16:02:18 +07:00
<a t-att-href= "st[1]" target= "new" role= "menuitem" t-attf-class= "
2022-11-30 18:44:25 +07:00
dropdown-item
2022-11-29 16:02:18 +07:00
{{'bg-success' if st[0] == 'success'
[IMP] runbot_merge: better styling for missing statuses on stagings
Before this, until the first status for a required context the status
would appear as pending, but would be have oddly (e.g. not clickable).
Update the style of such statuses for clarity:
- use a light background to show them as inactive
- use the `wait` cursor to show their status as oddball (and not clickable)
Setting this styling on the link (or even `li`) doesn't seem to work,
so set it on the `ul`, the actual active links will set the relevant
"active" cursor instead, which seems to work fine.
While at it, extract the status menu to its own template and unify the
disparate bits, mainly in that both the main dashboard and the
per-branch list display the staging instant in UTC on hover: before,
the main dashboard would display a relative delta and provide the
UTC-formatted instant on hover, but the branch would only show a zoned
ISO-8601 instant.
While adjusting is easy, it's unnecessary, we can easily provide the UTC
staging instant there).
2022-06-28 14:52:24 +07:00
else 'bg-danger' if st[0] in ('error', 'failure')
else 'bg-info' if st[0]
2022-11-29 16:02:18 +07:00
else 'bg-light'}}">
2024-12-05 21:56:00 +07:00
<t t-out= "req.repo_id.name" /> : <t t-out= "req.context" />
2022-11-29 16:02:18 +07:00
</a>
[IMP] runbot_merge: better styling for missing statuses on stagings
Before this, until the first status for a required context the status
would appear as pending, but would be have oddly (e.g. not clickable).
Update the style of such statuses for clarity:
- use a light background to show them as inactive
- use the `wait` cursor to show their status as oddball (and not clickable)
Setting this styling on the link (or even `li`) doesn't seem to work,
so set it on the `ul`, the actual active links will set the relevant
"active" cursor instead, which seems to work fine.
While at it, extract the status menu to its own template and unify the
disparate bits, mainly in that both the main dashboard and the
per-branch list display the staging instant in UTC on hover: before,
the main dashboard would display a relative delta and provide the
UTC-formatted instant on hover, but the branch would only show a zoned
ISO-8601 instant.
While adjusting is easy, it's unnecessary, we can easily provide the UTC
staging instant there).
2022-06-28 14:52:24 +07:00
</t>
2022-11-30 18:44:25 +07:00
</div>
[IMP] runbot_merge: better styling for missing statuses on stagings
Before this, until the first status for a required context the status
would appear as pending, but would be have oddly (e.g. not clickable).
Update the style of such statuses for clarity:
- use a light background to show them as inactive
- use the `wait` cursor to show their status as oddball (and not clickable)
Setting this styling on the link (or even `li`) doesn't seem to work,
so set it on the `ul`, the actual active links will set the relevant
"active" cursor instead, which seems to work fine.
While at it, extract the status menu to its own template and unify the
disparate bits, mainly in that both the main dashboard and the
per-branch list display the staging instant in UTC on hover: before,
the main dashboard would display a relative delta and provide the
UTC-formatted instant on hover, but the branch would only show a zoned
ISO-8601 instant.
While adjusting is easy, it's unnecessary, we can easily provide the UTC
staging instant there).
2022-06-28 14:52:24 +07:00
</div>
</template>
2022-06-30 19:33:18 +07:00
<template id= "alerts" >
<div id= "alerts" class= "row text-center" >
<div class= "alert alert-light col-md-12 h6 mb-0" >
<a href= "/runbot_merge/changelog" > Changelog</a>
</div>
<t t-set= "stagingcron" t-value= "env(user=1).ref('runbot_merge.staging_cron')" />
<div t-if= "not stagingcron.active" class= "alert alert-warning col-12 mb-0" role= "alert" >
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')" />
<div t-if= "not mergecron.active" class= "alert alert-warning col-12 mb-0" role= "alert" >
2022-07-26 15:16:07 +07:00
Merging is disabled, stagings will not be integrated.
2022-06-30 19:33:18 +07:00
</div>
</div>
</template>
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" >
2022-06-30 19:33:18 +07:00
<t t-call= "runbot_merge.alerts" />
2024-11-29 17:57:57 +07:00
<ul class= "nav justify-content-center mt-3" >
<li t-foreach= "projects" t-as= "project"
class="nav-item">
<a t-attf-href= "#project-{{project.id}}" class= "nav-link" >
<t t-out= "project.name" />
</a>
</li>
</ul>
<section
t-foreach="projects" t-as="project"
class="row" t-attf-id="project-{{project.id}}"
>
<h1 class= "col-md-12" > <t t-out= "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}}" >
2024-11-29 17:57:57 +07:00
<t t-out= "branch.name" />
2019-08-21 19:15:10 +07:00
</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" >
2022-06-08 20:43:28 +07:00
<t t-call= "runbot_merge.link-pr" />
2019-10-07 14:26:27 +07:00
</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" >
2022-06-08 20:43:28 +07:00
<t t-call= "runbot_merge.link-pr" />
2019-03-04 18:11:34 +07:00
</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" >
2022-06-08 20:43:28 +07:00
<t t-call= "runbot_merge.link-pr" />
2019-06-11 16:31:24 +07:00
</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" >
2022-06-08 20:43:28 +07:00
<t t-call= "runbot_merge.link-pr" />
2018-10-16 18:15:00 +07:00
</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" >
2023-07-06 15:28:52 +07:00
<t t-foreach= "stagings_map[branch]" 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" >
2022-11-29 16:02:18 +07:00
<t t-if= "4 > staging_index >= 2" > d-none d-md-block</t>
<t t-if= "staging_index >= 4" > d-none d-lg-block</t>
2018-06-18 15:08:48 +07:00
</t>
2018-10-01 15:21:32 +07:00
<t t-set= "title" >
2024-09-27 19:13:43 +07:00
<t t-if= "staging.state == 'success'" />
<t t-else= "" >
<t t-if= "staging.state == 'pending'" > last status< /t
><t t-elif= "staging.state == 'ff_failed'" > fast forward failed (<t t-out= "(staging.reason or '').replace('\'', '')" /> )< /t
><t t-else= "" t-out= "(staging.reason or '').replace('\'', '')"
/> at <t t-out= "(staging.staging_end or staging.write_date).replace(microsecond=0)" /> Z
</t>
2018-10-01 15:21:32 +07:00
</t>
2024-09-27 19:13:43 +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" >
2024-12-05 21:56:00 +07:00
<t t-out= "batch.prs[:1].label" />
2018-09-21 17:19:44 +07:00
<t t-foreach= "batch.prs" t-as= "pr" >
2022-06-08 20:43:28 +07:00
<t t-call= "runbot_merge.link-pr" />
2018-09-21 17:19:44 +07:00
</t>
</li>
</ul>
[IMP] runbot_merge: better styling for missing statuses on stagings
Before this, until the first status for a required context the status
would appear as pending, but would be have oddly (e.g. not clickable).
Update the style of such statuses for clarity:
- use a light background to show them as inactive
- use the `wait` cursor to show their status as oddball (and not clickable)
Setting this styling on the link (or even `li`) doesn't seem to work,
so set it on the `ul`, the actual active links will set the relevant
"active" cursor instead, which seems to work fine.
While at it, extract the status menu to its own template and unify the
disparate bits, mainly in that both the main dashboard and the
per-branch list display the staging instant in UTC on hover: before,
the main dashboard would display a relative delta and provide the
UTC-formatted instant on hover, but the branch would only show a zoned
ISO-8601 instant.
While adjusting is easy, it's unnecessary, we can easily provide the UTC
staging instant there).
2022-06-28 14:52:24 +07:00
<t t-call= "runbot_merge.staging-statuses" >
Staged <span t-field= "staging.staged_at" t-options= "{'widget': 'relative'}" />
2024-05-30 20:11:38 +07:00
(duration <span t-field= "staging.staging_duration" t-options= "{
'widget': 'duration',
'format': 'short',
'round': 'minute'
}"/>)
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" >
2024-12-05 21:56:00 +07:00
<h1 class= "col-md-12" > <t t-out= "branch.project_id.name" /> : <t t-out= "branch.name" /> </h1>
2019-08-21 19:15:10 +07:00
</section>
2023-07-06 19:12:38 +07:00
<form method= "get" >
<label for= "until" > Staged before:</label>
<input type= "datetime-local" name= "until" t-att-value= "until" />
(UTC)
<label for= "state" > State:</label>
<select name= "state" >
<option t-att-selected= "'selected' if not state else None" />
<option t-att-selected= "'selected' if state == 'success' else None" value= "success" > Success</option>
<option t-att-selected= "'selected' if state == 'failure' else None" value= "failure" > Failure</option>
</select>
<button type= "submit" > Apply</button>
</form>
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" >
2024-09-27 19:13:43 +07:00
<t t-if= "staging.state == 'ff_failed'" >
Fast Forward Failed
2019-08-26 16:55:41 +07:00
</t>
2024-09-27 19:13:43 +07:00
<t t-elif= "staging.state == 'canceled'" >
Cancelled<t t-if= "staging.reason" > : <t t-out= "staging.reason.replace('\'', '')" /> </t>
2019-08-26 16:55:41 +07:00
</t>
2024-09-27 19:13:43 +07:00
<t t-else= "" >
<t t-out= "(staging.reason or '').replace('\'', '')" />
2019-08-26 16:55:41 +07:00
</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>
[IMP] runbot_merge: better styling for missing statuses on stagings
Before this, until the first status for a required context the status
would appear as pending, but would be have oddly (e.g. not clickable).
Update the style of such statuses for clarity:
- use a light background to show them as inactive
- use the `wait` cursor to show their status as oddball (and not clickable)
Setting this styling on the link (or even `li`) doesn't seem to work,
so set it on the `ul`, the actual active links will set the relevant
"active" cursor instead, which seems to work fine.
While at it, extract the status menu to its own template and unify the
disparate bits, mainly in that both the main dashboard and the
per-branch list display the staging instant in UTC on hover: before,
the main dashboard would display a relative delta and provide the
UTC-formatted instant on hover, but the branch would only show a zoned
ISO-8601 instant.
While adjusting is easy, it's unnecessary, we can easily provide the UTC
staging instant there).
2022-06-28 14:52:24 +07:00
<t t-call= "runbot_merge.staging-statuses" >
<span t-field= "staging.staged_at"
t-options="{'format': 'yyyy-MM-dd\'T\'HH:mm:ssZ'}"/>
2024-05-30 20:11:38 +07:00
in <span t-field= "staging.staging_duration" t-options= "{
'widget': 'duration',
'format': 'narrow',
'round': 'minute'
}"/>
[IMP] runbot_merge: better styling for missing statuses on stagings
Before this, until the first status for a required context the status
would appear as pending, but would be have oddly (e.g. not clickable).
Update the style of such statuses for clarity:
- use a light background to show them as inactive
- use the `wait` cursor to show their status as oddball (and not clickable)
Setting this styling on the link (or even `li`) doesn't seem to work,
so set it on the `ul`, the actual active links will set the relevant
"active" cursor instead, which seems to work fine.
While at it, extract the status menu to its own template and unify the
disparate bits, mainly in that both the main dashboard and the
per-branch list display the staging instant in UTC on hover: before,
the main dashboard would display a relative delta and provide the
UTC-formatted instant on hover, but the branch would only show a zoned
ISO-8601 instant.
While adjusting is easy, it's unnecessary, we can easily provide the UTC
staging instant there).
2022-06-28 14:52:24 +07:00
</t>
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"
2022-07-29 19:25:11 +07:00
t-value="batch.prs[-1:]"/>
<li class= "dropdown" t-if= "first_pr" >
2019-08-26 16:55:41 +07:00
<button class= "btn btn-link dropdown-toggle"
type="button"
aria-haspopup="true"
2024-12-02 14:14:20 +07:00
data-bs-toggle="dropdown"
aria-expanded="false"
2019-08-26 16:55:41 +07:00
>
2024-12-05 21:56:00 +07:00
<t t-out= "first_pr.label" />
2019-08-26 16:55:41 +07:00
<span class= "caret" > </span>
</button>
2022-11-30 18:44:25 +07:00
<div class= "dropdown-menu" >
2022-11-29 16:02:18 +07:00
<t t-foreach= "batch.prs" t-as= "pr" >
2022-06-08 20:43:28 +07:00
<t t-call= "runbot_merge.link-pr" >
<t t-set= "target" > new</t>
2022-11-29 16:02:18 +07:00
<t t-set= "classes" > dropdown-item</t>
2022-06-08 20:43:28 +07:00
</t>
2022-11-29 16:02:18 +07:00
</t>
2022-11-30 18:44:25 +07:00
</div>
2019-08-26 16:55:41 +07:00
</li>
</t>
</ul>
</td>
</tr>
</t>
</table>
2019-08-21 19:15:10 +07:00
<t t-if= "next" >
2023-07-06 19:12:38 +07:00
<a t-attf-href= "/runbot_merge/{{branch.id}}?until={{next}}&state={{state}}" >
2019-08-21 19:15:10 +07:00
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" >
2024-12-05 21:56:00 +07:00
<h3 t-if= "not entry_first" t-out= "entry" />
2021-10-20 19:28:29 +07:00
<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" >
2024-12-05 21:56:00 +07:00
at <a t-attf-href= "https://github.com/{{pr.repository.name}}/commit/{{merged_head}}" > <t t-out= "merged_head" /> </a>
2020-11-13 16:38:48 +07:00
</t>
2024-05-30 20:28:25 +07:00
<p > Statuses:</p>
<ul >
<t t-foreach= "pr.repository.status_ids._for_pr(pr)" t-as= "ci" >
<t t-set= "st" t-value= "statuses.get(ci.context.strip())" />
<li t-if= "st" >
2024-12-05 21:56:00 +07:00
<a t-att-href= "st.get('target_url') if st else None" > <t t-out= "ci.context.strip()" /> </a> <t t-if= "st and st.get('description')" > : <t t-out= "st['description']" /> </t>
2024-05-30 20:28:25 +07:00
</li>
</t>
</ul>
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:
2024-12-05 21:56:00 +07:00
<span t-out= "pr.with_context(active_test=False).batch_id.staging_ids[-1:].reason" >
2021-08-30 19:40:38 +07:00
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" >
2024-12-05 21:56:00 +07:00
<a t-att-href= "st.get('target_url') if st else None" > <t t-out= "ci.context.strip()" /> </a> <t t-if= "st and st.get('description')" > : <t t-out= "st['description']" /> </t>
2020-11-13 16:38:48 +07:00
</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" >
2022-06-30 19:33:18 +07:00
<t t-call= "runbot_merge.alerts" />
2021-10-19 19:39:19 +07:00
<h1 >
2022-06-30 19:33:18 +07:00
<a t-att-href= "pr.github_url" t-field= "pr.display_name" >
</a>
<a t-attf-href= "/web#view_type=form&model=runbot_merge.pull_requests&id={{pr.id}}"
2024-08-13 19:39:09 +07:00
class="btn btn-sm btn-secondary align-top float-end"
2024-06-20 19:21:40 +07:00
groups="runbot_merge.group_admin">View in backend</a>
2021-10-19 19:39:19 +07:00
</h1>
2020-11-13 16:38:48 +07:00
<h6 > Created by <span t-field= "pr.author.display_name" /> </h6>
<t t-set= "tmpl" >
2024-12-05 21:56:00 +07:00
<t t-if= "pr.state in ('merged', 'closed', 'error')" > <t t-out= "pr.state" /> </t>
2020-11-13 16:38:48 +07:00
<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>
2024-03-05 18:59:58 +07:00
<t t-call= "runbot_merge.dashboard-table" />
2024-07-11 16:53:01 +07:00
<p t-field= "pr.message_html" />
2020-11-13 16:38:48 +07:00
</div> </div>
</t>
</template>
2024-03-05 18:59:58 +07:00
<record id= "dashboard-pre" model= "ir.actions.server" >
<field name= "name" > Preparation for the preparation of the PR dashboard content</field>
<field name= "state" > code</field>
<field name= "model_id" ref= "base.model_ir_qweb" />
<field name= "code" > < ![CDATA[
project = pr.repository.project_id
genealogy = pr.batch_id.genealogy_ids
repos = project.repo_ids & genealogy.all_prs.repository
targets = genealogy.all_prs.target
if not genealogy:
# if a PR is closed, it may not have a batch to get a genealogy from,
# in which case it's just a sole soul drifting in the deep dark
branches = pr.target
repos = pr.repository
elif all(p.state in ('merged', 'closed') for p in genealogy[-1].all_prs):
branches = (project.branch_ids & targets)[::-1]
2024-10-22 20:05:48 +07:00
elif pr.batch_id.fw_policy == 'no':
branches = pr.target
2024-03-05 18:59:58 +07:00
else:
# if the tip of the genealogy is not closed, extend to the furthest limit,
# keeping branches which are active or have an associated batch / PR
2024-06-12 20:09:47 +07:00
limit = min(genealogy.prs.limit_id, key=lambda b: (b.sequence, b.name), default=None)
2024-03-05 18:59:58 +07:00
limit_high = project.branch_ids.ids.index(limit.id) if limit else None
2024-06-12 20:09:47 +07:00
limit = max(targets, key=lambda b: (b.sequence, b.name))
2024-03-05 18:59:58 +07:00
limit_low = project.branch_ids.ids.index(limit.id)
2024-06-12 20:09:47 +07:00
2024-03-05 18:59:58 +07:00
branches = project.branch_ids[limit_high:limit_low+1].filtered(lambda b: b.active or b in targets)[::-1]
action = (project, repos, branches, genealogy)
]]></field>
</record>
<record id= "dashboard-prep" model= "ir.actions.server" >
<field name= "name" > Preparation of the PR dashboard content</field>
<field name= "state" > code</field>
<field name= "model_id" ref= "base.model_ir_qweb" />
<field name= "code" > < ![CDATA[
batches = {}
2024-07-18 17:13:52 +07:00
for branch in [*branches, branches.browse(())]:
2024-03-05 18:59:58 +07:00
if genealogy:
prs_batch = genealogy.filtered(lambda b: b.target == branch).all_prs
2024-07-18 17:13:52 +07:00
if not (branch or prs_batch):
continue
2024-03-05 18:59:58 +07:00
else:
prs_batch = pr
for repo in repos:
prs = prs_batch.filtered(lambda p: p.repository == repo)
st = 0
detached = False
pr_fmt = []
for p in prs:
st |= (bool(p.error) < < 2 | ( p.state = = ' m e r g e d ' ) < < 1 | b o o l ( p . b l o c k e d ) < < 0 )
done = p.state in ('closed', 'merged')
# this will hide the detachment signal when the PRs are merged/closed, cleaner but less correct?
detached = detached or bool(p.source_id and not p.parent_id and not done)
label = p.state
if p.blocked:
label = "%s, %s" % (label, p.blocked)
pr_fmt.append({
'pr': p,
'number': p.number,
'label': label,
'closed': p.closed,
'backend_url': "/web#view_type=form& model=runbot_merge.pull_requests& id=%d" % p.id,
'github_url': p.github_url,
'checked': done or p.status == 'success',
'reviewed': done or bool(p.reviewed_by),
'attached': done or p.parent_id or not p.source_id,
})
state = None
for i, s in zip(range(2, -1, -1), ['danger', 'success', 'warning']):
if st & (1 < < i ) :
state = s
break
batches[repo, branch] = {
'active': pr in prs,
'detached': detached,
'state': state,
'prs': pr_fmt,
'pr_ids': prs,
}
action = batches
]]></field>
</record>
<template id= "dashboard-table" >
<t t-set= "pre" t-value= "pr.env.ref('runbot_merge.dashboard-pre').sudo()._run_action_code_multi({'pr': pr})" />
<t t-set= "repos" t-value= "pre[1]" />
<t t-set= "branches" t-value= "pre[2]" />
<t t-set= "batches" t-value= "env.ref('runbot_merge.dashboard-prep').sudo()._run_action_code_multi({
'pr': pr,
'repos': repos,
'branches': branches,
'genealogy': pre[3],
})"/>
2024-07-18 17:13:52 +07:00
<div t-if= "not pr.batch_id.target" class= "alert alert-danger" >
<p > Inconsistent targets:</p>
<ul > <li t-foreach= "pr.batch_id.prs" t-as= "p" >
<a t-att-href= "p.url" > <t t-out= "p.display_name" /> </a> has target '<t t-out= "p.target.name" /> '</li> </ul>
</div>
<table t-else= "" class= "table table-bordered table-sm" >
2024-03-05 18:59:58 +07:00
<colgroup >
<col />
<col t-foreach= "repos" t-as= "repo"
t-att-class="'bg-info' if repo == pr.repository else None"
/>
</colgroup>
<thead >
<tr >
<th />
<th t-foreach= "repos" t-as= "repo" >
<t t-out= "repo.name" />
</th>
</tr>
</thead>
<tbody >
<!--
table-info looks like shit (possibly because no odoo styling so use bg-info
text-muted doesn't do anything, so set some opacity
-->
<tr t-foreach= "branches" t-as= "branch"
t-att-title="None if branch.active else 'branch is disabled'"
t-attf-class="{{
'bg-info' if branch == pr.target else ''
}} {{
'inactive' if not branch.active else ''
}}">
2024-07-18 17:13:52 +07:00
<td t-out= "branch.name or ''" />
2024-03-05 18:59:58 +07:00
<t t-foreach= "repos" t-as= "repo" >
<t t-set= "ps" t-value= "batches[repo, branch]" />
<t t-set= "stateclass" t-value= "ps['state'] and 'table-'+ps['state']" />
<t t-set= "detached" t-value= "ps['detached']" />
<td t-if= "ps['prs']"
t-att-title="'detached' if detached else None"
t-attf-class="{{
'table-active' if ps['active'] else ''
}} {{
'detached' if detached else ''
}}{{stateclass}}">
<!--
there should be only one PR per (repo, target) but
that's not always the case
-->
<span t-foreach= "ps['prs']" t-as= "p"
t-att-title="p['label']"
t-att-class="'closed' if p['closed'] else None">
<a t-attf-href= "/{{repo.name}}/pull/{{p['number']}}" > #<t t-out= "p['number']" /> </a>
<a t-attf-class= "fa fa-brands fa-github"
title="Open on Github"
t-att-href="p['github_url']"
/>
2024-06-20 19:21:40 +07:00
<a groups= "runbot_merge.group_admin"
2024-03-05 18:59:58 +07:00
title="Open in Backend"
t-attf-class="fa fa-external-link"
t-att-href="p['backend_url']"
/>
2024-06-12 20:45:27 +07:00
<sup t-if= "not p['checked']" class= "text-danger" > missing statuses</sup>
<sup t-if= "not p['reviewed']" class= "text-danger" > missing r+</sup>
2024-03-05 18:59:58 +07:00
<sup t-if= "not p['attached']"
t-attf-title="detached: {{p['pr'].detach_reason}}"
class="text-warning fa fa-unlink"/>
2024-06-07 20:51:26 +07:00
<sup t-if= "p['pr'].staging_id" class= "text-success" >
staged
</sup>
<sup t-elif= "p['pr']._ready" class= "text-success" >
ready
</sup>
2024-03-05 18:59:58 +07:00
</span>
</td>
<td t-else= "" />
</t>
</tr>
</tbody>
</table>
</template>
2018-06-18 15:08:48 +07:00
</odoo>