mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
Remove unnecessary logger as dep
Signed-off-by: Sebastian Malton <sebastian@malton.name>
This commit is contained in:
parent
192b486991
commit
90964239ef
@ -10,43 +10,25 @@ import { observer } from "mobx-react";
|
|||||||
import { DrawerItem } from "../drawer";
|
import { DrawerItem } from "../drawer";
|
||||||
import { Badge } from "../badge";
|
import { Badge } from "../badge";
|
||||||
import type { KubeObjectDetailsProps } from "../kube-object-details";
|
import type { KubeObjectDetailsProps } from "../kube-object-details";
|
||||||
import { PodDisruptionBudget } from "../../../common/k8s-api/endpoints";
|
import type { PodDisruptionBudget } from "../../../common/k8s-api/endpoints";
|
||||||
import type { Logger } from "../../../common/logger";
|
|
||||||
import { withInjectables } from "@ogre-tools/injectable-react";
|
|
||||||
import loggerInjectable from "../../../common/logger.injectable";
|
|
||||||
|
|
||||||
export interface PodDisruptionBudgetDetailsProps extends KubeObjectDetailsProps<PodDisruptionBudget> {
|
export interface PodDisruptionBudgetDetailsProps extends KubeObjectDetailsProps<PodDisruptionBudget> {
|
||||||
}
|
}
|
||||||
|
|
||||||
interface Dependencies {
|
export const PodDisruptionBudgetDetails = observer((props: PodDisruptionBudgetDetailsProps) => {
|
||||||
logger: Logger;
|
const { object: pdb } = props;
|
||||||
}
|
|
||||||
|
|
||||||
@observer
|
|
||||||
class NonInjectedPodDisruptionBudgetDetails extends React.Component<PodDisruptionBudgetDetailsProps & Dependencies> {
|
|
||||||
|
|
||||||
render() {
|
|
||||||
const { object: pdb } = this.props;
|
|
||||||
|
|
||||||
if (!pdb) {
|
if (!pdb) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(pdb instanceof PodDisruptionBudget)) {
|
|
||||||
this.props.logger.error("[PodDisruptionBudgetDetails]: passed object that is not an instanceof PodDisruptionBudget", pdb);
|
|
||||||
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
const selectors = pdb.getSelectors();
|
const selectors = pdb.getSelectors();
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="PdbDetails">
|
<div className="PdbDetails">
|
||||||
{selectors.length > 0 && (
|
{selectors.length > 0 && (
|
||||||
<DrawerItem name="Selector" labelsOnly>
|
<DrawerItem name="Selector" labelsOnly>
|
||||||
{
|
{selectors.map(label => <Badge key={label} label={label}/>)}
|
||||||
selectors.map(label => <Badge key={label} label={label}/>)
|
|
||||||
}
|
|
||||||
</DrawerItem>
|
</DrawerItem>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
@ -68,12 +50,4 @@ class NonInjectedPodDisruptionBudgetDetails extends React.Component<PodDisruptio
|
|||||||
|
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export const PodDisruptionBudgetDetails = withInjectables<Dependencies, PodDisruptionBudgetDetailsProps>(NonInjectedPodDisruptionBudgetDetails, {
|
|
||||||
getProps: (di, props) => ({
|
|
||||||
...props,
|
|
||||||
logger: di.inject(loggerInjectable),
|
|
||||||
}),
|
|
||||||
});
|
});
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user