- finally fixed custom imput to match what is on backend on sighting amend endpoint
This commit is contained in:
@@ -12,13 +12,12 @@ type ChannelFieldsProps = {
|
||||
};
|
||||
outputData?: OutputDataResponse;
|
||||
onSetFieldValue: (field: string, value: string, shouldValidate?: boolean | undefined) => void;
|
||||
customFields: (string | undefined)[];
|
||||
};
|
||||
|
||||
const ChannelFields = ({ errors, touched, values, outputData, onSetFieldValue, customFields }: ChannelFieldsProps) => {
|
||||
const ChannelFields = ({ errors, touched, values, outputData, onSetFieldValue }: ChannelFieldsProps) => {
|
||||
const { optionalConstantsQuery } = useOptionalConstants(outputData?.id?.split("-")[1] || "");
|
||||
const optionalConstants = optionalConstantsQuery?.data;
|
||||
console.log(customFields);
|
||||
|
||||
const channelFieldsObject = useMemo(() => {
|
||||
return {
|
||||
connectTimeoutSeconds: outputData?.propConnectTimeoutSeconds?.value || "5",
|
||||
@@ -160,7 +159,7 @@ const ChannelFields = ({ errors, touched, values, outputData, onSetFieldValue, c
|
||||
className="p-2 border border-gray-400 rounded-lg text-white bg-[#253445] w-full md:w-60"
|
||||
>
|
||||
<option value={"UTC"}>UTC</option>
|
||||
<option value={"local"}>Local</option>
|
||||
<option value={"LOCAL"}>Local</option>
|
||||
</Field>
|
||||
</div>
|
||||
<div className="flex flex-row justify-between">
|
||||
@@ -270,23 +269,24 @@ const ChannelFields = ({ errors, touched, values, outputData, onSetFieldValue, c
|
||||
<FieldArray name="customFields">
|
||||
{(arrayHelpers) => (
|
||||
<>
|
||||
{values?.customFields?.slice(0, 6).map((_, index) => (
|
||||
<div key={index} className="flex flex-row justify-between items-center mb-4">
|
||||
<Field
|
||||
name={`customFields.${index}.label`}
|
||||
className="p-2 border border-gray-400 rounded-lg w-full max-w-xs"
|
||||
placeholder={`Custom Field ${index + 1} label`}
|
||||
/>
|
||||
|
||||
<Field
|
||||
name={`customFields.${index}.value`}
|
||||
key={index}
|
||||
className="p-2 border border-gray-400 rounded-lg w-full max-w-xs"
|
||||
placeholder={`Enter Custom Field ${index + 1} value`}
|
||||
autoComplete="off"
|
||||
/>
|
||||
</div>
|
||||
))}
|
||||
{values?.customFields?.map((_, index) => {
|
||||
// if (!field.value) return null;
|
||||
return (
|
||||
<div key={index} className="flex flex-row justify-between items-center mb-4 gap-2">
|
||||
<Field
|
||||
name={`customFields.${index}.label`}
|
||||
className="p-2 border border-gray-400 rounded-lg w-full max-w-xs"
|
||||
placeholder={`Custom Field ${index + 1} Label`}
|
||||
/>
|
||||
<Field
|
||||
name={`customFields.${index}.value`}
|
||||
className="p-2 border border-gray-400 rounded-lg w-full max-w-xs"
|
||||
placeholder={`Custom Field ${index + 1} Value`}
|
||||
autoComplete="off"
|
||||
/>
|
||||
</div>
|
||||
);
|
||||
})}
|
||||
<button
|
||||
type="button"
|
||||
onClick={() => arrayHelpers.push({ label: "", value: "" })}
|
||||
|
||||
Reference in New Issue
Block a user