From 8356a00a68ebdc97829d6b4b2896bdcec9a6b67f Mon Sep 17 00:00:00 2001 From: Vincent Schippefilt Date: Wed, 6 Mar 2019 14:02:33 +0100 Subject: [REF] web_settings_dashboard: adapt code after jQuery update Part of task 1896658 Co-authored-by: Aaron Bohy Co-authored-by: Christophe Matthieu Co-authored-by: Mathieu Duckerts-Antoine Co-authored-by: David Monjoie Co-authored-by: Martin Geubelle Co-authored-by: svs-odoo Co-authored-by: Vincent Schippefilt --- addons/web_settings_dashboard/static/src/js/dashboard.js | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'addons/web_settings_dashboard/static/src') diff --git a/addons/web_settings_dashboard/static/src/js/dashboard.js b/addons/web_settings_dashboard/static/src/js/dashboard.js index a51b5c173b5..9807a00d001 100644 --- a/addons/web_settings_dashboard/static/src/js/dashboard.js +++ b/addons/web_settings_dashboard/static/src/js/dashboard.js @@ -20,13 +20,13 @@ var Dashboard = AbstractAction.extend({ start: function(){ var superDef = this._super.apply(this, arguments); - return $.when(superDef, this.load(this.all_dashboards)); + return Promise.all([superDef, this.load(this.all_dashboards)]); }, load: function(dashboards){ var self = this; - var loading_done = new $.Deferred(); - this._rpc({route: '/web_settings_dashboard/data'}) + return new Promise(function (resolve, reject) { + self._rpc({route: '/web_settings_dashboard/data'}) .then(function (data) { // Load each dashboard var all_dashboards_defs = []; @@ -37,12 +37,12 @@ var Dashboard = AbstractAction.extend({ } }); - // Resolve loading_done when all dashboards defs are resolved - $.when.apply($, all_dashboards_defs).then(function() { - loading_done.resolve(); + // Resolve the promise when all dashboards defs are resolved + Promise.all(all_dashboards_defs).then(function() { + resolve(); }); }); - return loading_done; + }); }, load_apps: function(data){ @@ -220,7 +220,7 @@ var DashboardInvitations = Widget.extend({ .then(function () { self.reload(); }) - .fail(function () { + .guardedCatch(function () { $button.button('reset'); }); } -- cgit v1.2.3