Skip to content

Commit

Permalink
CNV-37788: Fix instancetype link on vm details tab
Browse files Browse the repository at this point in the history
Signed-off-by: Matan Schatzman <mschatzm@redhat.com>
  • Loading branch information
metalice committed Jan 31, 2024
1 parent 01428db commit f28b870
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/utils/resources/instancetype/helper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@ import { K8sModel } from '@openshift-console/dynamic-plugin-sdk';
export const getInstanceTypeModelFromMatcher = (
instanceTypeMatcher: V1InstancetypeMatcher,
): K8sModel =>
instanceTypeMatcher.kind.includes('cluster')
instanceTypeMatcher.kind.includes('Cluster')
? VirtualMachineClusterInstancetypeModel
: VirtualMachineInstancetypeModel;
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import {
modelToGroupVersionKind,
VirtualMachineClusterPreferenceModelGroupVersionKind,
} from '@kubevirt-ui/kubevirt-api/console';
import VirtualMachineInstancetypeModel from '@kubevirt-ui/kubevirt-api/console/models/VirtualMachineInstancetypeModel';
import { V1VirtualMachine } from '@kubevirt-ui/kubevirt-api/kubevirt';
import MutedTextSpan from '@kubevirt-utils/components/MutedTextSpan/MutedTextSpan';
import { useKubevirtTranslation } from '@kubevirt-utils/hooks/useKubevirtTranslation';
Expand All @@ -25,7 +26,8 @@ const InstanceTypeDescription: FC<InstanceTypeDescriptionProps> = ({ vm }) => {
const None = <MutedTextSpan text={t('None')} />;

const itMatcher = getInstanceTypeMatcher(vm);

const itKind = getInstanceTypeModelFromMatcher(itMatcher);
const includeNamespace = itKind === VirtualMachineInstancetypeModel;
const preferenceMatcher = getPreferenceMatcher(vm);

return (
Expand All @@ -37,6 +39,7 @@ const InstanceTypeDescription: FC<InstanceTypeDescriptionProps> = ({ vm }) => {
<ResourceLink
groupVersionKind={modelToGroupVersionKind(getInstanceTypeModelFromMatcher(itMatcher))}
name={itMatcher.name}
namespace={includeNamespace && vm?.metadata?.namespace}
/>
) : (
None
Expand Down

0 comments on commit f28b870

Please sign in to comment.