Skip to content

Commit 4e742e6

Browse files
committed
chore: isExternal & isEnterprise support for doclink
1 parent eda6647 commit 4e742e6

File tree

22 files changed

+55
-55
lines changed

22 files changed

+55
-55
lines changed

src/Pages/Applications/DevtronApps/Details/AppConfigurations/MainContent/SelectMergeStrategy.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616

1717
import {
1818
ComponentSizeType,
19-
DOCUMENTATION_HOME_PAGE,
2019
getSelectPickerOptionByValue,
2120
InfoIconTippy,
2221
noop,
@@ -104,7 +103,7 @@ const SelectMergeStrategy = ({
104103
{PatchStrategyTooltipInfo && <PatchStrategyTooltipInfo />}
105104
</OverrideStrategyTippyContent>
106105
}
107-
documentationLink={DOCUMENTATION_HOME_PAGE}
106+
documentationLink="HOME_PAGE"
108107
/>
109108

110109
{renderContent()}

src/Pages/GlobalConfigurations/Authorization/APITokens/CreateAPIToken.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ import { Moment } from 'moment'
2222

2323
import {
2424
CustomInput,
25-
DOCUMENTATION,
2625
InfoIconTippy,
2726
ServerErrors,
2827
showError,
@@ -58,7 +57,7 @@ export const renderQuestionwithTippy = () => (
5857
<InfoIconTippy
5958
heading={API_COMPONENTS.TITLE}
6059
infoText={API_COMPONENTS.QUESTION_ICON_INFO}
61-
documentationLink={DOCUMENTATION.GLOBAL_CONFIG_API_TOKEN}
60+
documentationLink="GLOBAL_CONFIG_API_TOKEN"
6261
documentationLinkText="View Documentation"
6362
iconClassName="icon-dim-20 fcn-9 ml-4"
6463
/>

src/Pages/GlobalConfigurations/DeploymentCharts/List/DeploymentChartsListHeader.tsx

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

17-
import { DOCUMENTATION, InfoIconTippy, SearchBar } from '@devtron-labs/devtron-fe-common-lib'
17+
import { InfoIconTippy, SearchBar } from '@devtron-labs/devtron-fe-common-lib'
1818

1919
import { CUSTOM_CHART_TITLE_DESCRIPTION_CONTENT } from '@Config/constants'
2020

@@ -38,7 +38,7 @@ const DeploymentChartsListHeader = ({
3838
</p>
3939
}
4040
documentationLinkText={CUSTOM_CHART_TITLE_DESCRIPTION_CONTENT.documentationLinkText}
41-
documentationLink={DOCUMENTATION.GLOBAL_CONFIG_CUSTOM_CHART}
41+
documentationLink="GLOBAL_CONFIG_CUSTOM_CHART"
4242
iconClassName="icon-dim-20 fcn-6"
4343
/>
4444
</div>

src/Pages/GlobalConfigurations/DeploymentCharts/List/UploadChartModal.tsx

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ import { useRef, useState } from 'react'
1919
import {
2020
ButtonWithLoader,
2121
CustomInput,
22-
getDocumentationUrl,
22+
DocLink,
2323
noop,
2424
showError,
2525
Textarea,
@@ -202,14 +202,11 @@ const UploadChartModal = ({ closeUploadPopup }: UploadChartModalType) => {
202202
<div className="sidebar-action-container pr-20">
203203
<div className="fw-6 fs-13 cn-9 mb-8">
204204
📙 Need help?&nbsp;
205-
<a
206-
className="dc__link fw-6"
207-
href={getDocumentationUrl({ docLinkKey: 'GLOBAL_CONFIG_CUSTOM_CHART_PRE_REQUISITES' })}
208-
target="_blank"
209-
rel="noreferrer noopener"
210-
>
211-
View documentation
212-
</a>
205+
<DocLink
206+
docLinkKey="GLOBAL_CONFIG_CUSTOM_CHART_PRE_REQUISITES"
207+
text="View documentation"
208+
dataTestId="learn-more-about-custom-chart-pre-requisites-link"
209+
/>
213210
</div>
214211
</div>
215212
</>

src/components/CIPipelineN/PluginDetailHeader/PluginDetailHeader.component.tsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,6 @@
1717
import { useContext } from 'react'
1818

1919
import {
20-
getDocumentationUrl,
21-
PluginDetailType,
2220
PluginImageContainer,
2321
PluginTagsContainer,
2422
PluginType,
@@ -36,19 +34,20 @@ import { INLINE_PLUGIN_TEXT } from '../Constants'
3634
import { PluginDetailHeaderProps } from '../types'
3735
import CreatePluginButton from './CreatePluginButton'
3836
import PluginVersionSelect from './PluginVersionSelect'
37+
import { PluginDetailTypes } from './types'
3938

4039
const PluginDetailHeader = ({ handlePluginVersionChange }: PluginDetailHeaderProps) => {
4140
const { formData, activeStageName, selectedTaskIndex, pluginDataStore } = useContext(pipelineContext)
4241
const { stepType } = formData[activeStageName].steps[selectedTaskIndex]
4342

44-
const getPluginDetails = (): Pick<PluginDetailType, 'name' | 'description' | 'icon' | 'tags' | 'docLink'> => {
43+
const getPluginDetails = (): PluginDetailTypes => {
4544
if (stepType !== PluginType.PLUGIN_REF) {
4645
return {
4746
name: INLINE_PLUGIN_TEXT.TITLE,
4847
description: INLINE_PLUGIN_TEXT.DESCRIPTION,
4948
icon: '',
5049
tags: [],
51-
docLink: getDocumentationUrl({ docLinkKey: 'EXECUTE_CUSTOM_SCRIPT' }),
50+
docLink: 'EXECUTE_CUSTOM_SCRIPT',
5251
}
5352
}
5453
const selectedPluginId = formData[activeStageName].steps[selectedTaskIndex].pluginRefStepDetail.pluginId
@@ -109,8 +108,9 @@ const PluginDetailHeader = ({ handlePluginVersionChange }: PluginDetailHeaderPro
109108
showCloseButton
110109
trigger="click"
111110
interactive
112-
documentationLink={docLink}
111+
documentationLink={docLink as any}
113112
documentationLinkText="View documentation"
113+
isExternalLink
114114
>
115115
<button
116116
type="button"
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
import { DOCUMENTATION, PluginDetailType } from '@devtron-labs/devtron-fe-common-lib'
2+
3+
export interface PluginDetailTypes extends Pick<PluginDetailType, 'name' | 'description' | 'icon' | 'tags'> {
4+
isExternalLink?: boolean
5+
docLink: string | keyof typeof DOCUMENTATION
6+
}

src/components/CIPipelineN/Sidebar.tsx

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,8 @@ import {
2424
ResourceKindType,
2525
WORKFLOW_CACHE_CONFIG_ENUM,
2626
TriggerType,
27-
getDocumentationUrl,
27+
DocLink,
28+
DOCUMENTATION,
2829
} from '@devtron-labs/devtron-fe-common-lib'
2930
import Tippy from '@tippyjs/react'
3031
import { BuildStageVariable } from '../../config'
@@ -68,9 +69,9 @@ export const Sidebar = ({
6869
} = useContext(pipelineContext)
6970

7071
const [addConfigSecret, setAddConfigSecret] = useState<boolean>(false)
71-
const [helpData, setHelpData] = useState<{ helpText: string; docLink: string }>({
72+
const [helpData, setHelpData] = useState<{ helpText: string; docLink: keyof typeof DOCUMENTATION }>({
7273
helpText: 'Docs: Configure build stage',
73-
docLink: getDocumentationUrl({ docLinkKey: 'BUILD_STAGE' }),
74+
docLink: "BUILD_STAGE",
7475
})
7576
const isPreBuildTab = activeStageName === BuildStageVariable.PreBuild
7677
const changeTriggerType = (appCreationType: string): void => {
@@ -83,22 +84,22 @@ export const Sidebar = ({
8384
if (isJobCard) {
8485
setHelpData({
8586
helpText: 'Docs: Configure job',
86-
docLink: getDocumentationUrl({ docLinkKey: 'JOB_WORKFLOW_EDITOR' }),
87+
docLink: "JOB_WORKFLOW_EDITOR",
8788
})
8889
} else if (activeStageName === BuildStageVariable.Build) {
8990
setHelpData({
9091
helpText: 'Docs: Configure build stage',
91-
docLink: getDocumentationUrl({ docLinkKey: 'BUILD_STAGE' }),
92+
docLink: "BUILD_STAGE",
9293
})
9394
} else if (activeStageName === BuildStageVariable.PostBuild) {
9495
setHelpData({
9596
helpText: 'Docs: Configure post-build tasks',
96-
docLink: getDocumentationUrl({ docLinkKey: 'PRE_POST_BUILD_STAGE' }),
97+
docLink: "PRE_POST_BUILD_STAGE",
9798
})
9899
} else if (isPreBuildTab) {
99100
setHelpData({
100101
helpText: 'Docs: Configure pre-build tasks',
101-
docLink: getDocumentationUrl({ docLinkKey: 'PRE_POST_BUILD_STAGE' }),
102+
docLink: "PRE_POST_BUILD_STAGE",
102103
})
103104
}
104105
}, [activeStageName])
@@ -449,11 +450,11 @@ export const Sidebar = ({
449450
{!isCdPipeline && (
450451
<div className="sidebar-action-container pr-20">
451452
<div className="fw-6 fs-13 cn-9 mb-8">📙 Need help?</div>
452-
<div>
453-
<a className="dc__link fw-6" href={helpData.docLink} target="_blank" rel="noreferrer noopener">
454-
{helpData.helpText}
455-
</a>
456-
</div>
453+
<DocLink
454+
docLinkKey={helpData.docLink}
455+
text={helpData.helpText}
456+
dataTestId="learn-more-about-ci-pipeline-workflow-editor-link"
457+
/>
457458
</div>
458459
)}
459460
</div>

src/components/ClusterNodes/ClusterOverview.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@ import { getURLBasedOnSidebarGVK } from '@Components/ResourceBrowser/Utils'
3838
import { getAvailableCharts } from '@Services/service'
3939

4040
import { ReactComponent as Error } from '../../assets/icons/ic-error-exclamation.svg'
41-
import { URLS } from '../../config'
4241
import { MAX_LENGTH_350 } from '../../config/constantMessaging'
4342
import { importComponentFromFELibrary } from '../common'
4443
import GenericDescription from '../common/Description/GenericDescription'
@@ -90,7 +89,7 @@ const tippyForMetricsApi = () => (
9089
heading="Metrics API is not available"
9190
additionalContent={metricsApiTippyContent()}
9291
documentationLinkText="View metrics-server helm chart"
93-
documentationLink={`/dashboard${URLS.CHARTS_DISCOVER}?appStoreName=metrics-server`}
92+
documentationLink="CHART_STORE_METRICS_SERVER"
9493
iconClassName="icon-dim-20 ml-8 fcn-5"
9594
/>
9695
</div>

src/components/bulkEdits/BulkEdits.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -526,7 +526,7 @@ export default class BulkEdits extends Component<BulkEditsProps, BulkEditsState>
526526
tippyProps={{
527527
isTippyCustomized: true,
528528
tippyMessage: 'Run scripts to bulk edit configurations for multiple devtron components.',
529-
tippyRedirectLink: getDocumentationUrl({ docLinkKey: 'BULK_UPDATE' }),
529+
tippyRedirectLink: 'BULK_UPDATE',
530530
}}
531531
/>
532532
{this.renderBulkEditBody()}

src/components/ciConfig/CIBuildpackBuildOptions.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ const BuilderTippy = () => {
158158
infoText={CI_BUILDPACK_OPTION_TEXTS.BuilderTippyContent.infoText}
159159
additionalContent={additionalBuilderTippyContent()}
160160
documentationLinkText={CI_BUILDPACK_OPTION_TEXTS.BuilderTippyContent.documentationLinkText}
161-
documentationLink={DOCUMENTATION.APP_CI_CONFIG_BUILD_WITHOUT_DOCKER}
161+
documentationLink="APP_CI_CONFIG_BUILD_WITHOUT_DOCKER"
162162
iconClassName="icon-dim-16 fcn-6 ml-4"
163163
/>
164164
)

0 commit comments

Comments
 (0)