Skip to content

Commit ad5a2aa

Browse files
committed
chore: modification in the naming of the Doclink
1 parent 5c186f8 commit ad5a2aa

8 files changed

Lines changed: 30 additions & 47 deletions

File tree

src/Common/DocLink/DocLink.tsx

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,20 @@
11
import { Button, ButtonComponentType, ButtonVariantType, Icon } from '@Shared/Components'
22
import { ComponentSizeType } from '@Shared/constants'
33

4-
import { DOCUMENTATION_HOME_PAGE, DOCUMENTATION_VERSION } from '..'
54
import { DocLinkProps } from './types'
5+
import { getDocumentationUrl } from './utils'
66

7-
export const appendUtmToUrl = (docLink: string) => `${docLink}?utm_source=product`
8-
9-
export const getDocumentationUrl = (docLink: string) =>
10-
`${DOCUMENTATION_HOME_PAGE}${DOCUMENTATION_VERSION}/${appendUtmToUrl(docLink)}`
11-
12-
export const DocLink = ({ docLink, docLinkText = 'Learn more', dataTestId, showEndIcon, onClick }: DocLinkProps) => (
7+
export const DocLink = ({ doc, text = 'Learn more', dataTestId, showExternalIcon, onClick }: DocLinkProps) => (
138
<Button
149
component={ButtonComponentType.anchor}
1510
anchorProps={{
16-
href: getDocumentationUrl(docLink),
17-
target: '_blank',
18-
rel: 'noreferrer noopener',
11+
href: getDocumentationUrl(doc),
1912
}}
2013
onClick={onClick}
2114
dataTestId={dataTestId}
22-
text={docLinkText}
15+
text={text}
2316
variant={ButtonVariantType.text}
2417
size={ComponentSizeType.medium}
25-
endIcon={showEndIcon && <Icon name="ic-open-in-new" color={null} />}
18+
endIcon={showExternalIcon && <Icon name="ic-open-in-new" color={null} />}
2619
/>
2720
)

src/Common/DocLink/constants.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ export const DOCUMENTATION = {
5151
GLOBAL_CONFIG_GROUPS: 'getting-started/global-configurations/authorization/permission-groups',
5252
GLOBAL_CONFIG_HOST_URL: 'getting-started/global-configurations/host-url',
5353
GLOBAL_CONFIG_NOTIFICATION: 'getting-started/global-configurations/manage-notification',
54-
GLOBAL_CONFIG_PERMISSION: `${DOCUMENTATION_HOME_PAGE}/global-configurations/authorization/user-access#devtron-apps-permissions`,
54+
GLOBAL_CONFIG_PERMISSION: `global-configurations/authorization/user-access#devtron-apps-permissions`,
5555
GLOBAL_CONFIG_PROJECT: 'getting-started/global-configurations/projects',
5656
GLOBAL_CONFIG_SSO: 'getting-started/global-configurations/sso-login',
5757
GLOBAL_CONFIG_SCOPED_VARIABLES: 'getting-started/global-configurations/scoped-variables',
@@ -61,10 +61,9 @@ export const DOCUMENTATION = {
6161
JOB_SOURCE_CODE: 'usage/jobs/configuration-job',
6262
JOB_WORKFLOW_EDITOR: 'usage/jobs/workflow-editor-job',
6363
K8S_RESOURCES_PERMISSIONS: 'global-configurations/authorization/user-access#kubernetes-resources-permissions',
64-
MANDATORY_TAGS: `${DOCUMENTATION_HOME_PAGE}/global-configurations/tags-policy#create-application-with-mandatory-tags`,
6564
PRE_POST_BUILD_STAGE: 'usage/applications/creating-application/ci-pipeline/ci-build-pre-post-plugins',
6665
ROLLOUT: 'usage/applications/creating-application/deployment-template/rollout-deployment',
6766
SECURITY: 'usage/security-features',
6867
SPECIFY_IMAGE_PULL_SECRET: 'getting-started/global-configurations/container-registries#specify-image-pull-secret',
6968
TENANT_INSTALLATION: `${DOCUMENTATION_HOME_PAGE}${DOCUMENTATION_VERSION}/usage/software-distribution-hub/tenants`,
70-
}
69+
} as const

src/Common/DocLink/index.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
export { DOCUMENTATION } from './constants'
2-
export { DocLink, getDocumentationUrl } from './DocLink'
2+
export { DocLink } from './DocLink'
3+
export { getDocumentationUrl } from './utils'

src/Common/DocLink/types.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
import { ButtonComponentType, ButtonProps } from '@Shared/Components'
22

3+
import { DOCUMENTATION } from './constants'
4+
35
export interface DocLinkProps extends Pick<ButtonProps<ButtonComponentType.anchor>, 'onClick' | 'dataTestId'> {
4-
docLink: string
5-
docLinkText?: string
6-
className?: string
7-
showEndIcon?: boolean
6+
doc: keyof typeof DOCUMENTATION
7+
text?: string
8+
showExternalIcon?: boolean
89
}

src/Common/DocLink/utils.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
import { DOCUMENTATION_HOME_PAGE, DOCUMENTATION_VERSION } from '@Common/Constants'
2+
3+
import { DOCUMENTATION } from './constants'
4+
5+
export const appendUtmToUrl = (docLinkKey: keyof typeof DOCUMENTATION) =>
6+
`${DOCUMENTATION[docLinkKey]}?utm_source=product`
7+
8+
export const getDocumentationUrl = (docLinkKey: keyof typeof DOCUMENTATION) =>
9+
`${DOCUMENTATION_HOME_PAGE}${DOCUMENTATION_VERSION}/${appendUtmToUrl(docLinkKey)}`

src/Common/TippyCustomized.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -158,10 +158,10 @@ export const TippyCustomized = (props: TippyCustomizedProps) => {
158158
{documentationLink && (
159159
<div className="px-12 pb-12 flexbox">
160160
<DocLink
161-
docLink={documentationLink}
162-
docLinkText={documentationLinkText}
161+
doc={'APP_CREATE'}
162+
text={documentationLinkText}
163163
dataTestId="learn-more-about-creating-job-link"
164-
showEndIcon
164+
showExternalIcon
165165
onClick={closeTippy}
166166
/>
167167
</div>

src/Shared/Components/CICDHistory/Artifacts.tsx

Lines changed: 3 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -28,14 +28,7 @@ import { DocLink } from '@Common/DocLink'
2828
import { getIsApprovalPolicyConfigured } from '@Shared/Helpers'
2929
import { useDownload } from '@Shared/Hooks'
3030

31-
import {
32-
ClipboardButton,
33-
DOCUMENTATION,
34-
extractImage,
35-
GenericEmptyState,
36-
ImageTagsContainer,
37-
useGetUserRoles,
38-
} from '../../../Common'
31+
import { ClipboardButton, extractImage, GenericEmptyState, ImageTagsContainer, useGetUserRoles } from '../../../Common'
3932
import { EMPTY_STATE_STATUS } from '../../constants'
4033
import { TargetPlatformBadgeList } from '../TargetPlatforms'
4134
import { TERMINAL_STATUS_MAP } from './constants'
@@ -275,17 +268,9 @@ const Artifacts = ({
275268
<span className="fs-13 fw-4 mr-8 ml-8">
276269
{EMPTY_STATE_STATUS.ARTIFACTS_EMPTY_STATE_TEXTS.StoreFiles}
277270
</span>
278-
{/* <a
279-
className="fs-13 fw-6 cb-5 dc__no-decor"
280-
href={getDocumentationUrl(DOCUMENTATION.BLOB_STORAGE)}
281-
target="_blank"
282-
rel="noreferrer"
283-
>
284-
{EMPTY_STATE_STATUS.ARTIFACTS_EMPTY_STATE_TEXTS.ConfigureBlobStorage}
285-
</a> */}
286271
<DocLink
287-
docLink={DOCUMENTATION.BLOB_STORAGE}
288-
docLinkText={EMPTY_STATE_STATUS.ARTIFACTS_EMPTY_STATE_TEXTS.ConfigureBlobStorage}
272+
doc="BLOB_STORAGE"
273+
text={EMPTY_STATE_STATUS.ARTIFACTS_EMPTY_STATE_TEXTS.ConfigureBlobStorage}
289274
dataTestId="configure-blob-storage"
290275
/>
291276
<OpenInNew className="icon-dim-20 ml-8" />

src/Shared/Components/CICDHistory/LogsRenderer.tsx

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ import { ReactComponent as OpenInNew } from '../../../Assets/Icon/ic-arrow-out.s
3131
import { ReactComponent as HelpIcon } from '../../../Assets/Icon/ic-help.svg'
3232
import { ReactComponent as Info } from '../../../Assets/Icon/ic-info-filled.svg'
3333
import {
34-
DOCUMENTATION,
3534
Host,
3635
Progressing,
3736
ROUTES,
@@ -84,11 +83,7 @@ const renderBlobNotConfigured = (): JSX.Element => (
8483
<HelpIcon className="icon-dim-20 fcv-5" />
8584
<span className="fs-13 fw-4 mr-8 ml-8 text__white">Want to store logs to view later?</span>
8685

87-
<DocLink
88-
docLink={DOCUMENTATION.BLOB_STORAGE}
89-
docLinkText="Configure blob storage"
90-
dataTestId="configure-blob-storage"
91-
/>
86+
<DocLink doc="BLOB_STORAGE" text="Configure blob storage" dataTestId="configure-blob-storage" />
9287
<OpenInNew className="icon-dim-20 ml-8" />
9388
</div>
9489
</>

0 commit comments

Comments
 (0)