mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
Allow to specify KubeObjectDetailRegistration priority (#1335)
Signed-off-by: Jari Kolehmainen <jari.kolehmainen@gmail.com>
This commit is contained in:
1 parent
1f88c05e82
commit
deb4773b44
22 files changed
+201
-36
No files matched your search
@@ -9,13 +9,20 @@ export interface KubeObjectDetailRegistration {
|
||||
kind: string;
|
||||
apiVersions: string[];
|
||||
components: KubeObjectDetailComponents;
|
||||
priority?: number;
|
||||
}
|
||||
|
||||
export class KubeObjectDetailRegistry extends BaseRegistry<KubeObjectDetailRegistration> {
|
||||
getItemsForKind(kind: string, apiVersion: string) {
|
||||
return this.items.filter((item) => {
|
||||
const items = this.items.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)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user