mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
Demonstrate even step further to have an interface as dependency instead of concrete instance
Signed-off-by: Janne Savolainen <janne.savolainen@houston-inc.com>
This commit is contained in:
1 parent
91b14ee3fc
commit
29d0634729
2 files changed
+18
-10
No files matched your search
@@ -32,10 +32,13 @@ export interface KubeObjectMenuRegistration {
|
||||
components: KubeObjectMenuComponents;
|
||||
}
|
||||
|
||||
export class KubeObjectMenuRegistry extends BaseRegistry<KubeObjectMenuRegistration> {
|
||||
getItemsForKind(kind: string, apiVersion: string) {
|
||||
return this.getItems().filter((item) => {
|
||||
return item.kind === kind && item.apiVersions.includes(apiVersion);
|
||||
});
|
||||
}
|
||||
export interface IHasGettableItemsForKind {
|
||||
getItemsForKind(kind: string, apiVersion: string): any;
|
||||
}
|
||||
|
||||
export class KubeObjectMenuRegistry extends BaseRegistry<KubeObjectMenuRegistration> implements IHasGettableItemsForKind {
|
||||
getItemsForKind = (kind: string, apiVersion: string) =>
|
||||
this.getItems().filter((item) =>
|
||||
item.kind === kind && item.apiVersions.includes(apiVersion),
|
||||
);
|
||||
}
|
||||
Reference in new issue
Block a user