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
Pipeline #12755 failed with stage
in 0 seconds
......@@ -249,24 +249,22 @@
}
hideDesktopPanel(gadget, maximize);
if (maximize) {
return route(gadget, 'header', 'setButtonTitle', [{
gadget.deferSetButtonTitle({
icon: "compress",
action: "maximize"
}])
.push(function () {
gadget.props.deferred_minimize = new RSVP.Promise(
function () {return; },
function () {
// Wait for cancellation
// return triggerMaximize(gadget, false);
hideDesktopPanel(gadget, false);
return route(gadget, 'header', 'setButtonTitle', [{}]);
}
);
return gadget.props.deferred_minimize;
});
});
gadget.props.deferred_minimize = new RSVP.Promise(
function () {return; },
function () {
// Wait for cancellation
// return triggerMaximize(gadget, false);
hideDesktopPanel(gadget, false);
gadget.deferSetButtonTitle({});
}
);
return gadget.props.deferred_minimize;
}
return route(gadget, 'header', 'setButtonTitle', [{}]);
gadget.deferSetButtonTitle({});
}
//////////////////////////////////////////
......@@ -338,6 +336,9 @@
}
rJS(window)
.declareJob('deferSetButtonTitle', function (options) {
return route(this, 'header', 'setButtonTitle', [options]);
})
// Add mutex protected defered gadget loader.
// Multiple mutex are needed, to not prevent concurrent loading on
......
......@@ -234,7 +234,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>982.26879.4100.14950</string> </value>
<value> <string>986.32404.49746.11571</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -252,7 +252,7 @@
</tuple>
<state>
<tuple>
<float>1585300343.55</float>
<float>1601565748.05</float>
<string>UTC</string>
</tuple>
</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