Skip to content

Commit fa41148

Browse files
committed
feat: replace instances of getDocumentationUrl with DocLink component
1 parent f5c5bef commit fa41148

File tree

25 files changed

+127
-163
lines changed

25 files changed

+127
-163
lines changed

src/Pages/Applications/DevtronApps/Details/AppConfigurations/AppConfig.types.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ import {
1919
AppEnvDeploymentConfigType,
2020
AppEnvironment,
2121
CollapsibleListItem,
22+
DocLinkProps,
2223
EnvResourceType,
2324
ResourceIdToResourceApprovalPolicyConfigMapType,
2425
ResourceKindType,
@@ -108,7 +109,7 @@ export interface CustomNavItemsType {
108109
href?: string
109110
stage?: string
110111
isLocked?: boolean
111-
supportDocumentURL?: string
112+
supportDocumentURL?: DocLinkProps['docLinkKey']
112113
flowCompletionPercent?: number
113114
currentStep?: number
114115
required?: boolean

src/Pages/Applications/DevtronApps/Details/AppConfigurations/AppConfig.utils.ts

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ import {
2020
AppConfigProps,
2121
BASE_CONFIGURATION_ENV_ID,
2222
ConfigResourceType,
23-
getDocumentationUrl,
2423
ResourceKindType,
2524
stringComparatorBySortOrder,
2625
URLS as CommonURLS,
@@ -138,7 +137,7 @@ export const getNavItems = ({
138137
href: `/job/${appId}/edit/materials`,
139138
stage: STAGE_NAME.GIT_MATERIAL,
140139
isLocked: !_isUnlocked.material,
141-
supportDocumentURL: getDocumentationUrl({ docLinkKey: 'JOB_SOURCE_CODE' }),
140+
supportDocumentURL: 'JOB_SOURCE_CODE',
142141
flowCompletionPercent: completedPercent,
143142
currentStep: completedSteps,
144143
required: true,
@@ -148,7 +147,7 @@ export const getNavItems = ({
148147
href: `/job/${appId}/edit/workflow`,
149148
stage: STAGE_NAME.WORKFLOW,
150149
isLocked: !_isUnlocked.workflowEditor,
151-
supportDocumentURL: getDocumentationUrl({ docLinkKey: 'JOB_WORKFLOW_EDITOR' }),
150+
supportDocumentURL: 'JOB_WORKFLOW_EDITOR',
152151
flowCompletionPercent: completedPercent,
153152
currentStep: completedSteps,
154153
required: true,
@@ -166,7 +165,7 @@ export const getNavItems = ({
166165
href: getAppComposeURL(appId, APP_COMPOSE_STAGE.CONFIG_MAPS, true, isTemplateView),
167166
stage: STAGE_NAME.CONFIGMAP,
168167
isLocked: !_isUnlocked.configmap,
169-
supportDocumentURL: getDocumentationUrl({ docLinkKey: 'APP_CREATE_CONFIG_MAP' }),
168+
supportDocumentURL: 'APP_CREATE_CONFIG_MAP',
170169
flowCompletionPercent: completedPercent,
171170
currentStep: completedSteps,
172171
isProtectionAllowed: true,
@@ -178,7 +177,7 @@ export const getNavItems = ({
178177
href: getAppComposeURL(appId, APP_COMPOSE_STAGE.SECRETS, true, isTemplateView),
179178
stage: STAGE_NAME.SECRETS,
180179
isLocked: !_isUnlocked.secret,
181-
supportDocumentURL: getDocumentationUrl({ docLinkKey: 'APP_CREATE_SECRET' }),
180+
supportDocumentURL: 'APP_CREATE_SECRET',
182181
flowCompletionPercent: completedPercent,
183182
currentStep: completedSteps,
184183
isProtectionAllowed: true,
@@ -204,7 +203,7 @@ export const getNavItems = ({
204203
href: `${basePath}/edit/materials`,
205204
stage: STAGE_NAME.GIT_MATERIAL,
206205
isLocked: !_isUnlocked.material,
207-
supportDocumentURL: getDocumentationUrl({ docLinkKey: 'APP_CREATE_MATERIAL' }),
206+
supportDocumentURL: 'APP_CREATE_MATERIAL',
208207
flowCompletionPercent: completedPercent,
209208
currentStep: completedSteps,
210209
required: true,
@@ -214,7 +213,7 @@ export const getNavItems = ({
214213
href: `${basePath}/edit/docker-build-config`,
215214
stage: STAGE_NAME.CI_CONFIG,
216215
isLocked: !_isUnlocked.dockerBuildConfig,
217-
supportDocumentURL: getDocumentationUrl({ docLinkKey: 'APP_CREATE_CI_CONFIG' }),
216+
supportDocumentURL: 'APP_CREATE_CI_CONFIG',
218217
flowCompletionPercent: completedPercent,
219218
currentStep: completedSteps,
220219
required: true,
@@ -233,7 +232,7 @@ export const getNavItems = ({
233232
href: getAppComposeURL(appId, APP_COMPOSE_STAGE.DEPLOYMENT_TEMPLATE, null, isTemplateView),
234233
stage: STAGE_NAME.DEPLOYMENT_TEMPLATE,
235234
isLocked: !_isUnlocked.deploymentTemplate,
236-
supportDocumentURL: getDocumentationUrl({ docLinkKey: 'APP_DEPLOYMENT_TEMPLATE' }),
235+
supportDocumentURL: 'APP_DEPLOYMENT_TEMPLATE',
237236
flowCompletionPercent: completedPercent,
238237
currentStep: completedSteps,
239238
isProtectionAllowed: true,
@@ -255,7 +254,7 @@ export const getNavItems = ({
255254
href: `${basePath}/edit/workflow`,
256255
stage: STAGE_NAME.WORKFLOW,
257256
isLocked: !_isUnlocked.workflowEditor,
258-
supportDocumentURL: getDocumentationUrl({ docLinkKey: 'APP_CREATE_WORKFLOW' }),
257+
supportDocumentURL: 'APP_CREATE_WORKFLOW',
259258
flowCompletionPercent: completedPercent,
260259
currentStep: completedSteps,
261260
required: true,
@@ -265,7 +264,7 @@ export const getNavItems = ({
265264
href: getAppComposeURL(appId, APP_COMPOSE_STAGE.CONFIG_MAPS, null, isTemplateView),
266265
stage: STAGE_NAME.CONFIGMAP,
267266
isLocked: !_isUnlocked.configmap,
268-
supportDocumentURL: getDocumentationUrl({ docLinkKey: 'APP_CREATE_CONFIG_MAP' }),
267+
supportDocumentURL: 'APP_CREATE_CONFIG_MAP',
269268
flowCompletionPercent: completedPercent,
270269
currentStep: completedSteps,
271270
isProtectionAllowed: true,
@@ -277,7 +276,7 @@ export const getNavItems = ({
277276
href: getAppComposeURL(appId, APP_COMPOSE_STAGE.SECRETS, null, isTemplateView),
278277
stage: STAGE_NAME.SECRETS,
279278
isLocked: !_isUnlocked.secret,
280-
supportDocumentURL: getDocumentationUrl({ docLinkKey: 'APP_CREATE_SECRET' }),
279+
supportDocumentURL: 'APP_CREATE_SECRET',
281280
flowCompletionPercent: completedPercent,
282281
currentStep: completedSteps,
283282
isProtectionAllowed: true,
@@ -292,7 +291,7 @@ export const getNavItems = ({
292291
href: `${basePath}/edit/external-links`,
293292
stage: STAGE_NAME.EXTERNAL_LINKS,
294293
isLocked: false,
295-
supportDocumentURL: getDocumentationUrl({ docLinkKey: 'EXTERNAL_LINKS' }),
294+
supportDocumentURL: 'EXTERNAL_LINKS' as const,
296295
flowCompletionPercent: completedPercent,
297296
currentStep: completedSteps,
298297
},

src/Pages/Applications/DevtronApps/Details/AppConfigurations/Navigation/AppConfigurationCheckBox.tsx

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@
1414
* limitations under the License.
1515
*/
1616

17+
import { ComponentSizeType, DocLink } from '@devtron-labs/devtron-fe-common-lib'
18+
1719
import { CustomNavItemsType } from '../AppConfig.types'
1820

1921
interface HelpBoxType {
@@ -30,12 +32,13 @@ const HelpBox = ({ selectedNav, isJobView, totalSteps }: HelpBoxType) => (
3032
<div className="progress-container">
3133
<div className="progress-tracker" style={{ width: `${selectedNav?.flowCompletionPercent}%` }} />
3234
</div>
33-
<div className="fs-13 font-weight-600">{selectedNav?.title}</div>
34-
<div className="need-help font-weight-600">
35-
<a className="dc__link" href={selectedNav?.supportDocumentURL} target="_blank" rel="noreferrer noopener">
36-
Need help?
37-
</a>
38-
</div>
35+
<div className="fs-13 fw-6">{selectedNav?.title}</div>
36+
<DocLink
37+
dataTestId="app-configuration-help"
38+
docLinkKey={selectedNav?.supportDocumentURL}
39+
text="Need help?"
40+
size={ComponentSizeType.small}
41+
/>
3942
</div>
4043
)
4144

src/Pages/Applications/DevtronApps/Details/AppConfigurations/Navigation/EnvConfigurationsNav.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -466,6 +466,7 @@ export const EnvConfigurationsNav = ({
466466
linkProps={{ to: compareWithHref }}
467467
text="Compare with..."
468468
onClick={onClickCompareWith}
469+
fullWidth
469470
/>
470471
</div>
471472
)

src/Pages/Applications/DevtronApps/Details/AppConfigurations/Navigation/EnvironmentOverrideRouter.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ const EnvOverridesHelpNote = () => (
5555
docLinkKey="APP_CREATE_ENVIRONMENT_OVERRIDE"
5656
dataTestId="env-overrides-learn-more"
5757
size={ComponentSizeType.xs}
58+
fontWeight="normal"
5859
/>
5960
</div>
6061
)

src/Pages/Applications/DevtronApps/Details/AppConfigurations/appConfig.scss

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -56,14 +56,6 @@
5656
width: 1%;
5757
}
5858
}
59-
60-
.font-weight-600 {
61-
font-weight: 600;
62-
}
63-
64-
.need-help {
65-
color: var(--B500);
66-
}
6759
}
6860
}
6961

src/Pages/Shared/EnvironmentOverride/EnvironmentOverrides.types.ts

Lines changed: 1 addition & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,14 @@
1616

1717
import React from 'react'
1818

19-
import { AppConfigProps, getDocumentationUrl } from '@devtron-labs/devtron-fe-common-lib'
19+
import { AppConfigProps } from '@devtron-labs/devtron-fe-common-lib'
2020

2121
import {
2222
AppConfigState,
2323
EnvConfigurationState,
2424
} from '@Pages/Applications/DevtronApps/Details/AppConfigurations/AppConfig.types'
2525

2626
import { ConfigAppList } from '../../../components/ApplicationGroup/AppGroup.types'
27-
import { URLS } from '../../../config'
2827

2928
export enum ComponentStates {
3029
loading = 'loading',
@@ -34,26 +33,6 @@ export enum ComponentStates {
3433
reloading = 'reloading',
3534
}
3635

37-
export interface SectionHeadingType {
38-
title: string
39-
subtitle: string
40-
learnMoreLink: string
41-
}
42-
43-
export const SECTION_HEADING_INFO: Record<string, SectionHeadingType> = {
44-
[URLS.APP_CM_CONFIG]: {
45-
title: 'ConfigMaps',
46-
subtitle:
47-
'ConfigMap is used to store common configuration variables, allowing users to unify environment variables for different modules in a distributed system into one object.',
48-
learnMoreLink: getDocumentationUrl({ docLinkKey: 'APP_CREATE_CONFIG_MAP' }),
49-
},
50-
[URLS.APP_CS_CONFIG]: {
51-
title: 'Secrets',
52-
subtitle: 'A Secret is an object that contains sensitive data such as passwords, OAuth tokens, and SSH keys.',
53-
learnMoreLink: getDocumentationUrl({ docLinkKey: 'APP_CREATE_SECRET' }),
54-
},
55-
}
56-
5736
export interface EnvironmentOverrideComponentProps extends Required<Pick<AppConfigProps, 'isTemplateView'>> {
5837
appList?: ConfigAppList[]
5938
environments: AppConfigState['environmentList']

src/components/ApplicationGroup/Details/TriggerView/BulkCITrigger.tsx

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ import {
4242
uploadCIPipelineFile,
4343
UploadFileProps,
4444
savePipeline,
45-
getDocumentationUrl,
45+
DocLink,
4646
} from '@devtron-labs/devtron-fe-common-lib'
4747
import Tippy from '@tippyjs/react'
4848
import { getCIPipelineURL, getParsedBranchValuesForPlugin, importComponentFromFELibrary } from '../../../common'
@@ -51,7 +51,6 @@ import { ReactComponent as PlayIcon } from '@Icons/ic-play-outline.svg'
5151
import { ReactComponent as Warning } from '../../../../assets/icons/ic-warning.svg'
5252
import { ReactComponent as ICError } from '../../../../assets/icons/ic-alert-triangle.svg'
5353
import { ReactComponent as Storage } from '../../../../assets/icons/ic-storage.svg'
54-
import { ReactComponent as OpenInNew } from '../../../../assets/icons/ic-open-in-new.svg'
5554
import { ReactComponent as InfoIcon } from '../../../../assets/icons/info-filled.svg'
5655
import externalCiImg from '../../../../assets/img/external-ci.webp'
5756
import linkedCDBuildCIImg from '../../../../assets/img/linked-cd-bulk-ci.webp'
@@ -780,16 +779,15 @@ const BulkCITrigger = ({
780779
<div>
781780
<div className="fw-6 fs-13">{IGNORE_CACHE_INFO.BlobStorageNotConfigured.title}</div>
782781
<div className="fw-4 fs-12 flexbox">
783-
<span>{IGNORE_CACHE_INFO.BlobStorageNotConfigured.infoText}</span>
784-
<a
785-
className="fs-12 fw-6 cb-5 dc__no-decor ml-4"
786-
href={getDocumentationUrl({ docLinkKey: 'BLOB_STORAGE' })}
787-
target="_blank"
788-
rel="noreferrer"
789-
>
790-
{IGNORE_CACHE_INFO.BlobStorageNotConfigured.configure}
791-
</a>
792-
<OpenInNew className="icon-dim-16 mt-3 ml-8" />
782+
<span>{IGNORE_CACHE_INFO.BlobStorageNotConfigured.infoText}</span>&nbsp;
783+
<DocLink
784+
dataTestId="blob-storage-doc-link"
785+
docLinkKey="BLOB_STORAGE"
786+
text={IGNORE_CACHE_INFO.BlobStorageNotConfigured.configure}
787+
size={ComponentSizeType.small}
788+
showExternalIcon
789+
fontWeight='normal'
790+
/>
793791
</div>
794792
</div>
795793
</div>

src/components/CIPipelineN/CustomScriptCard.tsx

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,8 @@
1313
* See the License for the specific language governing permissions and
1414
* limitations under the License.
1515
*/
16-
import { getDocumentationUrl, stopPropagation } from '@devtron-labs/devtron-fe-common-lib'
16+
import { ComponentSizeType, DocLink, Icon, stopPropagation } from '@devtron-labs/devtron-fe-common-lib'
1717

18-
import { ReactComponent as ICBookOpen } from '@Icons/ic-book-open.svg'
1918
import { ReactComponent as ICCDStage } from '@Icons/ic-cd-stage.svg'
2019

2120
import { INLINE_PLUGIN_TEXT } from './Constants'
@@ -36,17 +35,14 @@ const CustomScriptCard = () => (
3635
</div>
3736

3837
<div className="flexbox dc__gap-4 dc__visible-hover--child dc__align-items-center">
39-
<a
40-
href={getDocumentationUrl({ docLinkKey: 'EXECUTE_CUSTOM_SCRIPT' })}
41-
className="anchor fs-12 fw-6 lh-20"
42-
target="_blank"
43-
rel="noopener noreferrer"
38+
<DocLink
39+
dataTestId="custom-script-documentation"
40+
docLinkKey="EXECUTE_CUSTOM_SCRIPT"
41+
startIcon={<Icon name="ic-book-open" color={null} />}
42+
size={ComponentSizeType.xs}
4443
onClick={stopPropagation}
45-
>
46-
Learn more
47-
</a>
48-
49-
<ICBookOpen className="icon-dim-12 dc__no-shrink scb-5" />
44+
openInNewTab
45+
/>
5046
</div>
5147
</div>
5248

src/components/ResourceBrowser/ResourceList/ClusterSelector.tsx

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ import ReactSelect, { Props as SelectProps, SelectInstance } from 'react-select'
2121
import {
2222
APP_SELECTOR_STYLES,
2323
AppSelectorDropdownIndicator,
24-
getDocumentationUrl,
24+
DocLink,
2525
Icon,
2626
PopupMenu,
2727
ValueContainerWithLoadingShimmer,
@@ -156,26 +156,29 @@ export default ClusterSelector
156156
export const unauthorizedInfoText = (nodeType?: string) => {
157157
const emptyStateData = {
158158
text: ERROR_SCREEN_SUBTITLE,
159-
link: getDocumentationUrl({ docLinkKey: 'K8S_RESOURCES_PERMISSIONS' }),
159+
link: 'K8S_RESOURCES_PERMISSIONS' as const,
160160
linkText: ERROR_SCREEN_LEARN_MORE,
161161
}
162162

163163
if (nodeType === SIDEBAR_KEYS.overviewGVK.Kind.toLowerCase()) {
164164
emptyStateData.text = clusterOverviewNodeText(true)
165-
emptyStateData.link = getDocumentationUrl({ docLinkKey: 'K8S_RESOURCES_PERMISSIONS' })
165+
emptyStateData.link = 'K8S_RESOURCES_PERMISSIONS'
166166
emptyStateData.linkText = LEARN_MORE
167167
} else if (nodeType === SIDEBAR_KEYS.nodeGVK.Kind.toLowerCase()) {
168168
emptyStateData.text = clusterOverviewNodeText(false)
169-
emptyStateData.link = getDocumentationUrl({ docLinkKey: 'K8S_RESOURCES_PERMISSIONS' })
169+
emptyStateData.link = 'K8S_RESOURCES_PERMISSIONS'
170170
emptyStateData.linkText = LEARN_MORE
171171
}
172172

173173
return (
174174
<>
175175
{emptyStateData.text}&nbsp;
176-
<a className="dc__link" href={emptyStateData.link} target="_blank" rel="noreferrer noopener">
177-
{emptyStateData.linkText}
178-
</a>
176+
<DocLink
177+
dataTestId="rb-permission-error-documentation"
178+
docLinkKey={emptyStateData.link}
179+
text={emptyStateData.linkText}
180+
fontWeight="normal"
181+
/>
179182
</>
180183
)
181184
}

0 commit comments

Comments
 (0)