Commit 2a7c34a3 authored by Sven Franck's avatar Sven Franck

replaced custom hack with pointer and handler in erp5storage

parent 90542791
......@@ -28,6 +28,9 @@
{"value": "32", "text": "32", "text_i18n":"portal_type_dict.computer_dict.text_dict.32"},
{"value": "64", "text": "64", "text_i18n":"portal_type_dict.computer_dict.text_dict.64"}
]
},
"url_pointer": {
"jump": "current_computer"
}
},
"scheme": [
......
......@@ -29,6 +29,9 @@
{"value": "32", "text": "32", "text_i18n":"portal_type_dict.invoice_dict.text_dict.32"},
{"value": "64", "text": "64", "text_i18n":"portal_type_dict.invoice_dict.text_dict.64"}
]
},
"url_pointer": {
"jump": "current_invoices"
}
},
"scheme": [
......
......@@ -20,6 +20,9 @@
"no_items": {
"message": "No networks found.",
"message_i18n": "portal_type_dict.network_dict.text_dict.nonet"
},
"url_pointer": {
"jump": "current_network"
}
},
"scheme": [
......
......@@ -24,6 +24,9 @@
{"value": "32", "text": "32", "text_i18n":"portal_type_dict.service_dict.text_dict.32"},
{"value": "64", "text": "64", "text_i18n":"portal_type_dict.service_dict.text_dict.64"}
]
},
"url_pointer": {
"jump": "current_hosting_subscriptions"
}
},
"scheme": [
......
......@@ -28,6 +28,9 @@
{"value": "32", "text": "32", "text_i18n":"portal_type_dict.ticket_dict.text_dict.32"},
{"value": "64", "text": "64", "text_i18n":"portal_type_dict.ticket_dict.text_dict.64"}
]
},
"url_pointer": {
"jump": "current_ticket"
}
},
"scheme": [
......
......@@ -718,64 +718,6 @@
return (reply);
},
/**
* @method ticketing
* @param {object} reply Object received from previous chain element
* @param {object} response Object object passed on to next element
**/
"ticketing": function (reply) {
var config, property, query, href, i, reply, store, pass = reply.pass;
store = app.storage_dict;
if (store.property_dict.storage) {
config = {
"url": app.storage_dict.property_dict.items.storage_list[0].url,
"type": "GET",
"xhrFields": {
"withCredentials": true
}
};
// access storage
return jIO.util.ajax(config)
.then(function(response) {
return jIO.util.ajax({
"url": util.parse(response.target.responseText)._links.me.href,
"xhrFields": {
"withCredentials": true
}
});
}).then(function (answer) {
reply = util.parse(answer.target.responseText)._links.slapos_jump;
for (i = 0; i < reply.length; i += 1) {
if (reply[i].name === "current_ticket") {
query = reply[i]._query;
}
}
if (query === undefined) {
query = reply.href;
}
if (pass.config.initial_query === undefined) {
pass.config.initial_query = {};
}
pass.config.initial_query.skip_type = true;
pass.config.initial_query.query = query;
// pass hacked query back into chain
if (reply.response) {
return {
"response": util.parse(reply.response),
"pass": pass
};
}
return {
"pass": pass
}
}).fail(util.error);
}
return (reply);
},
/**
* @method ticket_status
* @param {object} reply Object received from previous chain element
......@@ -818,235 +760,6 @@
}
return (reply);
},
/**
* @method subscriptions
* @param {object} reply Object received from previous chain element
* @param {object} response Object object passed on to next element
**/
"servers": function (reply) {
var config, property, query, href, i, store, reply, pass = reply.pass;
store = app.storage_dict;
if (store.property_dict) {
config = {
"url": app.storage_dict.property_dict.items.storage_list[0].url,
"type": "GET",
"xhrFields": {
"withCredentials": true
}
};
// access storage
return jIO.util.ajax(config)
.then(function(response) {
return jIO.util.ajax({
"url": util.parse(response.target.responseText)._links.me.href,
"xhrFields": {
"withCredentials": true
}
});
}).then(function (answer) {
reply = util.parse(answer.target.responseText)._links.slapos_jump;
for (i = 0; i < reply.length; i += 1) {
if (reply[i].name === "current_computer") {
query = reply[i]._query;
}
}
if (query === undefined) {
query = reply.href;
}
if (pass.config.initial_query === undefined) {
pass.config.initial_query = {};
}
pass.config.initial_query.query = query;
// pass hacked query back into chain
if (reply.response) {
return {
"response": util.parse(reply.response),
"pass": pass
};
}
return {
"pass": pass
}
}).fail(util.error);
}
return (reply);
},
/**
* @method subscriptions
* @param {object} reply Object received from previous chain element
* @param {object} response Object object passed on to next element
**/
"invoices": function (reply) {
var config, property, query, href, i, reply, store, pass = reply.pass;
store = app.storage_dict;
if (store.property_dict.storage) {
config = {
"url": app.storage_dict.property_dict.items.storage_list[0].url,
"type": "GET",
"xhrFields": {
"withCredentials": true
}
};
// access storage
return jIO.util.ajax(config)
.then(function(response) {
return jIO.util.ajax({
"url": util.parse(response.target.responseText)._links.me.href,
"xhrFields": {
"withCredentials": true
}
});
}).then(function (answer) {
reply = util.parse(answer.target.responseText)._links.slapos_jump;
for (i = 0; i < reply.length; i += 1) {
if (reply[i].name === "current_invoice") {
query = reply[i]._query;
}
}
if (query === undefined) {
query = reply.href;
}
if (pass.config.initial_query === undefined) {
pass.config.initial_query = {};
}
pass.config.initial_query.query = query;
// pass hacked query back into chain
if (reply.response) {
return {
"response": util.parse(reply.response),
"pass": pass
};
}
return {
"pass": pass
}
}).fail(util.error);
}
return (reply);
},
/**
* @method subscriptions
* @param {object} reply Object received from previous chain element
* @param {object} response Object object passed on to next element
**/
"networks": function (reply) {
var config, property, query, href, i, reply, store, pass = reply.pass;
store = app.storage_dict;
if (store.property_dict.storage) {
config = {
"url": app.storage_dict.property_dict.items.storage_list[0].url,
"type": "GET",
"xhrFields": {
"withCredentials": true
}
};
// access storage
return jIO.util.ajax(config)
.then(function(response) {
return jIO.util.ajax({
"url": util.parse(response.target.responseText)._links.me.href,
"xhrFields": {
"withCredentials": true
}
});
}).then(function (answer) {
reply = util.parse(answer.target.responseText)._links.slapos_jump;
for (i = 0; i < reply.length; i += 1) {
if (reply[i].name === "current_network") {
query = reply[i]._query;
}
}
if (query === undefined) {
query = reply.href;
}
if (pass.config.initial_query === undefined) {
pass.config.initial_query = {};
}
pass.config.initial_query.query = query;
// pass hacked query back into chain
if (reply.response) {
return {
"response": util.parse(reply.response),
"pass": pass
};
}
return {
"pass": pass
}
}).fail(util.error);
}
return (reply);
},
/**
* @method subscriptions
* @param {object} reply Object received from previous chain element
* @param {object} response Object object passed on to next element
**/
// TODO: should be renamed to overview
"subscriptions": function (reply) {
var config, property, query, href, i, reply, store, pass = reply.pass;
store = app.storage_dict;
if (store.property_dict.storage) {
config = {
"url": app.storage_dict.property_dict.items.storage_list[0].url,
"type": "GET",
"xhrFields": {
"withCredentials": true
}
};
// access storage
return jIO.util.ajax(config)
.then(function(response) {
return jIO.util.ajax({
"url": util.parse(response.target.responseText)._links.me.href,
"xhrFields": {
"withCredentials": true
}
});
}).then(function (answer) {
reply = util.parse(answer.target.responseText)._links.slapos_jump;
for (i = 0; i < reply.length; i += 1) {
if (reply[i].name === "current_hosting_subscription") {
query = reply[i]._query;
}
}
if (query === undefined) {
query = reply.href;
}
if (pass.config.initial_query === undefined) {
pass.config.initial_query = {};
}
pass.config.initial_query.query = query;
// pass hacked query back into chain
if (reply.response) {
return {
"response": util.parse(reply.response),
"pass": pass
};
}
return {
"pass": pass
}
}).fail(util.error);
}
return (reply);
}
};
/**
......
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