Add registration key
Fully implement registration step with conditional text fields
This commit is contained in:
parent
fb1c949a97
commit
2d777bd30d
3 changed files with 46 additions and 7 deletions
|
|
@ -1,15 +1,22 @@
|
||||||
import React from 'react';
|
import React, { useState, useEffect } from 'react';
|
||||||
import ImageCreator from './ImageCreator';
|
import ImageCreator from './ImageCreator';
|
||||||
import { useHistory } from 'react-router-dom';
|
import { useHistory } from 'react-router-dom';
|
||||||
import componentTypes from '@data-driven-forms/react-form-renderer/component-types';
|
import componentTypes from '@data-driven-forms/react-form-renderer/component-types';
|
||||||
import { Button } from '@patternfly/react-core';
|
import { Button, Spinner } from '@patternfly/react-core';
|
||||||
import { ExternalLinkAltIcon } from '@patternfly/react-icons';
|
import { ExternalLinkAltIcon } from '@patternfly/react-icons';
|
||||||
import { review, awsTarget, registration, googleCloudTarger, msAzureTarget, packages, imageOutput } from './steps';
|
import { review, awsTarget, registration, googleCloudTarger, msAzureTarget, packages, imageOutput } from './steps';
|
||||||
import './CreateImageWizard.scss';
|
import './CreateImageWizard.scss';
|
||||||
|
|
||||||
const CreateImage = () => {
|
const CreateImage = () => {
|
||||||
const history = useHistory();
|
const history = useHistory();
|
||||||
return <ImageCreator
|
const [ user, setUser ] = useState();
|
||||||
|
useEffect(() => {
|
||||||
|
(async () => {
|
||||||
|
const userData = await insights.chrome.auth.getUser();
|
||||||
|
setUser(() => userData);
|
||||||
|
})();
|
||||||
|
}, []);
|
||||||
|
return user ? <ImageCreator
|
||||||
onClose={ () => history.push('/landing') }
|
onClose={ () => history.push('/landing') }
|
||||||
onSubmit={ (values) => console.log(values) }
|
onSubmit={ (values) => console.log(values) }
|
||||||
defaultArch="x86_64"
|
defaultArch="x86_64"
|
||||||
|
|
@ -43,13 +50,13 @@ https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/8/html/up
|
||||||
awsTarget,
|
awsTarget,
|
||||||
msAzureTarget,
|
msAzureTarget,
|
||||||
googleCloudTarger,
|
googleCloudTarger,
|
||||||
registration,
|
registration(user),
|
||||||
packages,
|
packages,
|
||||||
review,
|
review,
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
} } />;
|
} } /> : <Spinner />;
|
||||||
};
|
};
|
||||||
|
|
||||||
export default CreateImage;
|
export default CreateImage;
|
||||||
|
|
|
||||||
|
|
@ -82,5 +82,6 @@ export default {
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
}
|
}
|
||||||
|
// TODO check oauth2 thing too here?
|
||||||
]
|
]
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -1,11 +1,12 @@
|
||||||
import componentTypes from '@data-driven-forms/react-form-renderer/component-types';
|
import componentTypes from '@data-driven-forms/react-form-renderer/component-types';
|
||||||
|
import validatorTypes from '@data-driven-forms/react-form-renderer/validator-types';
|
||||||
|
|
||||||
export const registerValues = {
|
export const registerValues = {
|
||||||
'subscribe-now-radio': 'Embed an activation key and register systems on first boot',
|
'subscribe-now-radio': 'Embed an activation key and register systems on first boot',
|
||||||
'register-later-radio-button': 'Register the system later'
|
'register-later-radio-button': 'Register the system later'
|
||||||
};
|
};
|
||||||
|
|
||||||
export default {
|
export default (user) => ({
|
||||||
title: 'Registration',
|
title: 'Registration',
|
||||||
name: 'registration',
|
name: 'registration',
|
||||||
nextStep: 'packages',
|
nextStep: 'packages',
|
||||||
|
|
@ -19,6 +20,36 @@ export default {
|
||||||
label: title,
|
label: title,
|
||||||
value: key
|
value: key
|
||||||
}))
|
}))
|
||||||
|
},
|
||||||
|
{
|
||||||
|
component: componentTypes.TEXT_FIELD,
|
||||||
|
name: 'subscription-organization',
|
||||||
|
type: 'text',
|
||||||
|
label: 'Organization ID',
|
||||||
|
initialValue: Number(user?.identity?.internal?.org_id),
|
||||||
|
isDisabled: true,
|
||||||
|
condition: {
|
||||||
|
or: [
|
||||||
|
{ when: 'register-system', is: 'subscribe-now-radio' },
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
component: componentTypes.TEXT_FIELD,
|
||||||
|
name: 'subscription-activation',
|
||||||
|
type: 'text',
|
||||||
|
label: 'Activation key',
|
||||||
|
condition: {
|
||||||
|
or: [
|
||||||
|
{ when: 'register-system', is: 'subscribe-now-radio' },
|
||||||
|
]
|
||||||
|
},
|
||||||
|
isRequired: true,
|
||||||
|
validate: [
|
||||||
|
{
|
||||||
|
type: validatorTypes.REQUIRED,
|
||||||
|
},
|
||||||
|
],
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
};
|
});
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue