Commit 40bed426 authored by Rafael Monnerat's avatar Rafael Monnerat

slapos_jio: Improve Frontpage

Remove Search Bar (not required as the user can use the module)
Fix sort on the listboxes
Include a Buttom Bar to include some shortcurts for manage tickets
Only show Pending tickets on the frontpage.
Show Modification Date on the Tickets listbox.
parent a9222712
......@@ -10,5 +10,18 @@
.box-gadget-bottom {
float: left;
width: 100%;
padding-top: 17px;
}
.ui-btn-white-front,
.ui-btn-white-front:active,
.ui-btn-white-front:hover {
background: white !important;
cursor: default;
text-align: center;
color: black;
padding: 3pt;
border: 1px solid rgba(0, 0, 0, 0.14);
border-radius: 0.325em;
margin-right: 6pt;
}
......@@ -39,6 +39,17 @@
</tuple>
</value>
</item>
<item>
<key> <string>_Copy_or_Move_Permission</string> </key>
<value>
<list>
<string>Manager</string>
<string>Authenticated</string>
<string>Developer</string>
<string>Owner</string>
</list>
</value>
</item>
<item>
<key> <string>_Modify_portal_content_Permission</string> </key>
<value>
......@@ -220,7 +231,7 @@
</item>
<item>
<key> <string>actor</string> </key>
<value> <string>ERP5TypeTestCase</string> </value>
<value> <string>zope</string> </value>
</item>
<item>
<key> <string>comment</string> </key>
......@@ -234,7 +245,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>962.26967.57647.26572</string> </value>
<value> <string>966.40300.60783.54357</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -252,7 +263,7 @@
</tuple>
<state>
<tuple>
<float>1506679318.27</float>
<float>1522775894.53</float>
<string>UTC</string>
</tuple>
</state>
......
......@@ -10,12 +10,22 @@
<!-- renderjs -->
<script src="rsvp.js" type="text/javascript"></script>
<script src="handlebars.js"></script>
<script src="renderjs.js" type="text/javascript"></script>
<!-- custom script -->
<script src="gadget_erp5_page_slapos.js" type="text/javascript"></script>
<link href="gadget_erp5_page_slapos.css" rel="stylesheet" type="text/css"/>
<script id="ticket-link-control-template" type="text/x-handlebars-template">
<div class="slapos-control-front">
<center>
<a class="ui-btn ui-first-child ui-btn-white-front ui-btn-icon-left ui-icon-sort-alpha-asc" href={{ show_all_url }} data-i18n="Show All Tickets" > Show All Tickets</a>
<a class="ui-btn ui-first-child ui-btn-white-front ui-btn-icon-left ui-icon-rss" href={{ rss_all_url }} data-i18n="RSS (all)" > RSS </a>
<a class="ui-btn ui-first-child ui-btn-white-front ui-btn-icon-left ui-icon-rss" href={{ rss_critical_url }} data-i18n="RSS Critical" > Critical </a>
</center>
</div>
</script>
</head>
<body>
......@@ -24,11 +34,11 @@
<div class="map-gadget"></div>
</div>
<div class="box-gadget-right">
<div data-gadget-url="gadget_erp5_pt_form_list.html"
<div data-gadget-url="gadget_erp5_pt_form_view.html"
data-gadget-scope="right"></div>
</div>
<div class="box-gadget-bottom">
<div data-gadget-url="gadget_erp5_pt_form_list.html"
<div data-gadget-url="gadget_erp5_pt_form_view.html"
data-gadget-scope="last"></div>
</div>
</form>
......
......@@ -245,7 +245,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>962.63073.16897.12851</string> </value>
<value> <string>966.40689.62566.35447</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -263,7 +263,7 @@
</tuple>
<state>
<tuple>
<float>1508759283.61</float>
<float>1522799337.96</float>
<string>UTC</string>
</tuple>
</state>
......
/*global document, window, Option, rJS, RSVP, Chart, UriTemplate*/
/*global document, window, Option, rJS, RSVP, Chart, UriTemplate, Handlebars*/
/*jslint nomen: true, indent: 2, maxerr: 3 */
(function (window, rJS, RSVP) {
(function (window, rJS, RSVP, Handlebars) {
"use strict";
var gadget_klass = rJS(window),
ticket_control_source = gadget_klass.__template_element
.getElementById("ticket-link-control-template")
.innerHTML,
ticket_control_template = Handlebars.compile(ticket_control_source);
rJS(window)
gadget_klass
.ready(function (gadget) {
gadget.property_dict = {};
return gadget.getElement()
......@@ -29,7 +34,7 @@
var gadget = this;
return gadget.jio_allDocs(param_list[0])
.push(function (result) {
var i, value, len = result.data.total_rows;
var i, value, date, len = result.data.total_rows;
for (i = 0; i < len; i += 1) {
if (1 || (result.data.rows[i].hasOwnProperty("id"))) {
value = result.data.rows[i].id;
......@@ -48,6 +53,25 @@
value: 2713
};
}
if (result.data.rows[i].value.hasOwnProperty("modification_date")) {
date = new Date(result.data.rows[i].value.modification_date);
result.data.rows[i].value.modification_date = {
allow_empty_time: 0,
ampm_time_style: 0,
css_class: "date_field",
date_only: 0,
description: "The Date",
editable: 0,
hidden: 0,
hidden_day_is_last_day: 0,
"default": date.toUTCString(),
key: "modification_date",
required: 0,
timezone_style: 0,
title: "Modification Date",
type: "DateTimeField"
};
}
}
return result;
});
......@@ -134,17 +158,39 @@
var lines_limit = 15;
return new RSVP.Queue()
.push(function () {
return gadget.getDeclaredGadget('last');
return RSVP.all([
gadget.getDeclaredGadget('last'),
gadget.getUrlFor({command: 'change', options: {page: "slap_ticket_list"}}),
gadget.getUrlFor({command: 'change', options: {page: "slap_rss_ticket"}}),
gadget.getUrlFor({command: 'change', options: {page: "slap_rss_critical_ticket"}})
]);
})
.push(function (form_list) {
var column_list = [
.push(function (result) {
var form_list = result[0],
column_list = [
['title', 'Title'],
['reference', 'Reference'],
['modification_date', 'Modification Date'],
['translated_simulation_state_title', 'State']
];
return form_list.render({
erp5_document: {
"_embedded": {"_view": {
"control": {
"description": "",
"title": "Link Control",
"default": ticket_control_template({
show_all_url: result[1],
rss_all_url: result[2],
rss_critical_url: result[3]
}),
"css_class": "",
"required": 1,
"editable": 0,
"key": "control",
"hidden": 0,
"type": "EditorField"
},
"listbox": {
"column_list": column_list,
"show_anchor": 0,
......@@ -154,12 +200,13 @@
"key": "slap_ticket_listbox",
"lines": lines_limit,
"list_method": "portal_catalog",
"query": "urn:jio:allDocs?query=portal_type%3A%20%28%22Support%20Request%22%2C%20%22Upgrade%20Decision%22%2C%20%22Regularisation%20Request%22%29%20AND%20destination_decision_reference%3A" + gadget.me_dict.reference,
"query": "urn:jio:allDocs?query=portal_type%3A%20%28%22Support%20Request%22%2C%20%22Upgrade%20Decision%22%2C%20%22Regularisation%20Request%22%29%20AND%20" +
"destination_decision_reference%3A" + gadget.me_dict.reference + "%20AND%20simulation_state%3A%20%28%22suspended%22%2C%20%22validated%22%2C%20%22confirmed%22%29",
"portal_type": [],
"search_column_list": column_list,
"sort_column_list": column_list,
"sort": [["modification_date", "Descending"]],
"title": "Tickets",
"title": "Pending Tickets to Process",
"type": "ListBox"
}
}},
......@@ -173,7 +220,7 @@
form_definition: {
group_list: [[
"bottom",
[["listbox"]]
[["control"], ["listbox"]]
]]
}
});
......@@ -231,4 +278,4 @@
});
});
});
}(window, rJS, RSVP));
\ No newline at end of file
}(window, rJS, RSVP, Handlebars));
\ No newline at end of file
......@@ -39,6 +39,17 @@
</tuple>
</value>
</item>
<item>
<key> <string>_Copy_or_Move_Permission</string> </key>
<value>
<list>
<string>Manager</string>
<string>Authenticated</string>
<string>Developer</string>
<string>Owner</string>
</list>
</value>
</item>
<item>
<key> <string>_Modify_portal_content_Permission</string> </key>
<value>
......@@ -230,7 +241,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>965.32166.29414.48520</string> </value>
<value> <string>966.41526.6603.40089</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -248,7 +259,7 @@
</tuple>
<state>
<tuple>
<float>1518617445.5</float>
<float>1522849395.6</float>
<string>UTC</string>
</tuple>
</state>
......
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