|
1 | 1 | import datetime |
2 | 2 | import functools |
3 | 3 | import logging |
4 | | -from collections import OrderedDict |
| 4 | +from collections import OrderedDict, defaultdict |
5 | 5 | from subprocess import CalledProcessError |
6 | 6 | from urllib.parse import urlsplit |
7 | 7 |
|
@@ -79,7 +79,7 @@ def _pending(self): |
79 | 79 | '/runbot', |
80 | 80 | '/runbot/<model("runbot.project"):project>', |
81 | 81 | '/runbot/<model("runbot.project"):project>/search/<search>'], website=True, auth='public', type='http') |
82 | | - def bundles(self, project=None, search='', refresh=False, for_next_freeze=False, limit=40, has_pr=None, **kwargs): |
| 82 | + def bundles(self, project=None, search='', refresh=False, limit=40, has_pr=None, **kwargs): |
83 | 83 | search = search if len(search) < 60 else search[:60] |
84 | 84 | env = request.env |
85 | 85 | categories = env['runbot.category'].search([]) |
@@ -114,9 +114,6 @@ def bundles(self, project=None, search='', refresh=False, for_next_freeze=False, |
114 | 114 | elif filter_mode == 'default' and not search: |
115 | 115 | domain.append(('sticky', '=', True)) |
116 | 116 |
|
117 | | - if for_next_freeze: |
118 | | - domain.append(('for_next_freeze', '=', True)) |
119 | | - |
120 | 117 | if search: |
121 | 118 | search_domains = [] |
122 | 119 | pr_numbers = [] |
@@ -811,3 +808,28 @@ def commit_links_diffs(self, commit_link_ids=None, versions_filter_ids=None, rep |
811 | 808 | 'commit_links': selected_commit_links, |
812 | 809 | 'diff_by_commit_link_ids': diff_by_commit_link_ids, |
813 | 810 | }) |
| 811 | + |
| 812 | + @route([ |
| 813 | + '/runbot/bundle/tag/<model("runbot.bundle.tag"):bundle_tag_id>', |
| 814 | + '/runbot/<model("runbot.project"):project>/bundle/tag/<model("runbot.bundle.tag"):bundle_tag_id>', |
| 815 | + ], type="http", auth="user", website=True, sitemap=False) |
| 816 | + def bundles_by_tag(self, bundle_tag_id=None, project=None, **kwargs): |
| 817 | + projects = self.env['runbot.project'].search([('hidden', '=', False)]) |
| 818 | + if not project and projects: |
| 819 | + project = projects[0] |
| 820 | + bundles_by_team = defaultdict(list) |
| 821 | + nb_bundles = 0 |
| 822 | + nb_bundles_done = 0 |
| 823 | + for bundle in self.env['runbot.bundle'].search([('tag_ids', 'in', bundle_tag_id.id)]): |
| 824 | + bundles_by_team[bundle.team_id.name or 'No Team Defined'].append(bundle) |
| 825 | + nb_bundles += 1 |
| 826 | + if any(bundle.branch_ids.filtered(lambda rec: rec.is_pr)) and not any(bundle.branch_ids.filtered(lambda rec: rec.is_pr).mapped('alive')): |
| 827 | + nb_bundles_done += 1 |
| 828 | + |
| 829 | + qctx = { |
| 830 | + 'tag': bundle_tag_id, |
| 831 | + 'bundles_by_team': bundles_by_team, |
| 832 | + 'nb_bundles': nb_bundles, |
| 833 | + 'nb_bundles_done': nb_bundles_done, |
| 834 | + } |
| 835 | + return request.render('runbot.bundles_by_tag', qctx) |
0 commit comments