Commit d34ebc02 authored by Roque's avatar Roque

erp5_officejs: store json form definition in indexedDB

parent e65f8589
......@@ -15,7 +15,8 @@
final_value = undefined;
if (tales_expr !== undefined && tales_expr !== null && tales_expr !== '') {
try {
final_value = eval(tales_expr);
throw "error";
//final_value = eval(tales_expr);
} catch (e) {} // TALES expressions are usually python code, so for now ignore
}
if (final_value === undefined) {
......@@ -99,19 +100,37 @@
]);
})
.push(function (setting_list) {
var jio_options = {
var jio_options_remote = {
type: "erp5",
url: setting_list[0],
default_view_reference: setting_list[1]
},
jio_storage = jIO.createJIO(jio_options),
jio_options_localIndexdb = {
type: "query",
sub_storage: {
type: "indexeddb",
database: "officejs-forms"
}
},
jio_storage_remote,
jio_indexdb_local = jIO.createJIO(jio_options_localIndexdb),
form_path = 'portal_skins/erp5_officejs_jio_connector/' +
setting_list[2].portal_type.replace(/ /g, '') +
'_viewAsJio';
return jio_storage.get(form_path)
return jio_indexdb_local.get(form_path)
.push(function (result) {
return result.form_definition;
});
}, function (error) {
if ((error.constructor.name === 'jIOError' && error.status_code === 404)) {
jio_storage_remote = jIO.createJIO(jio_options_remote);
return jio_storage_remote.get(form_path)
.push(function (result) {
jio_indexdb_local.put(form_path, result);
return result.form_definition;
});
}
throw error;
});
});
})
......
......@@ -225,7 +225,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>974.18617.14355.33792</string> </value>
<value> <string>974.18933.22256.43059</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -243,7 +243,7 @@
</tuple>
<state>
<tuple>
<float>1552327545.59</float>
<float>1552346315.67</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