diff --git a/runbot/__init__.py b/runbot/__init__.py
index 5e574231b..90b359970 100644
--- a/runbot/__init__.py
+++ b/runbot/__init__.py
@@ -10,6 +10,11 @@
import threading
from odoo.http import request
+# rng validators doesn't allow decoration-bg-attributes on list fields even if they work fine (as long as you don't have a widget)
+# disabling rng validators for list as they have a low value (as long as we test the views manually witch is the case on runbot)
+from odoo.tools.view_validation import _validators
+_validators['list'] = []
+
class UserFilter(logging.Filter):
def filter(self, record): # noqa: A003
message_parts = record.msg.split(' ', 2)
@@ -28,3 +33,4 @@ def filter(self, record): # noqa: A003
def runbot_post_load():
logging.getLogger('werkzeug').addFilter(UserFilter())
+
diff --git a/runbot/models/build.py b/runbot/models/build.py
index 6815e8ca6..1b88fde6b 100644
--- a/runbot/models/build.py
+++ b/runbot/models/build.py
@@ -172,8 +172,8 @@ class BuildResult(models.Model):
requested_action = fields.Selection([('wake_up', 'To wake up'), ('deathrow', 'To kill')], string='Action requested', index=True)
# web infos
- host = fields.Char('Host name')
- host_id = fields.Many2one('runbot.host', string="Host", compute='_compute_host_id')
+ host = fields.Char('Host name', index=True)
+ host_id = fields.Many2one('runbot.host', string="Host", compute='_compute_host_id', search="_search_host_id")
keep_host = fields.Boolean('Keep host on rebuild and for children')
port = fields.Integer('Port')
@@ -252,6 +252,12 @@ def _compute_host_id(self):
for record in self:
record.host_id = get_host(record.host)
+ def _search_host_id(self, operator, value):
+ names = self.env['runbot.host'].browse(value).mapped('name')
+ if isinstance(value, int):
+ names = names[0]
+ return [('host', operator, names)]
+
@api.depends('children_ids.global_state', 'local_state')
def _compute_global_state(self):
for record in self:
@@ -969,8 +975,6 @@ def _local_pg_dropdb(self, dbname):
except Exception as e:
msg = f"Failed to drop local logs database : {dbname} with exception: {e}"
_logger.exception(msg)
- host_name = self.env['runbot.host']._get_current_name()
- self.env['runbot.runbot']._warning(f'Host {host_name}: {msg}')
def _local_pg_createdb(self, dbname):
icp = self.env['ir.config_parameter']
diff --git a/runbot/models/build_error.py b/runbot/models/build_error.py
index c2eccda40..113cf6954 100644
--- a/runbot/models/build_error.py
+++ b/runbot/models/build_error.py
@@ -452,6 +452,24 @@ def action_view_errors(self):
'target': 'current',
}
+ def action_search_common_qualifier(self):
+ context = {}
+ model = self.env['runbot.build.error.content']
+ for key, value in self.common_qualifiers.dict.items():
+ key_fields = f'x_{key}'
+ if key_fields in model._fields:
+ context[f'search_default_{key_fields}'] = value
+ return {
+ 'type': 'ir.actions.act_window',
+ 'views': [(False, 'list'), (False, 'form')],
+ 'res_model': model._name,
+ #'domain': domain,
+ #'context': {'active_test': False, 'parse_domain': True},
+ 'context': context,
+ 'target': 'current',
+ 'name': 'Search Common qualifiers'
+ }
+
def action_view_similary_qualified(self):
return {
'type': 'ir.actions.act_window',
diff --git a/runbot/models/host.py b/runbot/models/host.py
index 8db11c3a8..ece06c20b 100644
--- a/runbot/models/host.py
+++ b/runbot/models/host.py
@@ -63,7 +63,7 @@ def _compute_nb(self):
def _compute_build_ids(self):
for host in self:
- host.build_ids = self.env['runbot.build'].search([('host', '=', host.name), ('local_state', '!=', 'done')])
+ host.build_ids = self.env['runbot.build'].search([('host', '=', host.name), ('local_state', 'in', (('pending', 'testing', 'running')))])
@api.model_create_multi
def create(self, vals_list):
@@ -320,6 +320,15 @@ def _get_builds(self, domain, order=None):
def _process_messages(self):
self.host_message_ids._process()
+ def action_list_all_builds(self):
+ return {
+ 'type': 'ir.actions.act_window',
+ 'views': [(False, 'list'), (False, 'form')],
+ 'name': 'Host builds',
+ 'res_model': 'runbot.build',
+ 'context': {'search_default_host': self.name},
+ 'target': 'current',
+ }
class MessageQueue(models.Model):
_name = 'runbot.host.message'
diff --git a/runbot/views/build_error_views.xml b/runbot/views/build_error_views.xml
index b1c30c925..69f907572 100644
--- a/runbot/views/build_error_views.xml
+++ b/runbot/views/build_error_views.xml
@@ -13,6 +13,7 @@
+
diff --git a/runbot/views/build_views.xml b/runbot/views/build_views.xml
index 9a5f6c170..e1d9088c4 100644
--- a/runbot/views/build_views.xml
+++ b/runbot/views/build_views.xml
@@ -93,7 +93,12 @@
-
+
@@ -119,16 +124,17 @@
+
-
-
-
-
+
+
+
+
diff --git a/runbot/views/host_views.xml b/runbot/views/host_views.xml
index 0a9b4f378..196330d52 100644
--- a/runbot/views/host_views.xml
+++ b/runbot/views/host_views.xml
@@ -21,12 +21,10 @@
+
-
-
-
-
+
@@ -37,6 +35,9 @@
+
+
+