constants: Move URLs to constants

Fixes #1923

This moves all URLs from code to constants.
This commit is contained in:
regexowl 2024-04-26 12:30:42 +02:00 committed by Lucas Garfield
parent bb91840eef
commit e9d28498e1
26 changed files with 146 additions and 68 deletions

View file

@ -8,6 +8,8 @@ import {
} from '@patternfly/react-core';
import { ExternalLinkAltIcon } from '@patternfly/react-icons';
import { FILE_SYSTEM_CUSTOMIZATION_URL } from '../../../../constants';
const FileSystemAutomaticPartition = () => {
return (
<TextContent>
@ -24,7 +26,7 @@ const FileSystemAutomaticPartition = () => {
variant="link"
icon={<ExternalLinkAltIcon />}
iconPosition="right"
href="https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/8/html/creating_customized_images_by_using_insights_image_builder/customizing-file-systems-during-the-image-creation"
href={FILE_SYSTEM_CUSTOMIZATION_URL}
className="pf-u-pl-0"
>
Customizing file systems during the image creation

View file

@ -18,7 +18,12 @@ import { v4 as uuidv4 } from 'uuid';
import FileSystemTable from './FileSystemTable';
import { UNIT_GIB, UNIT_KIB, UNIT_MIB } from '../../../../constants';
import {
FILE_SYSTEM_CUSTOMIZATION_URL,
UNIT_GIB,
UNIT_KIB,
UNIT_MIB,
} from '../../../../constants';
import { useAppDispatch, useAppSelector } from '../../../../store/hooks';
import {
addPartition,
@ -130,7 +135,7 @@ const FileSystemConfiguration = () => {
variant="link"
icon={<ExternalLinkAltIcon />}
iconPosition="right"
href="https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/8/html/creating_customized_images_by_using_insights_image_builder/customizing-file-systems-during-the-image-creation"
href={FILE_SYSTEM_CUSTOMIZATION_URL}
className="pf-u-pl-0"
>
Read more about manual configuration here

View file

@ -3,6 +3,8 @@ import React from 'react';
import { Alert, Button } from '@patternfly/react-core';
import { ExternalLinkAltIcon } from '@patternfly/react-icons';
import { DEVELOPERS_URL } from '../../../../constants';
const DeveloperProgramButton = () => {
return (
<Button
@ -12,7 +14,7 @@ const DeveloperProgramButton = () => {
icon={<ExternalLinkAltIcon />}
iconPosition="right"
isInline
href={'https://developers.redhat.com/about'}
href={DEVELOPERS_URL}
>
Red Hat Developer Program
</Button>

View file

@ -13,6 +13,7 @@ import annotationPlugin from 'chartjs-plugin-annotation';
import { Bar } from 'react-chartjs-2';
import {
RELEASE_LIFECYCLE_URL,
RHEL_8,
RHEL_8_FULL_SUPPORT,
RHEL_8_MAINTENANCE_SUPPORT,
@ -147,7 +148,7 @@ const ReleaseLifecycle = () => {
icon={<ExternalLinkAltIcon />}
iconPosition="right"
isInline
href={'https://access.redhat.com/support/policy/updates/errata'}
href={RELEASE_LIFECYCLE_URL}
>
View Red Hat Enterprise Linux Life Cycle dates
</Button>

View file

@ -5,6 +5,7 @@ import { ExternalLinkAltIcon } from '@patternfly/react-icons';
import { Oscap } from './Oscap';
import { COMPLIANCE_AND_VULN_SCANNING_URL } from '../../../../constants';
import { imageBuilderApi } from '../../../../store/enhancedImageBuilderApi';
import { useAppSelector } from '../../../../store/hooks';
import { selectDistribution } from '../../../../store/wizardSlice';
@ -35,9 +36,7 @@ const OscapStep = () => {
icon={<ExternalLinkAltIcon />}
iconPosition="right"
isInline
href={
'https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/6/html/security_guide/chap-compliance_and_vulnerability_scanning'
}
href={COMPLIANCE_AND_VULN_SCANNING_URL}
>
Documentation
</Button>

View file

@ -84,8 +84,8 @@ const Packages = () => {
// select the correct version of EPEL repository
// the urls are copied over from the content service
const epelRepoUrlByDistribution = distribution.startsWith('rhel-8')
? 'https://dl.fedoraproject.org/pub/epel/8/Everything/x86_64/'
: 'https://dl.fedoraproject.org/pub/epel/9/Everything/x86_64/';
? EPEL_8_REPO_DEFINITION.url
: EPEL_9_REPO_DEFINITION.url;
const { data: epelRepo, isSuccess: isSuccessEpelRepo } =
useListRepositoriesQuery({

View file

@ -25,6 +25,12 @@ import { ExternalLinkAltIcon, HelpIcon } from '@patternfly/react-icons';
import { useChrome } from '@redhat-cloud-services/frontend-components/useChrome';
import { addNotification } from '@redhat-cloud-services/frontend-components-notifications/redux';
import {
ACTIVATION_KEYS_PROD_URL,
ACTIVATION_KEYS_STAGE_URL,
CDN_PROD_URL,
CDN_STAGE_URL,
} from '../../../../constants';
import { useAppDispatch, useAppSelector } from '../../../../store/hooks';
import {
useListActivationKeysQuery,
@ -128,11 +134,7 @@ const ManageKeysButton = () => {
icon={<ExternalLinkAltIcon />}
iconPosition="right"
isInline
href={
isProd()
? 'https://console.redhat.com/insights/connector/activation-keys'
: 'https://console.stage.redhat.com/insights/connector/activation-keys'
}
href={isProd() ? ACTIVATION_KEYS_PROD_URL : ACTIVATION_KEYS_STAGE_URL}
>
Activation keys page
</Button>
@ -161,10 +163,10 @@ const ActivationKeysList = () => {
useEffect(() => {
if (isProd()) {
dispatch(changeServerUrl('subscription.rhsm.redhat.com'));
dispatch(changeBaseUrl('https://cdn.redhat.com/'));
dispatch(changeBaseUrl(CDN_PROD_URL));
} else {
dispatch(changeServerUrl('subscription.rhsm.stage.redhat.com'));
dispatch(changeBaseUrl('https://cdn.stage.redhat.com/'));
dispatch(changeBaseUrl(CDN_STAGE_URL));
}
}, [dispatch, isProd]);

View file

@ -8,6 +8,8 @@ import {
} from '@patternfly/react-core';
import { ExternalLinkAltIcon } from '@patternfly/react-icons';
import { RHC_URL } from '../../../../constants';
const RegisterLaterInformation = () => {
return (
<TextContent>
@ -28,7 +30,7 @@ const RegisterLaterInformation = () => {
icon={<ExternalLinkAltIcon />}
iconPosition="right"
isInline
href="https://access.redhat.com/articles/rhc"
href={RHC_URL}
>
Registering with remote host configuration
</Button>

View file

@ -11,6 +11,11 @@ import {
} from '@patternfly/react-core';
import { HelpIcon, ExternalLinkAltIcon } from '@patternfly/react-icons';
import {
INSIGHTS_URL,
RHC_URL,
SUBSCRIPTION_MANAGEMENT_URL,
} from '../../../../constants';
import { useAppDispatch, useAppSelector } from '../../../../store/hooks';
import {
changeActivationKey,
@ -37,7 +42,7 @@ const RHSMPopover = () => {
icon={<ExternalLinkAltIcon />}
iconPosition="right"
isInline
href="https://access.redhat.com/products/red-hat-subscription-management"
href={SUBSCRIPTION_MANAGEMENT_URL}
>
Learn more about Red Hat Subscription Management
</Button>
@ -77,7 +82,7 @@ const InsightsPopover = () => {
icon={<ExternalLinkAltIcon />}
iconPosition="right"
isInline
href="https://access.redhat.com/products/red-hat-insights"
href={INSIGHTS_URL}
>
Learn more about Red Hat Insights
</Button>
@ -116,7 +121,7 @@ const RhcPopover = () => {
icon={<ExternalLinkAltIcon />}
iconPosition="right"
isInline
href="https://access.redhat.com/articles/rhc"
href={RHC_URL}
>
Learn more about remote host configuration
</Button>

View file

@ -17,6 +17,7 @@ import { AzureAuthButton } from './AzureAuthButton';
import { AzureResourceGroups } from './AzureResourceGroups';
import { AzureSourcesSelect } from './AzureSourcesSelect';
import { AZURE_AUTH_URL } from '../../../../../constants';
import { useAppDispatch, useAppSelector } from '../../../../../store/hooks';
import {
changeAzureResourceGroup,
@ -85,7 +86,7 @@ const Azure = () => {
icon={<ExternalLinkAltIcon />}
iconPosition="right"
isInline
href="https://docs.microsoft.com/en-us/azure/active-directory/develop/v2-oauth2-auth-code-flow"
href={AZURE_AUTH_URL}
>
Learn more about OAuth 2.0
</Button>