Skip to content
This repository has been archived by the owner on Apr 28, 2020. It is now read-only.

Create VM Wizard: conditionally rendered Import provision source #519

Merged
merged 1 commit into from
Jul 19, 2019
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
5 changes: 4 additions & 1 deletion src/components/Wizard/CreateVmWizard/CreateVmWizard.js
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ export class CreateVmWizard extends React.Component {
key: VM_SETTINGS_TAB_KEY,
onCloseWizard: onCloseVmSettings,
render: () => {
const { namespaces, templates, dataVolumes, virtualMachines, Firehose } = this.props;
const { namespaces, templates, dataVolumes, virtualMachines, Firehose, isV2vVmwareCrd } = this.props;

const loadingData = { namespaces, templates, dataVolumes, virtualMachines };
const vmSettings = getVmSettings(this.state);
Expand All @@ -201,6 +201,7 @@ export class CreateVmWizard extends React.Component {
vmSettings={vmSettings}
onChange={(value, valid) => this.onStepDataChanged(VM_SETTINGS_TAB_KEY, value, valid)}
{...loadingData}
isV2vVmwareCrd={isV2vVmwareCrd}
>
<ImportProvider isVisible={isVmwareProvider(this.state)}>
<Firehose resources={vmwareImportResources}>
Expand Down Expand Up @@ -318,6 +319,7 @@ CreateVmWizard.defaultProps = {
storageClasses: null,
createTemplate: false,
dataVolumes: null,
isV2vVmwareCrd: false,
};

CreateVmWizard.propTypes = {
Expand All @@ -337,4 +339,5 @@ CreateVmWizard.propTypes = {
units: PropTypes.object.isRequired,
createTemplate: PropTypes.bool,
dataVolumes: PropTypes.array,
isV2vVmwareCrd: PropTypes.bool,
};
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@ export const getVmSettingsInitialState = props => ({
valid: false,
});

export const getInitialVmSettings = (props = { createTemplate: false }) => {
const { createTemplate } = props;
export const getInitialVmSettings = (props = { createTemplate: false, isV2vVmwareCrd: false }) => {
const { createTemplate, isV2vVmwareCrd } = props;

const provisionSources = [
PROVISION_SOURCE_PXE,
Expand All @@ -60,7 +60,10 @@ export const getInitialVmSettings = (props = { createTemplate: false }) => {

const importProviders = createTemplate ? [] : getProviders();

if (!createTemplate) {
if (!createTemplate && isV2vVmwareCrd) {
// Conditionally-enabled providers should go one level down, means to the list of providers.
// But as long as there is listed just a single "VMware" provider, the top-level "Import" option
// is disabled if VMware provider can not be used.
provisionSources.push(PROVISION_SOURCE_IMPORT);
}

Expand Down