Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 | import React from "react"; import { useDispatch, useSelector } from "react-redux"; import { connectorSelector, setKey, } from "../../../store/features/integrations/integrationsSlice.ts"; import Checkbox from "../../common/Checkbox/index.tsx"; import CustomInput from "../../Inputs/CustomInput.tsx"; import { InputTypes } from "../../../types/inputs/inputTypes.ts"; type HandleKeyOptionsPropTypes = { option: any; connectorActive: boolean; value?: string; onValueChange?: (value: string) => void; }; function HandleKeyOptions({ option, connectorActive, value, onValueChange, }: HandleKeyOptionsPropTypes) { const dispatch = useDispatch(); const currentConnector = useSelector(connectorSelector); switch (option.display_name) { case "Service Account JSON": case "PEM": return ( <CustomInput inputType={InputTypes.MULTILINE} disabled={connectorActive} value={value ?? currentConnector[option.key_type]} handleChange={(value) => { Iif (onValueChange) { onValueChange(value); return; } dispatch(setKey({ key: option.key_type, value })); }} placeholder={`Enter ${option.display_name}`} length={500} className="h-40 lg:!max-w-1/2 !max-w-full !w-[300px] text-xs outline-none" /> ); case "SSL Certificate Authority Data": return ( <CustomInput inputType={InputTypes.MULTILINE} disabled={connectorActive} value={value ?? currentConnector[option.key_type]} handleChange={(value) => { Iif (onValueChange) { onValueChange(value); return; } dispatch(setKey({ key: option.key_type, value })); }} placeholder={`Enter ${option.display_name} or enter path to certificate in the next field`} length={500} className="border rounded-lg h-40 lg:max-w-1/2 max-w-full mr-2 p-2 w-[300px] resize-none text-xs outline-none" /> ); case "Enable TLS certificate validation": return ( <Checkbox label="" id="ssl-verify" disabled={connectorActive} isChecked={ value ? value === "true" : currentConnector[option.key_type]?.toString() === "true" } onChange={() => { const currVal = currentConnector[option.key_type]; Iif (onValueChange) { onValueChange( value === "false" || value === "" ? "true" : "false", ); return; } dispatch(setKey({ key: option.key_type, value: !currVal })); }} /> ); default: return ( <CustomInput inputType={InputTypes.TEXT} handleChange={(val) => { Iif (onValueChange) { onValueChange(val); return; } dispatch(setKey({ key: option.key_type, value: val })); }} disabled={connectorActive} value={value ?? currentConnector[option.key_type]} placeholder={option.display_name} className="!w-[300px]" /> ); } } export default HandleKeyOptions; |