mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
Make another dependency a segregated interface instead of concrete instance
Notice how interface is in fact segregated, i.e. it only advertises the minimal properties currently required. With this we satisfy Interface Segregation Principle and thus permit e.g. minimal requirement for stubbing in future unit tests. Signed-off-by: Janne Savolainen <janne.savolainen@houston-inc.com>
This commit is contained in:
parent
d9e8821d33
commit
73e3dd95f4
@ -37,12 +37,16 @@ import { ClusterMetadataKey, initialNodeShellImage, ClusterStatus } from "../com
|
||||
import { disposer, storedKubeConfigFolder, toJS } from "../common/utils";
|
||||
import type { Response } from "request";
|
||||
|
||||
export interface IHasName {
|
||||
readonly name: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Cluster
|
||||
*
|
||||
* @beta
|
||||
*/
|
||||
export class Cluster implements ClusterModel, ClusterState {
|
||||
export class Cluster implements ClusterModel, ClusterState, IHasName {
|
||||
/** Unique id for a cluster */
|
||||
public readonly id: ClusterId;
|
||||
private kubeCtl: Kubectl;
|
||||
|
||||
@ -27,7 +27,7 @@ import identity from "lodash/identity";
|
||||
|
||||
import type { IHasGettableItemsForKind } from "../../../extensions/registries";
|
||||
import type { IGettableStore } from "../../../common/k8s-api/api-manager";
|
||||
import type { Cluster } from "../../../main/cluster";
|
||||
import type { IHasName } from "../../../main/cluster";
|
||||
|
||||
|
||||
export interface KubeObjectMenuProps<T> extends MenuActionsProps {
|
||||
@ -39,7 +39,7 @@ export interface KubeObjectMenuProps<T> extends MenuActionsProps {
|
||||
interface KubeObjectMenuDependencies<T> extends KubeObjectMenuProps<T>{
|
||||
apiManager: IGettableStore,
|
||||
kubeObjectMenuRegistry: IHasGettableItemsForKind
|
||||
cluster: Cluster,
|
||||
cluster: IHasName,
|
||||
hideDetails: Function,
|
||||
editResourceTab: Function,
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user