Commit 4498d7c3 authored by Sven Franck's avatar Sven Franck

update to erp5 storage

parent 2ea8b22d
......@@ -18,6 +18,15 @@
"text": "Created Networks",
"text_i18n": "portal_type_dict.network_dict.text_dict.created_networks"
},
"pagination": {
"slot": 4,
"option_list": [
{"value": "8", "text": "8", "text_i18n":"portal_type_dict.network_dict.text_dict.8"},
{"value": "16", "text": "16", "text_i18n":"portal_type_dict.network_dict.text_dict.16"},
{"value": "32", "text": "32", "text_i18n":"portal_type_dict.network_dict.text_dict.32"},
{"value": "64", "text": "64", "text_i18n":"portal_type_dict.network_dict.text_dict.64"}
]
},
"no_items": {
"message": "No networks found.",
"message_i18n": "portal_type_dict.network_dict.text_dict.nonet"
......
......@@ -8,7 +8,7 @@
"view": "web_view",
"property_dict": {
"link": true,
"link_identifier": "_relative_url",
"link_identifier": "_id",
"dynamic_children": [0]
},
"scheme": [
......
......@@ -2887,69 +2887,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, pass = reply.pass;
if (storage) {
config = {
"url": storage.items.dict.url,
"type": "GET",
"xhrFields": {
"withCredentials": true
}
};
// access storage
return jIO.util.ajax(config)
.then(function(response) {
var parsed = util.parse(response.target.responseText),
me = parsed.me,
flux = flux || {};
if (!me) {
return {"pass": pass};
} else {
return jIO.util.ajax({
"url": me.href,
"xhrFields": {
"withCredentials": true
}
});
}
}).then(function (answer) {
if (answer.pass) {
flux.not_logged_in = true;
return {"pass": pass};
} else {
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
return {
"response": util.parse(reply.response),
"pass": pass
};
}
}).fail(util.error);
}
return (reply);
},
/**
* @method ticket_status
* @param {object} reply Object received from previous chain element
......@@ -2991,13 +2928,15 @@
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, reply, pass = reply.pass;
var config, property, query, href, i, reply, uri, pass = reply.pass;
if (storage) {
config = {
......@@ -3012,24 +2951,22 @@
return jIO.util.ajax(config)
.then(function(response) {
var parsed = util.parse(response.target.responseText),
me = parsed.me,
me = parsed._links.me,
flux = flux || {};
if (!me) {
flux.not_logged_in = true;
return {"pass": pass};
} else {
return jIO.util.ajax({
"url": me.href,
"xhrFields": {
"withCredentials": true
}
});
uri = new URI(me.href)
return storage.items.get({"_id": uri.segment(2)});
}
}).then(function (answer) {
if (answer.pass) {
flux.not_logged_in = true;
return {"pass": pass};
} else {
reply = util.parse(answer.target.responseText)._links.slapos_jump;
reply = util.parse(answer.data)._links.slapos_jump;
for (i = 0; i < reply.length; i += 1) {
if (reply[i].name === "current_computer") {
query = reply[i]._query;
......@@ -3059,7 +2996,7 @@
* @param {object} response Object object passed on to next element
**/
"invoices": function (reply) {
var config, property, query, href, i, reply, pass = reply.pass;
var config, property, query, href, i, reply, uri, pass = reply.pass;
if (storage) {
config = {
......@@ -3074,25 +3011,22 @@
return jIO.util.ajax(config)
.then(function(response) {
var parsed = util.parse(response.target.responseText),
me = parsed.me,
me = parsed._links.me,
flux = flux || {};
if (!me) {
flux.not_logged_in = true;
return {"pass": pass};
} else {
return jIO.util.ajax({
"url": me.href,
"xhrFields": {
"withCredentials": true
}
});
uri = new URI(me.href)
return storage.items.get({"_id": uri.segment(2)});
}
}).then(function (answer) {
if (answer.pass) {
flux.not_logged_in = true;
return {"pass": pass};
} else {
reply = util.parse(answer.target.responseText)._links.slapos_jump;
reply = util.parse(answer.data)._links.slapos_jump;
for (i = 0; i < reply.length; i += 1) {
if (reply[i].name === "current_invoice") {
query = reply[i]._query;
......@@ -3122,7 +3056,7 @@
* @param {object} response Object object passed on to next element
**/
"networks": function (reply) {
var config, property, query, href, i, reply, pass = reply.pass;
var config, property, query, href, i, reply, uri, pass = reply.pass;
if (storage) {
config = {
......@@ -3137,26 +3071,22 @@
return jIO.util.ajax(config)
.then(function(response) {
var parsed = util.parse(response.target.responseText),
me = parsed.me,
me = parsed._links.me,
flux = flux || {};
if (!me) {
return {
"pass": pass
}
flux.not_logged_in = true;
return {"pass": pass};
} else {
return jIO.util.ajax({
"url": me.href,
"xhrFields": {
"withCredentials": true
}
});
uri = new URI(me.href)
return storage.items.get({"_id": uri.segment(2)});
}
}).then(function (answer) {
if (answer.pass) {
flux.not_logged_in = true;
return {"pass": pass};
} else {
reply = util.parse(answer.target.responseText)._links.slapos_jump;
reply = util.parse(answer.data)._links.slapos_jump;
for (i = 0; i < reply.length; i += 1) {
if (reply[i].name === "current_network") {
query = reply[i]._query;
......@@ -3187,7 +3117,7 @@
**/
// TODO: should be renamed to overview
"subscriptions": function (reply) {
var config, property, query, href, i, reply, pass = reply.pass;
var config, property, query, href, i, reply, uri, pass = reply.pass;
if (storage) {
config = {
......@@ -3202,26 +3132,84 @@
return jIO.util.ajax(config)
.then(function(response) {
var parsed = util.parse(response.target.responseText),
me = parsed.me,
me = parsed._links.me,
flux = flux || {};
if (!me) {
flux.not_logged_in = true;
return {"pass": pass};
} else {
return jIO.util.ajax({
"url": me.href,
uri = new URI(me.href)
return storage.items.get({"_id": uri.segment(2)});
}
}).then(function (answer) {
if (answer.pass) {
flux.not_logged_in = true;
return {"pass": pass};
} else {
reply = util.parse(answer.data)._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
return {
"response": util.parse(reply.response),
"pass": pass
};
}
}).fail(util.error);
}
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, uri, pass = reply.pass;
if (storage) {
config = {
"url": storage.items.dict.url,
"type": "GET",
"xhrFields": {
"withCredentials": true
}
});
};
// access storage
return jIO.util.ajax(config)
.then(function(response) {
var parsed = util.parse(response.target.responseText),
me = parsed._links.me,
flux = flux || {};
if (!me) {
flux.not_logged_in = true;
return {"pass": pass};
} else {
uri = new URI(me.href)
return storage.items.get({"_id": uri.segment(2)});
}
}).then(function (answer) {
if (answer.pass) {
flux.not_logged_in = true;
return {"pass": pass};
} else {
reply = util.parse(answer.target.responseText)._links.slapos_jump;
reply = util.parse(answer.data)._links.slapos_jump;
for (i = 0; i < reply.length; i += 1) {
if (reply[i].name === "current_hosting_subscription") {
if (reply[i].name === "current_ticket") {
query = reply[i]._query;
}
}
......@@ -3231,6 +3219,7 @@
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
return {
......@@ -4164,7 +4153,6 @@
// loop data (!)
for (k = 0; k < items.length; k += 1) {
item = items[k].doc;
if (item === undefined) {
util.error("mapTableRows: Missing include_docs/data-set");
......@@ -4179,7 +4167,6 @@
// set id so it can be retrieved for radio/checkbox
// TODO: remove this! don't set on every cell...
cell.id = item.id || items[k]["_id"];
if (props.link) {
cell.href = item[props.link_source] ||
("#" + core + "/" + window.encodeURIComponent(item[props.link_identifier || "id"]));
......@@ -4191,10 +4178,10 @@
// action menu
if (props.action_menu && cell.action_list) {
// HACK to add correct HREF and reference
if (item._relative_url) {
if (item._id) {
for (o = 0; o < cell.action_list.length; o += 1) {
cell.action_list[o].reference = spec.set_id;
cell.action_list[o].href = window.encodeURIComponent(item._relative_url);
cell.action_list[o].href = window.encodeURIComponent(item._id);
}
}
cell.action_list = cell.action_list || [];
......
......@@ -73,7 +73,8 @@
"stopping": "Shutting Down...",
"success": "Ok",
"created": "Created",
"destroying": "Destroying"
"destroying": "Destroying",
"internal_error": "Internal Error"
},
"validation_dict": {
"general": "Please correct the highlighted fields.",
......
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