Fix: don't assign to priority in getItemsForKind (#2611)

This commit is contained in:
Sebastian Malton authored and GitHub committed 2021-04-23 12:26:26 -04:00
1 parent 476235b861
commit 4d10e07087
2 files changed
+2 -12

No files matched your search

@@ -35,10 +35,6 @@ export class EntitySettingRegistry extends BaseRegistry<EntitySettingRegistratio
getItemsForKind(kind: string, apiVersion: string, source?: string) {
let items = this.getItems().filter((item) => {
return item.kind === kind && item.apiVersions.includes(apiVersion);
}).map((item) => {
item.priority = item.priority ?? 50;
return item;
});
if (source) {
@@ -47,7 +43,7 @@ export class EntitySettingRegistry extends BaseRegistry<EntitySettingRegistratio
});
}
return items.sort((a, b) => b.priority - a.priority);
return items.sort((a, b) => (b.priority ?? 50) - (a.priority ?? 50));
}
}
@@ -16,15 +16,9 @@ export class KubeObjectDetailRegistry extends BaseRegistry<KubeObjectDetailRegis
getItemsForKind(kind: string, apiVersion: string) {
const items = this.getItems().filter((item) => {
return item.kind === kind && item.apiVersions.includes(apiVersion);
}).map((item) => {
if (item.priority === null) {
item.priority = 50;
}
return item;
});
return items.sort((a, b) => b.priority - a.priority);
return items.sort((a, b) => (b.priority ?? 50) - (a.priority ?? 50));
}
}