mirror of
https://github.com/odoo/runbot.git
synced 2025-03-15 15:35:46 +07:00
[IMP] runbot: speedup host page
This commit is contained in:
parent
9097aa4545
commit
844eda953f
@ -10,6 +10,11 @@ import logging
|
||||
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 @@ class UserFilter(logging.Filter):
|
||||
|
||||
def runbot_post_load():
|
||||
logging.getLogger('werkzeug').addFilter(UserFilter())
|
||||
|
||||
|
@ -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 @@ class BuildResult(models.Model):
|
||||
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 @@ class BuildResult(models.Model):
|
||||
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']
|
||||
|
@ -452,6 +452,24 @@ class BuildError(models.Model):
|
||||
'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',
|
||||
|
@ -63,7 +63,7 @@ class Host(models.Model):
|
||||
|
||||
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 @@ class Host(models.Model):
|
||||
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'
|
||||
|
@ -13,6 +13,7 @@
|
||||
</div>
|
||||
<widget name="web_ribbon" title="Test-tags" bg_color="bg-danger" invisible="not test_tags"/>
|
||||
<button name="action_view_errors" string="See all linked errors" type="object" class="oe_highlight"/>
|
||||
<button name="action_search_common_qualifier" string="Search common_qualifiers" type="object" class="oe_highlight"/>
|
||||
<group string="Base info">
|
||||
<field name="name"/>
|
||||
<field name="error_content_ids" readonly="1">
|
||||
|
@ -93,7 +93,12 @@
|
||||
<field name="arch" type="xml">
|
||||
<list string="Builds">
|
||||
<field name="dest"/>
|
||||
<field name="global_state"/>
|
||||
<field name="global_state"
|
||||
decoration-bg-danger="global_result == 'ko'"
|
||||
decoration-bg-warning="global_result == 'warn'"
|
||||
decoration-bg-success="global_result == 'ok' and global_state == 'done'"
|
||||
decoration-bg-info="global_result == 'ok' and global_state != 'done'"
|
||||
/>
|
||||
<field name="global_result"/>
|
||||
<field name="job"/>
|
||||
<field name="host"/>
|
||||
@ -119,16 +124,17 @@
|
||||
<field name="id"/>
|
||||
<field name="global_state"/>
|
||||
<field name="dest"/>
|
||||
<field name="host" operator="="/>
|
||||
<filter string="Pending" name='pending' domain="[('global_state','=', 'pending')]"/>
|
||||
<filter string="Testing" name='testing' domain="[('global_state','in', ('testing', 'waiting'))]"/>
|
||||
<filter string="Running" name='running' domain="[('global_state','=', 'running')]"/>
|
||||
<filter string="Done" name='done' domain="[('global_state','=','done')]"/>
|
||||
<filter string="Duplicate" name='duplicate' domain="[('local_state','=', 'duplicate')]"/>
|
||||
<group expand="0" string="Group By...">
|
||||
<filter string="Status" name='status' domain="[]" context="{'group_by':'global_state'}"/>
|
||||
<filter string="Result" name='result' domain="[]" context="{'group_by':'global_result'}"/>
|
||||
<filter string="Start" name='start' domain="[]" context="{'group_by':'job_start'}"/>
|
||||
<filter string="Host" name='host' domain="[]" context="{'group_by':'host'}"/>
|
||||
<filter string="Status" name='group_status' domain="[]" context="{'group_by':'global_state'}"/>
|
||||
<filter string="Result" name='group_result' domain="[]" context="{'group_by':'global_result'}"/>
|
||||
<filter string="Start" name='group_start' domain="[]" context="{'group_by':'job_start'}"/>
|
||||
<filter string="Host" name='group_host' domain="[]" context="{'group_by':'host'}"/>
|
||||
<filter string="Create Date" name='create_date' domain="[]" context="{'group_by':'create_date'}"/>
|
||||
</group>
|
||||
</search>
|
||||
|
@ -21,12 +21,10 @@
|
||||
<field name="nb_run_slot"/>
|
||||
<field name="last_exception" readonly='1'/>
|
||||
<field name="exception_count" readonly='1'/>
|
||||
<button type="object" name="action_list_all_builds">See all host builds</button>
|
||||
</group>
|
||||
<notebook>
|
||||
<page string="Messages">
|
||||
<field name="host_message_ids" readonly='1'/>
|
||||
</page>
|
||||
<page string="Builds">
|
||||
<page string="Current Builds">
|
||||
<field name="build_ids" widget="many2many" options="{'not_delete': True, 'no_create_edit': True}" readonly='1'>
|
||||
<list string="Builds">
|
||||
<field name="create_date"/>
|
||||
@ -37,6 +35,9 @@
|
||||
</list>
|
||||
</field>
|
||||
</page>
|
||||
<page string="Messages">
|
||||
<field name="host_message_ids" readonly='1'/>
|
||||
</page>
|
||||
</notebook>
|
||||
</sheet>
|
||||
<chatter/>
|
||||
|
Loading…
Reference in New Issue
Block a user