diff --git a/runbot/controllers/frontend.py b/runbot/controllers/frontend.py index 2653980c..d7c57838 100644 --- a/runbot/controllers/frontend.py +++ b/runbot/controllers/frontend.py @@ -178,27 +178,20 @@ class Runbot(Controller): } return request.render("runbot.build", context) - @route(['/runbot/b/', '/runbot//'], type='http', auth="public", website=True) - def fast_launch(self, branch_name=False, repo=False, **post): + @route(['/runbot/quick_connect/'], type='http', auth="public", website=True) + def fast_launch(self, branch, **post): """Connect to the running Odoo instance""" Build = request.env['runbot.build'] - - domain = [('branch_id.branch_name', '=', branch_name)] - - if repo: - domain.extend([('branch_id.repo_id', '=', repo.id)]) - order = "sequence desc" - else: - order = 'repo_id ASC, sequence DESC' + domain = [('branch_id', '=', branch.id), ('config_id', '=', branch.config_id.id)] # Take the 10 lasts builds to find at least 1 running... Else no luck - builds = Build.search(domain, order=order, limit=10) + builds = Build.search(domain, order='sequence desc', limit=10) if builds: last_build = False for build in builds: - if build.local_state == 'running' or (build.local_state == 'duplicate' and build.duplicate_id.local_state == 'running'): - last_build = build if build.local_state == 'running' else build.duplicate_id + if build.real_build.local_state == 'running': + last_build = build.real_build break if not last_build: @@ -208,7 +201,7 @@ class Runbot(Controller): if last_build.local_state != 'running': url = "/runbot/build/%s?ask_rebuild=1" % last_build.id else: - url = build.branch_id._get_branch_quickconnect_url(last_build.domain, last_build.dest)[build.branch_id.id] + url = "http://%s/web/login?db=%s-all&login=admin&redirect=/web?debug=1" % (last_build.domain, last_build.dest) else: return request.not_found() return werkzeug.utils.redirect(url) diff --git a/runbot/models/branch.py b/runbot/models/branch.py index d1769468..7d85b511 100644 --- a/runbot/models/branch.py +++ b/runbot/models/branch.py @@ -93,12 +93,6 @@ class runbot_branch(models.Model): return super(runbot_branch, self).create(vals) - def _get_branch_quickconnect_url(self, fqdn, dest): - self.ensure_one() - r = {} - r[self.id] = "http://%s/web/login?db=%s-all&login=admin&redirect=/web?debug=1" % (fqdn, dest) - return r - def _get_last_coverage_build(self): """ Return the last build with a coverage value > 0""" self.ensure_one() diff --git a/runbot/templates/frontend.xml b/runbot/templates/frontend.xml index 2a08fe0b..668e8d67 100644 --- a/runbot/templates/frontend.xml +++ b/runbot/templates/frontend.xml @@ -119,7 +119,7 @@