Skip to content

Commit ff8094a

Browse files
committed
feat: DocLink - open devtron docs in side panel, open doc links in new tab in case of drawers/modals
1 parent a1cbe9b commit ff8094a

14 files changed

Lines changed: 44 additions & 33 deletions

File tree

src/Common/CustomTagSelector/PropagateTagInfo.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ export default function PropagateTagInfo({ isCreateApp }: { isCreateApp: boolean
4747
interactive
4848
documentationLink={isCreateApp ? "APP_TAGS" : "APP_OVERVIEW_TAGS"}
4949
documentationLinkText="View Documentation"
50+
openInNewTab
5051
>
5152
<div className="flexbox cursor">
5253
<InjectTag className="icon-dim-16 mt-2 mr-4" />

src/Common/TippyCustomized.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@ export const TippyCustomized = <T extends boolean = false>(props: TippyCustomize
8181
documentationLinkText,
8282
isEnterprise,
8383
isExternalLink,
84+
openInNewTab,
8485
} = props
8586
return (
8687
<>
@@ -167,6 +168,7 @@ export const TippyCustomized = <T extends boolean = false>(props: TippyCustomize
167168
isEnterprise={isEnterprise}
168169
isExternalLink={isExternalLink}
169170
docLinkKey={documentationLink}
171+
openInNewTab={openInNewTab}
170172
/>
171173
</div>
172174
)}

src/Common/Types.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ import {
3333
ACTION_STATE,
3434
DEPLOYMENT_WINDOW_TYPE,
3535
DockerConfigOverrideType,
36-
DOCUMENTATION,
36+
DocLinkProps,
3737
RefVariableType,
3838
SortingOrder,
3939
TaskErrorObj,
@@ -120,10 +120,9 @@ export interface CheckboxProps {
120120
children?: ReactNode
121121
}
122122

123-
export type TippyWithBaseDocLinkTypes<T extends boolean> = {
124-
isExternalLink?: T
125-
isEnterprise?: boolean
126-
documentationLink?: T extends true ? string : keyof typeof DOCUMENTATION
123+
export interface TippyWithBaseDocLinkTypes<T extends boolean>
124+
extends Pick<DocLinkProps<T>, 'isEnterprise' | 'isExternalLink' | 'openInNewTab'> {
125+
documentationLink?: DocLinkProps<T>['docLinkKey']
127126
}
128127

129128
export type TippyCustomizedProps<T extends boolean> = Pick<TippyProps, 'appendTo'> &
@@ -171,6 +170,7 @@ export interface InfoIconTippyProps<T extends boolean = false>
171170
| 'documentationLink'
172171
| 'isEnterprise'
173172
| 'isExternalLink'
173+
| 'openInNewTab'
174174
> {
175175
dataTestid?: string
176176
children?: TippyCustomizedProps<T>['children']

src/Shared/Components/FeatureDescription/FeatureDescriptionModal.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ const FeatureDescriptionModalContent = ({
7171
showExternalIcon
7272
variant={ButtonVariantType.secondary}
7373
isEnterprise={isEnterprise}
74+
onClick={closeModal}
7475
/>
7576
)}
7677
<Button

src/Shared/Components/FeatureDescription/types.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,14 @@
1616

1717
import React, { ReactNode } from 'react'
1818

19-
import { DocLinkProps } from '@Shared/DocLink/types'
19+
import { DocLinkProps } from '@Shared/DocLink'
2020

2121
import { ImageType } from '../../../Common'
2222
import { Breadcrumb } from '../../../Common/BreadCrumb/Types'
2323

24-
interface BaseFeatureDescriptionModalProps<T extends boolean = false> {
24+
interface BaseFeatureDescriptionModalProps {
2525
renderDescriptionContent?: () => ReactNode
26-
docLink?: DocLinkProps<T>['docLinkKey']
26+
docLink?: DocLinkProps<false>['docLinkKey']
2727
imageVariant?: ImageType
2828
SVGImage?: React.FunctionComponent<React.SVGProps<SVGSVGElement>>
2929
imageStyles?: React.CSSProperties

src/Shared/Components/Header/types.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ export enum InstallationType {
2525
ENTERPRISE = 'enterprise',
2626
}
2727

28-
export interface PageHeaderType<T extends boolean = false> {
28+
export interface PageHeaderType {
2929
headerName?: string
3030
showTabs?: boolean
3131
additionalHeaderInfo?: () => JSX.Element
@@ -36,7 +36,7 @@ export interface PageHeaderType<T extends boolean = false> {
3636
showCloseButton?: boolean
3737
onClose?: () => void
3838
markAsBeta?: boolean
39-
tippyProps?: Pick<TippyCustomizedProps<T>, 'additionalContent'> & {
39+
tippyProps?: Pick<TippyCustomizedProps<false>, 'additionalContent'> & {
4040
isTippyCustomized?: boolean
4141
tippyRedirectLink?: keyof typeof DOCUMENTATION
4242
TippyIcon?: React.FunctionComponent<any>

src/Shared/Components/InfoIconTippy/InfoIconTippy.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ const InfoIconTippy = <T extends boolean = false>({
3434
buttonPadding = 'p-0',
3535
isEnterprise = false,
3636
isExternalLink,
37+
openInNewTab,
3738
}: InfoIconTippyProps<T>) => (
3839
<TippyCustomized
3940
theme={TippyTheme.white}
@@ -54,6 +55,7 @@ const InfoIconTippy = <T extends boolean = false>({
5455
duration={400}
5556
isEnterprise={isEnterprise}
5657
isExternalLink={isExternalLink}
58+
openInNewTab={openInNewTab}
5759
>
5860
{children || (
5961
<button

src/Shared/Components/License/License.components.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@ const InstallationFingerprintInfo = ({ fingerprint, showHelpTooltip = false }: I
9090
iconClassName="icon-dim-20 fcn-6"
9191
placement="right"
9292
documentationLink="ENTERPRISE_LICENSE"
93+
openInNewTab
9394
/>
9495
)}
9596
</div>

src/Shared/Components/ModalSidebarPanel/ModalSidebarPanel.component.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ const ModalSidebarPanel = ({
4444
dataTestId="learn-more-about-modal-sidebar-panel-link"
4545
showExternalIcon
4646
isEnterprise={isEnterprise}
47+
openInNewTab
4748
/>
4849
</div>
4950
</div>

src/Shared/Components/ModalSidebarPanel/types.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,14 @@
1616

1717
import { ReactNode } from 'react'
1818

19-
import { DocLinkProps } from '@Shared/DocLink/types'
19+
import { DocLinkProps } from '@Shared/DocLink'
2020

2121
import { PageHeaderType } from '../Header/types'
2222

23-
export interface ModalSidebarPanelProps<T extends boolean = false> extends Pick<PageHeaderType, 'isEnterprise'> {
23+
export interface ModalSidebarPanelProps extends Pick<PageHeaderType, 'isEnterprise'> {
2424
rootClassName?: string
2525
heading: string | null
2626
icon?: JSX.Element
2727
children?: ReactNode
28-
documentationLink: DocLinkProps<T>['docLinkKey']
28+
documentationLink: DocLinkProps<false>['docLinkKey']
2929
}

0 commit comments

Comments
 (0)