Skip to content

Commit 42638ec

Browse files
fixed
1 parent 6edc2b8 commit 42638ec

File tree

1 file changed

+23
-4
lines changed
  • src/ui/layouts/stackComponents/ConfigureComponent/CreateComponent

1 file changed

+23
-4
lines changed

src/ui/layouts/stackComponents/ConfigureComponent/CreateComponent/index.tsx

Lines changed: 23 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ export const CreateComponent: React.FC<{ flavor: any; state: any }> = ({
147147
id: value?.id ? value?.id : '',
148148
},
149149
});
150-
150+
151151
// if (value === undefined) {
152152
// return false;
153153
// }
@@ -373,7 +373,14 @@ export const CreateComponent: React.FC<{ flavor: any; state: any }> = ({
373373
: ''
374374
}
375375
onChange={(val: string, newEvent: any) => {
376-
callActionForSecret(props.name, val, newEvent);
376+
if (val.includes('{{')) {
377+
callActionForSecret(props.name, val, newEvent);
378+
} else {
379+
setInputData({
380+
...inputData,
381+
[props.name]: val,
382+
});
383+
}
377384
}}
378385
secretOnChange={(val: any, newEvent: any) => {
379386
// debugger;
@@ -385,7 +392,9 @@ export const CreateComponent: React.FC<{ flavor: any; state: any }> = ({
385392
if (val?.value?.includes('}}')) {
386393
setInputData({
387394
...inputData,
388-
[props?.name]: val?.value?.includes('.') ? val.value : val,
395+
[props?.name]: val?.value?.includes('.')
396+
? val.value
397+
: val,
389398
});
390399
} else if (val.value.includes('{{')) {
391400
callActionForSecret(props.name, val, newEvent);
@@ -398,7 +407,7 @@ export const CreateComponent: React.FC<{ flavor: any; state: any }> = ({
398407
)
399408
? secretOptionsWithKeys
400409
: secretOptions
401-
}
410+
}
402411
tooltipText='Start typing with "{{" to reference a secret for this field.'
403412
/>
404413
</Box>
@@ -550,6 +559,16 @@ export const CreateComponent: React.FC<{ flavor: any; state: any }> = ({
550559
}
551560
}
552561
}
562+
for (const [key, value] of Object.entries(inputData)) {
563+
if (typeof value === 'object') {
564+
return dispatch(
565+
showToasterAction({
566+
description: 'Invalid secret',
567+
type: toasterTypes.failure,
568+
}),
569+
);
570+
}
571+
}
553572
const body = {
554573
user: user?.id,
555574
workspace: id,

0 commit comments

Comments
 (0)