Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
edit: (formApi: FormApi) => {
const labelStyle = {position: 'absolute', right: 0, top: 0, zIndex: 1} as any;
const overrideRemoved = getNestedField(formApi.values, `${param.component}.${paramNameEncode(param.name)}`) === null;
return (
{overrideRemoved && (
<span>{param.original}</span>
) || }
{param.original && !overrideRemoved && <a> formApi.setValue(`${param.component}.${paramNameEncode(param.name)}`, null)} style={labelStyle}>
Remove override</a>}
{overrideRemoved && <a> formApi.setValue(`${param.component}.${paramNameEncode(param.name)}`, param.value)} style={labelStyle}>
Keep override</a>}
);
},
}));
onClick={() => {
formApi.setValue(fieldItemPath, getNestedField(app, fieldsPath)[i]);
removedOverrides[i] = false;
setRemovedOverrides(removedOverrides);
}}
style={labelStyle}>
validate={updatedApp => {
const errors = {} as any;
for (const fieldPath of ['spec.source.directory.jsonnet.tlas', 'spec.source.directory.jsonnet.extVars']) {
const invalid = ((getNestedField(updatedApp, fieldPath) || []) as Array).filter(item => !item.name && !item.code);
errors[fieldPath] = invalid.length > 0 ? 'All fields must have name' : null;
}
return errors;
}}
title={props.details.type.toLocaleUpperCase()}