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

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

parent bc94841c
{
"service_version": {
"type":"StringField",
"widget": {
"id": "service_version",
"title": "Version",
"title_i18n": "portal_type_dict.service_dict.field_list.version.title",
"description": "The version of the software installed on this computer.",
"description_i18n": "portal_type_dict.service_dict.field_list.version.description",
"alternate_name": "service_version",
"default_value": null,
"css_class": "",
"hidden": null,
"display_width": null,
"maximum_input": null,
"extra": null
},
"properties": {
"enabled": true,
"editable": true,
"external_validator": null,
"required": true,
"preserve_whitespace": null,
"unicode": null,
"maximum_length": 35,
"truncate": null
},
"message": {
"external_validator_failed": {
"message": "The input failed the external validator.",
"i18n": "validation_dict.external"
},
"required_not_found": {
"message": "Input required but not found.",
"i18n": "validation_dict.required"
},
"too_long": {
"message": "Too much input given.",
"i18n": "validation_dict.too_much_input"
}
}
},
"service_title": {
"type":"StringField",
"widget": {
"id": "service_title",
"title": "Title",
"title_i18n": "portal_type_dict.service_dict.field_list.title.title",
"description": "The title of the software being installed on this server.",
"description_i18n": "portal_type_dict.service_dict.field_list.title.description",
"alternate_name": "service_title",
"default_value": null,
"css_class": "",
"hidden": null,
"display_width": null,
"maximum_input": null,
"extra": null
},
"properties": {
"enabled": true,
"editable": true,
"external_validator": null,
"required": true,
"preserve_whitespace": null,
"unicode": null,
"maximum_length": 70,
"truncate": null
},
"message": {
"external_validator_failed": {
"message": "The input failed the external validator.",
"i18n": "validation_dict.external"
},
"required_not_found": {
"message": "Input required but not found.",
"i18n": "validation_dict.required"
},
"too_long": {
"message": "Too much input given.",
"i18n": "validation_dict.too_much_input"
}
}
},
"service_image_type": {
"type":"StringField",
"widget": {
"id": "service_image_type",
"title": "Type",
"title_i18n": "portal_type_dict.service_dict.field_list.image_type.title",
"description": "Type of Image (Icon/Image).",
"description_i18n": "portal_type_dict.service_dict.field_list.image_type.description",
"alternate_name": "service_image_type",
"default_value": null,
"css_class": null,
"hidden": null,
"display_width": null,
"maximum_input": null,
"extra": null
},
"properties": {
"enabled": true,
"editable": true,
"external_validator": null,
"required": true,
"preserve_whitespace": null,
"unicode": null,
"maximum_length": null,
"truncate": null
},
"message": {
"external_validator_failed": {
"message": "The input failed the external validator.",
"i18n": "validation_dict.external"
},
"required_not_found": {
"message": "Input required but not found.",
"i18n": "validation_dict.required"
},
"too_long": {
"message": "Too much input give.",
"i18n": "validation_dict.too_much_input"
}
}
},
"service_image_url": {
"type":"ImageField",
"widget": {
"id": "service_image_url",
"title": "Image",
"title_i18n": "portal_type_dict.service_dict.field_list.image_url.title",
"description": "The path to the icon/image for this software service.",
"description_i18n": "portal_type_dict.service_dict.field_list.image_url.description",
"alternate_name": "service_image_url",
"default_value": null,
"css_class": null,
"hidden": null,
"display_width": null,
"maximum_input": null,
"extra": null,
"image_display": null,
"image_format": null,
"image_quality": null,
"image_preconverted_only": null
},
"properties": {
"enabled": true,
"editable": true,
"external_validator": null,
"required": true,
"preserve_whitespace": null,
"unicode": null,
"maximum_length": null,
"truncate": null
},
"message": {
"external_validator_failed": {
"message": "The input failed the external validator.",
"i18n": "validation_dict.external"
},
"required_not_found": {
"message": "Input required but not found.",
"i18n": "validation_dict.required"
},
"too_long": {
"message": "Too much input give.",
"i18n": "validation_dict.too_much_input"
}
}
},
"service_status": {
"type":"StringField",
"widget": {
"id": "service_status",
"title": "Status",
"title_i18n": "portal_type_dict.service_dict.field_list.status.title",
"description": "The status of the software being installed on this server.",
"description_i18n": "portal_type_dict.service_dict.field_list.status.description",
"alternate_name": "service_status",
"default_value": null,
"css_class": null,
"hidden": null,
"display_width": null,
"maximum_input": null,
"extra": null
},
"properties": {
"enabled": true,
"editable": true,
"external_validator": null,
"required": true,
"preserve_whitespace": null,
"unicode": null,
"maximum_length": null,
"truncate": null
},
"message": {
"external_validator_failed": {
"message": "The input failed the external validator.",
"i18n": "validation_dict.external"
},
"required_not_found": {
"message": "Input required but not found.",
"i18n": "validation_dict.required"
},
"too_long": {
"message": "Too much input give.",
"i18n": "validation_dict.too_much_input"
}
}
},
"service_usage": {
"type":"StringField",
"widget": {
"id": "service_usage",
"title": "Usage",
"title_i18n": "portal_type_dict.service_dict.field_list.usage.title",
"description": "The usage of this software.",
"description_i18n": "portal_type_dict.service_dict.field_list.usage.description",
"alternate_name": "service_usage",
"default_value": null,
"css_class": null,
"hidden": null,
"display_width": null,
"maximum_input": null,
"extra": null
},
"properties": {
"enabled": true,
"editable": true,
"external_validator": null,
"required": true,
"preserve_whitespace": null,
"unicode": null,
"maximum_length": null,
"truncate": null
},
"message": {
"external_validator_failed": {
"message": "The input failed the external validator.",
"i18n": "validation_dict.external"
},
"required_not_found": {
"message": "Input required but not found.",
"i18n": "validation_dict.required"
},
"too_long": {
"message": "Too much input give.",
"i18n": "validation_dict.too_much_input"
}
}
},
"service_id": {
"type":"StringField",
"widget": {
"id": "service_id",
"title": "ID",
"title_i18n": "portal_type_dict.service_dict.field_list.id.title",
"description": "The id of this installation.",
"description_i18n": "portal_type_dict.service_dict.field_list.id.description",
"alternate_name": "service_id",
"default_value": null,
"css_class": null,
"hidden": null,
"display_width": null,
"maximum_input": null,
"extra": null
},
"properties": {
"enabled": true,
"editable": true,
"external_validator": null,
"required": true,
"preserve_whitespace": null,
"unicode": null,
"maximum_length": null,
"truncate": null
},
"message": {
"external_validator_failed": {
"message": "The input failed the external validator.",
"i18n": "validation_dict.external"
},
"required_not_found": {
"message": "Input required but not found.",
"i18n": "validation_dict.required"
},
"too_long": {
"message": "Too much input give.",
"i18n": "validation_dict.too_much_input"
}
}
},
"service_timestamp": {
"type":"DateTimeField",
"widget": {
"id": "service_timestamp",
"title": "ID",
"title_i18n": "portal_type_dict.service_dict.field_list.timestamp.title",
"description": "The timestamp this installation was made.",
"description_i18n": "portal_type_dict.service_dict.field_list.timestamp.description",
"alternate_name": "service_timestamp",
"default_value": null,
"css_class": null,
"hidden": null,
"display_width": null,
"maximum_input": null,
"extra": null
},
"properties": {
"enabled": true,
"editable": true,
"external_validator": null,
"required": true,
"preserve_whitespace": null,
"unicode": null,
"maximum_length": null,
"truncate": null
},
"message": {
"external_validator_failed": {
"message": "The input failed the external validator.",
"i18n": "validation_dict.external"
},
"required_not_found": {
"message": "Input required but not found.",
"i18n": "validation_dict.required"
},
"too_long": {
"message": "Too much input give.",
"i18n": "validation_dict.too_much_input"
}
}
},
"service_reference_computer": {
"type":"StringField",
"widget": {
"id": "service_reference_computer",
"title": "Computer",
"title_i18n": "portal_type_dict.service_dict.field_list.computer.title",
"description": "The computer this installation is made on.",
"description_i18n": "portal_type_dict.service_dict.field_list.computer.description",
"alternate_name": "service_reference_computer",
"default_value": null,
"css_class": null,
"hidden": null,
"display_width": null,
"maximum_input": null,
"extra": null
},
"properties": {
"enabled": true,
"editable": true,
"external_validator": null,
"required": true,
"preserve_whitespace": null,
"unicode": null,
"maximum_length": null,
"truncate": null
},
"message": {
"external_validator_failed": {
"message": "The input failed the external validator.",
"i18n": "validation_dict.external"
},
"required_not_found": {
"message": "Input required but not found.",
"i18n": "validation_dict.required"
},
"too_long": {
"message": "Too much input give.",
"i18n": "validation_dict.too_much_input"
}
}
},
"service_reference_release": {
"type":"StringField",
"widget": {
"id": "service_reference_release",
"title": "Release",
"title_i18n": "portal_type_dict.service_dict.field_list.release.title",
"description": "The release being this installation is based on.",
"description_i18n": "portal_type_dict.service_dict.field_list.release.description",
"alternate_name": "service_reference_release",
"default_value": null,
"css_class": null,
"hidden": null,
"display_width": null,
"maximum_input": null,
"extra": null
},
"properties": {
"enabled": true,
"editable": true,
"external_validator": null,
"required": true,
"preserve_whitespace": null,
"unicode": null,
"maximum_length": null,
"truncate": null
},
"message": {
"external_validator_failed": {
"message": "The input failed the external validator.",
"i18n": "validation_dict.external"
},
"required_not_found": {
"message": "Input required but not found.",
"i18n": "validation_dict.required"
},
"too_long": {
"message": "Too much input give.",
"i18n": "validation_dict.too_much_input"
}
}
},
"service_xml_recipe": {
"type": "TextareaField",
"widget": {
"id": "service_xml_recipe",
"title": "Parameter XML",
"title_i18n": "portal_type_dict.person_dict.field_list.recipe.title",
"description": "The XML recipe for this software installation.",
"description_i18n": "portal_type_dict.person_dict.field_list.recipe.description",
"alternate_name": "service_xml_recipe",
"default_value": null,
"css_class": null,
"hidden": null,
"width":null,
"height":null,
"extra":null
},
"properties": {
"enabled": true,
"editable": true,
"external_validator": null,
"required": null,
"preserve_whitespace": null,
"unicode": null,
"maximum_lines": null,
"maximum_length_of_line": null,
"maximum_characters": null
},
"message": {
"external_validator_failed": {
"message": "The input failed the external validator.",
"i18n": "validation_dict.external"
},
"required_not_found": {
"message": "Input required but not found.",
"i18n": "validation_dict.required"
},
"too_many_lines": {
"message": "You have entered too many lines.",
"i18n": "validation_dict.too_many_lines"
},
"line_too_long": {
"message": "One or more lines you have entered are too long.",
"i18n": "validation_dict.too_long_lines"
},
"too_long": {
"message": "You have entered too many characters.",
"i18n": "validation_dict.too_many_chars"
}
}
}
}
\ No newline at end of file
{
"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,11 +5331,15 @@ ...@@ -5330,11 +5331,15 @@
"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!
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]; pass.value = pass.fragment_list[pass.layout_level];
} }
}
// generate new query object // generate new query object
if (pass.config.initial_query) { if (pass.config.initial_query) {
...@@ -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,14 +5914,15 @@ ...@@ -5909,14 +5914,15 @@
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;
......
...@@ -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