Commit e77836e0 authored by Rafael Monnerat's avatar Rafael Monnerat

slapos_jio: Fixup display of items on the Project view listbox

   This fixup mostly the status column and introduces type (since it is multiple type entry).
parent be0d00d6
......@@ -30,10 +30,14 @@
.push(function (result) {
var i, value, value_jio_key, len = result.data.total_rows;
for (i = 0; i < len; i += 1) {
if (1 || (result.data.rows[i].value.hasOwnProperty("Computer_getNewsDict"))) {
if (result.data.rows[i].value.hasOwnProperty("portal_type")) {
if (result.data.rows[i].value.portal_type === "Computer") {
value_jio_key = result.data.rows[i].id;
value = result.data.rows[i].value.Computer_getNewsDict;
result.data.rows[i].value.Computer_getNewsDict = {
value = result.data.rows[i].value.Document_getNewsDict;
// Use a User-friendly for the Website, this value should be translated
// most liketly
result.data.rows[i].value.portal_type = "Server";
result.data.rows[i].value.Document_getNewsDict = {
field_gadget_param : {
css_class: "",
description: gadget.description_translation,
......@@ -45,6 +49,45 @@
type: "GadgetField"
}
};
}
if (result.data.rows[i].value.portal_type === "Instance Tree") {
value_jio_key = result.data.rows[i].id;
value = result.data.rows[i].value.Document_getNewsDict;
// Use a User-friendly for the Website, this value should be translated
// most liketly
result.data.rows[i].value.portal_type = "Service";
result.data.rows[i].value.Document_getNewsDict = {
field_gadget_param : {
css_class: "",
description: gadget.description_translation,
hidden: 0,
"default": {jio_key: value_jio_key, result: value},
key: "status",
url: "gadget_slapos_instance_tree_status.html",
title: gadget.title_translation,
type: "GadgetField"
}
};
}
if (result.data.rows[i].value.portal_type === "Computer Network") {
value_jio_key = result.data.rows[i].id;
value = result.data.rows[i].value.Document_getNewsDict;
// Use a User-friendly for the Website, this value should be translated
// most liketly
result.data.rows[i].value.portal_type = "Network";
result.data.rows[i].value.Document_getNewsDict = {
field_gadget_param : {
css_class: "",
description: gadget.description_translation,
hidden: 0,
"default": {jio_key: value_jio_key, result: value},
key: "status",
url: "gadget_slapos_network_status.html",
title: gadget.title_translation,
type: "GadgetField"
}
};
}
result.data.rows[i].value["listbox_uid:list"] = {
key: "listbox_uid:list",
value: 2713
......@@ -97,7 +140,8 @@
"Project",
"The Status",
"Status",
"Data updated."
"Data updated.",
"Type"
];
return new RSVP.Queue()
.push(function () {
......@@ -116,7 +160,8 @@
column_list = [
['title', result[2][0]],
['reference', result[2][1]],
['Computer_getNewsDict', result[2][8]]
['portal_type', result[2][10]],
['Document_getNewsDict', result[2][8]]
];
return result[0].render({
erp5_document: {
......
......@@ -247,7 +247,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>986.45437.22132.61764</string> </value>
<value> <string>994.20990.137.57600</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -265,7 +265,7 @@
</tuple>
<state>
<tuple>
<float>1602258777.59</float>
<float>1629819771.94</float>
<string>UTC</string>
</tuple>
</state>
......
portal_type = context.getPortalType()
if portal_type == "Computer":
return context.Computer_getNewsDict(**kw)
if portal_type == "Instance Tree":
return context.InstanceTree_getNewsDict(**kw)
if portal_type == "Computer Network":
return context.ComputerNetwork_getNewsDict(**kw)
raise ValueError("Unsupported Type")
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="PythonScript" module="Products.PythonScripts.PythonScript"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>Script_magic</string> </key>
<value> <int>3</int> </value>
</item>
<item>
<key> <string>_bind_names</string> </key>
<value>
<object>
<klass>
<global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/>
</klass>
<tuple/>
<state>
<dictionary>
<item>
<key> <string>_asgns</string> </key>
<value>
<dictionary>
<item>
<key> <string>name_container</string> </key>
<value> <string>container</string> </value>
</item>
<item>
<key> <string>name_context</string> </key>
<value> <string>context</string> </value>
</item>
<item>
<key> <string>name_m_self</string> </key>
<value> <string>script</string> </value>
</item>
<item>
<key> <string>name_subpath</string> </key>
<value> <string>traverse_subpath</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>_params</string> </key>
<value> <string>**kw</string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>Document_getNewsDict</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
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