mirror of
https://github.com/odoo/runbot.git
synced 2025-03-27 05:15:45 +07:00
[IMP] runbot: split prending count and scheduled count
This commit is contained in:
parent
f4fd17a884
commit
3345d18050
@ -20,9 +20,10 @@ class Runbot(Controller):
|
|||||||
ICP = request.env['ir.config_parameter'].sudo().get_param
|
ICP = request.env['ir.config_parameter'].sudo().get_param
|
||||||
warn = int(ICP('runbot.pending.warning', 5))
|
warn = int(ICP('runbot.pending.warning', 5))
|
||||||
crit = int(ICP('runbot.pending.critical', 12))
|
crit = int(ICP('runbot.pending.critical', 12))
|
||||||
count = request.env['runbot.build'].search_count([('local_state', '=', 'pending')])
|
pending_count = request.env['runbot.build'].search_count([('local_state', '=', 'pending'), ('build_type', '!=', 'scheduled')])
|
||||||
level = ['info', 'warning', 'danger'][int(count > warn) + int(count > crit)]
|
scheduled_count = request.env['runbot.build'].search_count([('local_state', '=', 'pending'), ('build_type', '=', 'scheduled')])
|
||||||
return count, level
|
level = ['info', 'warning', 'danger'][int(pending_count > warn) + int(pending_count > crit)]
|
||||||
|
return pending_count, level, scheduled_count
|
||||||
|
|
||||||
@route(['/runbot', '/runbot/repo/<model("runbot.repo"):repo>'], website=True, auth='public', type='http')
|
@route(['/runbot', '/runbot/repo/<model("runbot.repo"):repo>'], website=True, auth='public', type='http')
|
||||||
def repo(self, repo=None, search='', refresh='', **kwargs):
|
def repo(self, repo=None, search='', refresh='', **kwargs):
|
||||||
@ -43,6 +44,7 @@ class Runbot(Controller):
|
|||||||
'host_stats': [],
|
'host_stats': [],
|
||||||
'pending_total': pending[0],
|
'pending_total': pending[0],
|
||||||
'pending_level': pending[1],
|
'pending_level': pending[1],
|
||||||
|
'scheduled_count': pending[2],
|
||||||
'hosts_data': request.env['runbot.host'].search([]),
|
'hosts_data': request.env['runbot.host'].search([]),
|
||||||
'search': search,
|
'search': search,
|
||||||
'refresh': refresh,
|
'refresh': refresh,
|
||||||
@ -317,6 +319,7 @@ class Runbot(Controller):
|
|||||||
'refresh': refresh,
|
'refresh': refresh,
|
||||||
'pending_total': pending[0],
|
'pending_total': pending[0],
|
||||||
'pending_level': pending[1],
|
'pending_level': pending[1],
|
||||||
|
'scheduled_count': pending[2],
|
||||||
'glances_data': glances_ctx,
|
'glances_data': glances_ctx,
|
||||||
'hosts_data': hosts_data,
|
'hosts_data': hosts_data,
|
||||||
'last_monitored': last_monitored, # nightly
|
'last_monitored': last_monitored, # nightly
|
||||||
|
Loading…
Reference in New Issue
Block a user