Commit d45f3cf8 authored by Cédric Le Ninivin's avatar Cédric Le Ninivin

erp5_officejs: No Default jIO storage and Redirect to jio configurator if no...

erp5_officejs: No Default jIO  storage and Redirect to jio configurator if no storage is defined on jIO call
parent 4dcfcee1
......@@ -6,6 +6,9 @@
// jIO call wrapper for redirection to authentication page if needed
function wrapJioCall(gadget, method_name, argument_list) {
var storage = gadget.state_parameter_dict.jio_storage;
if (storage === undefined) {
return gadget.redirect({page: "jio_configurator"});
}
return storage[method_name].apply(storage, argument_list)
.push(undefined, function (error) {
if ((error.target !== undefined) && (error.target.status === 401)) {
......@@ -43,16 +46,7 @@
.declareMethod('createJio', function (jio_options) {
var gadget = this;
if (jio_options === undefined) {
jio_options = {
type: "query",
sub_storage: {
type: "uuid",
sub_storage: {
type: "indexeddb",
database: "officejs"
}
}
};
return;
}
this.state_parameter_dict.jio_storage = jIO.createJIO(jio_options);
return this.getSetting("jio_storage_name")
......
......@@ -14,6 +14,13 @@
</head>
<body>
<article class="ui-content ui-body-c message" style="display: none;">
<section class="ui-content-header-plain">
<h3 class="ui-content-title ui-body-c" style="color: red">
<span class="ui-icon ui-icon-custom ui-icon-exclamation-triangle">&nbsp;</span>
</3>
</section>
</article>
<article class="ui-content ui-body-c">
<section class="ui-content-header-plain">
......
/*global window, rJS, RSVP, URI, location,
/*global window, document, rJS, RSVP, URI, location,
loopEventListener*/
/*jslint nomen: true, indent: 2, maxerr: 3*/
(function (window, rJS, RSVP) {
......@@ -92,10 +92,19 @@
.declareAcquiredMethod("redirect", "redirect")
.declareAcquiredMethod("reload", "reload")
.declareAcquiredMethod("setSetting", "setSetting")
.declareAcquiredMethod("getSetting", "getSetting")
.declareMethod("render", function () {
var gadget = this;
return gadget.updateHeader({
title: "Storage Configuration"
}).push(function () {
return gadget.getSetting('jio_storage_description');
}).push(function (jio_storage_description) {
if (jio_storage_description === undefined) {
gadget.props.element.querySelector(".message h3").appendChild(document.createTextNode("Please choose a storage before continuing"));
gadget.props.element.querySelector(".message").setAttribute("style", "");
}
return;
}).push(function () {
return gadget.props.deferred.resolve();
});
......
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