Skip to content

Commit 1c80320

Browse files
committed
refactor: EditTaintsModal - validation text updates
1 parent 9a8688f commit 1c80320

File tree

5 files changed

+32
-14
lines changed

5 files changed

+32
-14
lines changed

src/Pages/GlobalConfigurations/DeploymentCharts/List/UploadChartModal.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ const UploadChartModal = ({ closeUploadPopup }: UploadChartModalType) => {
199199
2. Image descriptor template file - .image_descriptor_template.json.
200200
</div>
201201
<div className="cn-7 fw-4 fs-14 cn-7 mb-20">3. Custom chart packaged in the *.tgz format.</div>
202-
<div className="flexbox-col dc__align-start">
202+
<div className="flexbox-col dc__align-start pt-20">
203203
<div className="fw-6 fs-13 cn-9 mb-8">
204204
📙 Need help?&nbsp;
205205
<DocLink

src/components/CIPipelineN/CIPipeline.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -833,7 +833,7 @@ export default function CIPipeline({
833833
<pipelineContext.Provider value={contextValue}>
834834
<div className={`${isAdvanced ? 'pipeline-container' : ''}`}>
835835
{isAdvanced && (
836-
<div className="sidebar-container">
836+
<div className="sidebar-container pt-20">
837837
<Sidebar
838838
isJobView={isJobView}
839839
isJobCI={isJobCI}

src/components/ClusterNodes/NodeActions/EditTaintsModal.tsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,10 @@ const EditTaintsModal = ({ name, version, kind, taints, closePopup }: EditTaints
127127
const { isValid, taintCellError: updatedTaintCellError } = getTaintTableValidateState({ taintList })
128128
setTaintCellError(updatedTaintCellError)
129129
if (!isValid) {
130+
ToastManager.showToast({
131+
variant: ToastVariantType.error,
132+
description: 'Please resolve errors and try again',
133+
})
130134
return
131135
}
132136

src/components/ClusterNodes/NodeActions/utils.ts

Lines changed: 24 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -89,19 +89,28 @@ export const getTaintsTableCellValidateState = (
8989
if (value.indexOf('/') !== -1) {
9090
const keyArr = value.split('/')
9191

92-
if (keyArr.length > 2) {
93-
return { errorMessages: ['Maximum one ( / ) allowed'], isValid: false }
94-
}
95-
96-
if (!keyPrefixRegex.test(keyArr[0])) {
97-
return { errorMessages: ['Invalid prefix in key'], isValid: false }
92+
if (keyArr.length > 2 || !keyPrefixRegex.test(keyArr[0])) {
93+
return {
94+
errorMessages: ["The key can begin with a DNS subdomain prefix and a single '/'"],
95+
isValid: false,
96+
}
9897
}
9998

10099
if (!keyNameRegex.test(keyArr[1])) {
101-
return { errorMessages: ['Invalid name in key'], isValid: false }
100+
return {
101+
errorMessages: [
102+
'The key must begin with a letter or number, and may contain letters, numbers, hyphens, dots, and underscores',
103+
],
104+
isValid: false,
105+
}
102106
}
103107
} else if (!keyNameRegex.test(value)) {
104-
return { errorMessages: ['Invalid key'], isValid: false }
108+
return {
109+
errorMessages: [
110+
'The key must begin with a letter or number, and may contain letters, numbers, hyphens, dots, and underscores',
111+
],
112+
isValid: false,
113+
}
105114
}
106115
}
107116

@@ -112,7 +121,12 @@ export const getTaintsTableCellValidateState = (
112121
return { errorMessages: ['Maximum 63 chars are allowed'], isValid: false }
113122
}
114123
if (!valueRegex.test(value)) {
115-
return { errorMessages: ['Invalid value'], isValid: false }
124+
return {
125+
errorMessages: [
126+
'The value must begin with a letter or number, and may contain letters, numbers, hyphens, dots, and underscores',
127+
],
128+
isValid: false,
129+
}
116130
}
117131
}
118132

@@ -139,7 +153,7 @@ export const validateUniqueTaintKey = ({
139153

140154
return acc
141155
}, {})
142-
const uniqueKeyErrorMsg = 'Key and effect must be a unique combination.'
156+
const uniqueKeyErrorMsg = 'Key and effect must be a unique combination'
143157

144158
taintList.forEach(({ id, data }) => {
145159
const key = getTaintUniqueKey(data)

src/components/ClusterNodes/constants.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,9 +110,9 @@ export const EDIT_TAINTS_MODAL_MESSAGING = {
110110
description: {
111111
title: 'A taint consists of a key, value, and effect.',
112112
messageList: [
113-
'Key: The key must begin with a letter or number, and may contain letters, numbers, hyphens, dots,and underscores, up to 253 characters. Optionally, the key can begin with a DNS subdomain prefix and a single &apos;/&apos;, like example.com/my-app.',
113+
"Key: The key must begin with a letter or number, and may contain letters, numbers, hyphens, dots,and underscores, up to 253 characters. Optionally, the key can begin with a DNS subdomain prefix and a single '/', like example.com/my-app.",
114114
'Value(Optional): If given, it must begin with a letter or number, and may contain letters, numbers, hyphens, dots, and underscores, up to 63 characters.',
115-
'Combination of &lt;key, effect&gt; must be unique',
115+
'Combination of <key, effect> must be unique',
116116
],
117117
},
118118
emptyState: {

0 commit comments

Comments
 (0)