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 | import { functionOptions } from "../../utils/conditionals/functionOptions.ts"; import useEdgeConditions from "../../hooks/playbooks/useEdgeConditions.ts"; import { additionalStateSelector } from "../../store/features/drawers/drawersSlice.ts"; import { useSelector } from "react-redux"; import { operationOptions } from "../../utils/conditionals/operationOptions.ts"; import { timeseriesOptions } from "../../utils/conditionals/typeOptions/timeseries.ts"; import HandleTypes from "./HandleTypes.tsx"; import { currentPlaybookSelector } from "../../store/features/playbook/playbookSlice.ts"; import { ResultTypeType, ResultTypeTypes, } from "../../utils/conditionals/resultTypeOptions.ts"; import CustomInput from "../Inputs/CustomInput.tsx"; import { InputTypes } from "../../types/inputs/inputTypes.ts"; import useIsPrefetched from "../../hooks/playbooks/useIsPrefetched.ts"; import { RuleType } from "../common/Conditions/types/RuleTypes.ts"; function Timeseries({ condition, conditionIndex, rule, resultType }) { const { id } = useSelector(additionalStateSelector); const currentPlaybook = useSelector(currentPlaybookSelector); const tasks = currentPlaybook?.ui_requirement.tasks ?? []; const { handleRule } = useEdgeConditions(id); const task = tasks?.find((e) => e.id === condition?.task?.id); const isPrefetched = useIsPrefetched(); const handleChange = (val: string, type: string) => { handleRule(type, val, conditionIndex, RuleType.RULE); }; return ( <div className="flex flex-wrap gap-2"> <CustomInput inputType={InputTypes.DROPDOWN} options={timeseriesOptions} disabled={!!isPrefetched} value={rule.type} placeholder={`Select Type`} handleChange={(id: string) => handleChange(id, `${resultType?.toLowerCase()}.type`) } /> <HandleTypes condition={condition} conditionIndex={conditionIndex} rule={rule} /> <CustomInput inputType={InputTypes.DROPDOWN} disabled={!!isPrefetched} options={functionOptions( (task?.ui_requirement?.resultType as ResultTypeType) ?? ResultTypeTypes.OTHERS, )} value={rule.function} placeholder={`Select Function`} handleChange={(id: string) => handleChange(id, `${resultType?.toLowerCase()}.function`) } /> <CustomInput inputType={InputTypes.DROPDOWN} disabled={!!isPrefetched} options={operationOptions} value={rule.operator} placeholder={`Select Operator`} handleChange={(id: string) => handleChange(id, `${resultType?.toLowerCase()}.operator`) } /> <CustomInput inputType={InputTypes.TEXT} disabled={!!isPrefetched} handleChange={(val: string) => handleChange(val, `${resultType?.toLowerCase()}.threshold`) } value={rule.threshold} placeholder={"Enter Value of condition"} className="!w-[200px]" /> </div> ); } export default Timeseries; |