Commit 8ded3cca authored by Jérome Perrin's avatar Jérome Perrin

GUI: update to new jio API

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