Commit 3603d4cd authored by Vincent Bechu's avatar Vincent Bechu

[erp5_officejs] Add safereapair storage in erp5 configurator

Update caches and jio gadget
parent 81326fc1
......@@ -11,6 +11,7 @@
<script src="jiodev.js" type="text/javascript"></script>
<script src="jio_mappingstorage.js" type="text/javascript"></script>
<script src="jio_saferepairstorage.js" type="text/javascript"></script>
<script src="jio_fixstorage.js" type="text/javascript"></script>
......
......@@ -238,7 +238,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>960.3901.52182.22272</string> </value>
<value> <string>961.46357.14957.50005</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -256,7 +256,7 @@
</tuple>
<state>
<tuple>
<float>1497517315.49</float>
<float>1504533512.84</float>
<string>UTC</string>
</tuple>
</state>
......
......@@ -71,6 +71,8 @@
}
},
remote_sub_storage: {
type: "saferepair",
sub_storage: {
type: "mapping",
attachment_list: ["data"],
attachment: {
......@@ -94,6 +96,7 @@
default_view_reference: result[2]
}
}
}
};
return gadget.setSetting('jio_storage_description', configuration);
})
......
......@@ -273,7 +273,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>961.48147.7132.45448</string> </value>
<value> <string>961.49200.15936.15257</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -291,7 +291,7 @@
</tuple>
<state>
<tuple>
<float>1504018485.52</float>
<float>1504084622.06</float>
<string>UTC</string>
</tuple>
</state>
......
......@@ -118,6 +118,7 @@ font-awesome/font-awesome-webfont.svg\n
gadget_erp5_nojqm.css\n
jio_mappingstorage.js\n
jio_fixstorage.js\n
jio_saferepairstorage.js\n
gadget_erp5_global.js\n
URI.js\n
dygraph.js\n
......@@ -346,7 +347,7 @@ NETWORK:\n
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>961.10686.10882.5973</string> </value>
<value> <string>961.46357.14957.50005</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -364,7 +365,7 @@ NETWORK:\n
</tuple>
<state>
<tuple>
<float>1502956869.41</float>
<float>1504533611.59</float>
<string>UTC</string>
</tuple>
</state>
......
......@@ -115,6 +115,7 @@ CACHE:\n
jiodev.js\n
jio_mappingstorage.js\n
jio_fixstorage.js\n
jio_saferepairstorage.js\n
renderjs.js\n
rsvp.js\n
gadget_officejs_setting.js\n
......@@ -265,7 +266,7 @@ NETWORK:\n
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>960.57151.51816.16622</string> </value>
<value> <string>961.10686.10882.5973</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -283,7 +284,7 @@ NETWORK:\n
</tuple>
<state>
<tuple>
<float>1501160529.99</float>
<float>1504533620.03</float>
<string>UTC</string>
</tuple>
</state>
......
......@@ -122,6 +122,7 @@ font-awesome/font-awesome-webfont.svg\n
gadget_officejs_nojqm.css\n
jio_mappingstorage.js\n
jio_fixstorage.js\n
jio_saferepairstorage.js\n
gadget_erp5_global.js\n
URI.js\n
dygraph.js\n
......@@ -350,7 +351,7 @@ NETWORK:\n
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>961.46357.14957.50005</string> </value>
<value> <string>961.56686.22927.2474</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -368,7 +369,7 @@ NETWORK:\n
</tuple>
<state>
<tuple>
<float>1504530140.93</float>
<float>1504533633.59</float>
<string>UTC</string>
</tuple>
</state>
......
/*jslint indent:2,maxlen:80,nomen:true*/
/*global jIO, RSVP*/
(function (jIO, RSVP) {
"use strict";
/**
* The jIO SafeRepairStorage extension
*
* @class SafeRepairStorage
* @constructor
*/
function SafeRepairStorage(spec) {
this._sub_storage = jIO.createJIO(spec.sub_storage);
this._id_dict = {};
}
SafeRepairStorage.prototype.get = function () {
return this._sub_storage.get.apply(this._sub_storage, arguments);
};
SafeRepairStorage.prototype.allAttachments = function () {
return this._sub_storage.allAttachments.apply(this._sub_storage, arguments);
};
SafeRepairStorage.prototype.post = function () {
return this._sub_storage.post.apply(this._sub_storage, arguments);
};
SafeRepairStorage.prototype.put = function (id, doc) {
var storage = this;
return this._sub_storage.put.apply(this._sub_storage, arguments)
.push(undefined, function (error) {
if (error instanceof jIO.util.jIOError &&
error.status_code === 403) {
if (storage._id_dict[id]) {
return storage._sub_storage.put(storage._id_dict[id], doc);
}
return storage._sub_storage.post(doc)
.push(function (sub_id) {
storage._id_dict[id] = sub_id;
return sub_id;
});
}
});
};
SafeRepairStorage.prototype.remove = function () {
return;
};
SafeRepairStorage.prototype.getAttachment = function () {
return this._sub_storage.getAttachment.apply(this._sub_storage, arguments);
};
SafeRepairStorage.prototype.putAttachment = function (id, attachment_id,
attachment) {
var storage = this;
return this._sub_storage.putAttachment.apply(this._sub_storage, arguments)
.push(undefined, function (error) {
if (error instanceof jIO.util.jIOError &&
error.status_code === 403) {
return new RSVP.Queue()
.push(function () {
if (storage._id_dict[id]) {
return storage._id_dict[id];
}
return storage._sub_storage.get(id)
.push(function (doc) {
return storage._sub_storage.post(doc);
});
})
.push(function (sub_id) {
storage._id_dict[id] = sub_id;
return storage._sub_storage.putAttachment(sub_id, attachment_id,
attachment);
});
}
});
};
SafeRepairStorage.prototype.removeAttachment = function () {
return;
};
SafeRepairStorage.prototype.repair = function () {
return this._sub_storage.repair.apply(this._sub_storage, arguments);
};
SafeRepairStorage.prototype.hasCapacity = function (name) {
return this._sub_storage.hasCapacity(name);
};
SafeRepairStorage.prototype.buildQuery = function () {
return this._sub_storage.buildQuery.apply(this._sub_storage,
arguments);
};
jIO.addStorage('saferepair', SafeRepairStorage);
}(jIO, RSVP));
......@@ -118,6 +118,7 @@ font-awesome/font-awesome-webfont.svg\n
gadget_erp5_nojqm.css\n
jio_mappingstorage.js\n
jio_fixstorage.js\n
jio_saferepairstorage.js\n
gadget_erp5_global.js\n
URI.js\n
dygraph.js\n
......@@ -348,7 +349,7 @@ NETWORK:\n
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>961.30792.56927.40004</string> </value>
<value> <string>961.50636.39446.44697</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -366,7 +367,7 @@ NETWORK:\n
</tuple>
<state>
<tuple>
<float>1503306177.8</float>
<float>1504533603.02</float>
<string>UTC</string>
</tuple>
</state>
......
......@@ -118,6 +118,7 @@ font-awesome/font-awesome-webfont.svg\n
gadget_erp5_nojqm.css\n
jio_mappingstorage.js\n
jio_fixstorage.js\n
jio_saferepairstorage.js\n
gadget_erp5_global.js\n
URI.js\n
dygraph.js\n
......@@ -340,7 +341,7 @@ NETWORK:\n
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>961.10686.10882.5973</string> </value>
<value> <string>961.50636.39446.44697</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -358,7 +359,7 @@ NETWORK:\n
</tuple>
<state>
<tuple>
<float>1502956909.56</float>
<float>1504533641.35</float>
<string>UTC</string>
</tuple>
</state>
......
......@@ -118,6 +118,7 @@ font-awesome/font-awesome-webfont.svg\n
gadget_erp5_nojqm.css\n
jio_mappingstorage.js\n
jio_fixstorage.js\n
jio_saferepairstorage.js\n
gadget_erp5_global.js\n
URI.js\n
dygraph.js\n
......@@ -346,7 +347,7 @@ NETWORK:\n
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>961.10686.10882.5973</string> </value>
<value> <string>961.50636.39446.44697</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -364,7 +365,7 @@ NETWORK:\n
</tuple>
<state>
<tuple>
<float>1502956899.93</float>
<float>1504533648.94</float>
<string>UTC</string>
</tuple>
</state>
......
......@@ -118,6 +118,7 @@ font-awesome/font-awesome-webfont.svg\n
gadget_erp5_nojqm.css\n
jio_mappingstorage.js\n
jio_fixstorage.js\n
jio_saferepairstorage.js\n
gadget_erp5_global.js\n
URI.js\n
dygraph.js\n
......@@ -346,7 +347,7 @@ NETWORK:\n
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>961.10686.10882.5973</string> </value>
<value> <string>961.50636.39446.44697</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -364,7 +365,7 @@ NETWORK:\n
</tuple>
<state>
<tuple>
<float>1502956891.05</float>
<float>1504533655.19</float>
<string>UTC</string>
</tuple>
</state>
......
......@@ -118,6 +118,7 @@ font-awesome/font-awesome-webfont.svg\n
gadget_erp5_nojqm.css\n
jio_mappingstorage.js\n
jio_fixstorage.js\n
jio_saferepairstorage.js\n
gadget_erp5_global.js\n
URI.js\n
dygraph.js\n
......@@ -346,7 +347,7 @@ NETWORK:\n
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>961.10686.10882.5973</string> </value>
<value> <string>961.50636.39446.44697</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -364,7 +365,7 @@ NETWORK:\n
</tuple>
<state>
<tuple>
<float>1502956880.85</float>
<float>1504533661.97</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