Commit ba3646b8 authored by Romain Courteaud's avatar Romain Courteaud

[erp5_web_renderjs_ui] Launcher: reset the url state when displaying an error

parent aa98bcae
...@@ -154,24 +154,19 @@ ...@@ -154,24 +154,19 @@
// Gadget has not yet been correctly initialized // Gadget has not yet been correctly initialized
throw error; throw error;
} }
// XXX Improve error rendering
gadget.props.content_element.innerHTML = "<br/><br/><br/><pre></pre>"; return gadget.changeState({
gadget.props.content_element.querySelector('pre').textContent = error_text: error_text,
"Error: " + error_text; url: undefined
// XXX Notify error });
} }
function displayError(gadget, error) { function displayError(gadget, error) {
if (error instanceof RSVP.CancellationError) { if (error instanceof RSVP.CancellationError) {
return; return;
} }
displayErrorContent(gadget, error); return displayErrorContent(gadget, error);
return gadget.dropGadget(MAIN_SCOPE)
.push(undefined, function () {
// Do not crash the app if the pg gadget in not defined
// ie, keep the original error on screen
return;
});
} }
////////////////////////////////////////// //////////////////////////////////////////
...@@ -479,6 +474,23 @@ ...@@ -479,6 +474,23 @@
.onStateChange(function (modification_dict) { .onStateChange(function (modification_dict) {
var gadget = this, var gadget = this,
route_result = gadget.state; route_result = gadget.state;
if (modification_dict.hasOwnProperty('error_text')) {
return gadget.dropGadget(MAIN_SCOPE)
.push(undefined, function () {
// Do not crash the app if the pg gadget in not defined
// ie, keep the original error on screen
return;
})
.push(function () {
// XXX Improve error rendering
gadget.props.content_element.innerHTML = "<br/><br/><br/><pre></pre>";
gadget.props.content_element.querySelector('pre').textContent =
"Error: " + gadget.state.error_text;
// XXX Notify error
});
}
if (modification_dict.hasOwnProperty('url')) { if (modification_dict.hasOwnProperty('url')) {
return new RSVP.Queue() return new RSVP.Queue()
.push(function () { .push(function () {
......
...@@ -230,7 +230,7 @@ ...@@ -230,7 +230,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>958.43029.38869.9284</string> </value> <value> <string>960.2672.38593.36659</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -248,7 +248,7 @@ ...@@ -248,7 +248,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1492087071.7</float> <float>1497443691.6</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