diff --git a/muk_web_client_refresh/__manifest__.py b/muk_web_client_refresh/__manifest__.py index 1a3f394..111a76b 100644 --- a/muk_web_client_refresh/__manifest__.py +++ b/muk_web_client_refresh/__manifest__.py @@ -20,7 +20,7 @@ { "name": "MuK Web Refresh", "summary": """Web Client Refresh""", - "version": "11.0.2.1.0", + "version": "11.0.2.1.2", "category": "Extra Tools", "license": "AGPL-3", "website": "http://www.mukit.at", @@ -31,6 +31,7 @@ ], "depends": [ "base_automation", + "muk_automation_extension", "muk_web_client", ], "data": [ diff --git a/muk_web_client_refresh/models/res_config_settings.py b/muk_web_client_refresh/models/res_config_settings.py index fedccd6..1e5983c 100644 --- a/muk_web_client_refresh/models/res_config_settings.py +++ b/muk_web_client_refresh/models/res_config_settings.py @@ -25,9 +25,11 @@ class ResConfigSettings(models.TransientModel): refresh_delay = fields.Integer( string="Delay", - help="""Delays the execution of refresh and thus prevents the view from being reloaded too often. - For example, a delay of 1000 (ms) would mean that the view cannot be reloaded more than once a second. """) - + help="""Prevents multiple executions of refresh in a certain timeframe to avoid the view from being + reloaded too often. For example, a delay of 1000 (ms) would mean that the view cannot be + reloaded more than once a second.""") + + @api.multi def set_values(self): res = super(ResConfigSettings, self).set_values() param = self.env['ir.config_parameter'].sudo() diff --git a/muk_web_client_refresh/static/src/js/client_refresh.js b/muk_web_client_refresh/static/src/js/client_refresh.js index 0b7cb0a..57f0b6b 100644 --- a/muk_web_client_refresh/static/src/js/client_refresh.js +++ b/muk_web_client_refresh/static/src/js/client_refresh.js @@ -25,15 +25,13 @@ var session = require('web.session'); var config = require('web.config'); var bus = require('bus.bus'); -var utils = require('muk_web_utils.common'); - WebClient.include({ start: function () { var self = this; var load_config = this._rpc({ route: '/config/muk_web_client_refresh.refresh_delay', }).done(function(result) { - self.refresh_delay = result.refresh_delay; + self.refresh = _.throttle(self.refresh.bind(self), result.refresh_delay || 1000, true); }); return $.when(this._super.apply(this, arguments), load_config); }, @@ -45,26 +43,21 @@ WebClient.include({ refresh: function(message) { var widget = this.action_manager && this.action_manager.inner_widget; var active_view = widget ? widget.active_view : false; - if (active_view && message.uid && session.uid !== message.uid) { + if (active_view && session.uid !== message.uid) { var controller = this.action_manager.inner_widget.active_view.controller; if(controller.modelName === message.model && controller.mode === "readonly") { if(active_view.type === "form" && message.ids.includes(widget.env.currentId)) { - this.reload(controller); + controller.reload(); } else if(active_view.type === "list" && (message.create || _.intersection(message.ids, widget.env.ids) >= 1)) { - this.reload(controller); + controller.reload(); } else if(active_view.type === "kanban" && (message.create || _.intersection(message.ids, widget.env.ids) >= 1)) { - this.reload(controller); + controller.reload(); } } } }, - reload: function(controller) { - utils.delay(function() { - controller.reload(); - }, this.refresh_delay || 1000); - }, }); }); diff --git a/muk_web_security/doc/index.rst b/muk_web_security/doc/index.rst index 1d33486..d1a016c 100644 --- a/muk_web_security/doc/index.rst +++ b/muk_web_security/doc/index.rst @@ -2,8 +2,8 @@ MuK Web Security ================ -Technical module to provide some utility features and libraries that can be used -in other applications. This module has no direct effect on the running system. +Technical module to extend the security module. This module has no direct +effect on the running system. Installation ============ @@ -23,7 +23,7 @@ No additional configuration is needed to use this module. Usage ============= -This module has no direct visible effect on the system. It provide utility features. +This module has no direct visible effect on the system. It provide security features. Credits ======= diff --git a/muk_web_security/static/description/index.html b/muk_web_security/static/description/index.html index 154f50f..4490abd 100644 --- a/muk_web_security/static/description/index.html +++ b/muk_web_security/static/description/index.html @@ -11,10 +11,9 @@

Overview

-

Technical module to provide some utility - features. The module is mainly used as a dependency by other modules - and to provide a collection of common libraries. It has no direct - visible effect on the system.

+

Technical module to extend the security + module. The module is mainly used as a dependency by other modules + and has no direct visible effect on the system.