Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OCP has ID no need to manually add it #613

Merged
merged 1 commit into from
Jul 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 2 additions & 12 deletions packages/legacy/src/Plans/components/Wizard/helpers.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -312,17 +312,7 @@ export const getAvailableVMs = (
}

// If no matching VMs were found, use an empty array
matchingVMs = matchingVMs || [];

// Create a new array from `matchingVMs` by mapping over it
// Each element of the new array is an object with an `id` property and all the properties of the original VM
return matchingVMs.map((vm) => {
// If the VM is not defined, its id would be `undefined`, and the spread operator will have no effect
const id = vm?.uid;
const vmProperties = vm || {};

return { id, ...vmProperties };
});
return matchingVMs || [];
};

export interface IVMTreePathInfo {
Expand Down Expand Up @@ -492,7 +482,7 @@ export const getVMConcernStatusLabel = (concern: ISourceVMConcern | null): strin
: concern?.category || 'Ok';

export const someVMHasConcern = (vms: SourceVM[], concernLabel: string): boolean =>
vms.some((vm) => vm.concerns.some((concern) => concern.label === concernLabel));
vms?.some((vm) => vm.concerns?.some((concern) => concern.label === concernLabel));

export interface IGenerateMappingsArgs {
forms: PlanWizardFormState;
Expand Down
2 changes: 1 addition & 1 deletion packages/legacy/src/queries/tree.ts
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ export const useInventoryTreeQuery = <T extends InventoryTree>(
ovirt: '/tree/cluster',
openstack: '/tree/project',
openshift: '/tree/namespace',
ova: '/vms',
ova: '/vms?detail=4',
};
const mockTreeData: Record<ProviderType, IInventoryHostTree> = {
vsphere: MOCK_VMWARE_HOST_TREE,
Expand Down