Commit bda756e0 authored by Sven Franck's avatar Sven Franck

moved pagination from JSON API to automatic generation

parent eb354604
...@@ -20,9 +20,34 @@ ...@@ -20,9 +20,34 @@
"link_source": null, "link_source": null,
"editable": null, "editable": null,
"action_menu": true, "action_menu": true,
"search": {"text": "Search available servers", "text_i18n": "portal_type_dict.computer_dict.text_dict.search", "id": "search_server_list", "records": true, "filter": true, "sorted": true}, "caption": {
"caption": {"slot": 1, "text": "Created Servers", "text_i18n": "portal_type_dict.computer_dict.text_dict.created_servers"}, "slot": 1,
"pagination": {"slot": 2, "options": [{"text":8, "text_i18n":"portal_type_dict.computer_dict.text_dict.8"},{"text":16, "text_i18n":"portal_type_dict.computer_dict.text_dict.16"},{"text":32, "text_i18n":"portal_type_dict.computer_dict.text_dict.32"},{"text":64, "text_i18n":"portal_type_dict.computer_dict.text_dict.64"}]} "text": "Created Servers",
"text_i18n": "portal_type_dict.computer_dict.text_dict.created_servers"
},
"no_items": {
"message":"No Software installed.",
"message_i18n":"portal_type_dict.software_dict.text_dict.no_software",
"children": [
{
"href": "#software::new",
"text": "Add Software",
"text_i18n": "portal_type_dict.software_dict.text_dict.add_software",
"class_list": "translate ui-btn-slapos-black"
}
]
},
"pagination": {
"slot": 2,
"option_list": [
{"text":8, "text_i18n":"portal_type_dict.computer_dict.text_dict.8"},
{"text":16, "text_i18n":"portal_type_dict.computer_dict.text_dict.16"},
{"text":32, "text_i18n":"portal_type_dict.computer_dict.text_dict.32"},
{"text":64, "text_i18n":"portal_type_dict.computer_dict.text_dict.64"}
]
},
"search": {"text": "Search available servers", "text_i18n": "portal_type_dict.computer_dict.text_dict.search", "id": "search_server_list", "records": true, "filter": true, "sorted": true}
}, },
"scheme": { "scheme": {
"header": [ "header": [
...@@ -67,24 +92,6 @@ ...@@ -67,24 +92,6 @@
"type": "controlbar", "type": "controlbar",
"property_dict": {"slot": 3}, "property_dict": {"slot": 3},
"children": [{"type": "a","direct": {"className": "toggle_local_popup ui-btn ui-btn-icon-left ui-icon-cogs ui-shadow ui-corner-all","href":"#global_popup"},"attributes": {"data-reference":"configure_search","data-type":"invoices", "data-rel":"popup","data-transition":"pop","data-position-to":"window"},"logic": {"text":"Configuration"}}] "children": [{"type": "a","direct": {"className": "toggle_local_popup ui-btn ui-btn-icon-left ui-icon-cogs ui-shadow ui-corner-all","href":"#global_popup"},"attributes": {"data-reference":"configure_search","data-type":"invoices", "data-rel":"popup","data-transition":"pop","data-position-to":"window"},"logic": {"text":"Configuration"}}]
},{
"generate": "widget",
"type": "controlbar",
"property_dict": {"slot": 4},
"children": [
{
"generate":"widget",
"type": "controlgroup",
"property_dict": {"direction":"horizontal"},
"children":[
{"type": "a", "direct":{"className":"action", "href":""}, "attributes":{"data-i18n":"global_dict.pagination_dict.first", "data-action":"first", "data-icon":"step-backward", "data-iconpos":"notext"}, "logic": {"text":"First"}},
{"type": "a", "direct":{"className":"action", "href":""}, "attributes":{"data-i18n":"global_dict.pagination_dict.previous", "data-action":"prev", "data-icon":"backward", "data-iconpos":"notext"}, "logic": {"text":"Step Backward"}},
{"type":"select", "direct":{"id":"paginate_release_list", "className":"action"},"attributes": {"data-icon":"reorder", "data-action":"limit", "data-iconpos":"notext"},"logic": {"options":[{"value": "16", "text": "16", "text_i18n":"global_dict.pagination_dict.16"},{"value": "32", "text": "32", "text_i18n":"global_dict.pagination_dict.32"},{"value": "64", "text": "64", "text_i18n":"global_dict.pagination_dict.64"}, {"value": "128", "text": "128", "text_i18n":"global_dict.pagination_dict.128"}]}},
{"type": "a", "direct":{"className":"action", "href":""}, "attributes":{"data-i18n":"global_dict.pagination_dict.next", "data-action":"next", "data-icon":"forward", "data-iconpos":"notext"}, "logic": {"text":"Step Forward"}},
{"type": "a", "direct":{"className":"action", "href":""}, "attributes":{"data-i18n":"global_dict.pagination_dict.last", "data-action":"last", "data-icon":"step-forward", "data-iconpos":"notext"}, "logic": {"text": "Last"}}
]
}
]
}, { }, {
"generate": "widget", "generate": "widget",
"type": "table", "type": "table",
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
"id": "computer_overview", "id": "computer_overview",
"property_dict": { "property_dict": {
"initial_query_url_identifier": "_id", "initial_query_url_identifier": "_id",
"dynamic_children": [4], "dynamic_children": [2],
"requires_authentication": true, "requires_authentication": true,
"depends_on": "login_state", "depends_on": "login_state",
"wrap_gadget": 2, "wrap_gadget": 2,
...@@ -20,6 +20,15 @@ ...@@ -20,6 +20,15 @@
"slot": 1, "slot": 1,
"text": "Created Servers", "text": "Created Servers",
"text_i18n": "portal_type_dict.computer_dict.text_dict.created_servers" "text_i18n": "portal_type_dict.computer_dict.text_dict.created_servers"
},
"pagination": {
"slot": 2,
"option_list": [
{"value": "8", "text": "8", "text_i18n":"portal_type_dict.computer_dict.text_dict.8"},
{"value": "16", "text": "16", "text_i18n":"portal_type_dict.computer_dict.text_dict.16"},
{"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"}
]
} }
}, },
"scheme": [ "scheme": [
...@@ -61,24 +70,6 @@ ...@@ -61,24 +70,6 @@
"data-icon": "edit" "data-icon": "edit"
}, },
"logic": {"text":"Add server"} "logic": {"text":"Add server"}
}, {
"generate": "widget",
"type": "controlbar",
"property_dict": {"slot": 2},
"children": [
{
"generate":"widget",
"type": "controlgroup",
"property_dict": {"direction":"horizontal"},
"children":[
{"type": "a", "direct":{"className":"action", "href":""}, "attributes":{"data-i18n":"portal_type_dict.computer_dict.text_dict.first", "data-action":"first", "data-icon":"step-backward", "data-iconpos":"notext"}, "logic": {"text":"First"}},
{"type": "a", "direct":{"className":"action", "href":""}, "attributes":{"data-i18n":"portal_type_dict.computer_dict.text_dict.previous", "data-action":"prev", "data-icon":"backward", "data-iconpos":"notext"}, "logic": {"text":"Step Backward"}},
{"type":"select", "direct":{"id":"paginate_server_list", "className":"action"},"attributes": {"data-icon":"reorder", "data-action":"limit", "data-iconpos":"notext"},"logic": {"options":[{"value": "8", "text": "8", "text_i18n":"portal_type_dict.computer_dict.text_dict.8"},{"value": "16", "text": "16", "text_i18n":"portal_type_dict.computer_dict.text_dict.16"},{"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"}]}},
{"type": "a", "direct":{"className":"action", "href":""}, "attributes":{"data-i18n":"portal_type_dict.computer_dict.text_dict.next", "data-action":"next", "data-icon":"forward", "data-iconpos":"notext"}, "logic": {"text":"Step Forward"}},
{"type": "a", "direct":{"className":"action", "href":""}, "attributes":{"data-i18n":"portal_type_dict.computer_dict.text_dict.last", "data-action":"last", "data-icon":"step-forward", "data-iconpos":"notext"}, "logic": {"text": "Last"}}
]
}
]
}, { }, {
"generate": "widget", "generate": "widget",
"type": "table", "type": "table",
......
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
"message":"No invoices found", "message":"No invoices found",
"message_i18n":"portal_type_dict.invoice_dict.text_dict.nodata" "message_i18n":"portal_type_dict.invoice_dict.text_dict.nodata"
}, },
"dynamic_children": [3], "dynamic_children": [1],
"requires_authentication": true, "requires_authentication": true,
"wrap_gadget": 2, "wrap_gadget": 2,
"sortable": true, "sortable": true,
...@@ -21,6 +21,15 @@ ...@@ -21,6 +21,15 @@
"slot": 1, "slot": 1,
"text": "Invoice Overview", "text": "Invoice Overview",
"text_i18n": "portal_type_dict.invoice_dict.text_dict.overview" "text_i18n": "portal_type_dict.invoice_dict.text_dict.overview"
},
"pagination": {
"slot": 2,
"option_list": [
{"value": "8", "text": "8", "text_i18n":"portal_type_dict.invoice_dict.text_dict.8"},
{"value": "16", "text": "16", "text_i18n":"portal_type_dict.invoice_dict.text_dict.16"},
{"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"}
]
} }
}, },
"scheme": [ "scheme": [
...@@ -46,25 +55,6 @@ ...@@ -46,25 +55,6 @@
} }
], ],
"children": [{ "children": [{
"generate": "widget",
"type": "controlbar",
"property_dict": {"slot": 2},
"children": [
{
"generate":"widget",
"type": "controlgroup",
"property_dict": {"direction":"horizontal"},
"children":[
{"type": "a", "direct":{"className":"action", "href":""}, "attributes":{"data-i18n":"portal_type_dict.invoice_dict.text_dict.first", "data-action":"first", "data-icon":"step-backward", "data-iconpos":"notext"}, "logic": {"text":"First"}},
{"type": "a", "direct":{"className":"action", "href":""}, "attributes":{"data-i18n":"portal_type_dict.invoice_dict.text_dict.previous", "data-action":"prev", "data-icon":"backward", "data-iconpos":"notext"}, "logic": {"text":"Step Backward"}},
{"type":"select", "direct":{"id":"paginate_invoice_list", "className":"action"},"attributes": {"data-icon":"reorder", "data-action":"limit", "data-iconpos":"notext"},"logic": {"options":[{"value": "8", "text": "8", "text_i18n":"portal_type_dict.invoice_dict.text_dict.8"},{"value": "16", "text": "16", "text_i18n":"portal_type_dict.invoice_dict.text_dict.16"},{"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"}]}},
{"type": "a", "direct":{"className":"action", "href":""}, "attributes":{"data-i18n":"portal_type_dict.invoice_dict.text_dict.next", "data-action":"next", "data-icon":"forward", "data-iconpos":"notext"}, "logic": {"text":"Step Forward"}},
{"type": "a", "direct":{"className":"action", "href":""}, "attributes":{"data-i18n":"portal_type_dict.invoice_dict.text_dict.last", "data-action":"last", "data-icon":"step-forward", "data-iconpos":"notext"}, "logic": {"text": "Last"}}
]
}
]
},
{
"generate": "widget", "generate": "widget",
"type": "controlbar", "type": "controlbar",
"class_list": "responsive", "class_list": "responsive",
......
...@@ -7,11 +7,7 @@ ...@@ -7,11 +7,7 @@
"view": "FOO", "view": "FOO",
"id": "network_overview", "id": "network_overview",
"property_dict": { "property_dict": {
"no_items": { "dynamic_children": [2],
"message": "No networks found.",
"message_i18n": "portal_type_dict.network_dict.text_dict.nonet"
},
"dynamic_children": [4],
"requires_authentication": true, "requires_authentication": true,
"depends_on": "login_state", "depends_on": "login_state",
"wrap_gadget": 2, "wrap_gadget": 2,
...@@ -21,6 +17,19 @@ ...@@ -21,6 +17,19 @@
"slot": 1, "slot": 1,
"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": 2,
"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"
} }
}, },
"scheme": [ "scheme": [
...@@ -46,24 +55,6 @@ ...@@ -46,24 +55,6 @@
"data-icon": "edit" "data-icon": "edit"
}, },
"logic": {"text":"Add network"} "logic": {"text":"Add network"}
}, {
"generate": "widget",
"type": "controlbar",
"property_dict": {"slot": 2},
"children": [
{
"generate":"widget",
"type": "controlgroup",
"property_dict": {"direction":"horizontal"},
"children":[
{"type": "a", "direct":{"className":"action", "href":""}, "attributes":{"data-i18n":"portal_type_dict.network_dict.text_dict.first", "data-action":"first", "data-icon":"step-backward", "data-iconpos":"notext"}, "logic": {"text":"First"}},
{"type": "a", "direct":{"className":"action", "href":""}, "attributes":{"data-i18n":"portal_type_dict.network_dict.text_dict.previous", "data-action":"prev", "data-icon":"backward", "data-iconpos":"notext"}, "logic": {"text":"Step Backward"}},
{"type":"select", "direct":{"id":"paginate_network_list", "className":"action"},"attributes": {"data-icon":"reorder", "data-action":"limit", "data-iconpos":"notext"},"logic": {"options":[{"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"}]}},
{"type": "a", "direct":{"className":"action", "href":""}, "attributes":{"data-i18n":"portal_type_dict.network_dict.text_dict.next", "data-action":"next", "data-icon":"forward", "data-iconpos":"notext"}, "logic": {"text":"Step Forward"}},
{"type": "a", "direct":{"className":"action", "href":""}, "attributes":{"data-i18n":"portal_type_dict.network_dict.text_dict.last", "data-action":"last", "data-icon":"step-forward", "data-iconpos":"notext"}, "logic": {"text": "Last"}}
]
}
]
}, { }, {
"generate": "widget", "generate": "widget",
"type": "controlbar", "type": "controlbar",
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
"id": "release_overview", "id": "release_overview",
"property_dict": { "property_dict": {
"initial_query_url_identifier": "reference_id", "initial_query_url_identifier": "reference_id",
"dynamic_children": [2], "dynamic_children": [1],
"wrap_gadget": 2, "wrap_gadget": 2,
"link": true, "link": true,
"link_identifier": "_id", "link_identifier": "_id",
...@@ -16,6 +16,15 @@ ...@@ -16,6 +16,15 @@
"slot": 1, "slot": 1,
"text": "Available Releases", "text": "Available Releases",
"text_i18n": "portal_type_dict.release_dict.text_dict.available_releases" "text_i18n": "portal_type_dict.release_dict.text_dict.available_releases"
},
"pagination": {
"slot": 2,
"option_list": [
{"value": "8", "text": "8", "text_i18n":"portal_type_dict.release_dict.text_dict.8"},
{"value": "16", "text": "16", "text_i18n":"portal_type_dict.release_dict.text_dict.16"},
{"value": "32", "text": "32", "text_i18n":"portal_type_dict.release_dict.text_dict.32"},
{"value": "64", "text": "64", "text_i18n":"portal_type_dict.release_dict.text_dict.64"}
]
} }
}, },
"scheme": [ "scheme": [
...@@ -36,26 +45,7 @@ ...@@ -36,26 +45,7 @@
] ]
} }
], ],
"children": [ "children": [{
{
"generate": "widget",
"type": "controlbar",
"property_dict": {"slot": 2},
"children": [
{
"generate":"widget",
"type": "controlgroup",
"property_dict": {"direction":"horizontal"},
"children":[
{"type": "a", "direct":{"className":"action", "href":""}, "attributes":{"data-i18n":"portal_type_dict.release_dict.text_dict.first", "data-action":"first", "data-icon":"step-backward", "data-iconpos":"notext"}, "logic": {"text":"First"}},
{"type": "a", "direct":{"className":"action", "href":""}, "attributes":{"data-i18n":"portal_type_dict.release_dict.text_dict.previous", "data-action":"prev", "data-icon":"backward", "data-iconpos":"notext"}, "logic": {"text":"Step Backward"}},
{"type":"select", "direct":{"id":"paginate_release_list", "className":"action"},"attributes": {"data-icon":"reorder", "data-action":"limit", "data-iconpos":"notext"},"logic": {"options":[{"value": "8", "text": "8", "text_i18n":"portal_type_dict.release_dict.text_dict.8"},{"value": "16", "text": "16", "text_i18n":"portal_type_dict.release_dict.text_dict.16"},{"value": "32", "text": "32", "text_i18n":"portal_type_dict.release_dict.text_dict.32"}, {"value": "64", "text": "64", "text_i18n":"portal_type_dict.release_dict.text_dict.64"}]}},
{"type": "a", "direct":{"className":"action", "href":""}, "attributes":{"data-i18n":"portal_type_dict.release_dict.text_dict.next", "data-action":"next", "data-icon":"forward", "data-iconpos":"notext"}, "logic": {"text":"Step Forward"}},
{"type": "a", "direct":{"className":"action", "href":""}, "attributes":{"data-i18n":"portal_type_dict.release_dict.text_dict.last", "data-action":"last", "data-icon":"step-forward", "data-iconpos":"notext"}, "logic": {"text": "Last"}}
]
}
]
}, {
"generate": "widget", "generate": "widget",
"type": "controlbar", "type": "controlbar",
"class_list": "responsive", "class_list": "responsive",
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
"id": "service_overview", "id": "service_overview",
"property_dict": { "property_dict": {
"initial_query_url_identifier": "reference_computer", "initial_query_url_identifier": "reference_computer",
"dynamic_children": [4], "dynamic_children": [2],
"wrap_gadget": 2, "wrap_gadget": 2,
"link": true, "link": true,
"link_identifier": "_id", "link_identifier": "_id",
...@@ -16,6 +16,15 @@ ...@@ -16,6 +16,15 @@
"slot": 1, "slot": 1,
"text": "Installed Services", "text": "Installed Services",
"text_i18n": "portal_type_dict.service_dict.text_dict.installed_services" "text_i18n": "portal_type_dict.service_dict.text_dict.installed_services"
},
"pagination": {
"slot": 2,
"option_list": [
{"value": "8", "text": "8", "text_i18n":"portal_type_dict.service_dict.text_dict.8"},
{"value": "16", "text": "16", "text_i18n":"portal_type_dict.service_dict.text_dict.16"},
{"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"}
]
} }
}, },
"scheme": [ "scheme": [
...@@ -46,24 +55,6 @@ ...@@ -46,24 +55,6 @@
"data-icon": "edit" "data-icon": "edit"
}, },
"logic": {"text":"Install new service"} "logic": {"text":"Install new service"}
}, {
"generate": "widget",
"type": "controlbar",
"property_dict": {"slot": 2},
"children": [
{
"generate":"widget",
"type": "controlgroup",
"property_dict": {"direction":"horizontal"},
"children":[
{"type": "a", "direct":{"className":"action", "href":""}, "attributes":{"data-i18n":"portal_type_dict.service_dict.text_dict.first", "data-action":"first", "data-icon":"step-backward", "data-iconpos":"notext"}, "logic": {"text":"First"}},
{"type": "a", "direct":{"className":"action", "href":""}, "attributes":{"data-i18n":"portal_type_dict.service_dict.text_dict.previous", "data-action":"prev", "data-icon":"backward", "data-iconpos":"notext"}, "logic": {"text":"Step Backward"}},
{"type":"select", "direct":{"id":"paginate_services_list", "className":"action"},"attributes": {"data-icon":"reorder", "data-action":"limit", "data-iconpos":"notext"},"logic": {"options":[{"value": "8", "text": "8", "text_i18n":"portal_type_dict.service_dict.text_dict.8"},{"value": "16", "text": "16", "text_i18n":"portal_type_dict.service_dict.text_dict.16"},{"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"}]}},
{"type": "a", "direct":{"className":"action", "href":""}, "attributes":{"data-i18n":"portal_type_dict.service_dict.text_dict.next", "data-action":"next", "data-icon":"forward", "data-iconpos":"notext"}, "logic": {"text":"Step Forward"}},
{"type": "a", "direct":{"className":"action", "href":""}, "attributes":{"data-i18n":"portal_type_dict.service_dict.text_dict.last", "data-action":"last", "data-icon":"step-forward", "data-iconpos":"notext"}, "logic": {"text": "Last"}}
]
}
]
}, { }, {
"generate": "widget", "generate": "widget",
"type": "controlbar", "type": "controlbar",
......
...@@ -10,7 +10,16 @@ ...@@ -10,7 +10,16 @@
"link": true, "link": true,
"link_identifier": "id", "link_identifier": "id",
"link_to_view": "install", "link_to_view": "install",
"dynamic_children": [1] "dynamic_children": [1],
"pagination": {
"class_list": "responsive",
"option_list": [
{"value": "8", "text": "8", "text_i18n":"portal_type_dict.software_dict.text_dict.8"},
{"value": "16", "text": "16", "text_i18n":"portal_type_dict.software_dict.text_dict.16"},
{"value": "32", "text": "32", "text_i18n":"portal_type_dict.software_dict.text_dict.32"},
{"value": "64", "text": "64", "text_i18n":"portal_type_dict.software_dict.text_dict.64"}
]
}
}, },
"scheme": [ "scheme": [
{ {
...@@ -50,25 +59,6 @@ ...@@ -50,25 +59,6 @@
"input": "#search_software_list" "input": "#search_software_list"
}, },
"children": [] "children": []
}, {
"generate":"widget",
"type": "controlbar",
"class_list": "responsive",
"children": [{
"generate": "widget",
"type": "controlgroup",
"class_list": "pagination",
"property_dict": {
"direction": "horizontal"
},
"children": [
{"type": "a", "direct":{"className":"action", "href":""}, "attributes":{"data-i18n":"portal_type_dict.software_dict.text_dict.first", "data-action":"first", "data-icon":"step-backward", "data-iconpos":"notext"}, "logic": {"text":"First"}},
{"type": "a", "direct":{"className":"action", "href":""}, "attributes":{"data-i18n":"portal_type_dict.software_dict.text_dict.previous", "data-action":"prev", "data-icon":"backward", "data-iconpos":"notext"}, "logic": {"text":"Step Backward"}},
{"type":"select", "direct":{"id":"paginate_software_list", "className":"action"},"attributes": {"data-icon":"reorder", "data-action":"limit", "data-iconpos":"notext"},"logic": {"options":[{"value": "16", "text": "16", "text_i18n":"portal_type_dict.software_dict.text_dict.16"},{"value": "32", "text": "32", "text_i18n":"portal_type_dict.software_dict.text_dict.32"},{"value": "64", "text": "64", "text_i18n":"portal_type_dict.software_dict.text_dict.64"}, {"value": "128", "text": "128", "text_i18n":"portal_type_dict.software_dict.text_dict.128"}]}},
{"type": "a", "direct":{"className":"action", "href":""}, "attributes":{"data-i18n":"portal_type_dict.software_dict.text_dict.next", "data-action":"next", "data-icon":"forward", "data-iconpos":"notext"}, "logic": {"text":"Step Forward"}},
{"type": "a", "direct":{"className":"action", "href":""}, "attributes":{"data-i18n":"portal_type_dict.software_dict.text_dict.last", "data-action":"last", "data-icon":"step-forward", "data-iconpos":"notext"}, "logic": {"text": "Last"}}
]
}]
}] }]
} }
......
...@@ -9,7 +9,16 @@ ...@@ -9,7 +9,16 @@
"property_dict": { "property_dict": {
"link": true, "link": true,
"link_identifier": "id", "link_identifier": "id",
"dynamic_children": [1] "dynamic_children": [1],
"pagination": {
"class_list": "responsive",
"option_list": [
{"value": "8", "text": "8", "text_i18n":"portal_type_dict.software_dict.text_dict.8"},
{"value": "16", "text": "16", "text_i18n":"portal_type_dict.software_dict.text_dict.16"},
{"value": "32", "text": "32", "text_i18n":"portal_type_dict.software_dict.text_dict.32"},
{"value": "64", "text": "64", "text_i18n":"portal_type_dict.software_dict.text_dict.64"}
]
}
}, },
"scheme": [ "scheme": [
{ {
...@@ -47,25 +56,6 @@ ...@@ -47,25 +56,6 @@
"input": "#search_software_list" "input": "#search_software_list"
}, },
"children": [] "children": []
}, {
"generate":"widget",
"type": "controlbar",
"class_list": "responsive",
"children": [{
"generate": "widget",
"type": "controlgroup",
"class_list": "pagination",
"property_dict": {
"direction": "horizontal"
},
"children": [
{"type": "a", "direct":{"className":"action", "href":""}, "attributes":{"data-i18n":"portal_type_dict.software_dict.text_dict.first", "data-action":"first", "data-icon":"step-backward", "data-iconpos":"notext"}, "logic": {"text":"First"}},
{"type": "a", "direct":{"className":"action", "href":""}, "attributes":{"data-i18n":"portal_type_dict.software_dict.text_dict.previous", "data-action":"prev", "data-icon":"backward", "data-iconpos":"notext"}, "logic": {"text":"Step Backward"}},
{"type":"select", "direct":{"id":"paginate_software_list", "className":"action"},"attributes": {"data-icon":"reorder", "data-action":"limit", "data-iconpos":"notext"},"logic": {"options":[{"value": "16", "text": "16", "text_i18n":"portal_type_dict.software_dict.text_dict.16"},{"value": "32", "text": "32", "text_i18n":"portal_type_dict.software_dict.text_dict.32"},{"value": "64", "text": "64", "text_i18n":"portal_type_dict.software_dict.text_dict.64"}, {"value": "128", "text": "128", "text_i18n":"portal_type_dict.software_dict.text_dict.128"}]}},
{"type": "a", "direct":{"className":"action", "href":""}, "attributes":{"data-i18n":"portal_type_dict.software_dict.text_dict.next", "data-action":"next", "data-icon":"forward", "data-iconpos":"notext"}, "logic": {"text":"Step Forward"}},
{"type": "a", "direct":{"className":"action", "href":""}, "attributes":{"data-i18n":"portal_type_dict.software_dict.text_dict.last", "data-action":"last", "data-icon":"step-forward", "data-iconpos":"notext"}, "logic": {"text": "Last"}}
]
}]
}] }]
} }
......
...@@ -7,6 +7,16 @@ ...@@ -7,6 +7,16 @@
"id": "service_overview", "id": "service_overview",
"view": "FOO", "view": "FOO",
"property_dict": { "property_dict": {
"initial_query_url_identifier": "reference_computer",
"dynamic_children": [0],
"wrap_gadget": 2,
"linkable": true,
"link_identifier": "id",
"caption": {
"slot": 1,
"text": "Installed Services",
"text_i18n":"portal_type_dict.software_dict.text_dict.no_software"
},
"no_items": { "no_items": {
"message":"No Software installed.", "message":"No Software installed.",
"message_i18n":"portal_type_dict.software_dict.text_dict.no_software", "message_i18n":"portal_type_dict.software_dict.text_dict.no_software",
...@@ -18,16 +28,6 @@ ...@@ -18,16 +28,6 @@
"class_list": "translate ui-btn-slapos-black" "class_list": "translate ui-btn-slapos-black"
} }
] ]
},
"initial_query_url_identifier": "reference_computer",
"dynamic_children": [0],
"wrap_gadget": 2,
"linkable": true,
"link_identifier": "id",
"caption": {
"slot": 1,
"text": "Installed Services",
"text_i18n":"portal_type_dict.software_dict.text_dict.no_software"
} }
}, },
"scheme":[ "scheme":[
......
...@@ -203,7 +203,7 @@ ...@@ -203,7 +203,7 @@
// create signature and ticket // create signature and ticket
signature = util.generateRandomIdentifier(36); signature = util.generateRandomIdentifier(36);
flux[signature] = util.generateUuid(); flux[signature] = util.uuid();
// authenticate with 3rd party // authenticate with 3rd party
// NOTE: normally the signature should be a server roundtrip token! // NOTE: normally the signature should be a server roundtrip token!
...@@ -792,7 +792,7 @@ ...@@ -792,7 +792,7 @@
// TODO: not nice, find better way // TODO: not nice, find better way
if (prevail.setValue) { if (prevail.setValue) {
field_value = prevail.setValue + util.generateUuid(); field_value = prevail.setValue + util.uuid();
} }
// easy way out if not enabled // easy way out if not enabled
...@@ -1284,6 +1284,11 @@ ...@@ -1284,6 +1284,11 @@
// query has results // query has results
if (answer.data.total_rows > 0) { if (answer.data.total_rows > 0) {
// add pagination
if (props.pagination) {
spec.children.push(factory.util.paginate(props.pagination));
}
// loop children (elements to generate) // loop children (elements to generate)
for (i = 0; i < spec.children.length; i += 1) { for (i = 0; i < spec.children.length; i += 1) {
element = spec.children[i]; element = spec.children[i];
...@@ -1333,7 +1338,8 @@ ...@@ -1333,7 +1338,8 @@
// TODO: refactor! // TODO: refactor!
"listbox": function (spec, answer, field_dict, update, url_pointer) { "listbox": function (spec, answer, field_dict, update, url_pointer) {
var element, i, j, k, l, m, target, container, pack, slot, pop, active, var element, i, j, k, l, m, target, container, pack, slot, pop, active,
countColumns, column, no_content, no_result, content, segment, field; countColumns, column, no_content, no_result, content, segment, field,
props;
// count columns // count columns
countColumns = function (scheme) { countColumns = function (scheme) {
...@@ -1357,14 +1363,16 @@ ...@@ -1357,14 +1363,16 @@
return app.noItemsFound(config, "td", countColumns(spec.scheme)) return app.noItemsFound(config, "td", countColumns(spec.scheme))
}; };
props = spec.property_dict;
// set update of gadget flag // set update of gadget flag
if (spec.property_dict.depends_on) { if (props.depends_on) {
spec.depend = spec.property_dict.depends_on; spec.depend = props.depends_on;
} }
// set state reset flag // set state reset flag
if (spec.property_dict.resets) { if (props.resets) {
spec.reset = spec.property_dict.resets; spec.reset = props.resets;
} }
// no auth // no auth
...@@ -1380,8 +1388,8 @@ ...@@ -1380,8 +1388,8 @@
if (update) { if (update) {
target = document.createDocumentFragment(); target = document.createDocumentFragment();
} else { } else {
slot = spec.property_dict.wrap_gadget; slot = props.wrap_gadget;
pop = spec.property_dict.need_popup; pop = props.need_popup;
if (slot) { if (slot) {
container = factory.element("div", {"className": "span_" + slot}); container = factory.element("div", {"className": "span_" + slot});
pack = true; pack = true;
...@@ -1407,20 +1415,25 @@ ...@@ -1407,20 +1415,25 @@
} }
// add caption // add caption
if (spec.property_dict.caption) { if (props.caption) {
spec.children.push({ spec.children.push({
"generate":"widget", "generate":"widget",
"type": "controlbar", "type": "controlbar",
"property_dict": {"slot": spec.property_dict.caption.slot || 1}, "property_dict": {"slot": props.caption.slot || 1},
"children": [{ "children": [{
"type": "p", "type": "p",
"direct": {"className": "ui-table-caption translate"}, "direct": {"className": "ui-table-caption translate"},
"attributes": {"data-i18n": spec.property_dict.caption.text_i18n || null}, "attributes": {"data-i18n": props.caption.text_i18n || null},
"logic": {"text": spec.property_dict.caption.text} "logic": {"text": props.caption.text}
}] }]
}) });
} }
// add pagination
if (props.pagination) {
spec.children.push(factory.util.paginate(props.pagination));
}
// loop over dynamic data and generate table // loop over dynamic data and generate table
for (i = 0; i < spec.children.length; i += 1) { for (i = 0; i < spec.children.length; i += 1) {
element = spec.children[i]; element = spec.children[i];
...@@ -1429,8 +1442,8 @@ ...@@ -1429,8 +1442,8 @@
element.reference = spec.id; element.reference = spec.id;
// set flag to label elements that should contain dynamic data // set flag to label elements that should contain dynamic data
if (spec.property_dict.dynamic_children) { if (props.dynamic_children) {
if (spec.property_dict.dynamic_children.indexOf(i) > -1) { if (props.dynamic_children.indexOf(i) > -1) {
// pass relevant information to method generating the gadget // pass relevant information to method generating the gadget
element.portal_type = spec.portal_type_title; element.portal_type = spec.portal_type_title;
element.dynamic = true; element.dynamic = true;
...@@ -1456,9 +1469,9 @@ ...@@ -1456,9 +1469,9 @@
// dynamic element being updated - 0 results need placeholder // dynamic element being updated - 0 results need placeholder
if (element.dynamic && no_result) { if (element.dynamic && no_result) {
if (update) { if (update) {
content.appendChild(no_content(spec.property_dict.no_items)); content.appendChild(no_content(props.no_items));
} else { } else {
content.querySelector("tbody").appendChild(no_content(spec.property_dict.no_items)); content.querySelector("tbody").appendChild(no_content(props.no_items));
} }
} }
if (content) { if (content) {
...@@ -1523,7 +1536,7 @@ ...@@ -1523,7 +1536,7 @@
if (answer.request_new || answer.data.total_rows === 0) { if (answer.request_new || answer.data.total_rows === 0) {
data = {}; data = {};
if (answer.request_new) { if (answer.request_new) {
data._id = util.generateUuid(); data._id = util.uuid();
} }
} else if (answer.data.total_rows > 1) { } else if (answer.data.total_rows > 1) {
util.error("Fieldlist: More than 1 record"); util.error("Fieldlist: More than 1 record");
...@@ -1568,6 +1581,86 @@ ...@@ -1568,6 +1581,86 @@
/* ********************************************************************** */ /* ********************************************************************** */
factory.util = {}; factory.util = {};
/** Generate a pagination toolbar
* @method paginate
* @param {object} spec Pagination configuration
* @return {object} finished config object
**/
factory.util.paginate = function (spec) {
var n, option, props, option_list, class_list;
option_list = [{"value": "", "text": "", "text_i18n": ""}];
props = spec.slot ? {"slot": spec.slot} : {};
class_list = spec.class_list || "";
for (n = 0; n < spec.option_list.length; n += 1) {
option = spec.option_list[n];
option_list.push({"value": option.value, "text": option.text, "text_i18n": option.text_i18n});
}
return {
"generate": "widget",
"type": "controlbar",
"class_list": class_list,
"property_dict": props,
"children": [{
"generate": "widget",
"type": "controlgroup",
"property_dict": {"direction": "horizontal"},
"children": [{
"type": "a",
"direct":{"className":"action", "href":"#"},
"attributes":{
"data-i18n": "global_dict.first",
"data-action": "first",
"data-icon": "step-backward",
"data-iconpos": "notext"
},
"logic": {"text":"First"}
}, {
"type": "a",
"direct":{"className":"action", "href":"#"},
"attributes":{
"data-i18n": "global_dict.previous",
"data-action": "prev",
"data-icon": "backward",
"data-iconpos": "notext"
},
"logic": {"text":"Previous"}
}, {
"type":"select",
"direct":{"id": "select_" + util.uuid(), "className": "action"},
"attributes": {
"data-icon":"reorder",
"data-action":"limit",
"data-iconpos":"notext"
},
"logic": {"options":option_list}
}, {
"type": "a",
"direct":{"className":"action", "href":"#"},
"attributes":{
"data-i18n": "global_dict.next",
"data-action": "next",
"data-icon": "forward",
"data-iconpos": "notext"
},
"logic": {"text":"Next"}
}, {
"type": "a",
"direct":{"className":"action", "href":"#"},
"attributes":{
"data-i18n": "global_dict.last",
"data-action": "last",
"data-icon": "step-forward",
"data-iconpos": "notext"
},
"logic": {"text":"Last"}
}]
}]
};
};
/** /**
* Update an element dict depending on status * Update an element dict depending on status
* @method convertDict * @method convertDict
...@@ -2361,7 +2454,7 @@ ...@@ -2361,7 +2454,7 @@
// make sure value is set correctly // make sure value is set correctly
if (input_config.logic && input_config.logic.setValue) { if (input_config.logic && input_config.logic.setValue) {
input_config.direct.value = input_config.logic.setValue + input_config.direct.value = input_config.logic.setValue +
util.generateUuid(); util.uuid();
} }
} else { } else {
config = spec.fields[field.field]; config = spec.fields[field.field];
...@@ -6419,10 +6512,10 @@ ...@@ -6419,10 +6512,10 @@
/** /**
* Generate a UUID ticket for a transaction * Generate a UUID ticket for a transaction
* @method generateUuid * @method uuid
* @return {string} UUID * @return {string} UUID
**/ **/
util.generateUuid = function () { util.uuid = function () {
function S4() { function S4() {
return ('0000' + Math.floor( return ('0000' + Math.floor(
Math.random() * 0x10000 /* 65536 */ Math.random() * 0x10000 /* 65536 */
......
{ {
"global_dict": { "global_dict": {
"first": "First",
"previous": "Previous",
"next": "Next",
"last": "Last",
"english": "English", "english": "English",
"search": "Search", "search": "Search",
"account": "Account", "account": "Account",
...@@ -84,10 +88,6 @@ ...@@ -84,10 +88,6 @@
"nonet": "No networks found.", "nonet": "No networks found.",
"add": "Add network", "add": "Add network",
"created_networks": "Created Networks", "created_networks": "Created Networks",
"first": "First",
"previous": "Previous",
"next": "Next",
"last": "Last",
"8":"8", "8":"8",
"16": "16", "16": "16",
"32": "32", "32": "32",
...@@ -127,10 +127,6 @@ ...@@ -127,10 +127,6 @@
"search": "Search available services", "search": "Search available services",
"add": "Install new service", "add": "Install new service",
"installed_services": "Installed Services", "installed_services": "Installed Services",
"first": "First",
"previous": "Previous",
"next": "Next",
"last": "Last",
"8":"8", "8":"8",
"16": "16", "16": "16",
"32": "32", "32": "32",
...@@ -216,10 +212,6 @@ ...@@ -216,10 +212,6 @@
"add": "Add Server", "add": "Add Server",
"servers": "Servers", "servers": "Servers",
"created_servers": "Created Servers", "created_servers": "Created Servers",
"first": "First",
"previous": "Previous",
"next": "Next",
"last": "Last",
"8":"8", "8":"8",
"16": "16", "16": "16",
"32": "32", "32": "32",
...@@ -450,10 +442,6 @@ ...@@ -450,10 +442,6 @@
"title": "Invoices", "title": "Invoices",
"nodata": "No invoices found", "nodata": "No invoices found",
"overview": "Invoice Overview", "overview": "Invoice Overview",
"first": "First",
"previous": "Previous",
"next": "Next",
"last": "Last",
"8":"8", "8":"8",
"16": "16", "16": "16",
"32": "32", "32": "32",
...@@ -757,10 +745,6 @@ ...@@ -757,10 +745,6 @@
"add_software": "Install software", "add_software": "Install software",
"status": "Status", "status": "Status",
"search": "Search available software", "search": "Search available software",
"first": "First",
"previous": "Previous",
"next": "Next",
"last": "Last",
"8":"8", "8":"8",
"16": "16", "16": "16",
"32": "32", "32": "32",
...@@ -812,10 +796,6 @@ ...@@ -812,10 +796,6 @@
"instance_recipe": "Instance Configuration", "instance_recipe": "Instance Configuration",
"instance_server": "Computer", "instance_server": "Computer",
"instance_network": "Network", "instance_network": "Network",
"first": "First",
"previous": "Previous",
"next": "Next",
"last": "Last",
"8":"8", "8":"8",
"16": "16", "16": "16",
"32": "32", "32": "32",
......
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