Commit 2d2f2b57 authored by Romain Courteaud's avatar Romain Courteaud

erp5_web_renderjs_ui: catch potential error by using renderjs's job

RSVP.Promise cancel callback do not expect a Promise as result.
In order to handle potential errors triggered by setButtonTitle, run it in an renderjs's job.
parent 707eaed2
...@@ -249,24 +249,22 @@ ...@@ -249,24 +249,22 @@
} }
hideDesktopPanel(gadget, maximize); hideDesktopPanel(gadget, maximize);
if (maximize) { if (maximize) {
return route(gadget, 'header', 'setButtonTitle', [{ gadget.deferSetButtonTitle({
icon: "compress", icon: "compress",
action: "maximize" action: "maximize"
}]) });
.push(function () {
gadget.props.deferred_minimize = new RSVP.Promise( gadget.props.deferred_minimize = new RSVP.Promise(
function () {return; }, function () {return; },
function () { function () {
// Wait for cancellation // Wait for cancellation
// return triggerMaximize(gadget, false); // return triggerMaximize(gadget, false);
hideDesktopPanel(gadget, false); hideDesktopPanel(gadget, false);
return route(gadget, 'header', 'setButtonTitle', [{}]); gadget.deferSetButtonTitle({});
} }
); );
return gadget.props.deferred_minimize; return gadget.props.deferred_minimize;
});
} }
return route(gadget, 'header', 'setButtonTitle', [{}]); gadget.deferSetButtonTitle({});
} }
////////////////////////////////////////// //////////////////////////////////////////
...@@ -338,6 +336,9 @@ ...@@ -338,6 +336,9 @@
} }
rJS(window) rJS(window)
.declareJob('deferSetButtonTitle', function (options) {
return route(this, 'header', 'setButtonTitle', [options]);
})
// Add mutex protected defered gadget loader. // Add mutex protected defered gadget loader.
// Multiple mutex are needed, to not prevent concurrent loading on // Multiple mutex are needed, to not prevent concurrent loading on
......
...@@ -234,7 +234,7 @@ ...@@ -234,7 +234,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>982.26879.4100.14950</string> </value> <value> <string>986.32404.49746.11571</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -252,7 +252,7 @@ ...@@ -252,7 +252,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1585300343.55</float> <float>1601565748.05</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment