MCPcopy Create free account
hub / github.com/Superflows-AI/superflows / EditActionModal

Function EditActionModal

components/actions/editActionModal.tsx:99–494  ·  view source on GitHub ↗
(props: {
  action: Action;
  close: () => void;
  setAction: (action: Action) => void;
})

Source from the content-addressed store, hash-verified

97 },
98];
99export default function EditActionModal(props: {
100 action: Action;
101 close: () => void;
102 setAction: (action: Action) => void;
103}) {
104 const saveRef = useRef(null);
105 const [nameValid, setNameValid] = useState<boolean>(
106 props.action.name.length > 0 && isAlphaNumericUnderscore(props.action.name),
107 );
108
109 const [localAction, setLocalAction] = useState<Action>(props.action);
110
111 const [parametersValidJSON, setParameterValidJSON] = useState<boolean>(true);
112
113 const [bodyValidJSON, setBodyValidJSON] = useState<boolean>(true);
114
115 const [responsesValidJSON, setResponsesValidJSON] = useState<boolean>(true);
116 const [includeAllInResposes, setIncludeAllInResponses] = useState<boolean>(
117 localAction.keys_to_keep === null,
118 );
119 const [inclInResponsesValidJSON, setInclInResponsesValidJSON] =
120 useState<boolean>(true);
121
122 // State variable useful for caching the keys to keep when the checkbox is checked
123 const [cacheKeysToKeep, setCacheKeysToKeep] = useState<string[]>(
124 localAction.keys_to_keep as string[],
125 );
126 const [showAdvanced, setShowAdvanced] = useState<boolean | null>(null);
127 useEffect(() => {
128 if (showAdvanced !== null) {
129 let ele = document.getElementById("scroll-modal");
130 // If the element exists, scroll to the bottom
131 if (ele) {
132 ele.scrollTop = ele.scrollHeight;
133 }
134 }
135 }, [showAdvanced]);
136
137 return (
138 <Modal open={!!props.action} setOpen={props.close} classNames={"max-w-4xl"}>
139 <div className="flex flex-row justify-between">
140 <div className="flex flex-row place-items-center gap-x-4">
141 <div className="flex h-10 w-10 items-center justify-center rounded-full bg-sky-100">
142 <PencilSquareIcon
143 className="h-6 w-6 text-sky-600"
144 aria-hidden="true"
145 />
146 </div>
147 <Dialog.Title as="h3" className="text-xl leading-6 text-gray-100">
148 Edit Action
149 </Dialog.Title>
150 </div>
151 </div>
152
153 <div className="mt-10 mb-7 grid grid-cols-2 gap-x-6">
154 <div className="relative">
155 <FloatingLabelInput
156 className={classNames(

Callers

nothing calls this directly

Calls 2

isAlphaNumericUnderscoreFunction · 0.90
classNamesFunction · 0.90

Tested by

no test coverage detected