Skip to content

Commit b774fa8

Browse files
authored
Merge pull request #2825 from devtron-labs/fix/doc-link-unsecure-connection
feat: add handling for insecure connections in SidePanelDocumentation
2 parents a0a16e8 + 4de6990 commit b774fa8

File tree

4 files changed

+49
-20
lines changed

4 files changed

+49
-20
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"private": true,
55
"homepage": "/dashboard",
66
"dependencies": {
7-
"@devtron-labs/devtron-fe-common-lib": "1.17.0",
7+
"@devtron-labs/devtron-fe-common-lib": "1.17.1",
88
"@esbuild-plugins/node-globals-polyfill": "0.2.3",
99
"@rjsf/core": "^5.13.3",
1010
"@rjsf/utils": "^5.13.3",

src/assets/img/img-page-blocked.webp

19.2 KB
Binary file not shown.

src/components/common/SidePanel/SidePanelDocumentation.tsx

Lines changed: 43 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -7,25 +7,44 @@ import {
77
ButtonVariantType,
88
ComponentSizeType,
99
DOCUMENTATION,
10+
GenericEmptyState,
1011
getUniqueId,
1112
Icon,
1213
ProgressBar,
1314
SidePanelTab,
15+
useIsSecureConnection,
1416
useMainContext,
1517
useTheme,
1618
} from '@devtron-labs/devtron-fe-common-lib'
1719

20+
import ImgPageBlocked from '@Images/img-page-blocked.webp'
21+
1822
import { SidePanelContentBaseProps } from './types'
1923

24+
const renderButton = (docLink: string) => () => (
25+
<Button
26+
dataTestId="open-in-new-tab-button"
27+
endIcon={<Icon name="ic-arrow-square-out" color={null} />}
28+
variant={ButtonVariantType.text}
29+
size={ComponentSizeType.medium}
30+
component={ButtonComponentType.anchor}
31+
text="Open in new tab"
32+
anchorProps={{
33+
href: docLink,
34+
}}
35+
/>
36+
)
37+
2038
export const SidePanelDocumentation = ({ SidePanelHeaderActions }: SidePanelContentBaseProps) => {
2139
// HOOKS
2240
const { appTheme } = useTheme()
2341
const {
2442
sidePanelConfig: { state, docLink: sidePanelDocLink, reinitialize },
2543
setSidePanelConfig,
2644
} = useMainContext()
45+
const isSecureConnection = useIsSecureConnection()
2746

28-
const [isLoading, setIsLoading] = useState(true)
47+
const [isLoading, setIsLoading] = useState(isSecureConnection)
2948

3049
const docLink = sidePanelDocLink ?? DOCUMENTATION.DOC_HOME_PAGE
3150

@@ -74,19 +93,29 @@ export const SidePanelDocumentation = ({ SidePanelHeaderActions }: SidePanelCont
7493
<div className="flex-grow-1 dc__position-rel">
7594
<ProgressBar isLoading={isLoading} />
7695

77-
{iframeSrc && (
78-
<iframe
79-
key={iframeKeyRef.current}
80-
ref={iframeRef}
81-
title="side-panel-documentation"
82-
loading="lazy"
83-
className="dc__no-border"
84-
src={iframeSrc}
85-
width="100%"
86-
height="100%"
87-
allow="clipboard-read; clipboard-write"
88-
referrerPolicy="strict-origin-when-cross-origin"
89-
onLoad={onLoad}
96+
{isSecureConnection ? (
97+
iframeSrc && (
98+
<iframe
99+
key={iframeKeyRef.current}
100+
ref={iframeRef}
101+
title="side-panel-documentation"
102+
loading="lazy"
103+
className="dc__no-border"
104+
src={iframeSrc}
105+
width="100%"
106+
height="100%"
107+
allow="clipboard-read; clipboard-write"
108+
referrerPolicy="strict-origin-when-cross-origin"
109+
onLoad={onLoad}
110+
/>
111+
)
112+
) : (
113+
<GenericEmptyState
114+
title="Unable to load docs"
115+
subTitle="Your Devtron setup isn’t secure, so the documentation can’t be displayed here."
116+
image={ImgPageBlocked}
117+
isButtonAvailable
118+
renderButton={renderButton(docLink)}
90119
/>
91120
)}
92121
</div>

yarn.lock

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1722,9 +1722,9 @@ __metadata:
17221722
languageName: node
17231723
linkType: hard
17241724

1725-
"@devtron-labs/devtron-fe-common-lib@npm:1.17.0":
1726-
version: 1.17.0
1727-
resolution: "@devtron-labs/devtron-fe-common-lib@npm:1.17.0"
1725+
"@devtron-labs/devtron-fe-common-lib@npm:1.17.1":
1726+
version: 1.17.1
1727+
resolution: "@devtron-labs/devtron-fe-common-lib@npm:1.17.1"
17281728
dependencies:
17291729
"@codemirror/autocomplete": "npm:6.18.6"
17301730
"@codemirror/lang-json": "npm:6.0.1"
@@ -1773,7 +1773,7 @@ __metadata:
17731773
react-select: 5.8.0
17741774
rxjs: ^7.8.1
17751775
yaml: ^2.4.1
1776-
checksum: 10c0/184b4d26eb3252c329aca4f863ce21764d535e5f77d52e26417303612c1dfae37c0205e1ac48da1eb2ac0d35bfeed9ff781edee604b240e531a75357ca84fc75
1776+
checksum: 10c0/d3b52fcda1289dcb7c73af80f54a7a24953516d82cd1cf9bfde7b585c1f5750e77cb1ad0651e000cdc19f0c66b0d9c5ab2bd55b245fe406f42cc50fc53ca1d08
17771777
languageName: node
17781778
linkType: hard
17791779

@@ -5685,7 +5685,7 @@ __metadata:
56855685
version: 0.0.0-use.local
56865686
resolution: "dashboard@workspace:."
56875687
dependencies:
5688-
"@devtron-labs/devtron-fe-common-lib": "npm:1.17.0"
5688+
"@devtron-labs/devtron-fe-common-lib": "npm:1.17.1"
56895689
"@esbuild-plugins/node-globals-polyfill": "npm:0.2.3"
56905690
"@playwright/test": "npm:^1.32.1"
56915691
"@rjsf/core": "npm:^5.13.3"

0 commit comments

Comments
 (0)