Commit 4d0f2071 authored by Romain Courteaud's avatar Romain Courteaud

slapos_panel: software.json contains multiple entries with the same software-type

parent 1fec7e13
...@@ -25,6 +25,10 @@ ...@@ -25,6 +25,10 @@
}); });
} }
function filterUnique(value, index, self) {
return self.indexOf(value) === index;
}
function getContentFromSoftwareReleaseURLView(gadget) { function getContentFromSoftwareReleaseURLView(gadget) {
var software_url; var software_url;
return gadget.getDeclaredGadget(FIELD_SCOPE) return gadget.getDeclaredGadget(FIELD_SCOPE)
...@@ -46,13 +50,23 @@ ...@@ -46,13 +50,23 @@
console.log(software_json); console.log(software_json);
for (software_type in software_json['software-type']) { for (software_type in software_json['software-type']) {
if (software_json['software-type'].hasOwnProperty(software_type)) { if (software_json['software-type'].hasOwnProperty(software_type)) {
software_type_array.push(software_type); // Multiple form can use the same software type
// This is a hack to separate slave/non slave
if (software_json['software-type'][software_type]
.hasOwnProperty('software-type')) {
software_type_array.push(
software_json['software-type'][software_type]['software-type']
);
} else {
software_type_array.push(software_type);
}
} }
} }
result[gadget.state.title_key] = software_json.name; result[gadget.state.title_key] = software_json.name;
result[gadget.state.description_key] = software_json.description || ""; result[gadget.state.description_key] = software_json.description || "";
result[gadget.state.software_release_key] = software_url; result[gadget.state.software_release_key] = software_url;
result[gadget.state.software_type_key] = software_type_array; result[gadget.state.software_type_key] =
software_type_array.filter(filterUnique);
console.log(result); console.log(result);
return result; return result;
}); });
......
...@@ -240,7 +240,7 @@ ...@@ -240,7 +240,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>1004.795.25465.61781</string> </value> <value> <string>1004.3478.38769.10274</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -258,7 +258,7 @@ ...@@ -258,7 +258,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1667235665.03</float> <float>1667396728.07</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </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