Skip to content

Commit d4d4f7c

Browse files
committed
Merge branch 'develop' of github.com:devtron-labs/devtron-fe-common-lib into feat/runtime-params
2 parents 3af95d8 + 4804744 commit d4d4f7c

File tree

25 files changed

+364
-211
lines changed

25 files changed

+364
-211
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,3 +105,4 @@ typings/
105105

106106
.DS_Store
107107
.npmrc
108+
.build-cache

package-lock.json

Lines changed: 28 additions & 27 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@devtron-labs/devtron-fe-common-lib",
3-
"version": "1.2.4-beta-16",
3+
"version": "1.2.9",
44
"description": "Supporting common component library",
55
"type": "module",
66
"main": "dist/index.js",
@@ -48,7 +48,7 @@
4848
"@typescript-eslint/eslint-plugin": "8.3.0",
4949
"@typescript-eslint/parser": "8.3.0",
5050
"@vitejs/plugin-react": "4.3.1",
51-
"eslint": "^8.56.0",
51+
"eslint": "^8.57.1",
5252
"eslint-config-airbnb": "^19.0.4",
5353
"eslint-config-prettier": "^9.1.0",
5454
"eslint-import-resolver-typescript": "^3.6.1",
@@ -66,6 +66,8 @@
6666
"react-toastify": "9.1.3",
6767
"sharp": "^0.33.5",
6868
"svgo": "^3.3.2",
69+
"monaco-editor": "0.44.0",
70+
"monaco-yaml": "5.1.1",
6971
"typescript": "5.5.4",
7072
"vite": "5.4.11",
7173
"vite-plugin-dts": "4.0.3",
@@ -80,14 +82,11 @@
8082
"@rjsf/validator-ajv8": "^5.13.3",
8183
"@typeform/embed-react": "2.20.0",
8284
"dompurify": "^3.0.2",
83-
"monaco-editor": "0.44.0",
84-
"monaco-yaml": "5.1.1",
8585
"react": "^17.0.2",
8686
"react-dom": "^17.0.2",
8787
"react-draggable": "^4.4.5",
8888
"react-ga4": "^1.4.1",
8989
"react-mde": "^11.5.0",
90-
"react-monaco-editor": "^0.54.0",
9190
"react-router-dom": "^5.3.0",
9291
"react-select": "5.8.0",
9392
"rxjs": "^7.8.1",
@@ -102,11 +101,13 @@
102101
"jsonpath-plus": "^10.0.0",
103102
"marked": "^13.0.3",
104103
"react-dates": "^21.8.0",
104+
"react-monaco-editor": "^0.54.0",
105105
"react-diff-viewer-continued": "^3.4.0",
106106
"sass": "^1.69.7",
107107
"tslib": "2.7.0"
108108
},
109109
"overrides": {
110+
"cross-spawn": "^7.0.5",
110111
"react-dates": {
111112
"react": "^17.0.2",
112113
"react-dom": "^17.0.2"

src/Common/Api.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,14 @@ async function fetchAPI<K = object>(
150150
})
151151
} else {
152152
handleLogout()
153-
return { code: 401, status: 'Unauthorized', result: [] }
153+
// Using this way to ensure that the user is redirected to the login page
154+
// and the component has enough time to get unmounted otherwise the component re-renders
155+
// and try to access some property of a variable and log exception to sentry
156+
return await new Promise((resolve) => {
157+
setTimeout(() => {
158+
resolve({ code: 401, status: 'Unauthorized', result: [] })
159+
}, 1000)
160+
})
154161
}
155162
} else if (response.status >= 300 && response.status <= 599) {
156163
return await handleServerError(contentType, response)

src/Common/Constants.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,7 @@ export const ROUTES = {
118118
K8S_RESOURCE_LIST: 'k8s/resource/list',
119119
FILE_UPLOAD: 'file/upload',
120120
PLUGIN_GLOBAL_VARIABLES: 'plugin/global/list/global-variable',
121+
CONFIG_COMPARE_SECRET: 'config/compare/secret',
121122
}
122123

123124
export enum KEY_VALUE {

src/Common/Helper.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -511,7 +511,7 @@ export const getUrlWithSearchParams = <T extends string | number = string | numb
511511
/**
512512
* Custom exception logger function for logging errors to sentry
513513
*/
514-
export const logExceptionToSentry = Sentry.captureException.bind(window)
514+
export const logExceptionToSentry: typeof Sentry.captureException = Sentry.captureException.bind(window)
515515

516516
export const customStyles = {
517517
control: (base, state) => ({

src/Common/Markdown/MarkDown.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,10 +47,10 @@ const MarkDown = ({ setExpandableIcon, markdown, className, breaks, disableEscap
4747
if (task) {
4848
return `<li style="list-style: none">
4949
<input disabled type="checkbox" ${checked ? 'checked' : ''} class="dc__vertical-align-middle" style="margin: 0 0.2em 0.25em -1.4em">
50-
${text}
50+
${marked(text)}
5151
</li>`
5252
}
53-
return `<li>${text}</li>`
53+
return `<li>${marked(text)}</li>`
5454
}
5555

5656
renderer.image = ({ href, title, text }: Tokens.Image) =>
@@ -60,7 +60,7 @@ const MarkDown = ({ setExpandableIcon, markdown, className, breaks, disableEscap
6060
<div class="table-container">
6161
<table>
6262
<thead>
63-
<tr>${header.map((headerCell) => `<th align="${headerCell.align}">${headerCell.text}</th>`).join('')}</tr>
63+
<tr>${header.map((headerCell) => `<th align="${headerCell.align}">${marked(headerCell.text)}</th>`).join('')}</tr>
6464
</thead>
6565
<tbody>
6666
${rows.map((row) => renderTableRow(row)).join('')}
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
/*
2+
* Copyright (c) 2024. Devtron Inc.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
import { OptionType } from '@Common/Types'
18+
import StyledRadioGroup from '../RadioGroup/RadioGroup'
19+
import { SegmentedControlProps, SegmentedControlVariant } from './types'
20+
21+
const SegmentedControl = ({
22+
tabs,
23+
initialTab,
24+
onChange,
25+
tooltips,
26+
disabled = false,
27+
rootClassName = '',
28+
name,
29+
variant = SegmentedControlVariant.WHITE_ON_GRAY,
30+
}: SegmentedControlProps) => (
31+
<StyledRadioGroup
32+
className={`${variant} ${rootClassName}`}
33+
onChange={onChange}
34+
initialTab={initialTab}
35+
name={name}
36+
disabled={disabled}
37+
>
38+
{tabs.map((tab: OptionType, index) => (
39+
<StyledRadioGroup.Radio
40+
value={tab.value}
41+
key={tab.value}
42+
className="fs-12 cn-7 fw-6 lh-20"
43+
showTippy={!!tooltips?.[index]}
44+
tippyContent={tooltips?.[index] ?? ''}
45+
dataTestId={`${name}-${tab.value}`}
46+
>
47+
{tab.label}
48+
</StyledRadioGroup.Radio>
49+
))}
50+
</StyledRadioGroup>
51+
)
52+
53+
export default SegmentedControl

src/Common/SegmentedControl/index.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
export { type SegmentedControlProps, SegmentedControlVariant } from './types'
2+
export { default as SegmentedControl } from './SegmentedControl.component'

0 commit comments

Comments
 (0)