💄 Sort add-ons in the Hass.io add-ons store (#733)

Signed-off-by: Franck Nijhof <frenck@addons.community>
This commit is contained in:
Franck Nijhof 2017-12-23 06:17:04 +01:00 committed by Paulus Schoutsen
parent 34fd3e4899
commit 36c658096a

View File

@ -91,6 +91,22 @@ class HassioAddonStoreOverview extends window.hassMixins.EventsMixin(Polymer.Ele
computeAddOns(repo) { computeAddOns(repo) {
return this.addons.filter(function (addon) { return this.addons.filter(function (addon) {
return addon.repository === repo; return addon.repository === repo;
}).sort(function (addonA, addonB) {
if (addonA.name < addonB.name) {
return -1;
}
if (addonA.name > addonB.name) {
return 1;
}
return 0;
}).sort(function (addonA, addonB) {
if (addonA.installed && !addonB.installed) {
return -1;
}
if (!addonA.installed && addonB.installed) {
return 1;
}
return 0;
}); });
} }