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

update to erp5 storage

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