1
0
mirror of https://github.com/lensapp/lens.git synced 2025-05-20 05:10:56 +00:00

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

This commit is contained in:
Sebastian Malton 2021-04-23 12:26:26 -04:00 committed by GitHub
parent 476235b861
commit 4d10e07087
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 12 deletions

View File

@ -35,10 +35,6 @@ export class EntitySettingRegistry extends BaseRegistry<EntitySettingRegistratio
getItemsForKind(kind: string, apiVersion: string, source?: string) { getItemsForKind(kind: string, apiVersion: string, source?: string) {
let items = this.getItems().filter((item) => { let items = this.getItems().filter((item) => {
return item.kind === kind && item.apiVersions.includes(apiVersion); return item.kind === kind && item.apiVersions.includes(apiVersion);
}).map((item) => {
item.priority = item.priority ?? 50;
return item;
}); });
if (source) { 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));
} }
} }

View File

@ -16,15 +16,9 @@ export class KubeObjectDetailRegistry extends BaseRegistry<KubeObjectDetailRegis
getItemsForKind(kind: string, apiVersion: string) { getItemsForKind(kind: string, apiVersion: string) {
const items = this.getItems().filter((item) => { const items = this.getItems().filter((item) => {
return item.kind === kind && item.apiVersions.includes(apiVersion); 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));
} }
} }