summaryrefslogtreecommitdiff
path: root/addons/web/static/src/js/views/graph
diff options
context:
space:
mode:
authorJulien Mougenot <jum@odoo.com>2020-06-19 07:06:32 +0000
committerAaron Bohy <aab@odoo.com>2020-06-22 13:04:01 +0000
commit6998452065044650665c5020e6b730aede690ec0 (patch)
treeea5bd87ab198b1b9ca7278f8eb9567786b2c2186 /addons/web/static/src/js/views/graph
parentc7964657ecbbad278cec73cf231d7eef55b44347 (diff)
[IMP] web: disable keyboard navigation with sample data
Previous commit introduces the sample data feature in list and kanban views. When sample data is displayed, most parts of the renderers can't be clicked on, to prevent the user from interacting with sample records (e.g. to open a sample record in form view from the list). This commit disables keyboard navigation as well, as those sample records could still be accessed with the keyboard. To do so, several refactorings have been done in views: - _giveFocus function added on controllers (so that we can hook on the moment where we want to focus the renderer, and prevent it in sample mode), it kind of replaces giveFocus of ActionMixin which wasn't use from the outside - updateRendererState -> _updateRendererState as it is private - _setState function added on controllers, to have a hook when we set a new state (already existed, but only in kanban) - _renderView function moved from Basic to AbstractRenderer, so that we have a proper hook to deactivate clickable elements in sample mode Task 2232801 X-original-commit: 4482a03fe2f083f4f44fc6eb76d90ae22afbff91
Diffstat (limited to 'addons/web/static/src/js/views/graph')
-rw-r--r--addons/web/static/src/js/views/graph/graph_renderer.js11
1 files changed, 1 insertions, 10 deletions
diff --git a/addons/web/static/src/js/views/graph/graph_renderer.js b/addons/web/static/src/js/views/graph/graph_renderer.js
index 4def49a6d7e..52608e7b9cd 100644
--- a/addons/web/static/src/js/views/graph/graph_renderer.js
+++ b/addons/web/static/src/js/views/graph/graph_renderer.js
@@ -76,12 +76,6 @@ return AbstractRenderer.extend({
this.$tooltip = null;
},
/**
- * @override
- */
- updateState: function () {
- return this._super.apply(this, arguments);
- },
- /**
* Chart.js does not need the canvas to be in dom in order
* to be able to work well. We could avoid the calls to on_attach_callback
* and on_detach_callback.
@@ -754,10 +748,8 @@ return AbstractRenderer.extend({
* immediately, then we render the chart when the widget is in the DOM.
*
* @override
- * @private
- * @returns {Promise} The _super promise is actually resolved immediately
*/
- _render: function () {
+ async _renderView() {
if (this.chart) {
this.chart.destroy();
}
@@ -796,7 +788,6 @@ return AbstractRenderer.extend({
this._renderTitle();
}
- return this._super.apply(this, arguments);
},
/**
* create bar chart.