Skip to content

Commit e5e69fd

Browse files
committed
Merge branch 'develop' of github.com:devtron-labs/devtron-fe-common-lib into feat/pipeline-deploy-config-diff-revamp
2 parents 90dd9f1 + 7dfb823 commit e5e69fd

35 files changed

+792
-481
lines changed

package-lock.json

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

package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@devtron-labs/devtron-fe-common-lib",
3-
"version": "0.3.6-beta-4",
3+
"version": "0.3.12",
44
"description": "Supporting common component library",
55
"type": "module",
66
"main": "dist/index.js",
@@ -66,7 +66,7 @@
6666
"react-mde": "^11.5.0",
6767
"react-toastify": "9.1.3",
6868
"typescript": "5.5.4",
69-
"vite": "5.4.2",
69+
"vite": "5.4.6",
7070
"vite-plugin-dts": "4.0.3",
7171
"vite-plugin-lib-inject-css": "2.1.1",
7272
"vite-plugin-svgr": "^2.4.0",
@@ -109,7 +109,7 @@
109109
"monaco-editor": "0.44.0"
110110
},
111111
"vite-plugin-svgr": {
112-
"vite": "5.4.2"
112+
"vite": "5.4.6"
113113
}
114114
}
115115
}

src/Common/CustomInput/CustomInput.tsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ export const CustomInput = ({
3737
rootClassName = '',
3838
autoComplete = 'off',
3939
helperText = '',
40-
handleOnBlur,
40+
onBlur,
4141
readOnly = false,
4242
noTrim = false,
4343
onKeyPress,
@@ -66,15 +66,15 @@ export const CustomInput = ({
6666
return error
6767
}
6868

69-
const onBlur = (event) => {
69+
const handleOnBlur = (event) => {
7070
// NOTE: This is to prevent the input from being trimmed when the user do not want to trim the input
7171
if (!noTrim) {
7272
event.stopPropagation()
7373
event.target.value = event.target.value?.trim()
7474
onChange(event)
7575
}
76-
if (typeof handleOnBlur === 'function') {
77-
handleOnBlur(event)
76+
if (typeof onBlur === 'function') {
77+
onBlur(event)
7878
}
7979
}
8080

@@ -127,7 +127,7 @@ export const CustomInput = ({
127127
e.persist()
128128
onChange(e)
129129
}}
130-
onBlur={onBlur}
130+
onBlur={handleOnBlur}
131131
onFocus={onFocus}
132132
placeholder={placeholder}
133133
value={value}

src/Common/CustomInput/Types.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ export interface CustomInputProps {
3434
rootClassName?: string
3535
error?: string[] | string
3636
helperText?: ReactNode
37-
handleOnBlur?: (e) => void
37+
onBlur?: (e) => void
3838
readOnly?: boolean
3939
noTrim?: boolean
4040
onKeyPress?: (e) => void

src/Common/CustomTagSelector/TagDetails.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ export const TagDetails = ({
6060
{!hidePropagateTag && (
6161
<div
6262
className={`dc__border h-30 pl-4 pr-4 br-4 mr-8 pointer ${tagData.propagate ? 'bcn-7' : ''} ${tagData.key.startsWith('devtron.ai/') ? 'cursor-not-allowed bcn-1' : ''}`}
63-
onClick={propagateTagToResource}
63+
onClick={!tagData?.isPropagateDisabled ? propagateTagToResource : null}
6464
data-testid={`propagate-tag-${index}`}
6565
>
6666
<InjectTag className={`icon-dim-20 mt-4 ${tagData.propagate ? 'scn-0' : ''}`} />

src/Common/DeleteComponentModal/DeleteComponent.tsx

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

17-
import React, { useState } from 'react'
17+
import { useState } from 'react'
1818
import { useHistory } from 'react-router-dom'
1919
import info from '../../Assets/Icon/ic-info-filled.svg'
2020
import { ConfirmationDialog, DeleteDialog } from '../Dialogs'
2121
import { ServerErrors } from '../ServerError'
2222
import { DeleteComponentProps } from './types'
2323
import { ToastManager, ToastVariantType } from '@Shared/Services'
24+
import { showError } from '@Common/Helper'
2425

2526
const DeleteComponent = ({
2627
setDeleting,
@@ -36,11 +37,13 @@ const DeleteComponent = ({
3637
configuration = '',
3738
closeCustomComponent,
3839
}: DeleteComponentProps) => {
40+
const [isDeleting, setIsDeleting] = useState(false)
3941
const [showCannotDeleteDialogModal, setCannotDeleteDialogModal] = useState(false)
4042
const { push } = useHistory()
4143

4244
async function handleDelete() {
43-
setDeleting(true)
45+
setDeleting?.(true)
46+
setIsDeleting(true)
4447
try {
4548
await deleteComponent(payload)
4649
ToastManager.showToast({
@@ -59,9 +62,12 @@ const DeleteComponent = ({
5962
} catch (serverError) {
6063
if (serverError instanceof ServerErrors && serverError.code === 500) {
6164
setCannotDeleteDialogModal(true)
65+
} else {
66+
showError(serverError)
6267
}
6368
} finally {
64-
setDeleting(false)
69+
setDeleting?.(false)
70+
setIsDeleting(false)
6571
}
6672
}
6773

@@ -92,6 +98,7 @@ const DeleteComponent = ({
9298
delete={handleDelete}
9399
closeDelete={() => toggleConfirmation(false)}
94100
dataTestId="delete-dialog"
101+
apiCallInProgress={isDeleting}
95102
>
96103
<DeleteDialog.Description>
97104
<p>Are you sure you want to delete this {configuration || component}? </p>

src/Common/DeleteComponentModal/types.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,10 @@
1515
*/
1616

1717
export interface DeleteComponentProps {
18-
setDeleting: (boolean) => void
18+
/**
19+
* @deprecated - Delete component internally handles loading for the `Delete Button`.
20+
*/
21+
setDeleting?: (boolean) => void
1922
toggleConfirmation: any
2023
deleteComponent: (any) => Promise<any>
2124
title: string

src/Common/Drawer/Drawer.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ export const Drawer = ({
4141
maxWidth,
4242
parentClassName,
4343
onEscape,
44+
onClose,
4445
}: drawerInterface) => {
4546
const drawerRef = useRef(null)
4647
useEffect(() => {
@@ -61,7 +62,7 @@ export const Drawer = ({
6162
style['--height'] = height
6263
}
6364
return (
64-
<VisibleModal className="drawer--container" parentClassName={parentClassName || ''} onEscape={onEscape}>
65+
<VisibleModal className="drawer--container" parentClassName={parentClassName || ''} onEscape={onEscape} close={onClose}>
6566
<aside style={style} ref={drawerRef} className={`drawer ${position}`}>
6667
{children}
6768
</aside>

0 commit comments

Comments
 (0)