From 1ed573226241814fbdab657b1bbc65fcb8d331d1 Mon Sep 17 00:00:00 2001 From: Montse Ortega Date: Tue, 28 May 2024 09:02:01 +0200 Subject: [PATCH] Create docs_links file with all documentation links (#2584) --- .../DiscoveryImageConfigForm.tsx | 2 +- .../DiscoveryTroubleshootingModal.tsx | 2 +- .../components/hosts/HostRequirements.tsx | 5 +- .../components/ui/TechnologyPreview.tsx | 2 +- libs/ui-lib/lib/common/config/constants.ts | 80 --------------- libs/ui-lib/lib/common/config/docs_links.ts | 99 +++++++++++++++++++ libs/ui-lib/lib/common/config/index.ts | 1 + .../UserManagedNetworkingTextContent.tsx | 2 +- .../ReviewClusterFeatureSupportLevels.tsx | 2 +- .../hosts/HostRequirementsContent.tsx | 4 +- 10 files changed, 108 insertions(+), 91 deletions(-) create mode 100644 libs/ui-lib/lib/common/config/docs_links.ts diff --git a/libs/ui-lib/lib/common/components/clusterConfiguration/DiscoveryImageConfigForm.tsx b/libs/ui-lib/lib/common/components/clusterConfiguration/DiscoveryImageConfigForm.tsx index ef40d1f220..1119998605 100644 --- a/libs/ui-lib/lib/common/components/clusterConfiguration/DiscoveryImageConfigForm.tsx +++ b/libs/ui-lib/lib/common/components/clusterConfiguration/DiscoveryImageConfigForm.tsx @@ -27,7 +27,7 @@ import { ProxyFieldsType, StatusErrorType } from '../../types'; import ProxyFields from './ProxyFields'; import UploadSSH from './UploadSSH'; import DiscoveryImageTypeControlGroup from './DiscoveryImageTypeControlGroup'; -import { getOCPStaticIPDocLink } from '../../config/constants'; +import { getOCPStaticIPDocLink } from '../../config/docs_links'; import { useTranslation } from '../../hooks/use-translation-wrapper'; export const StaticIPInfo = ({ docVersion }: { docVersion?: string }) => { diff --git a/libs/ui-lib/lib/common/components/clusterConfiguration/DiscoveryTroubleshootingModal.tsx b/libs/ui-lib/lib/common/components/clusterConfiguration/DiscoveryTroubleshootingModal.tsx index ae505bbb8d..fbaa1af73d 100644 --- a/libs/ui-lib/lib/common/components/clusterConfiguration/DiscoveryTroubleshootingModal.tsx +++ b/libs/ui-lib/lib/common/components/clusterConfiguration/DiscoveryTroubleshootingModal.tsx @@ -18,7 +18,7 @@ import { PrismCode, SimpleAIPrismTheme, UiIcon } from '../ui'; import { useTranslation } from '../../hooks/use-translation-wrapper'; import { Trans } from 'react-i18next'; import { saveAs } from 'file-saver'; -import { CHANGE_ISO_PASSWORD_FILE_LINK } from '../../config/constants'; +import { CHANGE_ISO_PASSWORD_FILE_LINK } from '../../config/docs_links'; import * as Sentry from '@sentry/browser'; export const DiscoveryTroubleshootingModalContent = () => { diff --git a/libs/ui-lib/lib/common/components/hosts/HostRequirements.tsx b/libs/ui-lib/lib/common/components/hosts/HostRequirements.tsx index 3fb12835b4..3c1a79c804 100644 --- a/libs/ui-lib/lib/common/components/hosts/HostRequirements.tsx +++ b/libs/ui-lib/lib/common/components/hosts/HostRequirements.tsx @@ -3,6 +3,7 @@ import * as React from 'react'; import ExternalLink from '../ui/ExternalLink'; import { useTranslation } from '../../hooks/use-translation-wrapper'; import { fileSize } from '../../utils'; +import { HOST_REQUIREMENTS_LINK } from '../../config/docs_links'; type HWRequirements = { cpuCores?: number; @@ -75,9 +76,7 @@ export const HostRequirementsList: React.FC = ({ {t( "ai:Also note that each host's disk write speed should meet the minimum requirements to run OpenShift. ", )} - - {t('ai:Learn more')} - + {t('ai:Learn more')} ); diff --git a/libs/ui-lib/lib/common/components/ui/TechnologyPreview.tsx b/libs/ui-lib/lib/common/components/ui/TechnologyPreview.tsx index 21ebf56c8f..759fc210e3 100644 --- a/libs/ui-lib/lib/common/components/ui/TechnologyPreview.tsx +++ b/libs/ui-lib/lib/common/components/ui/TechnologyPreview.tsx @@ -1,5 +1,5 @@ import React from 'react'; -import { TECH_SUPPORT_LEVEL_LINK } from '../../config/constants'; +import { TECH_SUPPORT_LEVEL_LINK } from '../../config/docs_links'; import { useTranslation } from '../../hooks/use-translation-wrapper'; import { PreviewBadge, PreviewBadgeProps } from './PreviewBadge'; diff --git a/libs/ui-lib/lib/common/config/constants.ts b/libs/ui-lib/lib/common/config/constants.ts index 089e1e67bd..f0cd1a927e 100644 --- a/libs/ui-lib/lib/common/config/constants.ts +++ b/libs/ui-lib/lib/common/config/constants.ts @@ -12,60 +12,6 @@ import { FeatureSupportLevelData } from '../components/featureSupportLevels/Feat import type { NewFeatureSupportLevelData } from '../components/newFeatureSupportLevels'; import buildManifest from '@openshift-assisted/ui-lib/package.json'; -export const getShortOpenshiftVersion = (ocpVersion?: string) => - ocpVersion?.split('.').slice(0, 2).join('.'); - -export const ASSISTED_INSTALLER_DOCUMENTATION_LINK = - 'https://access.redhat.com/documentation/en-us/assisted_installer_for_openshift_container_platform/2024/html/installing_openshift_container_platform_with_the_assisted_installer/index'; - -export const OPENSHIFT_LIFE_CYCLE_DATES_LINK = - 'https://access.redhat.com/support/policy/updates/openshift#dates'; -export const getOpenShiftNetworkingDocsLink = (ocpVersion?: string) => - `https://docs.openshift.com/container-platform/${ - getShortOpenshiftVersion(ocpVersion) || '4.13' - }/installing/installing_bare_metal/installing-bare-metal.html#installation-network-user-infra_installing-bare-metal`; -export const CLUSTER_MANAGER_SITE_LINK = 'https://console.redhat.com/openshift/install/pull-secret'; -export const PULL_SECRET_INFO_LINK = CLUSTER_MANAGER_SITE_LINK; -export const ODF_REQUIREMENTS_LINK = - 'https://access.redhat.com/documentation/en-us/red_hat_openshift_data_foundation/4.15'; -export const VSPHERE_CONFIG_LINK = 'https://access.redhat.com/solutions/6677901'; - -export const getReportIssueLink = () => - 'https://issues.redhat.com/secure/CreateIssue!default.jspa?pid=12332330&issuetype=1&components=12370775'; - -export const FEEDBACK_FORM_LINK = - 'https://docs.google.com/forms/d/e/1FAIpQLSfg9M8wRW4m_HkWeAl6KpB5dTcMu8iI3iJ29GlLfZpF2hnjng/viewform'; - -export const TECH_SUPPORT_LEVEL_LINK = 'https://access.redhat.com/support/offerings/techpreview'; - -export const getEncryptingDiskDuringInstallationDocsLink = (ocpVersion?: string) => - `https://docs.openshift.com/container-platform/${ - getShortOpenshiftVersion(ocpVersion) || '4.12' - }/installing/install_config/installing-customizing.html#installation-special-config-encrypt-disk_installing-customizing`; - -export const getOcpConsoleNodesPage = (ocpConsoleUrl: string) => - `${ocpConsoleUrl}/k8s/cluster/nodes`; - -export const REDHAT_CONSOLE_OPENSHIFT = 'https://console.redhat.com/openshift'; - -export const SSH_GENERATION_DOC_LINK = 'https://www.redhat.com/sysadmin/configure-ssh-keygen'; - -export const CNV_LINK = 'https://cloud.redhat.com/learn/topics/virtualization/'; - -export const ODF_LINK = 'https://www.redhat.com/en/resources/openshift-data-foundation-datasheet'; - -export const getLvmsDocsLink = (ocpVersion?: string) => - `https://docs.openshift.com/container-platform/${ - getShortOpenshiftVersion(ocpVersion) || '4.12' - }/storage/persistent_storage/persistent_storage_local/persistent-storage-using-lvms.html`; - -export const NMSTATE_EXAMPLES_LINK = 'https://nmstate.io/examples.html'; - -export const getApproveNodesInClLink = (ocpVersion?: string) => - `https://docs.openshift.com/container-platform/${ - getShortOpenshiftVersion(ocpVersion) || '4.11' - }/installing/installing_platform_agnostic/installing-platform-agnostic.html#installation-approve-csrs_installing-platform-agnostic`; - // TODO(mlibra): Retrieve branding dynamically, if needed, i.e. via injecting to the "window" object export const getProductBrandingCode = () => 'redhat'; @@ -374,30 +320,4 @@ export const operatorLabels = ( }; }; -export const getOCPStaticIPDocLink = (docVersion = '2.8') => - `https://access.redhat.com/documentation/en-us/red_hat_advanced_cluster_management_for_kubernetes/${docVersion}/html-single/clusters/index#on-prem-creating-your-cluster-with-the-cli-nmstateconfig`; - export const AI_UI_TAG = 'ui_ocm'; - -export const OCP_RELEASES_PAGE = 'openshift/releases'; - -export const NUTANIX_CONFIG_LINK = 'https://access.redhat.com/solutions/6983944'; - -export const CHANGE_ISO_PASSWORD_FILE_LINK = - 'https://raw.githubusercontent.com/openshift/assisted-service/master/docs/change-iso-password.sh'; - -export const CUSTOM_MANIFESTS_HELP_LINK = - 'https://docs.openshift.com/container-platform/4.12/installing/install_config/installing-customizing.html'; - -export const getCustomManifestsDocsLink = (ocpVersion?: string) => - `https://docs.openshift.com/container-platform/${ - getShortOpenshiftVersion(ocpVersion) || '4.12' - }/installing/install_config/installing-customizing.html`; - -export const HOW_TO_KNOW_IF_CLUSTER_SUPPORTS_MULTIPLE_CPU_ARCHS = - 'https://access.redhat.com/documentation/en-us/assisted_installer_for_openshift_container_platform/2024/html/installing_openshift_container_platform_with_the_assisted_installer/expanding-the-cluster#checking-for-multiple-architectures_expanding-the-cluster'; - -export const getMceDocsLink = (ocpVersion?: string) => - `https://docs.openshift.com/container-platform/${ - getShortOpenshiftVersion(ocpVersion) || '4.12' - }/architecture/mce-overview-ocp.html`; diff --git a/libs/ui-lib/lib/common/config/docs_links.ts b/libs/ui-lib/lib/common/config/docs_links.ts new file mode 100644 index 0000000000..7d4c707cca --- /dev/null +++ b/libs/ui-lib/lib/common/config/docs_links.ts @@ -0,0 +1,99 @@ +export const getShortOpenshiftVersion = (ocpVersion?: string) => + ocpVersion?.split('.').slice(0, 2).join('.'); + +export const getYearForAssistedInstallerDocumentationLink = () => { + return new Date().getFullYear(); +}; + +export const ASSISTED_INSTALLER_DOCUMENTATION_LINK = `https://access.redhat.com/documentation/en-us/assisted_installer_for_openshift_container_platform/${getYearForAssistedInstallerDocumentationLink()}/html/installing_openshift_container_platform_with_the_assisted_installer/index`; + +//New cluster page +export const OPENSHIFT_LIFE_CYCLE_DATES_LINK = + 'https://access.redhat.com/support/policy/updates/openshift#dates'; + +export const TECH_SUPPORT_LEVEL_LINK = 'https://access.redhat.com/support/offerings/techpreview'; + +export const CLUSTER_MANAGER_SITE_LINK = 'https://console.redhat.com/openshift/install/pull-secret'; + +export const PULL_SECRET_INFO_LINK = CLUSTER_MANAGER_SITE_LINK; + +export const getEncryptingDiskDuringInstallationDocsLink = (ocpVersion?: string) => + `https://docs.openshift.com/container-platform/${ + getShortOpenshiftVersion(ocpVersion) || '4.12' + }/installing/install_config/installing-customizing.html#installation-special-config-encrypt-disk_installing-customizing`; + +//Networking page +export const getOpenShiftNetworkingDocsLink = (ocpVersion?: string) => + `https://docs.openshift.com/container-platform/${ + getShortOpenshiftVersion(ocpVersion) || '4.13' + }/installing/installing_bare_metal/installing-bare-metal.html#installation-network-user-infra_installing-bare-metal`; +export const SSH_GENERATION_DOC_LINK = 'https://www.redhat.com/sysadmin/configure-ssh-keygen'; + +//Hosts status +export const getOcpConsoleNodesPage = (ocpConsoleUrl: string) => + `${ocpConsoleUrl}/k8s/cluster/nodes`; + +export const getApproveNodesInClLink = (ocpVersion?: string) => + `https://docs.openshift.com/container-platform/${ + getShortOpenshiftVersion(ocpVersion) || '4.11' + }/installing/installing_platform_agnostic/installing-platform-agnostic.html#installation-approve-csrs_installing-platform-agnostic`; + +//Static Ip configuration +export const NMSTATE_EXAMPLES_LINK = 'https://nmstate.io/examples.html'; + +export const getOCPStaticIPDocLink = (docVersion = '2.8') => + `https://access.redhat.com/documentation/en-us/red_hat_advanced_cluster_management_for_kubernetes/${docVersion}/html-single/clusters/index#on-prem-creating-your-cluster-with-the-cli-nmstateconfig`; + +//Platform integration +export const NUTANIX_CONFIG_LINK = 'https://access.redhat.com/solutions/6983944'; + +export const VSPHERE_CONFIG_LINK = 'https://access.redhat.com/solutions/6677901'; + +//Custom manifests +export const CUSTOM_MANIFESTS_HELP_LINK = + 'https://docs.openshift.com/container-platform/4.12/installing/install_config/installing-customizing.html'; + +export const getCustomManifestsDocsLink = (ocpVersion?: string) => + `https://docs.openshift.com/container-platform/${ + getShortOpenshiftVersion(ocpVersion) || '4.12' + }/installing/install_config/installing-customizing.html`; + +export const HOW_TO_KNOW_IF_CLUSTER_SUPPORTS_MULTIPLE_CPU_ARCHS = + 'https://access.redhat.com/documentation/en-us/assisted_installer_for_openshift_container_platform/2024/html/installing_openshift_container_platform_with_the_assisted_installer/expanding-the-cluster#checking-for-multiple-architectures_expanding-the-cluster'; + +export const OCP_RELEASES_PAGE = 'openshift/releases'; + +//Host requirements +export const DISK_WRITE_SPEED_LINK = 'https://access.redhat.com/solutions/4885641'; + +export const HOST_REQUIREMENTS_LINK = 'https://access.redhat.com/solutions/4885641'; + +//Operators page +export const ODF_REQUIREMENTS_LINK = + 'https://access.redhat.com/documentation/en-us/red_hat_openshift_data_foundation/4.15'; + +export const CNV_LINK = 'https://cloud.redhat.com/learn/topics/virtualization/'; + +export const ODF_LINK = 'https://www.redhat.com/en/resources/openshift-data-foundation-datasheet'; + +export const getMceDocsLink = (ocpVersion?: string) => + `https://docs.openshift.com/container-platform/${ + getShortOpenshiftVersion(ocpVersion) || '4.12' + }/architecture/mce-overview-ocp.html`; + +export const getLvmsDocsLink = (ocpVersion?: string) => + `https://docs.openshift.com/container-platform/${ + getShortOpenshiftVersion(ocpVersion) || '4.12' + }/storage/persistent_storage/persistent_storage_local/persistent-storage-using-lvms.html`; + +//Others +export const REDHAT_CONSOLE_OPENSHIFT = 'https://console.redhat.com/openshift'; + +export const getReportIssueLink = () => + 'https://issues.redhat.com/secure/CreateIssue!default.jspa?pid=12332330&issuetype=1&components=12370775'; + +export const FEEDBACK_FORM_LINK = + 'https://docs.google.com/forms/d/e/1FAIpQLSfg9M8wRW4m_HkWeAl6KpB5dTcMu8iI3iJ29GlLfZpF2hnjng/viewform'; + +export const CHANGE_ISO_PASSWORD_FILE_LINK = + 'https://raw.githubusercontent.com/openshift/assisted-service/master/docs/change-iso-password.sh'; diff --git a/libs/ui-lib/lib/common/config/index.ts b/libs/ui-lib/lib/common/config/index.ts index c94f80f843..2873d25669 100644 --- a/libs/ui-lib/lib/common/config/index.ts +++ b/libs/ui-lib/lib/common/config/index.ts @@ -1 +1,2 @@ export * from './constants'; +export * from './docs_links'; diff --git a/libs/ui-lib/lib/ocm/components/clusterConfiguration/networkConfiguration/UserManagedNetworkingTextContent.tsx b/libs/ui-lib/lib/ocm/components/clusterConfiguration/networkConfiguration/UserManagedNetworkingTextContent.tsx index ae712e0889..6d724735b3 100644 --- a/libs/ui-lib/lib/ocm/components/clusterConfiguration/networkConfiguration/UserManagedNetworkingTextContent.tsx +++ b/libs/ui-lib/lib/ocm/components/clusterConfiguration/networkConfiguration/UserManagedNetworkingTextContent.tsx @@ -1,7 +1,7 @@ import React from 'react'; import { List, ListItem, Text, TextContent } from '@patternfly/react-core'; import { ExternalLink } from '../../../../common/components/ui'; -import { getOpenShiftNetworkingDocsLink } from '../../../../common/config/constants'; +import { getOpenShiftNetworkingDocsLink } from '../../../../common/config/docs_links'; export interface UserManagedNetworkingTextContentProps { shouldDisplayLoadBalancersBullet?: boolean; diff --git a/libs/ui-lib/lib/ocm/components/featureSupportLevels/ReviewClusterFeatureSupportLevels.tsx b/libs/ui-lib/lib/ocm/components/featureSupportLevels/ReviewClusterFeatureSupportLevels.tsx index ff6beb12c4..66b95432d6 100644 --- a/libs/ui-lib/lib/ocm/components/featureSupportLevels/ReviewClusterFeatureSupportLevels.tsx +++ b/libs/ui-lib/lib/ocm/components/featureSupportLevels/ReviewClusterFeatureSupportLevels.tsx @@ -9,7 +9,7 @@ import { PreviewSupportLevel, isPreviewSupportLevel, } from '../../../common/types'; -import { TECH_SUPPORT_LEVEL_LINK } from '../../../common/config/constants'; +import { TECH_SUPPORT_LEVEL_LINK } from '../../../common/config/docs_links'; import ExternalLink from '../../../common/components/ui/ExternalLink'; import { Cluster } from '@openshift-assisted/types/assisted-installer-service'; import { DetailItem, UiIcon } from '../../../common'; diff --git a/libs/ui-lib/lib/ocm/components/hosts/HostRequirementsContent.tsx b/libs/ui-lib/lib/ocm/components/hosts/HostRequirementsContent.tsx index c771a0c9fe..3fdfe33a16 100644 --- a/libs/ui-lib/lib/ocm/components/hosts/HostRequirementsContent.tsx +++ b/libs/ui-lib/lib/ocm/components/hosts/HostRequirementsContent.tsx @@ -1,12 +1,10 @@ import React from 'react'; import { List, ListItem, Text, TextContent } from '@patternfly/react-core'; -import { ErrorState, ExternalLink, LoadingState } from '../../../common'; +import { DISK_WRITE_SPEED_LINK, ErrorState, ExternalLink, LoadingState } from '../../../common'; import { useClusterPreflightRequirements } from '../../hooks'; import { fileSize } from '../../../common/utils'; import { Cluster } from '@openshift-assisted/types/assisted-installer-service'; -const DISK_WRITE_SPEED_LINK = 'https://access.redhat.com/solutions/4885641'; - const parseRAM = (ramMib: number) => fileSize(ramMib * 1024 * 1024, 2, 'iec'); type PreflightRequirementsContentProps = {