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

Remove last usage of legacy global replicaSetStore

Signed-off-by: Sebastian Malton <sebastian@malton.name>
This commit is contained in:
Sebastian Malton 2022-11-30 09:45:06 -05:00
parent 388799da11
commit 8d8424152c
2 changed files with 25 additions and 17 deletions

View File

@ -15,9 +15,12 @@ import { prevDefault, stopPropagation } from "../../utils";
import { DrawerTitle } from "../drawer";
import { Table, TableCell, TableHead, TableRow } from "../table";
import { KubeObjectStatusIcon } from "../kube-object-status-icon";
import { replicaSetStore } from "../+workloads-replicasets/legacy-store";
import { showDetails } from "../kube-detail-params";
import { KubeObjectAge } from "../kube-object/age";
import type { ReplicaSetStore } from "../+workloads-replicasets/store";
import type { ShowDetails } from "../kube-detail-params/show-details.injectable";
import { withInjectables } from "@ogre-tools/injectable-react";
import showDetailsInjectable from "../kube-detail-params/show-details.injectable";
import replicaSetStoreInjectable from "../+workloads-replicasets/store.injectable";
enum sortBy {
@ -31,14 +34,23 @@ export interface DeploymentReplicaSetsProps {
replicaSets: ReplicaSet[];
}
interface Dependencies {
replicaSetStore: ReplicaSetStore;
showDetails: ShowDetails;
}
@observer
export class DeploymentReplicaSets extends React.Component<DeploymentReplicaSetsProps> {
class NonInjectedDeploymentReplicaSets extends React.Component<DeploymentReplicaSetsProps & Dependencies> {
getPodsLength(replicaSet: ReplicaSet) {
return replicaSetStore.getChildPods(replicaSet).length;
return this.props.replicaSetStore.getChildPods(replicaSet).length;
}
render() {
const { replicaSets } = this.props;
const {
replicaSets,
replicaSetStore,
showDetails,
} = this.props;
if (!replicaSets.length && !replicaSetStore.isLoaded) return (
<div className="ReplicaSets"><Spinner center/></div>
@ -95,6 +107,14 @@ export class DeploymentReplicaSets extends React.Component<DeploymentReplicaSets
}
}
export const DeploymentReplicaSets = withInjectables<Dependencies, DeploymentReplicaSetsProps>(NonInjectedDeploymentReplicaSets, {
getProps: (di, props) => ({
...props,
replicaSetStore: di.inject(replicaSetStoreInjectable),
showDetails: di.inject(showDetailsInjectable),
}),
});
export function ReplicaSetMenu(props: KubeObjectMenuProps<ReplicaSet>) {
return (
<KubeObjectMenu {...props}/>

View File

@ -1,12 +0,0 @@
/**
* Copyright (c) OpenLens Authors. All rights reserved.
* Licensed under MIT License. See LICENSE in root directory for more information.
*/
import { asLegacyGlobalForExtensionApi } from "../../../extensions/as-legacy-globals-for-extension-api/as-legacy-global-object-for-extension-api";
import replicaSetStoreInjectable from "./store.injectable";
/**
* @deprecated use `di.inject(replicaSetStoreInjectable)` instead
*/
export const replicaSetStore = asLegacyGlobalForExtensionApi(replicaSetStoreInjectable);