Wizard: Activation key management link based on env

The "Activation keys page" link on the Registration step previously led to prod from both prod and stage envs.

This fixes the problem and ensures that the button in stage links to the activation key management in stage and the prod one to prod.
This commit is contained in:
regexowl 2023-11-23 16:25:50 +01:00 committed by Klara Simickova
parent b797f62c66
commit 1fc0aca5b2

View file

@ -15,8 +15,30 @@ import { useChrome } from '@redhat-cloud-services/frontend-components/useChrome'
import StepTemplate from './stepTemplate';
import { useGetEnvironment } from '../../../Utilities/useGetEnvironment';
import CustomButtons from '../formComponents/CustomButtons';
const ManageKeysButton = () => {
const { isProd } = useGetEnvironment();
return (
<Button
component="a"
target="_blank"
variant="link"
icon={<ExternalLinkAltIcon />}
iconPosition="right"
isInline
href={
isProd()
? 'https://console.redhat.com/insights/connector/activation-keys'
: 'https://console.stage.redhat.com/insights/connector/activation-keys'
}
>
Activation keys page
</Button>
);
};
const PopoverActivation = () => {
const [orgId, setOrgId] = useState(null);
const { auth } = useChrome();
@ -121,17 +143,7 @@ const registrationStep = {
<span>
By default, activation key is generated and preset for you. Admins can
create and manage keys by visiting the&nbsp;
<Button
component="a"
target="_blank"
variant="link"
icon={<ExternalLinkAltIcon />}
iconPosition="right"
isInline
href="https://console.redhat.com/insights/connector/activation-keys"
>
Activation keys page
</Button>
<ManageKeysButton />
</span>
),
condition: {