Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug 2098234: fix broken update server link #11768

Merged
merged 1 commit into from Jul 13, 2022
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -17,7 +17,7 @@ import { confirmModal } from '@console/internal/components/modals/confirm-modal'
import {
ButtonBar,
ExternalLink,
getNetworkPolicyDocLink,
getNetworkPolicyDocURL,
history,
resourcePathFromModel,
} from '@console/internal/components/utils';
Expand Down Expand Up @@ -220,7 +220,7 @@ export const NetworkPolicyForm: React.FC<NetworkPolicyFormProps> = ({ formData,
<p>
{t('console-app~More information:')}&nbsp;
<ExternalLink
href={getNetworkPolicyDocLink(isOpenShift)}
href={getNetworkPolicyDocURL(isOpenShift)}
text={t('console-app~NetworkPolicies documentation')}
/>
</p>
Expand Down
@@ -1,7 +1,10 @@
import * as React from 'react';
import { Text, Title, Stack, StackItem } from '@patternfly/react-core';
import { useTranslation } from 'react-i18next';
import { ExternalLink, openshiftHelpBase } from '@console/internal/components/utils';
import {
DOC_URL_PODDISRUPTIONBUDGET_POLICY,
ExternalLink,
} from '@console/internal/components/utils';
import { FieldLevelHelp } from '@console/internal/components/utils/field-level-help';

const AvailabilityRequirementPopover: React.FC = () => {
Expand Down Expand Up @@ -37,7 +40,8 @@ const AvailabilityRequirementPopover: React.FC = () => {
</StackItem>
<StackItem>
<ExternalLink
href={`${openshiftHelpBase}rest_api/policy_apis/poddisruptionbudget-policy-v1.html#poddisruptionbudget-policy-v1`}
// no downstream URL
href={DOC_URL_PODDISRUPTIONBUDGET_POLICY}
text={t('console-app~PodDisruptionBudget documentation')}
/>
</StackItem>
Expand Down
Expand Up @@ -7,11 +7,11 @@ import Helmet from 'react-helmet';
import { useTranslation, Trans } from 'react-i18next';
import {
ContainerDropdown,
documentationURLs,
getDocumentationURL,
history,
isUpstream,
PageHeading,
ResourceLink,
openshiftHelpBase,
} from '@console/internal/components/utils';
import { ContainerModel } from '@console/internal/models';
import { K8sResourceKind, referenceFor, modelFor } from '@console/internal/module/k8s';
Expand Down Expand Up @@ -60,9 +60,7 @@ const AddHealthChecks: React.FC<FormikProps<FormikValues> & AddHealthChecksProps
const resourceKind = modelFor(kindForCRDResource).crd ? kindForCRDResource : kind;
const isFormClean = _.every(values.healthChecks, { modified: false });

const healthLink = isUpstream()
? `${openshiftHelpBase}applications/application-health.html`
: `${openshiftHelpBase}html/building_applications/application-health`;
const healthURL = getDocumentationURL(documentationURLs.applicationHealth);

const handleSelectContainer = (containerName: string) => {
const containerIndex = _.findIndex(resource.spec.template.spec.containers, [
Expand All @@ -86,7 +84,7 @@ const AddHealthChecks: React.FC<FormikProps<FormikValues> & AddHealthChecksProps
title={
<>
{pageTitle}
<Button variant="link" component="a" href={healthLink} target="_blank">
<Button variant="link" component="a" href={healthURL} target="_blank">
{t('devconsole~Learn more')} <ExternalLinkAltIcon />
</Button>
</>
Expand Down
Expand Up @@ -5,12 +5,12 @@ import Helmet from 'react-helmet';
import { useTranslation, Trans } from 'react-i18next';
import { Link } from 'react-router-dom';
import {
documentationURLs,
ExternalLink,
getDocumentationURL,
history,
LoadingBox,
isUpstream,
openshiftHelpBase,
PageHeading,
ExternalLink,
StatusBox,
} from '@console/internal/components/utils';
import { RoleBindingModel, RoleModel } from '@console/internal/models';
Expand Down Expand Up @@ -50,9 +50,7 @@ const ProjectAccess: React.FC<ProjectAccessProps> = ({
Object.keys(roles.data),
);

const rbacLink = isUpstream()
? `${openshiftHelpBase}authentication/using-rbac.html`
: `${openshiftHelpBase}html/authentication_and_authorization/using-rbac`;
const rbacURL = getDocumentationURL(documentationURLs.usingRBAC);

const initialValues = {
projectAccess: roleBindings.loaded && userRoleBindings,
Expand Down Expand Up @@ -118,7 +116,7 @@ const ProjectAccess: React.FC<ProjectAccessProps> = ({
<Link to={`/k8s/ns/${namespace}/${RoleModel.plural}`}>Roles</Link> and{' '}
<Link to={`/k8s/ns/${namespace}/${RoleBindingModel.plural}`}>Role Bindings</Link>. For
more information, see the{' '}
<ExternalLink href={rbacLink}>role-based access control documentation</ExternalLink>.
<ExternalLink href={rbacURL}>role-based access control documentation</ExternalLink>.
</Trans>
</PageHeading>
{roleBindings.loadError ? (
Expand Down
Expand Up @@ -5,9 +5,9 @@ import * as _ from 'lodash';
import { useTranslation } from 'react-i18next';
import { ErrorState } from '@console/internal/components/error';
import {
documentationURLs,
ExternalLink,
isUpstream,
openshiftHelpBase,
getDocumentationURL,
Timestamp,
} from '@console/internal/components/utils';
import { K8sResourceKind } from '@console/internal/module/k8s';
Expand Down Expand Up @@ -61,9 +61,7 @@ export const InsightsPopup: React.FC<PrometheusHealthPopupProps> = ({ responses,
const error = isError(metrics) || metricsError || operatorStatusError;
const disabled = !!conditions.Disabled;

const insightsLink = isUpstream()
? `${openshiftHelpBase}support/remote_health_monitoring/using-insights-to-identify-issues-with-your-cluster.html`
: `${openshiftHelpBase}html/support/remote-health-monitoring-with-connected-clusters#using-insights-to-identify-issues-with-your-cluster`;
const insightsURL = getDocumentationURL(documentationURLs.usingInsights);

const riskKeys = {
// t('insights-plugin~low')
Expand Down Expand Up @@ -166,7 +164,7 @@ export const InsightsPopup: React.FC<PrometheusHealthPopupProps> = ({ responses,
</StackItem>
)}
{(waiting || disabled || error) && (
<ExternalLink href={insightsLink} text={t('insights-plugin~More about Insights')} />
<ExternalLink href={insightsURL} text={t('insights-plugin~More about Insights')} />
)}
</Stack>
);
Expand Down
Expand Up @@ -32,27 +32,28 @@ import {
Flatten,
} from '@console/internal/components/factory';
import {
AsyncComponent,
DOC_URL_OPERATORFRAMEWORK_SDK,
documentationURLs,
ExternalLink,
FirehoseResult,
getDocumentationURL,
Kebab,
KebabAction,
KebabOption,
MsgBox,
navFactory,
Page,
RequireCreatePermission,
ResourceKebab,
ResourceLink,
Timestamp,
SectionHeading,
resourceObjPath,
resourcePathFromModel,
ResourceSummary,
ScrollToTopOnMount,
AsyncComponent,
ExternalLink,
FirehoseResult,
SectionHeading,
StatusBox,
RequireCreatePermission,
resourcePathFromModel,
KebabOption,
resourceObjPath,
KebabAction,
isUpstream,
openshiftHelpBase,
Page,
Timestamp,
} from '@console/internal/components/utils';
import { getBreadcrumbPath } from '@console/internal/components/utils/breadcrumbs';
import { useK8sWatchResource } from '@console/internal/components/utils/k8s-watch-hook';
Expand Down Expand Up @@ -726,16 +727,14 @@ export const ClusterServiceVersionList: React.FC<ClusterServiceVersionListProps>
export const ClusterServiceVersionsPage: React.FC<ClusterServiceVersionsPageProps> = (props) => {
const { t } = useTranslation();
const title = t('olm~Installed Operators');
const olmLink = isUpstream()
? `${openshiftHelpBase}operators/understanding/olm-what-operators-are.html`
: `${openshiftHelpBase}html/operators/understanding-operators#olm-what-operators-are`;
const olmURL = getDocumentationURL(documentationURLs.operators);
const helpText = (
<Trans ns="olm">
Installed Operators are represented by ClusterServiceVersions within this Namespace. For more
information, see the{' '}
<ExternalLink href={olmLink}>Understanding Operators documentation</ExternalLink>. Or create
an Operator and ClusterServiceVersion using the{' '}
<ExternalLink href="https://sdk.operatorframework.io/">Operator SDK</ExternalLink>.
<ExternalLink href={olmURL}>Understanding Operators documentation</ExternalLink>. Or create an
Operator and ClusterServiceVersion using the{' '}
<ExternalLink href={DOC_URL_OPERATORFRAMEWORK_SDK}>Operator SDK</ExternalLink>.
</Trans>
);

Expand Down
Expand Up @@ -5,12 +5,13 @@ import { Trans, useTranslation } from 'react-i18next';
import { match } from 'react-router';
import { Link } from 'react-router-dom';
import {
DOC_URL_RED_HAT_MARKETPLACE,
ExternalLink,
Firehose,
PageHeading,
StatusBox,
MsgBox,
ExternalLink,
PageHeading,
skeletonCatalog,
StatusBox,
} from '@console/internal/components/utils';
import { referenceForModel } from '@console/internal/module/k8s';
import { fromRequirements } from '@console/internal/module/k8s/selector';
Expand Down Expand Up @@ -263,10 +264,8 @@ export const OperatorHubPage = withFallback(
<Trans ns="olm">
Discover Operators from the Kubernetes community and Red Hat partners, curated by Red
Hat. You can purchase commercial software through{' '}
<ExternalLink href="https://marketplace.redhat.com/en-us?utm_source=openshift_console">
Red Hat Marketplace
</ExternalLink>
. You can install Operators on your clusters to provide optional add-ons and shared
<ExternalLink href={DOC_URL_RED_HAT_MARKETPLACE}>Red Hat Marketplace</ExternalLink>.
You can install Operators on your clusters to provide optional add-ons and shared
services to your developers. After installation, the Operator capabilities will appear
in the <Link to="/catalog">Developer Catalog</Link> providing a self-service
experience.
Expand Down
Expand Up @@ -6,15 +6,15 @@ import { Trans, useTranslation } from 'react-i18next';
import { match } from 'react-router';
import { RadioGroup, RadioInput } from '@console/internal/components/radio';
import {
documentationURLs,
Dropdown,
ExternalLink,
FieldLevelHelp,
Firehose,
getDocumentationURL,
history,
isUpstream,
MsgBox,
NsDropdown,
openshiftHelpBase,
PageHeading,
ResourceIcon,
ResourceName,
Expand Down Expand Up @@ -513,9 +513,7 @@ export const OperatorHubSubscribeForm: React.FC<OperatorHubSubscribeFormProps> =
const showMonitoringCheckbox =
operatorRequestsMonitoring && _.startsWith(selectedTargetNamespace, 'openshift-');

const monitoringLink = isUpstream()
? `${openshiftHelpBase}monitoring/configuring-the-monitoring-stack.html#maintenance-and-support_configuring-monitoring`
: `${openshiftHelpBase}html/monitoring/configuring-the-monitoring-stack#maintenance-and-support_configuring-the-monitoring-stack`;
const monitoringURL = getDocumentationURL(documentationURLs.configuringMonitoring);

const suggestedNamespaceDetails = showSuggestedNamespaceDetails && (
<>
Expand Down Expand Up @@ -560,7 +558,7 @@ export const OperatorHubSubscribeForm: React.FC<OperatorHubSubscribeFormProps> =
enabling monitoring voids user support. Enabling cluster monitoring for non-Red Hat
operators can lead to malicious metrics data overriding existing cluster metrics.
For more information, see the{' '}
<ExternalLink href={monitoringLink}>cluster monitoring documentation</ExternalLink>.
<ExternalLink href={monitoringURL}>cluster monitoring documentation</ExternalLink>.
</Trans>
</Alert>
)}
Expand Down
13 changes: 4 additions & 9 deletions frontend/public/components/cluster-settings/cluster-settings.tsx
Expand Up @@ -94,14 +94,14 @@ import {
UpdateHistory,
} from '../../module/k8s';
import {
documentationURLs,
EmptyBox,
ExternalLink,
FieldLevelHelp,
Firehose,
FirehoseResource,
getDocumentationURL,
HorizontalNav,
isUpstream,
openshiftHelpBase,
PageHeading,
ReleaseNotesLink,
ResourceLink,
Expand Down Expand Up @@ -422,15 +422,10 @@ export const CurrentVersionHeader: React.FC<CurrentVersionProps> = ({ cv }) => {
};

export const ChannelDocLink: React.FC<{}> = () => {
const upgradeLink = isUpstream()
? `${openshiftHelpBase}updating/understanding-upgrade-channels-release.html#understanding-upgrade-channels_understanding-upgrade-channels-releases`
: `${openshiftHelpBase}html/updating_clusters/understanding-upgrade-channels-releases#understanding-upgrade-channels_understanding-upgrade-channels-releases`;
const upgradeURL = getDocumentationURL(documentationURLs.understandingUpgradeChannels);
const { t } = useTranslation();
return (
<ExternalLink
href={upgradeLink}
text={t('public~Learn more about OpenShift update channels')}
/>
<ExternalLink href={upgradeURL} text={t('public~Learn more about OpenShift update channels')} />
);
};

Expand Down
Expand Up @@ -71,11 +71,9 @@ describe('ClusterSetupGettingStartedCard', () => {
href: '/monitoring/alertmanagerconfig',
},
]);
expect(wrapper.find(GettingStartedCard).props().moreLink).toEqual({
expect(wrapper.find(GettingStartedCard).props().moreLink).toMatchObject({
rhamilto marked this conversation as resolved.
Show resolved Hide resolved
id: 'machine-configuration',
title: 'View all steps in documentation',
href:
'https://docs.okd.io/latest/post_installation_configuration/machine-configuration-tasks.html',
external: true,
});
});
Expand Down
Expand Up @@ -11,6 +11,7 @@ import {

import { useIdentityProviderLink } from './cluster-setup-identity-provider-link';
import { useAlertReceiverLink } from './cluster-setup-alert-receiver-link';
import { documentationURLs, getDocumentationURL } from '../../../../utils';

export const ClusterSetupGettingStartedCard: React.FC = () => {
const { t } = useTranslation();
Expand All @@ -26,9 +27,9 @@ export const ClusterSetupGettingStartedCard: React.FC = () => {
return null;
}

const moreLinkURL = window.SERVER_FLAGS.documentationBaseURL
? `${window.SERVER_FLAGS.documentationBaseURL}html/post-installation_configuration/post-install-machine-configuration-tasks`
: 'https://docs.okd.io/latest/post_installation_configuration/machine-configuration-tasks.html';
const moreLinkURL = getDocumentationURL(
rhamilto marked this conversation as resolved.
Show resolved Hide resolved
documentationURLs.postInstallationMachineConfigurationTasks,
);

const moreLink: GettingStartedLink = {
id: 'machine-configuration',
Expand Down
Expand Up @@ -8,6 +8,7 @@ import {
GettingStartedCard,
GettingStartedLink,
} from '@console/shared/src/components/getting-started';
import { DOC_URL_OPENSHIFT_WHATS_NEW } from '../../../../utils';

export const ExploreAdminFeaturesGettingStartedCard: React.FC = () => {
const { t } = useTranslation();
Expand All @@ -31,7 +32,7 @@ export const ExploreAdminFeaturesGettingStartedCard: React.FC = () => {
const moreLink: GettingStartedLink = {
id: 'whats-new',
title: t("public~See what's new in OpenShift {{version}}", { version }),
href: 'https://www.openshift.com/learn/whats-new',
href: DOC_URL_OPENSHIFT_WHATS_NEW,
external: true,
};

Expand Down
3 changes: 2 additions & 1 deletion frontend/public/components/image-stream.tsx
Expand Up @@ -10,6 +10,7 @@ import { QuestionCircleIcon } from '@patternfly/react-icons';
import { K8sResourceKind, K8sResourceKindReference } from '../module/k8s';
import { ImageStreamModel } from '../models';
import { DetailsPage, ListPage, Table, TableData, RowFunctionArgs } from './factory';
import { DOC_URL_PODMAN } from './utils';
import { CopyToClipboard } from './utils/copy-to-clipboard';
import { ExpandableAlert } from './utils/alerts';
import { ExternalLink } from './utils/link';
Expand Down Expand Up @@ -185,7 +186,7 @@ export const ExampleDockerCommandPopover: React.FC<ImageStreamManipulationHelpPr
Red Hat Enterprise Linux users may use the equivalent <strong>podman</strong>{' '}
commands.{' '}
</Trans>
<ExternalLink href="https://podman.io/" text={t('public~Learn more.')} />
<ExternalLink href={DOC_URL_PODMAN} text={t('public~Learn more.')} />
</p>
</div>
}
Expand Down