Skip to content

Commit 31f11df

Browse files
authored
Merge pull request #312 from zenml-io/dev
Dev
2 parents 0217a22 + 481c384 commit 31f11df

File tree

1 file changed

+26
-5
lines changed
  • src/ui/layouts/stackComponents/ConfigureComponent/CreateComponent

1 file changed

+26
-5
lines changed

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

Lines changed: 26 additions & 5 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
// }
@@ -345,7 +345,7 @@ export const CreateComponent: React.FC<{ flavor: any; state: any }> = ({
345345
{props.sensitive ? (
346346
<Box marginTop="lg" style={{ width: '329px' }}>
347347
<MakeSecretField
348-
label={titleCase(props.name)}
348+
label={titleCase(props.name) + ' (Secret)'}
349349
placeholder={''}
350350
handleClick={() => {
351351
const state = {
@@ -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,18 @@ export const CreateComponent: React.FC<{ flavor: any; state: any }> = ({
550559
}
551560
}
552561
}
562+
563+
for (const [, value] of Object.entries(inputData)) {
564+
if (typeof value === 'object') {
565+
return dispatch(
566+
showToasterAction({
567+
description: 'Invalid secret',
568+
type: toasterTypes.failure,
569+
}),
570+
);
571+
}
572+
}
573+
553574
const body = {
554575
user: user?.id,
555576
workspace: id,

0 commit comments

Comments
 (0)