diff --git a/frontend/public/kubevirt/components/modals/create-vm-modal.js b/frontend/public/kubevirt/components/modals/create-vm-modal.js index 6448326a131..af1463fd01a 100644 --- a/frontend/public/kubevirt/components/modals/create-vm-modal.js +++ b/frontend/public/kubevirt/components/modals/create-vm-modal.js @@ -21,8 +21,8 @@ export const openCreateVmWizard = ( activeNamespace, createTemplate = false ) => resource: getResource(NamespaceModel), }, virtualMachines: { - resource: getResource(VirtualMachineModel), - required: true, + resource: getResource(VirtualMachineModel, {namespace: activeNamespace}), + requiredIfAuthorized: true, }, userTemplates: { resource: getResource(TemplateModel, {namespace: activeNamespace, prop: 'userTemplates', matchLabels: {[TEMPLATE_TYPE_LABEL]: TEMPLATE_TYPE_VM}}), diff --git a/frontend/public/kubevirt/components/utils/withResources.jsx b/frontend/public/kubevirt/components/utils/withResources.jsx index d1096c651c7..785146c0b3d 100644 --- a/frontend/public/kubevirt/components/utils/withResources.jsx +++ b/frontend/public/kubevirt/components/utils/withResources.jsx @@ -46,6 +46,8 @@ class Resources extends React.Component { if (resource) { if (resource.loaded) { childrenProps[resourceKey] = resource.data; + } else if (resourceConfig.requiredIfAuthorized && _.get(resource, 'loadError.json.code') !== 403){ + loaded = false; } else if (resourceConfig.required) { loaded = false; }