Commit e5af505b authored by Romain Courteaud's avatar Romain Courteaud Committed by Eteri

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

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