Commit a462cb6d authored by Jérome Perrin's avatar Jérome Perrin

GUI: update to new jio API

parent f26afe26
...@@ -35,7 +35,7 @@ ...@@ -35,7 +35,7 @@
"_attachment": "simulation.json" "_attachment": "simulation.json"
}) })
.push(undefined, function (error) { .push(undefined, function (error) {
if (error.status === 404) { if (error.status_code === 404) {
// Simulation not yet generated // Simulation not yet generated
return JSON.stringify([]); return JSON.stringify([]);
} }
......
...@@ -473,9 +473,14 @@ ...@@ -473,9 +473,14 @@
return g.getDeclaredGadget("jio") return g.getDeclaredGadget("jio")
.push(function (gadget) { .push(function (gadget) {
return gadget.createJio({ return gadget.createJio({
type: "local", type: "query",
username: "dream", sub_storage: {
applicationname: "dream" type: "document",
document_id: "/",
sub_storage: {
type: "local"
}
}
}); });
}); });
}) })
......
...@@ -21,7 +21,9 @@ ...@@ -21,7 +21,9 @@
}) })
.declareMethod('get', function () { .declareMethod('get', function () {
var storage = this.state_parameter_dict.jio_storage; var storage = this.state_parameter_dict.jio_storage;
return storage.get.apply(storage, arguments); return storage.get.apply(storage, arguments).push(function (result) {
return {data: result};
});
}) })
.declareMethod('remove', function () { .declareMethod('remove', function () {
var storage = this.state_parameter_dict.jio_storage; var storage = this.state_parameter_dict.jio_storage;
...@@ -32,20 +34,28 @@ ...@@ -32,20 +34,28 @@
return storage.getAttachment.apply(storage, arguments) return storage.getAttachment.apply(storage, arguments)
// XXX Where to put this &@! blob reading // XXX Where to put this &@! blob reading
.then(function (response) { .then(function (response) {
return jIO.util.readBlobAsText(response.data); return jIO.util.readBlobAsText(response);
}) })
.then(function (lala) { .then(function (lala) {
return lala.target.result; return lala.target.result;
}); });
}) })
.declareMethod('putAttachment', function () { .declareMethod('putAttachment', function () {
var storage = this.state_parameter_dict.jio_storage; var storage = this.state_parameter_dict.jio_storage,
return storage.putAttachment.apply(storage, arguments); argument_list = arguments;
return storage.putAttachment.apply(storage, arguments)
.push(function(){
return {id: argument_list[0]._id,
attachment: argument_list[0]._attachment};
});
}) })
.declareMethod('post', function () { .declareMethod('post', function () {
// XXX set modified value // XXX set modified value
var storage = this.state_parameter_dict.jio_storage; var storage = this.state_parameter_dict.jio_storage;
return storage.post.apply(storage, arguments); return storage.post.apply(storage, arguments).push(function(id){
return {id: id};
});
}); });
}(rJS, jIO)); }(rJS, jIO));
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