Commit 4a927725 authored by Rafael Monnerat's avatar Rafael Monnerat

slapos_jio: Wrapper getUrlForList instead getUrlFor

Reimplement the wrapper to follow up this change:

nexedi/erp5@f9c408f7
parent 7c22321a
......@@ -9,22 +9,23 @@
.declareAcquiredMethod("reload", "reload")
.declareAcquiredMethod("getSetting", "getSetting")
.declareAcquiredMethod("setSetting", "setSetting")
.declareAcquiredMethod("getUrlForList", "getUrlForList")
.declareAcquiredMethod("getUrlFor", "getUrlFor")
.declareAcquiredMethod("jio_allDocs", "jio_allDocs")
.allowPublicAcquisition("getUrlFor", function (param_list) {
var gadget = this;
if ((param_list[0].command === "index") && (param_list[0].options.jio_key) &&
(param_list[0].options.jio_key.startsWith("software_product_module"))) {
param_list[0].options.page = "slap_select_software_release";
if (gadget.computer_jio_key !== undefined) {
param_list[0].options.computer_jio_key = gadget.computer_jio_key;
.allowPublicAcquisition("getUrlForList", function (promise_list) {
var index, param_list, gadget = this;
for (index in promise_list[0]) {
if ((promise_list[0][index].command === "index") && (promise_list[0][index].options.jio_key) &&
(promise_list[0][index].options.jio_key.startsWith("software_product_module"))) {
promise_list[0][index].options.page = "slap_select_software_release";
if (gadget.computer_jio_key !== undefined) {
promise_list[0][index].options.computer_jio_key = gadget.computer_jio_key;
}
}
}
return gadget.getUrlFor(param_list[0])
.push(function (result) {
return result;
});
return gadget.getUrlForList(promise_list[0]);
})
/////////////////////////////////////////////////////////////////
......@@ -95,9 +96,15 @@
}
});
})
.push(function (result) {
.push(function () {
return RSVP.all([
gadget.getUrlFor({command: 'change', options: {"page": "slap_controller"}})
]);
})
.push(function (url_list) {
return gadget.updateHeader({
page_title: "Select one Software",
selection_url: url_list[0],
filter_action: true
});
});
......
......@@ -230,7 +230,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>964.7.40651.47240</string> </value>
<value> <string>972.37756.33633.30481</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -248,7 +248,7 @@
</tuple>
<state>
<tuple>
<float>1512753759.32</float>
<float>1545870712.4</float>
<string>UTC</string>
</tuple>
</state>
......
......@@ -10,24 +10,26 @@
.declareAcquiredMethod("getSetting", "getSetting")
.declareAcquiredMethod("setSetting", "setSetting")
.declareAcquiredMethod("getUrlFor", "getUrlFor")
.declareAcquiredMethod("getUrlForList", "getUrlForList")
.declareAcquiredMethod("jio_allDocs", "jio_allDocs")
.declareAcquiredMethod("jio_get", "jio_get")
.allowPublicAcquisition("getUrlFor", function (param_list) {
var gadget = this;
if ((param_list[0].command === "index") && (param_list[0].options.jio_key) &&
(param_list[0].options.jio_key.startsWith("software_release_module"))) {
if (gadget.computer_jio_key !== undefined) {
param_list[0].options.page = "slap_add_software_installation";
param_list[0].options.computer_jio_key = gadget.computer_jio_key;
} else {
param_list[0].options.page = "slap_add_hosting_subscription";
.allowPublicAcquisition("getUrlForList", function (promise_list) {
var index, param_list, gadget = this;
for (index in promise_list[0]) {
if ((promise_list[0][index].command === "index") && (promise_list[0][index].options.jio_key) &&
(promise_list[0][index].options.jio_key.startsWith("software_release_module"))) {
if (gadget.computer_jio_key !== undefined) {
promise_list[0][index].options.page = "slap_add_software_installation";
promise_list[0][index].options.computer_jio_key = gadget.computer_jio_key;
} else {
promise_list[0][index].options.page = "slap_add_hosting_subscription";
}
}
}
return gadget.getUrlFor(param_list[0])
.push(function (result) {
return result;
});
return gadget.getUrlForList(promise_list[0]);
})
/////////////////////////////////////////////////////////////////
......@@ -104,9 +106,15 @@
});
});
})
.push(function (result) {
.push(function () {
return RSVP.all([
gadget.getUrlFor({command: 'change', options: {"page": "slap_select_software_product"}})
]);
})
.push(function (url_list) {
return gadget.updateHeader({
page_title: "Select one Release",
selection_url: url_list[0],
filter_action: true
});
});
......
......@@ -230,7 +230,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>963.7896.10186.10564</string> </value>
<value> <string>972.37768.39754.62054</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -248,7 +248,7 @@
</tuple>
<state>
<tuple>
<float>1512753841.61</float>
<float>1545871468.02</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