Skip to content

Commit

Permalink
Merge pull request #7575 from metalice/bz-1907453-pods-on-topology-de…
Browse files Browse the repository at this point in the history
…v-view

Bug 1907453: Pod is now availble in Dev view , topology , machine detail
  • Loading branch information
openshift-merge-robot committed Dec 23, 2020
2 parents 04d9999 + a7f6bfa commit 29e86bb
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ import { TEMPLATE_TYPE_LABEL, TEMPLATE_TYPE_VM } from '../constants/vm';
import { VMDetailsList, VMResourceSummary } from '../components/vms/vm-resource';
import { VMNode } from './types';
import { VMKind } from '../types/vm';
import { PodKind } from '@console/internal/module/k8s/types';
import { usePodsForVm } from '../utils/usePodsForVm';

type TopologyVmDetailsPanelProps = {
vmNode: VMNode;
Expand All @@ -28,8 +30,8 @@ type LoadedTopologyVmDetailsPanelProps = TopologyVmDetailsPanelProps & {
const LoadedTopologyVmDetailsPanel: React.FC<LoadedTopologyVmDetailsPanelProps> = observer(
({ loaded, vmNode, templates }) => {
const vmData = vmNode.getData();
const { pod } = vmData.data.vmStatusBundle;
const vmObj = vmData.resource as VMKind;
const { podData: { pods = [] } = {} } = usePodsForVm(vmObj);
const { vmi, vmStatusBundle } = vmData.data;
const canUpdate =
useAccessReview(asAccessReview(VirtualMachineModel, vmObj || {}, 'patch')) && !!vmObj;
Expand All @@ -53,7 +55,7 @@ const LoadedTopologyVmDetailsPanel: React.FC<LoadedTopologyVmDetailsPanelProps>
canUpdateVM={canUpdate}
vm={vmObj}
vmi={vmi}
pods={[pod]}
pods={pods as PodKind[]}
kindObj={VirtualMachineModel}
vmStatusBundle={vmStatusBundle}
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ import { observer } from '@patternfly/react-topology';
import { PodsOverviewContent } from '@console/internal/components/overview/pods-overview';
import { NetworkingOverview } from '@console/internal/components/overview/networking-overview';
import { VMNode } from './types';
import { PodKind } from '@console/internal/module/k8s/types';
import { usePodsForVm } from '../utils/usePodsForVm';

type TopologyVmResourcePanelProps = {
vmNode: VMNode;
Expand All @@ -12,11 +14,11 @@ export const TopologyVmResourcesPanel: React.FC<TopologyVmResourcePanelProps> =
({ vmNode }: TopologyVmResourcePanelProps) => {
const vmData = vmNode.getData();
const vm = vmData.resource;
const { pod } = vmData.data.vmStatusBundle;
const { podData: { pods = [] } = {} } = usePodsForVm(vm);

return (
<div className="overview__sidebar-pane-body">
<PodsOverviewContent obj={vm} pods={pod ? [pod] : []} loaded loadError={null} />
<PodsOverviewContent obj={vm} pods={pods as PodKind[]} loaded loadError={null} />
<NetworkingOverview obj={vm} />
</div>
);
Expand Down

0 comments on commit 29e86bb

Please sign in to comment.