Commit 02320a0b authored by Sven Franck's avatar Sven Franck

fixed URL handling of "new" and "add" on deeplinks

parent bc94841c
This diff is collapsed.
{
"portal_type_source": "Service",
"portal_type_title": "service",
"portal_type_fields": "service_fieldlist",
"initial_query": {"include_docs": true, "limit":[0,16]},
"form": true,
"id": "service_overview",
"property_dict": {
"initial_query_url_identifier": "service_reference_computer",
"dynamic_children": [1],
"wrap_gadget": 2,
"layout": {
"header": [
[
{"custom": true, "text": "Image", "text_i18n": "portal_type_dict.service_dict.field_list.image_url.title", "show": true, "priority": 4},
{"column": "service_title", "show": true, "priority": 1},
{"column": "service_version", "show": true, "priority": 1},
{"column": "service_usage", "show": true, "priority": 5}
]
],
"body": [
{"column": "service_image_url", "show": true, "priority": 4, "image": true},
{"column": "service_title", "show": true, "priority": 1},
{"column": "service_version", "show": true, "priority": 1},
{"column": "service_usage", "show": true, "priority": 5}
],
"footer": []
},
"feature_dict": {
"linkable": true,
"link_identifier": null
}
},
"children": [{
"type": "a",
"direct": {"className":"translate ui-btn ui-icon-edit ui-btn-icon-left ui-corner-all ui-btn-inline ui-btn-slapos-black ui-link", "href": "#services::add"},
"attributes": {
"data-i18n": "page_dict.services.add",
"data-icon": "edit"
},
"logic": {"text":"Install new software"}
},{
"generate": "widget",
"type": "table",
"class_list": "table-stroke ui-responsive",
"property_dict": {
"mode": "columntoggle",
"toggle_popup": false,
"wrap": "both",
"top_grid": 1,
"bottom_grid": 1
},
"children": []
}]
}
[
{
"service_version":"slapos-0.92",
"service_title": "[EXPERIMENTAL] KVM",
"service_image_type": "image",
"service_image_url":"https://www.slapos.org/software_product_module/2/default_image?quality=75&display=thumbnail",
"service_status": "",
"service_usage": "",
"service_id": "",
"service_timestamp": "2013/12/24",
"service_reference_release": "2845497",
"service_reference_computer": "",
"service_xml_recipe": "<?xml version='1.0' encoding='utf-8'?>\n<instance>\n</instance>"
},
{
"service_version":"[EXPERIMENTAL] SlapOS Web Runner",
"service_title": "SlapOS Web Runner (Master Development)",
"service_image_type": "image",
"service_image_url":"https://www.slapos.org/software_product_module/20110316-88D7/default_image?quality=75&amp;display=thumbnail",
"service_status": "",
"service_usage": "",
"service_id": "",
"service_timestamp": "2013/12/23",
"service_reference_release": "1657159",
"service_reference_computer": "",
"service_xml_recipe": "<?xml version='1.0' encoding='utf-8'?>\n<instance>\n</instance>"
},
{
"service_version":"slapos-0.141",
"service_title": "Kumofs Branch Development",
"service_image_type": "image",
"service_image_url":"https://www.slapos.org/software_product_module/20110615-176F8/default_image?quality=75&amp;display=thumbnail",
"service_status": "",
"service_usage": "",
"service_id": "",
"service_timestamp": "2013/12/22",
"service_reference_release": "8516098",
"service_reference_computer": "",
"service_xml_recipe": "<?xml version='1.0' encoding='utf-8'?>\n<instance>\n</instance>"
},
{
"service_version":"slapos-0.96",
"service_title": "Zabbix Agent",
"service_image_type": "image",
"service_image_url":"https://www.slapos.org/software_product_module/20110613-107B5/default_image?quality=75&amp;display=thumbnail",
"service_status": "",
"service_usage": "",
"service_id": "",
"service_timestamp": "2013/12/22",
"service_reference_release": "3105599",
"service_reference_computer": "",
"service_xml_recipe": "<?xml version='1.0' encoding='utf-8'?>\n<instance>\n</instance>"
}
]
\ No newline at end of file
...@@ -28,7 +28,7 @@ ...@@ -28,7 +28,7 @@
}, },
"feature_dict": { "feature_dict": {
"linkable": true, "linkable": true,
"link_identifier": "id" "link_identifier": "_id"
} }
}, },
"children": [{ "children": [{
......
...@@ -14,8 +14,24 @@ ...@@ -14,8 +14,24 @@
{ {
"generate": "gadget", "generate": "gadget",
"type": "listbox", "type": "listbox",
"id": "installation_overview", "id": "service_overview",
"href": "installation_overview" "href": "service_overview"
}
]
}
}, {
"generate": "widget",
"type": "page",
"title": "Service Configuration",
"title_i18n": "page_dict.services.configuration",
"theme": "slapos-white",
"layout": {
"default": [
{
"generate": "gadget",
"type": "listgrid",
"id": "service_status",
"href": "service_status"
} }
], ],
"add": [ "add": [
...@@ -34,7 +50,7 @@ ...@@ -34,7 +50,7 @@
"title_i18n": "page_dict.services.select", "title_i18n": "page_dict.services.select",
"theme": "slapos-white", "theme": "slapos-white",
"layout": { "layout": {
"default": [ "add": [
{ {
"generate": "gadget", "generate": "gadget",
"type": "listbox", "type": "listbox",
...@@ -50,7 +66,7 @@ ...@@ -50,7 +66,7 @@
"title_i18n": "page_dict.services.install", "title_i18n": "page_dict.services.install",
"theme": "slapos-white", "theme": "slapos-white",
"layout": { "layout": {
"default": [ "add": [
{ {
"generate": "gadget", "generate": "gadget",
"type": "fieldlist", "type": "fieldlist",
......
...@@ -16,10 +16,7 @@ ...@@ -16,10 +16,7 @@
"class_list": "responsive", "class_list": "responsive",
"children": [ "children": [
{"type": "input", "direct": {"id":"search_software_list", "className": "translate"}, "attributes": {"data-action":"search", "data-enhanced":"true", "data-i18n": "[placeholder]page_dict.software.search","placeholder":"Search available software", "data-icon":"search", "data-action-btn":"true", "data-type":"search", "type":"search"}, "logic":{"clear":"true", "action":"search"}}, {"type": "input", "direct": {"id":"search_software_list", "className": "translate"}, "attributes": {"data-action":"search", "data-enhanced":"true", "data-i18n": "[placeholder]page_dict.software.search","placeholder":"Search available software", "data-icon":"search", "data-action-btn":"true", "data-type":"search", "type":"search"}, "logic":{"clear":"true", "action":"search"}},
{"type": "div", "direct": {"className":"info"}, "attributes": {"data-info":"records"}}, {"type": "div", "direct": {"className":"info"}, "attributes": {"data-info":"records"}}
{"type": "div", "direct": {"className":"info"}, "attributes": {"data-info":"selected"}},
{"type": "div", "direct": {"className":"info"}, "attributes": {"data-info":"filter"}},
{"type": "div", "direct": {"className":"info"}, "attributes": {"data-info":"sorted"}}
] ]
}, { }, {
"generate":"widget", "generate":"widget",
......
{ {
"portal_type_source": "Software Installation", "portal_type_source": "Service",
"portal_type_title": "installation", "portal_type_title": "service",
"portal_type_fields": "installation_fieldlist", "portal_type_fields": "service_fieldlist",
"form": true, "form": true,
"id": "installation_overview", "id": "service_overview",
"property_dict": { "property_dict": {
"dynamic_children": [0], "dynamic_children": [0],
"wrap_gadget": 2, "wrap_gadget": 2,
"layout": { "layout": {
"header": [ "header": [
[ [
{"column": "installation_image", "show": true, "priority": 4}, {"column": "service_image", "show": true, "priority": 4},
{"column": "installation_title", "show": true, "priority": 5}, {"column": "service_title", "show": true, "priority": 5},
{"column": "installation_version", "show": true, "priority": 2}, {"column": "service_version", "show": true, "priority": 2},
{"custom": true, "text": "Status", "text_i18n": "global_dict.common_dict.status", "show": true, "priority": 5}, {"custom": true, "text": "Status", "text_i18n": "global_dict.common_dict.status", "show": true, "priority": 5},
{"column": "installation_usage", "show": true, "priority": 3} {"column": "service_usage", "show": true, "priority": 3}
] ]
], ],
"body": [ "body": [
{"column": "installation_image", "show": true, "priority": 4}, {"column": "service_image", "show": true, "priority": 4},
{"column": "installation_title", "show": true, "priority": 5}, {"column": "service_title", "show": true, "priority": 5},
{"column": "installation_version", "show": true, "priority": 2}, {"column": "service_version", "show": true, "priority": 2},
{"custom": true, "show": true, "priority": 5, "status": true}, {"custom": true, "show": true, "priority": 5, "status": true},
{"custom": "installation_usage", "show": true, "priority": 3} {"custom": "service_usage", "show": true, "priority": 3}
], ],
"footer": [] "footer": []
}, },
"feature_dict": { "feature_dict": {
"linkable": true, "linkable": true,
"link_identifier": "installation_id" "link_identifier": "service_id"
} }
}, },
"children": [{ "children": [{
......
...@@ -4963,6 +4963,7 @@ ...@@ -4963,6 +4963,7 @@
query = clean_hash.split("::"); query = clean_hash.split("::");
// TODO: this should be generic and without a backup.... // TODO: this should be generic and without a backup....
// TODO: the whole view handling is not flexible, refactor!
for (i = 0; i < query.length; i += 1) { for (i = 0; i < query.length; i += 1) {
switch (query[i]) { switch (query[i]) {
case "new": case "new":
...@@ -4971,7 +4972,7 @@ ...@@ -4971,7 +4972,7 @@
break; break;
case "add": case "add":
config.mode = "add"; config.mode = "add";
backup = 1; //backup = 1;
break; break;
case "config": case "config":
config.mode = "config"; config.mode = "config";
...@@ -5307,7 +5308,7 @@ ...@@ -5307,7 +5308,7 @@
* @return {object} response object/promise * @return {object} response object/promise
*/ */
app.fetchDataTotal = function (reply) { app.fetchDataTotal = function (reply) {
var pass = reply.pass, reference; var pass = reply.pass, reference, last;
if (pass.skip === undefined) { if (pass.skip === undefined) {
// create or update state object // create or update state object
...@@ -5330,10 +5331,14 @@ ...@@ -5330,10 +5331,14 @@
"view": pass.mode "view": pass.mode
}; };
// on deeplinks, we have additional query parameters, // on deeplinks, take the URL element and query unless mode is defined
// but we should not do if pass.mode is set! // or if mode is defined and the last element is not same as mode
if (pass.layout_level > 0 && pass.mode === undefined) { // TODO: not stable! Find a new way!
pass.value = pass.fragment_list[pass.layout_level]; if (pass.layout_level > 0) {
last = pass.fragment_list[pass.fragment_list.length - 1];
if (pass.mode === undefined || last !== pass.mode) {
pass.value = pass.fragment_list[pass.layout_level];
}
} }
// generate new query object // generate new query object
...@@ -5892,16 +5897,16 @@ ...@@ -5892,16 +5897,16 @@
if (first || (page && base) || raw_url === $.mobile.getDocumentUrl() || if (first || (page && base) || raw_url === $.mobile.getDocumentUrl() ||
data.options.role === "popup") { data.options.role === "popup") {
// console.log("STOP us, JQM go") // stop us, JQM can go
return; return;
} }
if ((document.getElementById(config.id) && base !== null)) { if ((document.getElementById(config.id) && base !== null)) {
e.preventDefault(); e.preventDefault();
// console.log("STOP us, STOP JQM") // stop us and JQM
return; return;
} }
handle = true; handle = true;
// console.log("GO us, STOP JQM") // stop JQM, we go
e.preventDefault(); e.preventDefault();
} else { } else {
...@@ -5909,15 +5914,16 @@ ...@@ -5909,15 +5914,16 @@
if ($.mobile.navigate.history.initialDst && if ($.mobile.navigate.history.initialDst &&
window.location.hash !== "") { window.location.hash !== "") {
// this is the inital page (not) loaded, but stored as initial page! // this is the inital page (not) loaded
// this page needs to be stored as initial page in JQM
clean_url = window.location.href.split("#")[0]; clean_url = window.location.href.split("#")[0];
parsed_url = $.mobile.path.parseUrl(clean_url); parsed_url = $.mobile.path.parseUrl(clean_url);
// overwrite :-)
// NOTE: remove initialDist, otherwise closing popups will trigger // NOTE: remove initialDist, otherwise closing popups will trigger
// double backward transition. // double backward transition.
delete $.mobile.navigate.history.initialDst; delete $.mobile.navigate.history.initialDst;
// NOTE: Correctly set index as first page in JQM history
// NOTE: Correctly set index as first page in JQM history
$.mobile.navigate.history.stack[0].hash = ""; $.mobile.navigate.history.stack[0].hash = "";
$.mobile.navigate.history.stack[0].url = clean_url; $.mobile.navigate.history.stack[0].url = clean_url;
$.mobile.path.documentUrl = parsed_url; $.mobile.path.documentUrl = parsed_url;
......
...@@ -113,7 +113,8 @@ ...@@ -113,7 +113,8 @@
"instance_id": "Instance ID", "instance_id": "Instance ID",
"instance_recipe": "Instance Configuration", "instance_recipe": "Instance Configuration",
"instance_server": "Computer", "instance_server": "Computer",
"instance_network": "Network" "instance_network": "Network",
"configuration": "Configuration"
}, },
"networks": { "networks": {
"no_servers": "No servers associated with this network.", "no_servers": "No servers associated with this network.",
......
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