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 @@
});
}
function filterUnique(value, index, self) {
return self.indexOf(value) === index;
}
function getContentFromSoftwareReleaseURLView(gadget) {
var software_url;
return gadget.getDeclaredGadget(FIELD_SCOPE)
......@@ -46,13 +50,23 @@
console.log(software_json);
for (software_type in software_json['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.description_key] = software_json.description || "";
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);
return result;
});
......
......@@ -240,7 +240,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>1004.795.25465.61781</string> </value>
<value> <string>1004.3478.38769.10274</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -258,7 +258,7 @@
</tuple>
<state>
<tuple>
<float>1667235665.03</float>
<float>1667396728.07</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