mirror of
https://github.com/odoo/runbot.git
synced 2025-03-16 07:55:45 +07:00
[FIX] runbot: fix build creation from view form
Before this commit, creating branch/build from view form may lead to errors because of missing fields/ inexisting id.
This commit is contained in:
parent
3345d18050
commit
a7ecf6a631
@ -113,6 +113,8 @@ class runbot_branch(models.Model):
|
||||
if not _re_patch.match(pi['head']['label']):
|
||||
# label is used to disambiguate PR with same branch name
|
||||
branch.pull_head_name = pi['head']['label']
|
||||
else:
|
||||
branch.branch_name = ''
|
||||
|
||||
@api.depends('branch_name')
|
||||
def _get_branch_url(self):
|
||||
@ -123,6 +125,8 @@ class runbot_branch(models.Model):
|
||||
branch.branch_url = "https://%s/pull/%s" % (branch.repo_id.base, branch.branch_name)
|
||||
else:
|
||||
branch.branch_url = "https://%s/tree/%s" % (branch.repo_id.base, branch.branch_name)
|
||||
else:
|
||||
branch.branch_url = ''
|
||||
|
||||
def _get_pull_info(self):
|
||||
self.ensure_one()
|
||||
|
@ -332,7 +332,7 @@ class runbot_build(models.Model):
|
||||
nickname = build.branch_id.name.split('/')[2]
|
||||
nickname = re.sub(r'"|\'|~|\:', '', nickname)
|
||||
nickname = re.sub(r'_|/|\.', '-', nickname)
|
||||
build.dest = ("%05d-%s-%s" % (build.id, nickname[:32], build.name[:6])).lower()
|
||||
build.dest = ("%05d-%s-%s" % (build.id or 0, nickname[:32], build.name[:6])).lower()
|
||||
|
||||
@api.depends('repo_id', 'port', 'dest', 'host', 'duplicate_id.domain')
|
||||
def _compute_domain(self):
|
||||
|
@ -62,9 +62,12 @@
|
||||
<t t-set="testing" t-value="hosts_data._total_testing()"/>
|
||||
<t t-set="workers" t-value="hosts_data._total_workers()"/>
|
||||
<t t-set="klass">success</t>
|
||||
<t t-if="int(testing)/workers > 0"><t t-set="klass">info</t></t>
|
||||
<t t-if="int(testing)/workers > 0.75"><t t-set="klass">warning</t></t>
|
||||
<t t-if="int(testing)/workers >= 1"><t t-set="klass">danger</t></t>
|
||||
<t t-if="not workers" t-set="klass">danger</t>
|
||||
<t t-else="">
|
||||
<t t-if="int(testing)/workers > 0" t-set="klass">info</t>
|
||||
<t t-if="int(testing)/workers > 0.75" t-set="klass">warning</t>
|
||||
<t t-if="int(testing)/workers >= 1" t-set="klass">danger</t>
|
||||
</t>
|
||||
<span t-attf-class="label label-{{klass}}">Testing: <t t-esc="testing"/>/<t t-esc="workers"/></span>
|
||||
</template>
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user