fixed the issue
This commit is contained in:
@@ -148,7 +148,7 @@ export function ConfigPanel({ node, onClose, onUpdateNode }: ConfigPanelProps) {
|
|||||||
value: string,
|
value: string,
|
||||||
arrayName: string
|
arrayName: string
|
||||||
) => {
|
) => {
|
||||||
const array = [...(node.data[arrayName] || [])];
|
const array = [...node.data[arrayName]];
|
||||||
array[index] = { ...array[index], [field]: value };
|
array[index] = { ...array[index], [field]: value };
|
||||||
const newData = {
|
const newData = {
|
||||||
...node.data,
|
...node.data,
|
||||||
@@ -163,7 +163,7 @@ export function ConfigPanel({ node, onClose, onUpdateNode }: ConfigPanelProps) {
|
|||||||
const fieldToAdd = arrayName === "queryFields" ? newQueryField : newField;
|
const fieldToAdd = arrayName === "queryFields" ? newQueryField : newField;
|
||||||
if (!fieldToAdd.name.trim()) return;
|
if (!fieldToAdd.name.trim()) return;
|
||||||
|
|
||||||
const array = [...(node.data[arrayName] || []), { ...fieldToAdd }];
|
const array = [...node.data[arrayName], { ...fieldToAdd }];
|
||||||
const newData = {
|
const newData = {
|
||||||
...node.data,
|
...node.data,
|
||||||
[arrayName]: array,
|
[arrayName]: array,
|
||||||
@@ -181,7 +181,7 @@ export function ConfigPanel({ node, onClose, onUpdateNode }: ConfigPanelProps) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const removeField = (index: number, arrayName: string) => {
|
const removeField = (index: number, arrayName: string) => {
|
||||||
const array = [...(node.data[arrayName] || [])];
|
const array = [...node.data[arrayName]];
|
||||||
array.splice(index, 1);
|
array.splice(index, 1);
|
||||||
const newData = {
|
const newData = {
|
||||||
...node.data,
|
...node.data,
|
||||||
@@ -212,7 +212,7 @@ export function ConfigPanel({ node, onClose, onUpdateNode }: ConfigPanelProps) {
|
|||||||
<label className="block text-sm font-medium mb-1">Model</label>
|
<label className="block text-sm font-medium mb-1">Model</label>
|
||||||
<select
|
<select
|
||||||
name="model"
|
name="model"
|
||||||
value={node.data.model || ""}
|
value={node.data.model}
|
||||||
onBlur={handleChange}
|
onBlur={handleChange}
|
||||||
className="w-full p-2 border rounded"
|
className="w-full p-2 border rounded"
|
||||||
>
|
>
|
||||||
@@ -228,7 +228,7 @@ export function ConfigPanel({ node, onClose, onUpdateNode }: ConfigPanelProps) {
|
|||||||
<label className="block text-sm font-medium mb-1">Operation</label>
|
<label className="block text-sm font-medium mb-1">Operation</label>
|
||||||
<select
|
<select
|
||||||
name="operation"
|
name="operation"
|
||||||
value={node.data.operation || "findMany"}
|
value={node.data.operation}
|
||||||
onBlur={handleChange}
|
onBlur={handleChange}
|
||||||
className="w-full p-2 border rounded"
|
className="w-full p-2 border rounded"
|
||||||
>
|
>
|
||||||
@@ -241,7 +241,7 @@ export function ConfigPanel({ node, onClose, onUpdateNode }: ConfigPanelProps) {
|
|||||||
<label className="block text-sm font-medium mb-1">SQL Query</label>
|
<label className="block text-sm font-medium mb-1">SQL Query</label>
|
||||||
<textarea
|
<textarea
|
||||||
name="query"
|
name="query"
|
||||||
value={node.data.query || `SELECT * FROM ${node.data.model}`}
|
value={node.data.query}
|
||||||
onBlur={handleChange}
|
onBlur={handleChange}
|
||||||
className="w-full p-2 border rounded h-32 font-mono text-sm"
|
className="w-full p-2 border rounded h-32 font-mono text-sm"
|
||||||
placeholder="SELECT * FROM table WHERE id = :id"
|
placeholder="SELECT * FROM table WHERE id = :id"
|
||||||
@@ -252,7 +252,7 @@ export function ConfigPanel({ node, onClose, onUpdateNode }: ConfigPanelProps) {
|
|||||||
<input
|
<input
|
||||||
type="text"
|
type="text"
|
||||||
name="resultVar"
|
name="resultVar"
|
||||||
value={node.data.resultVar || "result"}
|
value={node.data.resultVar}
|
||||||
onBlur={handleChange}
|
onBlur={handleChange}
|
||||||
className="w-full p-2 border rounded"
|
className="w-full p-2 border rounded"
|
||||||
placeholder="result"
|
placeholder="result"
|
||||||
@@ -272,7 +272,7 @@ export function ConfigPanel({ node, onClose, onUpdateNode }: ConfigPanelProps) {
|
|||||||
</label>
|
</label>
|
||||||
<select
|
<select
|
||||||
name="authType"
|
name="authType"
|
||||||
value={node.data.authType || "bearer"}
|
value={node.data.authType}
|
||||||
onBlur={handleChange}
|
onBlur={handleChange}
|
||||||
className="w-full p-2 border rounded"
|
className="w-full p-2 border rounded"
|
||||||
>
|
>
|
||||||
@@ -288,7 +288,7 @@ export function ConfigPanel({ node, onClose, onUpdateNode }: ConfigPanelProps) {
|
|||||||
<input
|
<input
|
||||||
type="text"
|
type="text"
|
||||||
name="tokenVar"
|
name="tokenVar"
|
||||||
value={node.data.tokenVar || ""}
|
value={node.data.tokenVar}
|
||||||
onBlur={handleChange}
|
onBlur={handleChange}
|
||||||
className="w-full p-2 border rounded"
|
className="w-full p-2 border rounded"
|
||||||
placeholder="token"
|
placeholder="token"
|
||||||
@@ -304,7 +304,7 @@ export function ConfigPanel({ node, onClose, onUpdateNode }: ConfigPanelProps) {
|
|||||||
<label className="block text-sm font-medium mb-1">Method</label>
|
<label className="block text-sm font-medium mb-1">Method</label>
|
||||||
<select
|
<select
|
||||||
name="method"
|
name="method"
|
||||||
value={node.data.method || "GET"}
|
value={node.data.method}
|
||||||
onBlur={handleChange}
|
onBlur={handleChange}
|
||||||
className="w-full p-2 border rounded"
|
className="w-full p-2 border rounded"
|
||||||
>
|
>
|
||||||
@@ -524,7 +524,7 @@ export function ConfigPanel({ node, onClose, onUpdateNode }: ConfigPanelProps) {
|
|||||||
<label className="block text-sm font-medium mb-1">Output Type</label>
|
<label className="block text-sm font-medium mb-1">Output Type</label>
|
||||||
<select
|
<select
|
||||||
name="outputType"
|
name="outputType"
|
||||||
value={node.data.outputType || "definition"}
|
value={node.data.outputType}
|
||||||
onBlur={handleChange}
|
onBlur={handleChange}
|
||||||
className="w-full p-2 border rounded"
|
className="w-full p-2 border rounded"
|
||||||
>
|
>
|
||||||
@@ -538,7 +538,7 @@ export function ConfigPanel({ node, onClose, onUpdateNode }: ConfigPanelProps) {
|
|||||||
<label className="block text-sm font-medium mb-1">Response Raw</label>
|
<label className="block text-sm font-medium mb-1">Response Raw</label>
|
||||||
<textarea
|
<textarea
|
||||||
name="responseRaw"
|
name="responseRaw"
|
||||||
value={node.data.responseRaw || ""}
|
value={node.data.responseRaw}
|
||||||
onBlur={handleChange}
|
onBlur={handleChange}
|
||||||
className="w-full p-2 border rounded h-32"
|
className="w-full p-2 border rounded h-32"
|
||||||
placeholder="Enter raw response here..."
|
placeholder="Enter raw response here..."
|
||||||
@@ -633,7 +633,7 @@ export function ConfigPanel({ node, onClose, onUpdateNode }: ConfigPanelProps) {
|
|||||||
<input
|
<input
|
||||||
type="number"
|
type="number"
|
||||||
name="statusCode"
|
name="statusCode"
|
||||||
value={node.data.statusCode || 200}
|
value={node.data.statusCode}
|
||||||
onBlur={handleChange}
|
onBlur={handleChange}
|
||||||
className="w-full p-2 border rounded"
|
className="w-full p-2 border rounded"
|
||||||
placeholder="200"
|
placeholder="200"
|
||||||
@@ -662,7 +662,7 @@ export function ConfigPanel({ node, onClose, onUpdateNode }: ConfigPanelProps) {
|
|||||||
<label className="block text-sm font-medium mb-1">Type</label>
|
<label className="block text-sm font-medium mb-1">Type</label>
|
||||||
<select
|
<select
|
||||||
name="type"
|
name="type"
|
||||||
value={node.data.type || "string"}
|
value={node.data.type}
|
||||||
onBlur={handleChange}
|
onBlur={handleChange}
|
||||||
className="w-full p-2 border rounded"
|
className="w-full p-2 border rounded"
|
||||||
>
|
>
|
||||||
@@ -680,7 +680,7 @@ export function ConfigPanel({ node, onClose, onUpdateNode }: ConfigPanelProps) {
|
|||||||
<input
|
<input
|
||||||
type="text"
|
type="text"
|
||||||
name="defaultValue"
|
name="defaultValue"
|
||||||
value={node.data.defaultValue || ""}
|
value={node.data.defaultValue}
|
||||||
onBlur={handleChange}
|
onBlur={handleChange}
|
||||||
className="w-full p-2 border rounded"
|
className="w-full p-2 border rounded"
|
||||||
placeholder="Default value"
|
placeholder="Default value"
|
||||||
@@ -697,7 +697,7 @@ export function ConfigPanel({ node, onClose, onUpdateNode }: ConfigPanelProps) {
|
|||||||
</label>
|
</label>
|
||||||
<textarea
|
<textarea
|
||||||
name="code"
|
name="code"
|
||||||
value={node.data.code || ""}
|
value={node.data.code}
|
||||||
onBlur={handleChange}
|
onBlur={handleChange}
|
||||||
className="w-full p-2 border rounded h-40 font-mono text-sm"
|
className="w-full p-2 border rounded h-40 font-mono text-sm"
|
||||||
placeholder="// Write your JavaScript code here"
|
placeholder="// Write your JavaScript code here"
|
||||||
@@ -733,7 +733,7 @@ export function ConfigPanel({ node, onClose, onUpdateNode }: ConfigPanelProps) {
|
|||||||
</label>
|
</label>
|
||||||
<textarea
|
<textarea
|
||||||
name="variables"
|
name="variables"
|
||||||
value={node.data.variables || ""}
|
value={node.data.variables}
|
||||||
onBlur={handleChange}
|
onBlur={handleChange}
|
||||||
className="w-full p-2 border rounded h-20 font-mono text-sm"
|
className="w-full p-2 border rounded h-20 font-mono text-sm"
|
||||||
placeholder="name: string age: number"
|
placeholder="name: string age: number"
|
||||||
@@ -752,7 +752,7 @@ export function ConfigPanel({ node, onClose, onUpdateNode }: ConfigPanelProps) {
|
|||||||
<input
|
<input
|
||||||
type="text"
|
type="text"
|
||||||
name="idField"
|
name="idField"
|
||||||
value={node.data.idField || ""}
|
value={node.data.idField}
|
||||||
onBlur={handleChange}
|
onBlur={handleChange}
|
||||||
className="w-full p-2 border rounded"
|
className="w-full p-2 border rounded"
|
||||||
placeholder="id"
|
placeholder="id"
|
||||||
@@ -765,7 +765,7 @@ export function ConfigPanel({ node, onClose, onUpdateNode }: ConfigPanelProps) {
|
|||||||
</label>
|
</label>
|
||||||
<textarea
|
<textarea
|
||||||
name="variables"
|
name="variables"
|
||||||
value={node.data.variables || ""}
|
value={node.data.variables}
|
||||||
onBlur={handleChange}
|
onBlur={handleChange}
|
||||||
className="w-full p-2 border rounded h-20 font-mono text-sm"
|
className="w-full p-2 border rounded h-20 font-mono text-sm"
|
||||||
placeholder="name: string age: number"
|
placeholder="name: string age: number"
|
||||||
|
|||||||
Reference in New Issue
Block a user