Skip to content

Commit bb3ff48

Browse files
committed
Merge branch 'main' into feat/aws-code-commit
2 parents db63cc6 + e7a1af3 commit bb3ff48

File tree

87 files changed

+1596
-126
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

87 files changed

+1596
-126
lines changed

.eslintignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ src/Common/DebouncedSearch/__tests__/DebouncedSearch.test.tsx
3030
src/Common/DeleteComponentModal/DeleteComponent.tsx
3131
src/Common/DevtronProgressing/DevtronProgressing.tsx
3232
src/Common/Dialogs/ConfirmationDialog.tsx
33-
src/Common/Dialogs/DeleteDialog.tsx
3433
src/Common/Dialogs/DialogForm.tsx
3534
src/Common/Dialogs/ForceDeleteDialog.tsx
3635
src/Common/DraggableWrapper/DraggableButton.tsx

.eslintrc.cjs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ module.exports = {
9292
'react/react-in-jsx-scope': 'off',
9393
// additional rules:
9494
'@typescript-eslint/no-floating-promises': 'error',
95-
"import/prefer-default-export": "off",
95+
'import/prefer-default-export': 'off',
9696
'import/extensions': [
9797
'warn',
9898
'ignorePackages',
@@ -103,6 +103,7 @@ module.exports = {
103103
tsx: 'never',
104104
},
105105
],
106+
'no-restricted-exports': 'off',
106107
},
107108
overrides: [
108109
{
@@ -124,4 +125,4 @@ module.exports = {
124125
},
125126
},
126127
ignorePatterns: [".eslintrc.cjs", "vite.config.ts"],
127-
}
128+
}

.github/workflows/ci.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ on:
77
- synchronize
88
- edited
99
- reopened
10+
- ready_for_review
1011

1112
jobs:
1213
ci:

package-lock.json

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

package.json

Lines changed: 5 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": "0.0.90-beta-3",
3+
"version": "0.0.94",
44
"description": "Supporting common component library",
55
"type": "module",
66
"main": "dist/index.js",
@@ -23,12 +23,12 @@
2323
],
2424
"scripts": {
2525
"prepare": "node -e \"try { require('husky').install() } catch (e) {}\"",
26-
"lint": "tsc --noEmit && eslint 'src/**/*.{js,jsx,ts,tsx}' --max-warnings 0",
26+
"lint": "tsc --noEmit && NODE_OPTIONS=--max_old_space_size=8192 eslint 'src/**/*.{js,jsx,ts,tsx}' --max-warnings 0",
2727
"lint-fix": "eslint 'src/**/*.{js,jsx,ts,tsx}' --fix",
2828
"test": "exit 0",
29-
"dev": "vite",
30-
"build": "vite build --sourcemap",
31-
"build-watch": "vite build --sourcemap --watch",
29+
"dev": "NODE_OPTIONS=--max_old_space_size=8192 vite",
30+
"build": "NODE_OPTIONS=--max_old_space_size=8192 vite build --sourcemap",
31+
"build-watch": "NODE_OPTIONS=--max_old_space_size=8192 vite build --sourcemap --watch",
3232
"build-lib": "vite build",
3333
"preview": "vite preview",
3434
"lint-staged": "lint-staged"
Lines changed: 19 additions & 0 deletions
Loading

src/Assets/Icon/ic-docker.svg

Lines changed: 3 additions & 6 deletions
Loading

src/Assets/Icon/ic-fullscreen-2.svg

Lines changed: 19 additions & 0 deletions
Loading

src/Common/CodeEditor/codeEditor.scss

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,19 @@
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+
117
.code-editor__header {
218
height: 40px;
319
background: var(--N100);

src/Common/Dialogs/DeleteDialog.tsx

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

17-
import React from 'react'
17+
import React, { ChangeEvent, useState } from 'react'
1818
import warn from '../../Assets/Img/delete-medium.svg'
1919
import { Progressing } from '../Progressing'
2020
import ConfirmationDialog from './ConfirmationDialog'
2121
import { DeleteDialogProps } from './Types'
22+
import { CustomInput } from '../CustomInput'
23+
24+
export const DeleteDialog: React.FC<DeleteDialogProps> & { Description?: React.FC<any> } = ({
25+
showDeleteConfirmation: _showDeleteConfirmation,
26+
deleteConfirmationText = null,
27+
...props
28+
}: DeleteDialogProps) => {
29+
const [confirmationText, setConfirmationText] = useState('')
30+
31+
const showDeleteConfirmation = _showDeleteConfirmation && !!deleteConfirmationText
32+
const isDeleteDisabled =
33+
props.apiCallInProgress ||
34+
props.disabled ||
35+
(showDeleteConfirmation && deleteConfirmationText !== confirmationText)
36+
37+
const handleConfirmationTextChange = (e: ChangeEvent<HTMLInputElement>) => {
38+
setConfirmationText(e.target.value)
39+
}
2240

23-
export const DeleteDialog: React.FC<DeleteDialogProps> & { Description?: React.FC<any> } = (props) => {
2441
const handleDelete = (e: React.MouseEvent) => {
2542
if (props.shouldStopPropagation) {
2643
e.stopPropagation()
@@ -29,6 +46,18 @@ export const DeleteDialog: React.FC<DeleteDialogProps> & { Description?: React.F
2946
props.delete()
3047
}
3148

49+
const handleKeyDown = (event: KeyboardEvent) => {
50+
if (event.key === 'Enter' && !isDeleteDisabled) {
51+
event.preventDefault()
52+
53+
if (props.shouldStopPropagation) {
54+
event.stopPropagation()
55+
}
56+
57+
props.delete()
58+
}
59+
}
60+
3261
const handleModalClose = (e: React.MouseEvent) => {
3362
if (props.shouldStopPropagation) {
3463
e.stopPropagation()
@@ -37,13 +66,34 @@ export const DeleteDialog: React.FC<DeleteDialogProps> & { Description?: React.F
3766
props.closeDelete()
3867
}
3968

69+
const getLabel = () => (
70+
<span>
71+
Type
72+
<span className="fw-6 dc__word-break">&nbsp;&apos;{deleteConfirmationText}&apos;&nbsp;</span>
73+
to confirm
74+
</span>
75+
)
76+
4077
return (
4178
<ConfirmationDialog className="confirmation-dialog__body--w-400">
4279
<ConfirmationDialog.Icon src={warn} />
4380
<ConfirmationDialog.Body title={props.title}>
4481
<div className="fs-13 cn-7 lh-1-54 w-100">
4582
{props.description ? props.description : null}
4683
{props.children}
84+
{showDeleteConfirmation && (
85+
<CustomInput
86+
name="delete-confirmation"
87+
value={confirmationText}
88+
onChange={handleConfirmationTextChange}
89+
label={getLabel()}
90+
inputWrapClassName="mt-12 w-100"
91+
placeholder={`Type ${deleteConfirmationText} to confirm`}
92+
isRequiredField
93+
onKeyDown={handleKeyDown}
94+
autoFocus
95+
/>
96+
)}
4797
</div>
4898
</ConfirmationDialog.Body>
4999
<ConfirmationDialog.ButtonGroup>
@@ -61,7 +111,7 @@ export const DeleteDialog: React.FC<DeleteDialogProps> & { Description?: React.F
61111
type="button"
62112
className="cta delete cta-cd-delete-modal ml-16"
63113
onClick={handleDelete}
64-
disabled={props.apiCallInProgress || props.disabled}
114+
disabled={isDeleteDisabled}
65115
data-testid="dialog-delete"
66116
>
67117
{props.apiCallInProgress ? (
@@ -78,6 +128,7 @@ export const DeleteDialog: React.FC<DeleteDialogProps> & { Description?: React.F
78128
)
79129
}
80130

81-
const DeleteDialogDescription = (props) => <>{props.children}</>
131+
// eslint-disable-next-line react/jsx-no-useless-fragment
132+
const DeleteDialogDescription = ({ children }: Pick<DeleteDialogProps, 'children'>) => <>{children}</>
82133

83134
DeleteDialog.Description = DeleteDialogDescription

0 commit comments

Comments
 (0)