Commit a0abff34 authored by Rafael Monnerat's avatar Rafael Monnerat

slapos_jio: On add erp5 login form, handle errors using JIO API

It relies on using jIO.util.readBlobAsText rather them Blob.text() to recover the result.
parent 390b318a
...@@ -25,6 +25,11 @@ ...@@ -25,6 +25,11 @@
</head> </head>
<body> <body>
<div data-gadget-url="gadget_slapos_annotated_helper.html"
data-gadget-scope="annotated_helper"
data-template-id="add-new-login-header-text"
data-gadget-sandbox="public">
</div>
<form class="save_form ui-body-c" novalidate> <form class="save_form ui-body-c" novalidate>
<button type="submit" class="ui-btn ui-btn-b ui-btn-inline <button type="submit" class="ui-btn ui-btn-b ui-btn-inline
ui-icon-edit ui-btn-icon-right ui-screen-hidden"></button> ui-icon-edit ui-btn-icon-right ui-screen-hidden"></button>
......
...@@ -233,7 +233,7 @@ ...@@ -233,7 +233,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>982.32516.46874.3959</string> </value> <value> <string>984.14093.31233.63027</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -251,7 +251,7 @@ ...@@ -251,7 +251,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1584351106.69</float> <float>1590777644.94</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
/*global window, rJS, RSVP */ /*global window, rJS, RSVP */
/*jslint nomen: true, indent: 2, maxerr: 3 */ /*jslint nomen: true, indent: 2, maxerr: 3 */
(function (window, rJS, RSVP) { (function (window, rJS, RSVP, jIO) {
"use strict"; "use strict";
rJS(window) rJS(window)
...@@ -65,22 +65,17 @@ ...@@ -65,22 +65,17 @@
"page": "slap_controller"}}); "page": "slap_controller"}});
}) })
.push(undefined, function (error) { .push(undefined, function (error) {
return new RSVP.Queue() return gadget.getTranslationList(["Unknown Error, please open a ticket."])
.push(function () { .push(function (error_message) {
return RSVP.all([ return jIO.util.readBlobAsText(error.target.response)
error.target.response.text(), .then(function (evt) {
gadget.getTranslationList(["Unknown Error, please open a ticket."]) if (error.target.status === 406) {
]); return gadget.notifySubmitted({message: JSON.parse(evt.target.result),
}) status: 'error'});
.push(function (result) { }
var text = result[0], return gadget.notifySubmitted({message: error_message[0],
error_message = result[0][1]; status: 'error'});
if (error.target.status === 406) { });
return gadget.notifySubmitted({message: text,
status: 'error'});
}
return gadget.notifySubmitted({message: error_message,
status: 'error'});
}); });
}); });
}); });
...@@ -203,4 +198,4 @@ ...@@ -203,4 +198,4 @@
}); });
}); });
}); });
}(window, rJS, RSVP)); }(window, rJS, RSVP, jIO));
\ No newline at end of file \ No newline at end of file
...@@ -240,7 +240,7 @@ ...@@ -240,7 +240,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>984.12854.52715.32426</string> </value> <value> <string>984.13871.46211.53043</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -258,7 +258,7 @@ ...@@ -258,7 +258,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1590705868.36</float> <float>1590759622.51</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