Skip to content

Commit 9a8688f

Browse files
committed
feat: enhance Edit Taints Modal with improved styling and empty state handling
1 parent 3e38f4e commit 9a8688f

File tree

3 files changed

+15
-6
lines changed

3 files changed

+15
-6
lines changed

src/components/CIPipelineN/VariableDataTable/VariableDataTable.component.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -568,6 +568,7 @@ export const VariableDataTable = ({ type, isCustomTask = false }: VariableDataTa
568568
onRowDelete={handleRowDelete}
569569
onRowAdd={handleRowAdd}
570570
addBtnTooltip={VARIABLE_DATA_TABLE_ADD_BUTTON_TIPPY_MAP[type]}
571+
shouldAutoFocusOnMount
571572
{...(isFELibAvailable && isInputPluginVariable
572573
? {
573574
actionButtonConfig: {

src/components/ClusterNodes/NodeActions/EditTaintsModal.tsx

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@ import {
3232
ToastVariantType,
3333
} from '@devtron-labs/devtron-fe-common-lib'
3434

35+
import ImgEmptyChartGroup from '@Images/[email protected]'
36+
3537
import { updateTaints } from '../clusterNodes.service'
3638
import { EDIT_TAINTS_MODAL_MESSAGING, TAINTS_TABLE_HEADERS } from '../constants'
3739
import { EditTaintsModalType, EditTaintsRequest, TaintsTableHeaderKeys, TaintsTableType } from '../types'
@@ -95,7 +97,11 @@ const EditTaintsModal = ({ name, version, kind, taints, closePopup }: EditTaints
9597

9698
const handleDeleteTaint: TaintsTableType['onRowDelete'] = (row) => {
9799
const filteredTaintList = taintList.filter(({ id }) => id !== row.id)
100+
const updatedTaintCellError = structuredClone(taintCellError)
101+
delete updatedTaintCellError[row.id]
102+
98103
setTaintList(filteredTaintList)
104+
setTaintCellError(updatedTaintCellError)
99105
}
100106

101107
const handleEditTaint: TaintsTableType['onRowEdit'] = (row, headerKey, value) => {
@@ -149,8 +155,8 @@ const EditTaintsModal = ({ name, version, kind, taints, closePopup }: EditTaints
149155
return (
150156
<Drawer position="right" width="100%" minWidth="800px" maxWidth="1024px" onEscape={onClose}>
151157
<div className="flexbox-col bg__primary h-100 flex-grow-1 mh-0">
152-
<div className="flex flex-align-center flex-justify bg__primary pt-16 pr-20 pb-16 pl-20 dc__border-bottom">
153-
<h2 className="fs-16 fw-6 lh-1-43 m-0 cn-9 dc__truncate">{`${EDIT_TAINTS_MODAL_MESSAGING.titlePrefix} '${name}'`}</h2>
158+
<div className="flex flex-align-center flex-justify bg__primary px-20 pt-12 pb-11 border__primary--bottom">
159+
<h2 className="fs-16 fw-6 lh-1-5 m-0 cn-9 dc__truncate">{`${EDIT_TAINTS_MODAL_MESSAGING.titlePrefix} '${name}'`}</h2>
154160
<Button
155161
dataTestId="edit-taints-modal-close"
156162
ariaLabel="edit-taints-modal-close"
@@ -167,6 +173,7 @@ const EditTaintsModal = ({ name, version, kind, taints, closePopup }: EditTaints
167173
<GenericEmptyState
168174
title={EDIT_TAINTS_MODAL_MESSAGING.emptyState.title}
169175
subTitle={EDIT_TAINTS_MODAL_MESSAGING.emptyState.subTitle}
176+
image={ImgEmptyChartGroup}
170177
isButtonAvailable
171178
renderButton={() => (
172179
<Button
@@ -209,12 +216,13 @@ const EditTaintsModal = ({ name, version, kind, taints, closePopup }: EditTaints
209216
onRowEdit={handleEditTaint}
210217
cellError={taintCellError}
211218
isAdditionNotAllowed
219+
shouldAutoFocusOnMount
212220
/>
213221
</>
214222
)}
215223
</div>
216224
{!isTaintListEmpty && (
217-
<div className="dc__border-top flex right p-16 dc__gap-8">
225+
<div className="dc__border-top flex right p-16 dc__gap-12">
218226
<Button
219227
dataTestId="edit-taints-modal-cancel"
220228
variant={ButtonVariantType.secondary}

src/components/ClusterNodes/constants.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -338,9 +338,9 @@ export enum CLUSTER_PROD_TYPE {
338338
}
339339

340340
export const TAINTS_TABLE_HEADERS: TaintsTableType['headers'] = [
341-
{ key: TaintsTableHeaderKeys.KEY, label: 'Key', width: '1fr' },
342-
{ key: TaintsTableHeaderKeys.VALUE, label: 'Value', width: '1fr' },
343-
{ key: TaintsTableHeaderKeys.EFFECT, label: 'Effect', width: '250px' },
341+
{ key: TaintsTableHeaderKeys.KEY, label: 'KEY', width: '1fr' },
342+
{ key: TaintsTableHeaderKeys.VALUE, label: 'VALUE', width: '1fr' },
343+
{ key: TaintsTableHeaderKeys.EFFECT, label: 'TAINT EFFECT', width: '250px' },
344344
]
345345

346346
export const CLUSTER_CONFIG_POLLING_INTERVAL = 1000 * 30 // half a minute

0 commit comments

Comments
 (0)