From ae1eed46f56b15f1ed3f2e1111b03626d1244154 Mon Sep 17 00:00:00 2001
From: Christophe Monniez
Date: Sun, 26 May 2019 09:34:04 +0200
Subject: [PATCH] [IMP] runbot: add optional warning message on frontend
---
runbot/controllers/frontend.py | 2 ++
runbot/models/res_config_settings.py | 3 +++
runbot/templates/frontend.xml | 3 +++
runbot/views/res_config_settings_views.xml | 4 ++++
4 files changed, 12 insertions(+)
diff --git a/runbot/controllers/frontend.py b/runbot/controllers/frontend.py
index 43c8fce0..a5d41937 100644
--- a/runbot/controllers/frontend.py
+++ b/runbot/controllers/frontend.py
@@ -128,6 +128,8 @@ class Runbot(Controller):
'testing': build_obj.search_count([('local_state', '=', 'testing'), ('host', '=', result['host'])]),
'running': build_obj.search_count([('local_state', '=', 'running'), ('host', '=', result['host'])]),
})
+
+ context.update({'message': request.env['ir.config_parameter'].sudo().get_param('runbot.runbot_message')})
return request.render('runbot.repo', context)
@route(['/runbot/build//kill'], type='http', auth="user", methods=['POST'], csrf=False)
diff --git a/runbot/models/res_config_settings.py b/runbot/models/res_config_settings.py
index c9c77c27..202b87e6 100644
--- a/runbot/models/res_config_settings.py
+++ b/runbot/models/res_config_settings.py
@@ -15,6 +15,7 @@ class ResConfigSettings(models.TransientModel):
runbot_max_age = fields.Integer('Max branch age (in days)')
runbot_logdb_uri = fields.Char('Runbot URI for build logs')
runbot_update_frequency = fields.Integer('Update frequency (in seconds)')
+ runbot_message = fields.Text('Frontend warning message')
@api.model
def get_values(self):
@@ -28,6 +29,7 @@ class ResConfigSettings(models.TransientModel):
runbot_max_age=int(get_param('runbot.runbot_max_age', default=30)),
runbot_logdb_uri=get_param('runbot.runbot_logdb_uri', default=False),
runbot_update_frequency=int(get_param('runbot.runbot_update_frequency', default=10)),
+ runbot_message = get_param('runbot.runbot_message', default=''),
)
return res
@@ -43,3 +45,4 @@ class ResConfigSettings(models.TransientModel):
set_param("runbot.runbot_max_age", self.runbot_max_age)
set_param("runbot.runbot_logdb_uri", self.runbot_logdb_uri)
set_param('runbot.runbot_update_frequency', self.runbot_update_frequency)
+ set_param('runbot.runbot_message', self.runbot_message)
diff --git a/runbot/templates/frontend.xml b/runbot/templates/frontend.xml
index 316fbc53..15900996 100644
--- a/runbot/templates/frontend.xml
+++ b/runbot/templates/frontend.xml
@@ -97,6 +97,9 @@
+
+
+
No Repository yet.
diff --git a/runbot/views/res_config_settings_views.xml b/runbot/views/res_config_settings_views.xml
index 364d457b..74c2aa8f 100644
--- a/runbot/views/res_config_settings_views.xml
+++ b/runbot/views/res_config_settings_views.xml
@@ -50,6 +50,10 @@
+
+
+
+