create-bluecopa-react-app 1.0.20 → 1.0.22
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/create-bluecopa-react-app.js +6 -7
- package/package.json +1 -1
- package/templates/latest/app/components/app-sidebar.tsx +5 -0
- package/templates/latest/app/routes/apitest.tsx +1963 -0
- package/templates/latest/app/routes/comments.tsx +96 -60
- package/templates/latest/app/routes.tsx +2 -0
- package/templates/latest/dist/assets/{__federation_expose_App-CcOhEUCE.js → __federation_expose_App-rkiN5ftu.js} +1 -1
- package/templates/latest/dist/assets/{client-uh-HfYnI.js → client-CjZD2orr.js} +5762 -4345
- package/templates/latest/dist/assets/{index-C1IOBHtM.js → index-BIZxzud9.js} +1 -1
- package/templates/latest/dist/assets/remoteEntry.css +130 -0
- package/templates/latest/dist/assets/remoteEntry.js +1 -1
- package/templates/latest/dist/index.html +2 -2
- package/templates/latest/package-lock.json +82 -8
- package/templates/latest/package.json +2 -1
|
@@ -0,0 +1,1963 @@
|
|
|
1
|
+
import React, { useState } from "react";
|
|
2
|
+
import { AppSidebar } from "~/components/app-sidebar";
|
|
3
|
+
import { SiteHeader } from "~/components/site-header";
|
|
4
|
+
import { SidebarInset, SidebarProvider } from "~/components/ui/sidebar";
|
|
5
|
+
import {
|
|
6
|
+
Card,
|
|
7
|
+
CardContent,
|
|
8
|
+
CardDescription,
|
|
9
|
+
CardHeader,
|
|
10
|
+
CardTitle,
|
|
11
|
+
} from "~/components/ui/card";
|
|
12
|
+
import { Button } from "~/components/ui/button";
|
|
13
|
+
import { Input } from "~/components/ui/input";
|
|
14
|
+
import { Label } from "~/components/ui/label";
|
|
15
|
+
import { toast } from "sonner";
|
|
16
|
+
import {
|
|
17
|
+
useGetWorkbookDetails,
|
|
18
|
+
useSaveWorkbook,
|
|
19
|
+
usePublishWorkbook,
|
|
20
|
+
useGetTaskDetails,
|
|
21
|
+
useRunRecon,
|
|
22
|
+
useFileUpload,
|
|
23
|
+
useFileDownload,
|
|
24
|
+
useGetFormSchema,
|
|
25
|
+
useGetFormData,
|
|
26
|
+
useGetAuditLogs,
|
|
27
|
+
useCreateAuditLog,
|
|
28
|
+
useGetAllTemplatedPipelines,
|
|
29
|
+
useGetAllRecon,
|
|
30
|
+
useGetFormById,
|
|
31
|
+
useCreateOrUpdateForm,
|
|
32
|
+
useMarkTaskDone,
|
|
33
|
+
useReassignTask,
|
|
34
|
+
} from "@bluecopa/react";
|
|
35
|
+
|
|
36
|
+
// Default values for examples
|
|
37
|
+
const DEFAULT_WORKBOOK_ID = "MJ2T21GQ8O8DQXIOHZBF";
|
|
38
|
+
const DEFAULT_TASK_ID = "0V4Kxc7LhIpUvwZeORaj";
|
|
39
|
+
const DEFAULT_WORKFLOW_ID = "MJ02HD1HUJ4VCN66U0V0";
|
|
40
|
+
const DEFAULT_FORM_INSTANCE_ID = "0V5W3KVAWdRnVOZczmSN";
|
|
41
|
+
const DEFAULT_FORM_REVISION = 21949795;
|
|
42
|
+
const DEFAULT_FORM_ID = "0V5W3KVAWdRnVOZczmSN";
|
|
43
|
+
const DEFAULT_FILE_UPLOAD_PAYLOAD = {
|
|
44
|
+
id: "0URYQ4DIHB1mVzPA87ZW",
|
|
45
|
+
name: "octobereighteennnqq",
|
|
46
|
+
description: "",
|
|
47
|
+
sequence: [
|
|
48
|
+
{
|
|
49
|
+
step_id: "0URYQFlVMr1DuDagpmlS",
|
|
50
|
+
name: "activity_1_",
|
|
51
|
+
type: "UPDATE_AND_RUN_RECON",
|
|
52
|
+
description: "",
|
|
53
|
+
inputs: {
|
|
54
|
+
recon_run_config_id: "${0URYQEEuxOPKIlGouLr2.form_data.recon_form}",
|
|
55
|
+
},
|
|
56
|
+
},
|
|
57
|
+
],
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
// Default values for audit log examples
|
|
61
|
+
const DEFAULT_AUDIT_LOG_REQUEST = {
|
|
62
|
+
entityId: "0TOlmUqx0TKseTn8W6gW",
|
|
63
|
+
source: "UI",
|
|
64
|
+
limit: 20,
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
const DEFAULT_AUDIT_RECORD = [
|
|
68
|
+
{
|
|
69
|
+
source: "UI",
|
|
70
|
+
userId: "0TOlmUqx0TKseTn8W6gW",
|
|
71
|
+
entityId: "0TOlmUqx0TKseTn8W6gW",
|
|
72
|
+
entityType: "Dataset",
|
|
73
|
+
action: "CREATE",
|
|
74
|
+
eventType: "API",
|
|
75
|
+
},
|
|
76
|
+
];
|
|
77
|
+
|
|
78
|
+
const DEFAULT_NEW_ASSIGNEE = "0TOlmUqx0TKseTn8W6gW";
|
|
79
|
+
|
|
80
|
+
// Workbook Test Component
|
|
81
|
+
function WorkbookTestSection() {
|
|
82
|
+
const [workbookId, setWorkbookId] = useState<string>("");
|
|
83
|
+
const [workbookData, setWorkbookData] = useState<any>(null);
|
|
84
|
+
|
|
85
|
+
// Save Workbook inputs
|
|
86
|
+
const [saveWorkbookData, setSaveWorkbookData] = useState<string>("");
|
|
87
|
+
const [sheetInputs, setSheetInputs] = useState<string>("[]");
|
|
88
|
+
|
|
89
|
+
// Publish Workbook input
|
|
90
|
+
const [publishWorkbookId, setPublishWorkbookId] = useState<string>("");
|
|
91
|
+
|
|
92
|
+
// Get Workbook Details Hook - disabled by default, only runs on user action
|
|
93
|
+
const workbookDetailsQuery = useGetWorkbookDetails(workbookId || null, {
|
|
94
|
+
enabled: false, // No automatic fetching - all calls are user-initiated
|
|
95
|
+
});
|
|
96
|
+
|
|
97
|
+
// Save Workbook Hook
|
|
98
|
+
const saveWorkbookMutation = useSaveWorkbook();
|
|
99
|
+
|
|
100
|
+
// Publish Workbook Hook
|
|
101
|
+
const publishWorkbookMutation = usePublishWorkbook();
|
|
102
|
+
|
|
103
|
+
// Handle Load Example for Get Workbook
|
|
104
|
+
const handleLoadExample = () => {
|
|
105
|
+
setWorkbookId(DEFAULT_WORKBOOK_ID);
|
|
106
|
+
toast.info(
|
|
107
|
+
'Example workbook ID loaded. Click "Get Workbook Details" to fetch.'
|
|
108
|
+
);
|
|
109
|
+
};
|
|
110
|
+
|
|
111
|
+
// Handle Load Example for Save Workbook
|
|
112
|
+
const handleLoadSaveExample = () => {
|
|
113
|
+
// Create a minimal example workbook structure
|
|
114
|
+
const exampleWorkbook = {
|
|
115
|
+
name: "sap_test1",
|
|
116
|
+
description: null,
|
|
117
|
+
parentId: null,
|
|
118
|
+
type: "PROCESS",
|
|
119
|
+
addToHome: false,
|
|
120
|
+
path: "prod/MJ2T21GQ8O8DQXIOHZBF",
|
|
121
|
+
sheetIds: ["MJ2T1S6CAWSVEHR5136Z"],
|
|
122
|
+
sheetRevisionById: {
|
|
123
|
+
MJ2T1S6CAWSVEHR5136Z: 21944090,
|
|
124
|
+
},
|
|
125
|
+
published: false,
|
|
126
|
+
sheets: [
|
|
127
|
+
{
|
|
128
|
+
name: "Process",
|
|
129
|
+
sources: null,
|
|
130
|
+
parentId: "MJ2T21GQ8O8DQXIOHZBF",
|
|
131
|
+
parentVersion: null,
|
|
132
|
+
parentType: "PROCESS",
|
|
133
|
+
type: "PROCESS_SHEET",
|
|
134
|
+
published: false,
|
|
135
|
+
customFields: {},
|
|
136
|
+
publishedVersion: null,
|
|
137
|
+
externalUrl:
|
|
138
|
+
"gs://gcp-dev-v3-stage-out/PROC_DEFINITION/MJ6WV5IW2FT808T2JWFK.json",
|
|
139
|
+
modelUrl:
|
|
140
|
+
"gs://gcp-dev-v3-stage-out/PROC_CUSTOM_MODEL/MJ6WV5IYWOZI9YY6M3UR.json",
|
|
141
|
+
tags: null,
|
|
142
|
+
createdBy: "0TOlmUqx0TKseTn8W6gW",
|
|
143
|
+
createdDate: "2025-12-12T11:50:09.155+00:00",
|
|
144
|
+
lastModifiedBy: "0TOlmUqx0TKseTn8W6gW",
|
|
145
|
+
lastModifiedDate: "2025-12-15T08:47:53.402+00:00",
|
|
146
|
+
id: "MJ2T1S6CAWSVEHR5136Z",
|
|
147
|
+
workspaceId: "prod",
|
|
148
|
+
entityVersion: 13,
|
|
149
|
+
definitionFileId: "PROC_DEFINITION/MJ6WV5IW2FT808T2JWFK.json",
|
|
150
|
+
modelFileId: "PROC_CUSTOM_MODEL/MJ6WV5IYWOZI9YY6M3UR.json",
|
|
151
|
+
externalDataId: "PROC_DEFINITION/MJ6WV5IW2FT808T2JWFK.json",
|
|
152
|
+
modelId: "PROC_CUSTOM_MODEL/MJ6WV5IYWOZI9YY6M3UR.json",
|
|
153
|
+
},
|
|
154
|
+
],
|
|
155
|
+
customFields: {
|
|
156
|
+
formTriggered: {
|
|
157
|
+
value: false,
|
|
158
|
+
},
|
|
159
|
+
httpTriggered: {
|
|
160
|
+
value: false,
|
|
161
|
+
},
|
|
162
|
+
manualTriggered: {
|
|
163
|
+
value: true,
|
|
164
|
+
},
|
|
165
|
+
scheduledTriggered: {
|
|
166
|
+
value: false,
|
|
167
|
+
},
|
|
168
|
+
},
|
|
169
|
+
indexedForAssistant: false,
|
|
170
|
+
tags: null,
|
|
171
|
+
builderSpaceType: null,
|
|
172
|
+
latestVersionPublished: true,
|
|
173
|
+
createdBy: "0TOlmUqx0TKseTn8W6gW",
|
|
174
|
+
createdDate: "2025-12-12T11:50:09.183+00:00",
|
|
175
|
+
lastModifiedBy: "0TOlmUqx0TKseTn8W6gW",
|
|
176
|
+
lastModifiedDate: "2025-12-16T05:35:08.035+00:00",
|
|
177
|
+
id: "MJ2T21GQ8O8DQXIOHZBF",
|
|
178
|
+
workspaceId: "prod",
|
|
179
|
+
entityVersion: 9,
|
|
180
|
+
};
|
|
181
|
+
|
|
182
|
+
setSaveWorkbookData(JSON.stringify(exampleWorkbook, null, 2));
|
|
183
|
+
setSheetInputs("[]");
|
|
184
|
+
toast.info('Example workbook data loaded. Click "Save Workbook" to save.');
|
|
185
|
+
};
|
|
186
|
+
|
|
187
|
+
// Handle Load Example for Publish Workbook
|
|
188
|
+
const handleLoadPublishExample = () => {
|
|
189
|
+
setPublishWorkbookId(DEFAULT_WORKBOOK_ID);
|
|
190
|
+
toast.info(
|
|
191
|
+
'Example workbook ID loaded. Click "Publish Workbook" to publish.'
|
|
192
|
+
);
|
|
193
|
+
};
|
|
194
|
+
|
|
195
|
+
// Handle Get Workbook Details
|
|
196
|
+
const handleGetWorkbookDetails = async () => {
|
|
197
|
+
if (!workbookId) {
|
|
198
|
+
toast.error("Please enter a workbook ID");
|
|
199
|
+
return;
|
|
200
|
+
}
|
|
201
|
+
try {
|
|
202
|
+
const result = await workbookDetailsQuery.refetch();
|
|
203
|
+
if (result.data) {
|
|
204
|
+
setWorkbookData(result.data);
|
|
205
|
+
console.log("Workbook details:", result.data);
|
|
206
|
+
toast.success("Workbook details loaded! Check console for data.");
|
|
207
|
+
}
|
|
208
|
+
} catch (error: any) {
|
|
209
|
+
toast.error(`Error: ${error.message}`);
|
|
210
|
+
}
|
|
211
|
+
};
|
|
212
|
+
|
|
213
|
+
// Handle Save Workbook
|
|
214
|
+
const handleSaveWorkbook = async () => {
|
|
215
|
+
if (!saveWorkbookData) {
|
|
216
|
+
toast.error("Please enter workbook data (JSON)");
|
|
217
|
+
return;
|
|
218
|
+
}
|
|
219
|
+
try {
|
|
220
|
+
let parsedWorkbook;
|
|
221
|
+
let parsedSheetInputs;
|
|
222
|
+
|
|
223
|
+
try {
|
|
224
|
+
parsedWorkbook = JSON.parse(saveWorkbookData);
|
|
225
|
+
} catch (e) {
|
|
226
|
+
toast.error("Invalid JSON format for workbook data");
|
|
227
|
+
return;
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
try {
|
|
231
|
+
parsedSheetInputs = JSON.parse(sheetInputs);
|
|
232
|
+
} catch (e) {
|
|
233
|
+
toast.error("Invalid JSON format for sheet inputs");
|
|
234
|
+
return;
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
const result = await saveWorkbookMutation.mutateAsync({
|
|
238
|
+
workbook: parsedWorkbook,
|
|
239
|
+
sheetInputs: parsedSheetInputs,
|
|
240
|
+
});
|
|
241
|
+
console.log("Workbook saved:", result);
|
|
242
|
+
toast.success("Workbook saved successfully! Check console for data.");
|
|
243
|
+
} catch (error: any) {
|
|
244
|
+
console.error("Save error:", error);
|
|
245
|
+
toast.error(`Save failed: ${error.message}`);
|
|
246
|
+
}
|
|
247
|
+
};
|
|
248
|
+
|
|
249
|
+
// Handle Publish Workbook
|
|
250
|
+
const handlePublishWorkbook = async () => {
|
|
251
|
+
if (!publishWorkbookId) {
|
|
252
|
+
toast.error("Please enter a workbook ID");
|
|
253
|
+
return;
|
|
254
|
+
}
|
|
255
|
+
try {
|
|
256
|
+
const result = await publishWorkbookMutation.mutateAsync({
|
|
257
|
+
workbookId: publishWorkbookId,
|
|
258
|
+
});
|
|
259
|
+
console.log("Workbook published:", result);
|
|
260
|
+
toast.success("Workbook published successfully! Check console for data.");
|
|
261
|
+
} catch (error: any) {
|
|
262
|
+
console.error("Publish error:", error);
|
|
263
|
+
toast.error(`Publish failed: ${error.message}`);
|
|
264
|
+
}
|
|
265
|
+
};
|
|
266
|
+
|
|
267
|
+
return (
|
|
268
|
+
<Card className="mb-6">
|
|
269
|
+
<CardHeader>
|
|
270
|
+
<CardTitle>Workbook Operations Test</CardTitle>
|
|
271
|
+
<CardDescription>
|
|
272
|
+
Get, save, and publish workbook details
|
|
273
|
+
</CardDescription>
|
|
274
|
+
</CardHeader>
|
|
275
|
+
<CardContent className="space-y-4">
|
|
276
|
+
<div className="space-y-2">
|
|
277
|
+
<Label htmlFor="workbookId">Workbook ID</Label>
|
|
278
|
+
<div className="flex gap-2">
|
|
279
|
+
<Input
|
|
280
|
+
id="workbookId"
|
|
281
|
+
value={workbookId}
|
|
282
|
+
onChange={(e) => setWorkbookId(e.target.value)}
|
|
283
|
+
placeholder="Enter workbook ID"
|
|
284
|
+
/>
|
|
285
|
+
<Button onClick={handleLoadExample} variant="outline" type="button">
|
|
286
|
+
Load Example
|
|
287
|
+
</Button>
|
|
288
|
+
</div>
|
|
289
|
+
<p className="text-xs text-muted-foreground">
|
|
290
|
+
Example:{" "}
|
|
291
|
+
<button
|
|
292
|
+
type="button"
|
|
293
|
+
onClick={handleLoadExample}
|
|
294
|
+
className="underline text-blue-600 hover:text-blue-800"
|
|
295
|
+
>
|
|
296
|
+
{DEFAULT_WORKBOOK_ID}
|
|
297
|
+
</button>
|
|
298
|
+
</p>
|
|
299
|
+
</div>
|
|
300
|
+
|
|
301
|
+
<div className="flex gap-4">
|
|
302
|
+
<Button
|
|
303
|
+
onClick={handleGetWorkbookDetails}
|
|
304
|
+
disabled={workbookDetailsQuery.isLoading || !workbookId}
|
|
305
|
+
variant="default"
|
|
306
|
+
>
|
|
307
|
+
{workbookDetailsQuery.isLoading
|
|
308
|
+
? "Loading..."
|
|
309
|
+
: "1. Get Workbook Details"}
|
|
310
|
+
</Button>
|
|
311
|
+
</div>
|
|
312
|
+
|
|
313
|
+
{/* Status Messages for Get Workbook */}
|
|
314
|
+
{workbookDetailsQuery.isError && (
|
|
315
|
+
<p className="text-red-500">
|
|
316
|
+
Get Error: {workbookDetailsQuery.error?.message}
|
|
317
|
+
</p>
|
|
318
|
+
)}
|
|
319
|
+
{workbookDetailsQuery.isSuccess && workbookData && (
|
|
320
|
+
<p className="text-green-500">
|
|
321
|
+
✓ Workbook details loaded (ID: {workbookData.id})
|
|
322
|
+
</p>
|
|
323
|
+
)}
|
|
324
|
+
|
|
325
|
+
{/* Workbook Data Preview */}
|
|
326
|
+
{workbookData && (
|
|
327
|
+
<div className="mt-4 p-4 bg-muted rounded-lg">
|
|
328
|
+
<p className="text-sm font-semibold mb-2">Workbook Data:</p>
|
|
329
|
+
<pre className="text-xs overflow-auto max-h-60">
|
|
330
|
+
{JSON.stringify(workbookData, null, 2)}
|
|
331
|
+
</pre>
|
|
332
|
+
</div>
|
|
333
|
+
)}
|
|
334
|
+
|
|
335
|
+
{/* Save Workbook Section */}
|
|
336
|
+
<div className="border-t pt-4 mt-4 space-y-4">
|
|
337
|
+
<h3 className="text-lg font-semibold">Save Workbook</h3>
|
|
338
|
+
<div className="space-y-2">
|
|
339
|
+
<Label htmlFor="saveWorkbookData">Workbook Data (JSON)</Label>
|
|
340
|
+
<div className="flex gap-2 mb-2">
|
|
341
|
+
<Button
|
|
342
|
+
onClick={handleLoadSaveExample}
|
|
343
|
+
variant="outline"
|
|
344
|
+
type="button"
|
|
345
|
+
>
|
|
346
|
+
Load Example
|
|
347
|
+
</Button>
|
|
348
|
+
</div>
|
|
349
|
+
<textarea
|
|
350
|
+
id="saveWorkbookData"
|
|
351
|
+
value={saveWorkbookData}
|
|
352
|
+
onChange={(e) => setSaveWorkbookData(e.target.value)}
|
|
353
|
+
placeholder="Enter workbook JSON data"
|
|
354
|
+
className="w-full min-h-[150px] p-2 border rounded-md font-mono text-xs"
|
|
355
|
+
/>
|
|
356
|
+
<p className="text-xs text-muted-foreground">
|
|
357
|
+
Example: Click "Load Example" button above to load sample workbook
|
|
358
|
+
data
|
|
359
|
+
</p>
|
|
360
|
+
</div>
|
|
361
|
+
|
|
362
|
+
<div className="space-y-2">
|
|
363
|
+
<Label htmlFor="sheetInputs">Sheet Inputs (JSON Array)</Label>
|
|
364
|
+
<Input
|
|
365
|
+
id="sheetInputs"
|
|
366
|
+
value={sheetInputs}
|
|
367
|
+
onChange={(e) => setSheetInputs(e.target.value)}
|
|
368
|
+
placeholder="Enter sheet inputs as JSON array, e.g., []"
|
|
369
|
+
className="font-mono text-xs"
|
|
370
|
+
/>
|
|
371
|
+
<p className="text-xs text-muted-foreground">
|
|
372
|
+
Example: <code className="bg-muted px-1 rounded">[]</code> (empty
|
|
373
|
+
array)
|
|
374
|
+
</p>
|
|
375
|
+
</div>
|
|
376
|
+
|
|
377
|
+
<div className="space-y-2">
|
|
378
|
+
<Button
|
|
379
|
+
onClick={handleSaveWorkbook}
|
|
380
|
+
disabled={saveWorkbookMutation.isPending || !saveWorkbookData}
|
|
381
|
+
variant="default"
|
|
382
|
+
>
|
|
383
|
+
{saveWorkbookMutation.isPending
|
|
384
|
+
? "Saving..."
|
|
385
|
+
: "2. Save Workbook"}
|
|
386
|
+
</Button>
|
|
387
|
+
|
|
388
|
+
{/* Status Messages for Save Workbook */}
|
|
389
|
+
{saveWorkbookMutation.isError && (
|
|
390
|
+
<p className="text-red-500">
|
|
391
|
+
Save Error: {saveWorkbookMutation.error?.message}
|
|
392
|
+
</p>
|
|
393
|
+
)}
|
|
394
|
+
{saveWorkbookMutation.isSuccess && (
|
|
395
|
+
<p className="text-green-500">✓ Workbook saved successfully</p>
|
|
396
|
+
)}
|
|
397
|
+
</div>
|
|
398
|
+
</div>
|
|
399
|
+
|
|
400
|
+
{/* Publish Workbook Section */}
|
|
401
|
+
<div className="border-t pt-4 mt-4 space-y-4">
|
|
402
|
+
<h3 className="text-lg font-semibold">Publish Workbook</h3>
|
|
403
|
+
<div className="space-y-2">
|
|
404
|
+
<Label htmlFor="publishWorkbookId">Workbook ID</Label>
|
|
405
|
+
<div className="flex gap-2">
|
|
406
|
+
<Input
|
|
407
|
+
id="publishWorkbookId"
|
|
408
|
+
value={publishWorkbookId}
|
|
409
|
+
onChange={(e) => setPublishWorkbookId(e.target.value)}
|
|
410
|
+
placeholder="Enter workbook ID"
|
|
411
|
+
/>
|
|
412
|
+
<Button
|
|
413
|
+
onClick={handleLoadPublishExample}
|
|
414
|
+
variant="outline"
|
|
415
|
+
type="button"
|
|
416
|
+
>
|
|
417
|
+
Load Example
|
|
418
|
+
</Button>
|
|
419
|
+
</div>
|
|
420
|
+
<p className="text-xs text-muted-foreground">
|
|
421
|
+
Example:{" "}
|
|
422
|
+
<button
|
|
423
|
+
type="button"
|
|
424
|
+
onClick={handleLoadPublishExample}
|
|
425
|
+
className="underline text-blue-600 hover:text-blue-800"
|
|
426
|
+
>
|
|
427
|
+
{DEFAULT_WORKBOOK_ID}
|
|
428
|
+
</button>
|
|
429
|
+
</p>
|
|
430
|
+
</div>
|
|
431
|
+
|
|
432
|
+
<Button
|
|
433
|
+
onClick={handlePublishWorkbook}
|
|
434
|
+
disabled={publishWorkbookMutation.isPending || !publishWorkbookId}
|
|
435
|
+
variant="default"
|
|
436
|
+
>
|
|
437
|
+
{publishWorkbookMutation.isPending
|
|
438
|
+
? "Publishing..."
|
|
439
|
+
: "3. Publish Workbook"}
|
|
440
|
+
</Button>
|
|
441
|
+
|
|
442
|
+
{/* Status Messages for Publish Workbook */}
|
|
443
|
+
{publishWorkbookMutation.isError && (
|
|
444
|
+
<p className="text-red-500">
|
|
445
|
+
Publish Error: {publishWorkbookMutation.error?.message}
|
|
446
|
+
</p>
|
|
447
|
+
)}
|
|
448
|
+
{publishWorkbookMutation.isSuccess && (
|
|
449
|
+
<p className="text-green-500">✓ Workbook published successfully</p>
|
|
450
|
+
)}
|
|
451
|
+
</div>
|
|
452
|
+
</CardContent>
|
|
453
|
+
</Card>
|
|
454
|
+
);
|
|
455
|
+
}
|
|
456
|
+
|
|
457
|
+
// Task Test Component
|
|
458
|
+
function TaskTestSection() {
|
|
459
|
+
const [taskId, setTaskId] = useState<string>("");
|
|
460
|
+
|
|
461
|
+
// Get Task Details Hook - disabled by default
|
|
462
|
+
const taskDetailsQuery = useGetTaskDetails(taskId || null, {
|
|
463
|
+
enabled: false, // No automatic fetching - all calls are user-initiated
|
|
464
|
+
});
|
|
465
|
+
|
|
466
|
+
// Handle Load Example
|
|
467
|
+
const handleLoadExample = () => {
|
|
468
|
+
setTaskId(DEFAULT_TASK_ID);
|
|
469
|
+
toast.info('Example task ID loaded. Click "Get Task Details" to fetch.');
|
|
470
|
+
};
|
|
471
|
+
|
|
472
|
+
// Handle Get Task Details
|
|
473
|
+
const handleGetTaskDetails = async () => {
|
|
474
|
+
if (!taskId) {
|
|
475
|
+
toast.error("Please enter a task ID");
|
|
476
|
+
return;
|
|
477
|
+
}
|
|
478
|
+
try {
|
|
479
|
+
const result = await taskDetailsQuery.refetch();
|
|
480
|
+
if (result.data) {
|
|
481
|
+
console.log("Task details:", result.data);
|
|
482
|
+
toast.success("Task details loaded! Check console for data.");
|
|
483
|
+
}
|
|
484
|
+
} catch (error: any) {
|
|
485
|
+
toast.error(`Error: ${error.message}`);
|
|
486
|
+
}
|
|
487
|
+
};
|
|
488
|
+
|
|
489
|
+
return (
|
|
490
|
+
<Card className="mb-6">
|
|
491
|
+
<CardHeader>
|
|
492
|
+
<CardTitle>Task Operations Test</CardTitle>
|
|
493
|
+
<CardDescription>Get task details by task ID</CardDescription>
|
|
494
|
+
</CardHeader>
|
|
495
|
+
<CardContent className="space-y-4">
|
|
496
|
+
<div className="space-y-2">
|
|
497
|
+
<Label htmlFor="taskId">Task ID</Label>
|
|
498
|
+
<div className="flex gap-2">
|
|
499
|
+
<Input
|
|
500
|
+
id="taskId"
|
|
501
|
+
value={taskId}
|
|
502
|
+
onChange={(e) => setTaskId(e.target.value)}
|
|
503
|
+
placeholder="Enter task ID"
|
|
504
|
+
/>
|
|
505
|
+
<Button onClick={handleLoadExample} variant="outline" type="button">
|
|
506
|
+
Load Example
|
|
507
|
+
</Button>
|
|
508
|
+
</div>
|
|
509
|
+
<p className="text-xs text-muted-foreground">
|
|
510
|
+
Example:{" "}
|
|
511
|
+
<button
|
|
512
|
+
type="button"
|
|
513
|
+
onClick={handleLoadExample}
|
|
514
|
+
className="underline text-blue-600 hover:text-blue-800"
|
|
515
|
+
>
|
|
516
|
+
{DEFAULT_TASK_ID}
|
|
517
|
+
</button>
|
|
518
|
+
</p>
|
|
519
|
+
</div>
|
|
520
|
+
|
|
521
|
+
<div className="flex gap-4">
|
|
522
|
+
<Button
|
|
523
|
+
onClick={handleGetTaskDetails}
|
|
524
|
+
disabled={taskDetailsQuery.isLoading || !taskId}
|
|
525
|
+
variant="default"
|
|
526
|
+
>
|
|
527
|
+
{taskDetailsQuery.isLoading ? "Loading..." : "Get Task Details"}
|
|
528
|
+
</Button>
|
|
529
|
+
</div>
|
|
530
|
+
|
|
531
|
+
{/* Status Messages */}
|
|
532
|
+
{taskDetailsQuery.isError && (
|
|
533
|
+
<p className="text-red-500">
|
|
534
|
+
Get Error: {taskDetailsQuery.error?.message}
|
|
535
|
+
</p>
|
|
536
|
+
)}
|
|
537
|
+
{taskDetailsQuery.isSuccess && taskDetailsQuery.data && (
|
|
538
|
+
<p className="text-green-500">
|
|
539
|
+
✓ Task details loaded (ID: {taskDetailsQuery.data.id || taskId})
|
|
540
|
+
</p>
|
|
541
|
+
)}
|
|
542
|
+
|
|
543
|
+
{/* Task Data Preview */}
|
|
544
|
+
{taskDetailsQuery.data && (
|
|
545
|
+
<div className="mt-4 p-4 bg-muted rounded-lg">
|
|
546
|
+
<p className="text-sm font-semibold mb-2">Task Data:</p>
|
|
547
|
+
<pre className="text-xs overflow-auto max-h-60">
|
|
548
|
+
{JSON.stringify(taskDetailsQuery.data, null, 2)}
|
|
549
|
+
</pre>
|
|
550
|
+
</div>
|
|
551
|
+
)}
|
|
552
|
+
</CardContent>
|
|
553
|
+
</Card>
|
|
554
|
+
);
|
|
555
|
+
}
|
|
556
|
+
|
|
557
|
+
// Run Recon Test Component
|
|
558
|
+
function RunReconTestSection() {
|
|
559
|
+
const [workflowId, setWorkflowId] = useState<string>("");
|
|
560
|
+
const [fullRefresh, setFullRefresh] = useState<boolean>(true);
|
|
561
|
+
const [reconResult, setReconResult] = useState<any>(null);
|
|
562
|
+
|
|
563
|
+
// Run Recon Hook
|
|
564
|
+
const runReconMutation = useRunRecon();
|
|
565
|
+
|
|
566
|
+
// Handle Load Example
|
|
567
|
+
const handleLoadExample = () => {
|
|
568
|
+
setWorkflowId(DEFAULT_WORKFLOW_ID);
|
|
569
|
+
setFullRefresh(true);
|
|
570
|
+
toast.info('Example workflow ID loaded. Click "Run Recon" to execute.');
|
|
571
|
+
};
|
|
572
|
+
|
|
573
|
+
// Handle Run Recon
|
|
574
|
+
const handleRunRecon = async () => {
|
|
575
|
+
if (!workflowId) {
|
|
576
|
+
toast.error("Please enter a workflow ID");
|
|
577
|
+
return;
|
|
578
|
+
}
|
|
579
|
+
try {
|
|
580
|
+
const result = await runReconMutation.mutateAsync({
|
|
581
|
+
workflowId: workflowId,
|
|
582
|
+
fullRefresh: fullRefresh,
|
|
583
|
+
});
|
|
584
|
+
console.log("Run Recon result:", result);
|
|
585
|
+
setReconResult(result);
|
|
586
|
+
toast.success("Recon workflow started! Check console for data.");
|
|
587
|
+
} catch (error: any) {
|
|
588
|
+
console.error("Run Recon error:", error);
|
|
589
|
+
toast.error(`Run Recon failed: ${error.message}`);
|
|
590
|
+
}
|
|
591
|
+
};
|
|
592
|
+
|
|
593
|
+
return (
|
|
594
|
+
<Card className="mb-6">
|
|
595
|
+
<CardHeader>
|
|
596
|
+
<CardTitle>Run Recon Operations Test</CardTitle>
|
|
597
|
+
<CardDescription>Run a reconciliation workflow</CardDescription>
|
|
598
|
+
</CardHeader>
|
|
599
|
+
<CardContent className="space-y-4">
|
|
600
|
+
<div className="space-y-2">
|
|
601
|
+
<Label htmlFor="workflowId">Workflow ID</Label>
|
|
602
|
+
<div className="flex gap-2">
|
|
603
|
+
<Input
|
|
604
|
+
id="workflowId"
|
|
605
|
+
value={workflowId}
|
|
606
|
+
onChange={(e) => setWorkflowId(e.target.value)}
|
|
607
|
+
placeholder="Enter workflow ID"
|
|
608
|
+
/>
|
|
609
|
+
<Button onClick={handleLoadExample} variant="outline" type="button">
|
|
610
|
+
Load Example
|
|
611
|
+
</Button>
|
|
612
|
+
</div>
|
|
613
|
+
<p className="text-xs text-muted-foreground">
|
|
614
|
+
Example:{" "}
|
|
615
|
+
<button
|
|
616
|
+
type="button"
|
|
617
|
+
onClick={handleLoadExample}
|
|
618
|
+
className="underline text-blue-600 hover:text-blue-800"
|
|
619
|
+
>
|
|
620
|
+
{DEFAULT_WORKFLOW_ID}
|
|
621
|
+
</button>
|
|
622
|
+
</p>
|
|
623
|
+
</div>
|
|
624
|
+
|
|
625
|
+
<div className="flex items-center gap-2">
|
|
626
|
+
<input
|
|
627
|
+
type="checkbox"
|
|
628
|
+
id="fullRefresh"
|
|
629
|
+
checked={fullRefresh}
|
|
630
|
+
onChange={(e) => setFullRefresh(e.target.checked)}
|
|
631
|
+
className="h-4 w-4"
|
|
632
|
+
/>
|
|
633
|
+
<Label htmlFor="fullRefresh" className="cursor-pointer">
|
|
634
|
+
Full Refresh
|
|
635
|
+
</Label>
|
|
636
|
+
</div>
|
|
637
|
+
|
|
638
|
+
<div className="flex gap-4">
|
|
639
|
+
<Button
|
|
640
|
+
onClick={handleRunRecon}
|
|
641
|
+
disabled={runReconMutation.isPending || !workflowId}
|
|
642
|
+
variant="default"
|
|
643
|
+
>
|
|
644
|
+
{runReconMutation.isPending ? "Running..." : "Run Recon"}
|
|
645
|
+
</Button>
|
|
646
|
+
</div>
|
|
647
|
+
|
|
648
|
+
{/* Status Messages */}
|
|
649
|
+
{runReconMutation.isError && (
|
|
650
|
+
<p className="text-red-500">
|
|
651
|
+
Run Recon Error: {runReconMutation.error?.message}
|
|
652
|
+
</p>
|
|
653
|
+
)}
|
|
654
|
+
{runReconMutation.isSuccess && reconResult && (
|
|
655
|
+
<p className="text-green-500">
|
|
656
|
+
✓ Recon workflow started successfully
|
|
657
|
+
</p>
|
|
658
|
+
)}
|
|
659
|
+
|
|
660
|
+
{/* Recon Result Preview */}
|
|
661
|
+
{reconResult && (
|
|
662
|
+
<div className="mt-4 p-4 bg-muted rounded-lg">
|
|
663
|
+
<p className="text-sm font-semibold mb-2">Recon Result:</p>
|
|
664
|
+
<pre className="text-xs overflow-auto max-h-60">
|
|
665
|
+
{JSON.stringify(reconResult, null, 2)}
|
|
666
|
+
</pre>
|
|
667
|
+
</div>
|
|
668
|
+
)}
|
|
669
|
+
</CardContent>
|
|
670
|
+
</Card>
|
|
671
|
+
);
|
|
672
|
+
}
|
|
673
|
+
|
|
674
|
+
// File Upload Test Component
|
|
675
|
+
function FileUploadTestSection() {
|
|
676
|
+
const [fileUploadData, setFileUploadData] = useState<string>("");
|
|
677
|
+
const [fileId, setFileId] = useState<string>("");
|
|
678
|
+
const [downloadedData, setDownloadedData] = useState<any>(null);
|
|
679
|
+
|
|
680
|
+
// File Upload Hook
|
|
681
|
+
const fileUploadMutation = useFileUpload();
|
|
682
|
+
|
|
683
|
+
// File Download Hook - disabled by default
|
|
684
|
+
const fileDownloadQuery = useFileDownload(fileId || null, {
|
|
685
|
+
enabled: false, // No automatic fetching - all calls are user-initiated
|
|
686
|
+
});
|
|
687
|
+
|
|
688
|
+
// Handle Load Example
|
|
689
|
+
const handleLoadExample = () => {
|
|
690
|
+
setFileUploadData(JSON.stringify(DEFAULT_FILE_UPLOAD_PAYLOAD, null, 2));
|
|
691
|
+
toast.info('Example payload loaded. Click "Upload File" to upload.');
|
|
692
|
+
};
|
|
693
|
+
|
|
694
|
+
// Handle File Upload
|
|
695
|
+
const handleFileUpload = async () => {
|
|
696
|
+
if (!fileUploadData) {
|
|
697
|
+
toast.error("Please enter file data (JSON)");
|
|
698
|
+
return;
|
|
699
|
+
}
|
|
700
|
+
try {
|
|
701
|
+
let parsedData;
|
|
702
|
+
try {
|
|
703
|
+
parsedData = JSON.parse(fileUploadData);
|
|
704
|
+
} catch (e) {
|
|
705
|
+
toast.error("Invalid JSON format");
|
|
706
|
+
return;
|
|
707
|
+
}
|
|
708
|
+
|
|
709
|
+
const result = await fileUploadMutation.mutateAsync({
|
|
710
|
+
data: parsedData,
|
|
711
|
+
uploadType: "DEFINITION",
|
|
712
|
+
});
|
|
713
|
+
console.log("File uploaded, fileId:", result.fileId);
|
|
714
|
+
setFileId(result.fileId);
|
|
715
|
+
toast.success(`File uploaded successfully! File ID: ${result.fileId}`);
|
|
716
|
+
} catch (error: any) {
|
|
717
|
+
console.error("File upload error:", error);
|
|
718
|
+
toast.error(`File upload failed: ${error.message}`);
|
|
719
|
+
}
|
|
720
|
+
};
|
|
721
|
+
|
|
722
|
+
// Handle File Download
|
|
723
|
+
const handleFileDownload = async () => {
|
|
724
|
+
if (!fileId) {
|
|
725
|
+
toast.error("Please upload a file first to get fileId");
|
|
726
|
+
return;
|
|
727
|
+
}
|
|
728
|
+
try {
|
|
729
|
+
const result = await fileDownloadQuery.refetch();
|
|
730
|
+
if (result.data) {
|
|
731
|
+
setDownloadedData(result.data);
|
|
732
|
+
console.log("File downloaded:", result.data);
|
|
733
|
+
toast.success("File downloaded! Check console for data.");
|
|
734
|
+
}
|
|
735
|
+
} catch (error: any) {
|
|
736
|
+
toast.error(`Download Error: ${error.message}`);
|
|
737
|
+
}
|
|
738
|
+
};
|
|
739
|
+
|
|
740
|
+
return (
|
|
741
|
+
<Card className="mb-6">
|
|
742
|
+
<CardHeader>
|
|
743
|
+
<CardTitle>File Upload/Download Operations Test</CardTitle>
|
|
744
|
+
<CardDescription>
|
|
745
|
+
Upload a file, get fileId, then download and display the file
|
|
746
|
+
</CardDescription>
|
|
747
|
+
</CardHeader>
|
|
748
|
+
<CardContent className="space-y-4">
|
|
749
|
+
<div className="space-y-2">
|
|
750
|
+
<Label htmlFor="fileUploadData">File Data (JSON)</Label>
|
|
751
|
+
<div className="flex gap-2 mb-2">
|
|
752
|
+
<Button onClick={handleLoadExample} variant="outline" type="button">
|
|
753
|
+
Load Example
|
|
754
|
+
</Button>
|
|
755
|
+
</div>
|
|
756
|
+
<textarea
|
|
757
|
+
id="fileUploadData"
|
|
758
|
+
value={fileUploadData}
|
|
759
|
+
onChange={(e) => setFileUploadData(e.target.value)}
|
|
760
|
+
placeholder="Enter JSON data to upload"
|
|
761
|
+
className="w-full min-h-[150px] p-2 border rounded-md font-mono text-xs"
|
|
762
|
+
/>
|
|
763
|
+
<p className="text-xs text-muted-foreground">
|
|
764
|
+
Example: Click "Load Example" button above to load sample JSON
|
|
765
|
+
payload
|
|
766
|
+
</p>
|
|
767
|
+
</div>
|
|
768
|
+
|
|
769
|
+
<div className="space-y-2">
|
|
770
|
+
<Label htmlFor="fileId">File ID (from upload response)</Label>
|
|
771
|
+
<Input
|
|
772
|
+
id="fileId"
|
|
773
|
+
value={fileId}
|
|
774
|
+
onChange={(e) => setFileId(e.target.value)}
|
|
775
|
+
placeholder="File ID will appear here after upload"
|
|
776
|
+
/>
|
|
777
|
+
</div>
|
|
778
|
+
|
|
779
|
+
<div className="flex gap-4">
|
|
780
|
+
<Button
|
|
781
|
+
onClick={handleFileUpload}
|
|
782
|
+
disabled={fileUploadMutation.isPending || !fileUploadData}
|
|
783
|
+
variant="default"
|
|
784
|
+
>
|
|
785
|
+
{fileUploadMutation.isPending ? "Uploading..." : "1. Upload File"}
|
|
786
|
+
</Button>
|
|
787
|
+
|
|
788
|
+
<Button
|
|
789
|
+
onClick={handleFileDownload}
|
|
790
|
+
disabled={fileDownloadQuery.isLoading || !fileId}
|
|
791
|
+
variant="default"
|
|
792
|
+
>
|
|
793
|
+
{fileDownloadQuery.isLoading
|
|
794
|
+
? "Downloading..."
|
|
795
|
+
: "2. Download File"}
|
|
796
|
+
</Button>
|
|
797
|
+
</div>
|
|
798
|
+
|
|
799
|
+
{/* Status Messages */}
|
|
800
|
+
{fileUploadMutation.isError && (
|
|
801
|
+
<p className="text-red-500">
|
|
802
|
+
Upload Error: {fileUploadMutation.error?.message}
|
|
803
|
+
</p>
|
|
804
|
+
)}
|
|
805
|
+
{fileUploadMutation.isSuccess && fileId && (
|
|
806
|
+
<p className="text-green-500">
|
|
807
|
+
✓ File uploaded successfully (File ID: {fileId})
|
|
808
|
+
</p>
|
|
809
|
+
)}
|
|
810
|
+
|
|
811
|
+
{fileDownloadQuery.isError && (
|
|
812
|
+
<p className="text-red-500">
|
|
813
|
+
Download Error: {fileDownloadQuery.error?.message}
|
|
814
|
+
</p>
|
|
815
|
+
)}
|
|
816
|
+
{fileDownloadQuery.isSuccess && downloadedData && (
|
|
817
|
+
<p className="text-green-500">✓ File downloaded successfully</p>
|
|
818
|
+
)}
|
|
819
|
+
|
|
820
|
+
{/* Uploaded Payload Preview */}
|
|
821
|
+
{fileUploadMutation.isSuccess && fileUploadData && (
|
|
822
|
+
<div className="mt-4 p-4 bg-muted rounded-lg">
|
|
823
|
+
<p className="text-sm font-semibold mb-2">Uploaded Payload:</p>
|
|
824
|
+
<pre className="text-xs overflow-auto max-h-40">
|
|
825
|
+
{fileUploadData}
|
|
826
|
+
</pre>
|
|
827
|
+
</div>
|
|
828
|
+
)}
|
|
829
|
+
|
|
830
|
+
{/* Downloaded File Data Preview */}
|
|
831
|
+
{downloadedData && (
|
|
832
|
+
<div className="mt-4 p-4 bg-muted rounded-lg">
|
|
833
|
+
<p className="text-sm font-semibold mb-2">Downloaded File Data:</p>
|
|
834
|
+
<pre className="text-xs overflow-auto max-h-60">
|
|
835
|
+
{JSON.stringify(downloadedData, null, 2)}
|
|
836
|
+
</pre>
|
|
837
|
+
</div>
|
|
838
|
+
)}
|
|
839
|
+
</CardContent>
|
|
840
|
+
</Card>
|
|
841
|
+
);
|
|
842
|
+
}
|
|
843
|
+
|
|
844
|
+
// Form Schema Test Component
|
|
845
|
+
function FormSchemaTestSection() {
|
|
846
|
+
const [formInstanceId, setFormInstanceId] = useState<string>("");
|
|
847
|
+
const [formRevision, setFormRevision] = useState<number>(1);
|
|
848
|
+
|
|
849
|
+
// Get Form Schema Hook - disabled by default
|
|
850
|
+
const formSchemaQuery = useGetFormSchema(
|
|
851
|
+
formInstanceId || null,
|
|
852
|
+
formRevision ? Number(formRevision) : null
|
|
853
|
+
);
|
|
854
|
+
|
|
855
|
+
// Handle Load Example
|
|
856
|
+
const handleLoadExample = () => {
|
|
857
|
+
setFormInstanceId(DEFAULT_FORM_INSTANCE_ID);
|
|
858
|
+
setFormRevision(DEFAULT_FORM_REVISION);
|
|
859
|
+
toast.info(
|
|
860
|
+
'Example form instance ID and revision loaded. Click "Get Form Schema" to fetch.'
|
|
861
|
+
);
|
|
862
|
+
};
|
|
863
|
+
|
|
864
|
+
// Handle Get Form Schema
|
|
865
|
+
const handleGetFormSchema = async () => {
|
|
866
|
+
if (!formInstanceId || !formRevision) {
|
|
867
|
+
toast.error("Please enter form instance ID and revision");
|
|
868
|
+
return;
|
|
869
|
+
}
|
|
870
|
+
try {
|
|
871
|
+
const result = await formSchemaQuery.refetch();
|
|
872
|
+
if (result.data) {
|
|
873
|
+
console.log("Form schema:", result.data);
|
|
874
|
+
toast.success("Form schema loaded! Check console for data.");
|
|
875
|
+
}
|
|
876
|
+
} catch (error: any) {
|
|
877
|
+
toast.error(`Error: ${error.message}`);
|
|
878
|
+
}
|
|
879
|
+
};
|
|
880
|
+
|
|
881
|
+
return (
|
|
882
|
+
<Card className="mb-6">
|
|
883
|
+
<CardHeader>
|
|
884
|
+
<CardTitle>Form Schema Operations Test</CardTitle>
|
|
885
|
+
<CardDescription>
|
|
886
|
+
Get form schema by form instance ID and revision
|
|
887
|
+
</CardDescription>
|
|
888
|
+
</CardHeader>
|
|
889
|
+
<CardContent className="space-y-4">
|
|
890
|
+
<div className="space-y-2">
|
|
891
|
+
<Label htmlFor="formInstanceId">Form Instance ID</Label>
|
|
892
|
+
<div className="flex gap-2">
|
|
893
|
+
<Input
|
|
894
|
+
id="formInstanceId"
|
|
895
|
+
value={formInstanceId}
|
|
896
|
+
onChange={(e) => setFormInstanceId(e.target.value)}
|
|
897
|
+
placeholder="Enter form instance ID"
|
|
898
|
+
/>
|
|
899
|
+
<Button onClick={handleLoadExample} variant="outline" type="button">
|
|
900
|
+
Load Example
|
|
901
|
+
</Button>
|
|
902
|
+
</div>
|
|
903
|
+
<p className="text-xs text-muted-foreground">
|
|
904
|
+
Example:{" "}
|
|
905
|
+
<button
|
|
906
|
+
type="button"
|
|
907
|
+
onClick={handleLoadExample}
|
|
908
|
+
className="underline text-blue-600 hover:text-blue-800"
|
|
909
|
+
>
|
|
910
|
+
{DEFAULT_FORM_INSTANCE_ID || "Enter form instance ID"}
|
|
911
|
+
</button>
|
|
912
|
+
</p>
|
|
913
|
+
</div>
|
|
914
|
+
|
|
915
|
+
<div className="space-y-2">
|
|
916
|
+
<Label htmlFor="formRevision">Form Revision</Label>
|
|
917
|
+
<Input
|
|
918
|
+
id="formRevision"
|
|
919
|
+
value={formRevision}
|
|
920
|
+
onChange={(e) => setFormRevision(Number(e.target.value) || 1)}
|
|
921
|
+
placeholder="Enter form revision (e.g., 1)"
|
|
922
|
+
/>
|
|
923
|
+
<p className="text-xs text-muted-foreground">
|
|
924
|
+
Example:{" "}
|
|
925
|
+
<code className="bg-muted px-1 rounded">
|
|
926
|
+
{DEFAULT_FORM_REVISION}
|
|
927
|
+
</code>
|
|
928
|
+
</p>
|
|
929
|
+
</div>
|
|
930
|
+
|
|
931
|
+
<div className="flex gap-4">
|
|
932
|
+
<Button
|
|
933
|
+
onClick={handleGetFormSchema}
|
|
934
|
+
disabled={
|
|
935
|
+
formSchemaQuery.isLoading || !formInstanceId || !formRevision
|
|
936
|
+
}
|
|
937
|
+
variant="default"
|
|
938
|
+
>
|
|
939
|
+
{formSchemaQuery.isLoading ? "Loading..." : "Get Form Schema"}
|
|
940
|
+
</Button>
|
|
941
|
+
</div>
|
|
942
|
+
|
|
943
|
+
{/* Status Messages */}
|
|
944
|
+
{formSchemaQuery.isError && (
|
|
945
|
+
<p className="text-red-500">
|
|
946
|
+
Get Error: {formSchemaQuery.error?.message}
|
|
947
|
+
</p>
|
|
948
|
+
)}
|
|
949
|
+
{formSchemaQuery.isSuccess && formSchemaQuery.data && (
|
|
950
|
+
<p className="text-green-500">✓ Form schema loaded successfully</p>
|
|
951
|
+
)}
|
|
952
|
+
|
|
953
|
+
{/* Form Schema Data Preview */}
|
|
954
|
+
{formSchemaQuery.data && (
|
|
955
|
+
<div className="mt-4 p-4 bg-muted rounded-lg">
|
|
956
|
+
<p className="text-sm font-semibold mb-2">Form Schema Data:</p>
|
|
957
|
+
<pre className="text-xs overflow-auto max-h-60">
|
|
958
|
+
{JSON.stringify(formSchemaQuery.data, null, 2)}
|
|
959
|
+
</pre>
|
|
960
|
+
</div>
|
|
961
|
+
)}
|
|
962
|
+
</CardContent>
|
|
963
|
+
</Card>
|
|
964
|
+
);
|
|
965
|
+
}
|
|
966
|
+
|
|
967
|
+
// Get Audit Logs Test Component
|
|
968
|
+
function GetAuditLogsTestSection() {
|
|
969
|
+
const [auditLogRequest, setAuditLogRequest] = useState<string>("");
|
|
970
|
+
const [auditLogsResult, setAuditLogsResult] = useState<any>(null);
|
|
971
|
+
|
|
972
|
+
// Get Audit Logs Hook
|
|
973
|
+
const getAuditLogsMutation = useGetAuditLogs();
|
|
974
|
+
|
|
975
|
+
// Handle Load Example
|
|
976
|
+
const handleLoadExample = () => {
|
|
977
|
+
setAuditLogRequest(JSON.stringify(DEFAULT_AUDIT_LOG_REQUEST, null, 2));
|
|
978
|
+
toast.info(
|
|
979
|
+
'Example audit log request loaded. Click "Get Audit Logs" to fetch.'
|
|
980
|
+
);
|
|
981
|
+
};
|
|
982
|
+
|
|
983
|
+
// Handle Get Audit Logs
|
|
984
|
+
const handleGetAuditLogs = async () => {
|
|
985
|
+
if (!auditLogRequest) {
|
|
986
|
+
toast.error("Please enter audit log request (JSON)");
|
|
987
|
+
return;
|
|
988
|
+
}
|
|
989
|
+
try {
|
|
990
|
+
let parsedRequest;
|
|
991
|
+
try {
|
|
992
|
+
parsedRequest = JSON.parse(auditLogRequest);
|
|
993
|
+
} catch (e) {
|
|
994
|
+
toast.error("Invalid JSON format");
|
|
995
|
+
return;
|
|
996
|
+
}
|
|
997
|
+
|
|
998
|
+
const result = await getAuditLogsMutation.mutateAsync(parsedRequest);
|
|
999
|
+
setAuditLogsResult(result);
|
|
1000
|
+
toast.success("Audit logs loaded! Check console for data.");
|
|
1001
|
+
} catch (error: any) {
|
|
1002
|
+
console.error("Get audit logs error:", error);
|
|
1003
|
+
toast.error(`Get audit logs failed: ${error.message}`);
|
|
1004
|
+
}
|
|
1005
|
+
};
|
|
1006
|
+
|
|
1007
|
+
return (
|
|
1008
|
+
<Card className="mb-6">
|
|
1009
|
+
<CardHeader>
|
|
1010
|
+
<CardTitle>Get Audit Logs Operations Test</CardTitle>
|
|
1011
|
+
<CardDescription>Get audit logs with filter criteria</CardDescription>
|
|
1012
|
+
</CardHeader>
|
|
1013
|
+
<CardContent className="space-y-4">
|
|
1014
|
+
<div className="space-y-2">
|
|
1015
|
+
<Label htmlFor="auditLogRequest">Audit Log Request (JSON)</Label>
|
|
1016
|
+
<div className="flex gap-2 mb-2">
|
|
1017
|
+
<Button onClick={handleLoadExample} variant="outline" type="button">
|
|
1018
|
+
Load Example
|
|
1019
|
+
</Button>
|
|
1020
|
+
</div>
|
|
1021
|
+
<textarea
|
|
1022
|
+
id="auditLogRequest"
|
|
1023
|
+
value={auditLogRequest}
|
|
1024
|
+
onChange={(e) => setAuditLogRequest(e.target.value)}
|
|
1025
|
+
placeholder="Enter audit log request JSON"
|
|
1026
|
+
className="w-full min-h-[150px] p-2 border rounded-md font-mono text-xs"
|
|
1027
|
+
/>
|
|
1028
|
+
<p className="text-xs text-muted-foreground">
|
|
1029
|
+
Example: Click "Load Example" button above to load sample request
|
|
1030
|
+
</p>
|
|
1031
|
+
</div>
|
|
1032
|
+
|
|
1033
|
+
<div className="flex gap-4">
|
|
1034
|
+
<Button
|
|
1035
|
+
onClick={handleGetAuditLogs}
|
|
1036
|
+
disabled={getAuditLogsMutation.isPending || !auditLogRequest}
|
|
1037
|
+
variant="default"
|
|
1038
|
+
>
|
|
1039
|
+
{getAuditLogsMutation.isPending ? "Loading..." : "Get Audit Logs"}
|
|
1040
|
+
</Button>
|
|
1041
|
+
</div>
|
|
1042
|
+
|
|
1043
|
+
{/* Status Messages */}
|
|
1044
|
+
{getAuditLogsMutation.isError && (
|
|
1045
|
+
<p className="text-red-500">
|
|
1046
|
+
Get Error: {getAuditLogsMutation.error?.message}
|
|
1047
|
+
</p>
|
|
1048
|
+
)}
|
|
1049
|
+
{getAuditLogsMutation.isSuccess && auditLogsResult && (
|
|
1050
|
+
<p className="text-green-500">
|
|
1051
|
+
✓ Audit logs loaded successfully (Count:{" "}
|
|
1052
|
+
{auditLogsResult.count || 0})
|
|
1053
|
+
</p>
|
|
1054
|
+
)}
|
|
1055
|
+
|
|
1056
|
+
{/* Audit Logs Result Preview */}
|
|
1057
|
+
{auditLogsResult && (
|
|
1058
|
+
<div className="mt-4 p-4 bg-muted rounded-lg">
|
|
1059
|
+
<p className="text-sm font-semibold mb-2">Audit Logs Result:</p>
|
|
1060
|
+
<pre className="text-xs overflow-auto max-h-60">
|
|
1061
|
+
{JSON.stringify(auditLogsResult, null, 2)}
|
|
1062
|
+
</pre>
|
|
1063
|
+
</div>
|
|
1064
|
+
)}
|
|
1065
|
+
</CardContent>
|
|
1066
|
+
</Card>
|
|
1067
|
+
);
|
|
1068
|
+
}
|
|
1069
|
+
|
|
1070
|
+
// Create Audit Log Test Component
|
|
1071
|
+
function CreateAuditLogTestSection() {
|
|
1072
|
+
const [auditRecords, setAuditRecords] = useState<string>("");
|
|
1073
|
+
const [createResult, setCreateResult] = useState<any>(null);
|
|
1074
|
+
|
|
1075
|
+
// Create Audit Log Hook
|
|
1076
|
+
const createAuditLogMutation = useCreateAuditLog();
|
|
1077
|
+
|
|
1078
|
+
// Handle Load Example
|
|
1079
|
+
const handleLoadExample = () => {
|
|
1080
|
+
const exampleRecords = DEFAULT_AUDIT_RECORD;
|
|
1081
|
+
setAuditRecords(JSON.stringify(exampleRecords, null, 2));
|
|
1082
|
+
toast.info(
|
|
1083
|
+
'Example audit record loaded. Click "Create Audit Log" to create.'
|
|
1084
|
+
);
|
|
1085
|
+
};
|
|
1086
|
+
|
|
1087
|
+
// Handle Create Audit Log
|
|
1088
|
+
const handleCreateAuditLog = async () => {
|
|
1089
|
+
if (!auditRecords) {
|
|
1090
|
+
toast.error("Please enter audit records (JSON array)");
|
|
1091
|
+
return;
|
|
1092
|
+
}
|
|
1093
|
+
try {
|
|
1094
|
+
let parsedRecords;
|
|
1095
|
+
try {
|
|
1096
|
+
parsedRecords = JSON.parse(auditRecords);
|
|
1097
|
+
} catch (e) {
|
|
1098
|
+
toast.error("Invalid JSON format");
|
|
1099
|
+
return;
|
|
1100
|
+
}
|
|
1101
|
+
|
|
1102
|
+
if (!Array.isArray(parsedRecords)) {
|
|
1103
|
+
toast.error("Audit records must be an array");
|
|
1104
|
+
return;
|
|
1105
|
+
}
|
|
1106
|
+
|
|
1107
|
+
const result = await createAuditLogMutation.mutateAsync({
|
|
1108
|
+
auditRecords: parsedRecords,
|
|
1109
|
+
});
|
|
1110
|
+
console.log("Audit log created:", result);
|
|
1111
|
+
setCreateResult(result);
|
|
1112
|
+
toast.success("Audit log created successfully! Check console for data.");
|
|
1113
|
+
} catch (error: any) {
|
|
1114
|
+
console.error("Create audit log error:", error);
|
|
1115
|
+
toast.error(`Create audit log failed: ${error.message}`);
|
|
1116
|
+
}
|
|
1117
|
+
};
|
|
1118
|
+
|
|
1119
|
+
return (
|
|
1120
|
+
<Card className="mb-6">
|
|
1121
|
+
<CardHeader>
|
|
1122
|
+
<CardTitle>Create Audit Log Operations Test</CardTitle>
|
|
1123
|
+
<CardDescription>Create audit log records</CardDescription>
|
|
1124
|
+
</CardHeader>
|
|
1125
|
+
<CardContent className="space-y-4">
|
|
1126
|
+
<div className="space-y-2">
|
|
1127
|
+
<Label htmlFor="auditRecords">Audit Records (JSON Array)</Label>
|
|
1128
|
+
<div className="flex gap-2 mb-2">
|
|
1129
|
+
<Button onClick={handleLoadExample} variant="outline" type="button">
|
|
1130
|
+
Load Example
|
|
1131
|
+
</Button>
|
|
1132
|
+
</div>
|
|
1133
|
+
<textarea
|
|
1134
|
+
id="auditRecords"
|
|
1135
|
+
value={auditRecords}
|
|
1136
|
+
onChange={(e) => setAuditRecords(e.target.value)}
|
|
1137
|
+
placeholder="Enter audit records as JSON array"
|
|
1138
|
+
className="w-full min-h-[200px] p-2 border rounded-md font-mono text-xs"
|
|
1139
|
+
/>
|
|
1140
|
+
<p className="text-xs text-muted-foreground">
|
|
1141
|
+
Example: Click "Load Example" button above to load sample audit
|
|
1142
|
+
record
|
|
1143
|
+
</p>
|
|
1144
|
+
</div>
|
|
1145
|
+
|
|
1146
|
+
<div className="flex gap-4">
|
|
1147
|
+
<Button
|
|
1148
|
+
onClick={handleCreateAuditLog}
|
|
1149
|
+
disabled={createAuditLogMutation.isPending || !auditRecords}
|
|
1150
|
+
variant="default"
|
|
1151
|
+
>
|
|
1152
|
+
{createAuditLogMutation.isPending
|
|
1153
|
+
? "Creating..."
|
|
1154
|
+
: "Create Audit Log"}
|
|
1155
|
+
</Button>
|
|
1156
|
+
</div>
|
|
1157
|
+
|
|
1158
|
+
{/* Status Messages */}
|
|
1159
|
+
{createAuditLogMutation.isError && (
|
|
1160
|
+
<p className="text-red-500">
|
|
1161
|
+
Create Error: {createAuditLogMutation.error?.message}
|
|
1162
|
+
</p>
|
|
1163
|
+
)}
|
|
1164
|
+
{createAuditLogMutation.isSuccess && createResult && (
|
|
1165
|
+
<p className="text-green-500">✓ Audit log created successfully</p>
|
|
1166
|
+
)}
|
|
1167
|
+
|
|
1168
|
+
{/* Create Result Preview */}
|
|
1169
|
+
{createResult && (
|
|
1170
|
+
<div className="mt-4 p-4 bg-muted rounded-lg">
|
|
1171
|
+
<p className="text-sm font-semibold mb-2">Create Result:</p>
|
|
1172
|
+
<pre className="text-xs overflow-auto max-h-60">
|
|
1173
|
+
{JSON.stringify(createResult, null, 2)}
|
|
1174
|
+
</pre>
|
|
1175
|
+
</div>
|
|
1176
|
+
)}
|
|
1177
|
+
</CardContent>
|
|
1178
|
+
</Card>
|
|
1179
|
+
);
|
|
1180
|
+
}
|
|
1181
|
+
|
|
1182
|
+
// Get All Templated Pipelines Test Component
|
|
1183
|
+
function GetAllTemplatedPipelinesTestSection() {
|
|
1184
|
+
const [templatedPipelinesResult, setTemplatedPipelinesResult] =
|
|
1185
|
+
useState<any>(null);
|
|
1186
|
+
|
|
1187
|
+
// Get All Templated Pipelines Hook - disabled by default
|
|
1188
|
+
const templatedPipelinesQuery = useGetAllTemplatedPipelines({
|
|
1189
|
+
enabled: false,
|
|
1190
|
+
});
|
|
1191
|
+
|
|
1192
|
+
// Handle Get All Templated Pipelines
|
|
1193
|
+
const handleGetAllTemplatedPipelines = async () => {
|
|
1194
|
+
try {
|
|
1195
|
+
const result = await templatedPipelinesQuery.refetch();
|
|
1196
|
+
if (result.data) {
|
|
1197
|
+
setTemplatedPipelinesResult(result.data);
|
|
1198
|
+
console.log("Templated pipelines:", result.data);
|
|
1199
|
+
toast.success("Templated pipelines loaded! Check console for data.");
|
|
1200
|
+
}
|
|
1201
|
+
} catch (error: any) {
|
|
1202
|
+
toast.error(`Error: ${error.message}`);
|
|
1203
|
+
}
|
|
1204
|
+
};
|
|
1205
|
+
|
|
1206
|
+
return (
|
|
1207
|
+
<Card className="mb-6">
|
|
1208
|
+
<CardHeader>
|
|
1209
|
+
<CardTitle>Get All Templated Pipelines Test</CardTitle>
|
|
1210
|
+
<CardDescription>Get all templated pipeline workflows</CardDescription>
|
|
1211
|
+
</CardHeader>
|
|
1212
|
+
<CardContent className="space-y-4">
|
|
1213
|
+
<div className="flex gap-4">
|
|
1214
|
+
<Button
|
|
1215
|
+
onClick={handleGetAllTemplatedPipelines}
|
|
1216
|
+
disabled={templatedPipelinesQuery.isLoading}
|
|
1217
|
+
variant="default"
|
|
1218
|
+
>
|
|
1219
|
+
{templatedPipelinesQuery.isLoading
|
|
1220
|
+
? "Loading..."
|
|
1221
|
+
: "Get All Templated Pipelines"}
|
|
1222
|
+
</Button>
|
|
1223
|
+
</div>
|
|
1224
|
+
|
|
1225
|
+
{/* Status Messages */}
|
|
1226
|
+
{templatedPipelinesQuery.isError && (
|
|
1227
|
+
<p className="text-red-500">
|
|
1228
|
+
Get Error: {templatedPipelinesQuery.error?.message}
|
|
1229
|
+
</p>
|
|
1230
|
+
)}
|
|
1231
|
+
{templatedPipelinesQuery.isSuccess && templatedPipelinesResult && (
|
|
1232
|
+
<p className="text-green-500">
|
|
1233
|
+
✓ Templated pipelines loaded successfully (Count:{" "}
|
|
1234
|
+
{templatedPipelinesResult.length || 0})
|
|
1235
|
+
</p>
|
|
1236
|
+
)}
|
|
1237
|
+
|
|
1238
|
+
{/* Templated Pipelines Result Preview */}
|
|
1239
|
+
{templatedPipelinesResult && (
|
|
1240
|
+
<div className="mt-4 p-4 bg-muted rounded-lg">
|
|
1241
|
+
<p className="text-sm font-semibold mb-2">
|
|
1242
|
+
Templated Pipelines Result:
|
|
1243
|
+
</p>
|
|
1244
|
+
<pre className="text-xs overflow-auto max-h-60">
|
|
1245
|
+
{JSON.stringify(templatedPipelinesResult, null, 2)}
|
|
1246
|
+
</pre>
|
|
1247
|
+
</div>
|
|
1248
|
+
)}
|
|
1249
|
+
</CardContent>
|
|
1250
|
+
</Card>
|
|
1251
|
+
);
|
|
1252
|
+
}
|
|
1253
|
+
|
|
1254
|
+
// Get All Recon Test Component
|
|
1255
|
+
function GetAllReconTestSection() {
|
|
1256
|
+
const [reconResult, setReconResult] = useState<any>(null);
|
|
1257
|
+
|
|
1258
|
+
// Get All Recon Hook - disabled by default
|
|
1259
|
+
const reconQuery = useGetAllRecon({
|
|
1260
|
+
enabled: false,
|
|
1261
|
+
});
|
|
1262
|
+
|
|
1263
|
+
// Handle Get All Recon
|
|
1264
|
+
const handleGetAllRecon = async () => {
|
|
1265
|
+
try {
|
|
1266
|
+
const result = await reconQuery.refetch();
|
|
1267
|
+
if (result.data) {
|
|
1268
|
+
setReconResult(result.data);
|
|
1269
|
+
console.log("Recon workflows:", result.data);
|
|
1270
|
+
toast.success("Recon workflows loaded! Check console for data.");
|
|
1271
|
+
}
|
|
1272
|
+
} catch (error: any) {
|
|
1273
|
+
toast.error(`Error: ${error.message}`);
|
|
1274
|
+
}
|
|
1275
|
+
};
|
|
1276
|
+
|
|
1277
|
+
return (
|
|
1278
|
+
<Card className="mb-6">
|
|
1279
|
+
<CardHeader>
|
|
1280
|
+
<CardTitle>Get All Recon Workflows Test</CardTitle>
|
|
1281
|
+
<CardDescription>Get all reconciliation workflows</CardDescription>
|
|
1282
|
+
</CardHeader>
|
|
1283
|
+
<CardContent className="space-y-4">
|
|
1284
|
+
<div className="flex gap-4">
|
|
1285
|
+
<Button
|
|
1286
|
+
onClick={handleGetAllRecon}
|
|
1287
|
+
disabled={reconQuery.isLoading}
|
|
1288
|
+
variant="default"
|
|
1289
|
+
>
|
|
1290
|
+
{reconQuery.isLoading ? "Loading..." : "Get All Recon Workflows"}
|
|
1291
|
+
</Button>
|
|
1292
|
+
</div>
|
|
1293
|
+
|
|
1294
|
+
{/* Status Messages */}
|
|
1295
|
+
{reconQuery.isError && (
|
|
1296
|
+
<p className="text-red-500">Get Error: {reconQuery.error?.message}</p>
|
|
1297
|
+
)}
|
|
1298
|
+
{reconQuery.isSuccess && reconResult && (
|
|
1299
|
+
<p className="text-green-500">
|
|
1300
|
+
✓ Recon workflows loaded successfully (Count:{" "}
|
|
1301
|
+
{reconResult.length || 0})
|
|
1302
|
+
</p>
|
|
1303
|
+
)}
|
|
1304
|
+
|
|
1305
|
+
{/* Recon Result Preview */}
|
|
1306
|
+
{reconResult && (
|
|
1307
|
+
<div className="mt-4 p-4 bg-muted rounded-lg">
|
|
1308
|
+
<p className="text-sm font-semibold mb-2">
|
|
1309
|
+
Recon Workflows Result:
|
|
1310
|
+
</p>
|
|
1311
|
+
<pre className="text-xs overflow-auto max-h-60">
|
|
1312
|
+
{JSON.stringify(reconResult, null, 2)}
|
|
1313
|
+
</pre>
|
|
1314
|
+
</div>
|
|
1315
|
+
)}
|
|
1316
|
+
</CardContent>
|
|
1317
|
+
</Card>
|
|
1318
|
+
);
|
|
1319
|
+
}
|
|
1320
|
+
|
|
1321
|
+
// Get Form By ID Test Component
|
|
1322
|
+
function GetFormByIdTestSection() {
|
|
1323
|
+
const [formId, setFormId] = useState<string>("");
|
|
1324
|
+
const [formResult, setFormResult] = useState<any>(null);
|
|
1325
|
+
|
|
1326
|
+
// Get Form By ID Hook - disabled by default
|
|
1327
|
+
const formQuery = useGetFormById(formId || null, {
|
|
1328
|
+
enabled: false,
|
|
1329
|
+
});
|
|
1330
|
+
|
|
1331
|
+
// Handle Load Example
|
|
1332
|
+
const handleLoadExample = () => {
|
|
1333
|
+
setFormId(DEFAULT_FORM_ID);
|
|
1334
|
+
toast.info('Example form ID loaded. Click "Get Form By ID" to fetch.');
|
|
1335
|
+
};
|
|
1336
|
+
|
|
1337
|
+
// Handle Get Form By ID
|
|
1338
|
+
const handleGetFormById = async () => {
|
|
1339
|
+
if (!formId) {
|
|
1340
|
+
toast.error("Please enter a form ID");
|
|
1341
|
+
return;
|
|
1342
|
+
}
|
|
1343
|
+
try {
|
|
1344
|
+
const result = await formQuery.refetch();
|
|
1345
|
+
if (result.data) {
|
|
1346
|
+
setFormResult(result.data);
|
|
1347
|
+
console.log("Form:", result.data);
|
|
1348
|
+
toast.success("Form loaded! Check console for data.");
|
|
1349
|
+
}
|
|
1350
|
+
} catch (error: any) {
|
|
1351
|
+
toast.error(`Error: ${error.message}`);
|
|
1352
|
+
}
|
|
1353
|
+
};
|
|
1354
|
+
|
|
1355
|
+
return (
|
|
1356
|
+
<Card className="mb-6">
|
|
1357
|
+
<CardHeader>
|
|
1358
|
+
<CardTitle>Get Form By ID Test</CardTitle>
|
|
1359
|
+
<CardDescription>Get form details by form ID</CardDescription>
|
|
1360
|
+
</CardHeader>
|
|
1361
|
+
<CardContent className="space-y-4">
|
|
1362
|
+
<div className="space-y-2">
|
|
1363
|
+
<Label htmlFor="formId">Form ID</Label>
|
|
1364
|
+
<div className="flex gap-2">
|
|
1365
|
+
<Input
|
|
1366
|
+
id="formId"
|
|
1367
|
+
value={formId}
|
|
1368
|
+
onChange={(e) => setFormId(e.target.value)}
|
|
1369
|
+
placeholder="Enter form ID"
|
|
1370
|
+
/>
|
|
1371
|
+
<Button onClick={handleLoadExample} variant="outline" type="button">
|
|
1372
|
+
Load Example
|
|
1373
|
+
</Button>
|
|
1374
|
+
</div>
|
|
1375
|
+
<p className="text-xs text-muted-foreground">
|
|
1376
|
+
Example:{" "}
|
|
1377
|
+
<button
|
|
1378
|
+
type="button"
|
|
1379
|
+
onClick={handleLoadExample}
|
|
1380
|
+
className="underline text-blue-600 hover:text-blue-800"
|
|
1381
|
+
>
|
|
1382
|
+
{DEFAULT_FORM_ID || "Enter form ID"}
|
|
1383
|
+
</button>
|
|
1384
|
+
</p>
|
|
1385
|
+
</div>
|
|
1386
|
+
|
|
1387
|
+
<div className="flex gap-4">
|
|
1388
|
+
<Button
|
|
1389
|
+
onClick={handleGetFormById}
|
|
1390
|
+
disabled={formQuery.isLoading || !formId}
|
|
1391
|
+
variant="default"
|
|
1392
|
+
>
|
|
1393
|
+
{formQuery.isLoading ? "Loading..." : "Get Form By ID"}
|
|
1394
|
+
</Button>
|
|
1395
|
+
</div>
|
|
1396
|
+
|
|
1397
|
+
{/* Status Messages */}
|
|
1398
|
+
{formQuery.isError && (
|
|
1399
|
+
<p className="text-red-500">Get Error: {formQuery.error?.message}</p>
|
|
1400
|
+
)}
|
|
1401
|
+
{formQuery.isSuccess && formResult && (
|
|
1402
|
+
<p className="text-green-500">
|
|
1403
|
+
✓ Form loaded successfully (ID: {formResult.id || formId})
|
|
1404
|
+
</p>
|
|
1405
|
+
)}
|
|
1406
|
+
|
|
1407
|
+
{/* Form Result Preview */}
|
|
1408
|
+
{formResult && (
|
|
1409
|
+
<div className="mt-4 p-4 bg-muted rounded-lg">
|
|
1410
|
+
<p className="text-sm font-semibold mb-2">Form Result:</p>
|
|
1411
|
+
<pre className="text-xs overflow-auto max-h-60">
|
|
1412
|
+
{JSON.stringify(formResult, null, 2)}
|
|
1413
|
+
</pre>
|
|
1414
|
+
</div>
|
|
1415
|
+
)}
|
|
1416
|
+
</CardContent>
|
|
1417
|
+
</Card>
|
|
1418
|
+
);
|
|
1419
|
+
}
|
|
1420
|
+
|
|
1421
|
+
// Create Or Update Form Test Component
|
|
1422
|
+
function CreateOrUpdateFormTestSection() {
|
|
1423
|
+
const [formData, setFormData] = useState<string>("");
|
|
1424
|
+
const [createResult, setCreateResult] = useState<any>(null);
|
|
1425
|
+
|
|
1426
|
+
// Create Or Update Form Hook
|
|
1427
|
+
const createOrUpdateFormMutation = useCreateOrUpdateForm();
|
|
1428
|
+
|
|
1429
|
+
// Handle Create Or Update Form
|
|
1430
|
+
const handleCreateOrUpdateForm = async () => {
|
|
1431
|
+
if (!formData) {
|
|
1432
|
+
toast.error("Please enter form data (JSON)");
|
|
1433
|
+
return;
|
|
1434
|
+
}
|
|
1435
|
+
try {
|
|
1436
|
+
let parsedForm;
|
|
1437
|
+
try {
|
|
1438
|
+
parsedForm = JSON.parse(formData);
|
|
1439
|
+
} catch (e) {
|
|
1440
|
+
toast.error("Invalid JSON format");
|
|
1441
|
+
return;
|
|
1442
|
+
}
|
|
1443
|
+
|
|
1444
|
+
const result = await createOrUpdateFormMutation.mutateAsync({
|
|
1445
|
+
data: parsedForm,
|
|
1446
|
+
});
|
|
1447
|
+
console.log("Form created/updated:", result);
|
|
1448
|
+
setCreateResult(result);
|
|
1449
|
+
toast.success(
|
|
1450
|
+
"Form created/updated successfully! Check console for data."
|
|
1451
|
+
);
|
|
1452
|
+
} catch (error: any) {
|
|
1453
|
+
console.error("Create/Update form error:", error);
|
|
1454
|
+
toast.error(`Create/Update form failed: ${error.message}`);
|
|
1455
|
+
}
|
|
1456
|
+
};
|
|
1457
|
+
|
|
1458
|
+
return (
|
|
1459
|
+
<Card className="mb-6">
|
|
1460
|
+
<CardHeader>
|
|
1461
|
+
<CardTitle>Create Or Update Form Test</CardTitle>
|
|
1462
|
+
<CardDescription>Create or update a form</CardDescription>
|
|
1463
|
+
</CardHeader>
|
|
1464
|
+
<CardContent className="space-y-4">
|
|
1465
|
+
<div className="space-y-2">
|
|
1466
|
+
<Label htmlFor="formData">Form Data (JSON)</Label>
|
|
1467
|
+
<div className="flex gap-2 mb-2">
|
|
1468
|
+
</div>
|
|
1469
|
+
<textarea
|
|
1470
|
+
id="formData"
|
|
1471
|
+
value={formData}
|
|
1472
|
+
onChange={(e) => setFormData(e.target.value)}
|
|
1473
|
+
placeholder="Enter form data as JSON"
|
|
1474
|
+
className="w-full min-h-[200px] p-2 border rounded-md font-mono text-xs"
|
|
1475
|
+
/>
|
|
1476
|
+
<p className="text-xs text-muted-foreground">
|
|
1477
|
+
Example: Click "Load Example" button above to load sample form data
|
|
1478
|
+
</p>
|
|
1479
|
+
</div>
|
|
1480
|
+
|
|
1481
|
+
<div className="flex gap-4">
|
|
1482
|
+
<Button
|
|
1483
|
+
onClick={handleCreateOrUpdateForm}
|
|
1484
|
+
disabled={createOrUpdateFormMutation.isPending || !formData}
|
|
1485
|
+
variant="default"
|
|
1486
|
+
>
|
|
1487
|
+
{createOrUpdateFormMutation.isPending
|
|
1488
|
+
? "Saving..."
|
|
1489
|
+
: "Create Or Update Form"}
|
|
1490
|
+
</Button>
|
|
1491
|
+
</div>
|
|
1492
|
+
|
|
1493
|
+
{/* Status Messages */}
|
|
1494
|
+
{createOrUpdateFormMutation.isError && (
|
|
1495
|
+
<p className="text-red-500">
|
|
1496
|
+
Create/Update Error: {createOrUpdateFormMutation.error?.message}
|
|
1497
|
+
</p>
|
|
1498
|
+
)}
|
|
1499
|
+
{createOrUpdateFormMutation.isSuccess && createResult && (
|
|
1500
|
+
<p className="text-green-500">✓ Form created/updated successfully</p>
|
|
1501
|
+
)}
|
|
1502
|
+
|
|
1503
|
+
{/* Create Result Preview */}
|
|
1504
|
+
{createResult && (
|
|
1505
|
+
<div className="mt-4 p-4 bg-muted rounded-lg">
|
|
1506
|
+
<p className="text-sm font-semibold mb-2">Form Result:</p>
|
|
1507
|
+
<pre className="text-xs overflow-auto max-h-60">
|
|
1508
|
+
{JSON.stringify(createResult, null, 2)}
|
|
1509
|
+
</pre>
|
|
1510
|
+
</div>
|
|
1511
|
+
)}
|
|
1512
|
+
</CardContent>
|
|
1513
|
+
</Card>
|
|
1514
|
+
);
|
|
1515
|
+
}
|
|
1516
|
+
|
|
1517
|
+
// Mark Task Done Test Component
|
|
1518
|
+
function MarkTaskDoneTestSection() {
|
|
1519
|
+
const [taskId, setTaskId] = useState<string>("");
|
|
1520
|
+
const [taskData, setTaskData] = useState<string>("");
|
|
1521
|
+
const [markResult, setMarkResult] = useState<any>(null);
|
|
1522
|
+
|
|
1523
|
+
// Mark Task Done Hook
|
|
1524
|
+
const markTaskDoneMutation = useMarkTaskDone();
|
|
1525
|
+
|
|
1526
|
+
// Handle Load Example
|
|
1527
|
+
const handleLoadExample = () => {
|
|
1528
|
+
setTaskId(DEFAULT_TASK_ID);
|
|
1529
|
+
const exampleTaskData = {
|
|
1530
|
+
notes: "Task completed successfully",
|
|
1531
|
+
completedAt: new Date().toISOString(),
|
|
1532
|
+
};
|
|
1533
|
+
setTaskData(JSON.stringify(exampleTaskData, null, 2));
|
|
1534
|
+
toast.info(
|
|
1535
|
+
'Example task ID and data loaded. Click "Mark Task Done" to complete.'
|
|
1536
|
+
);
|
|
1537
|
+
};
|
|
1538
|
+
|
|
1539
|
+
// Handle Mark Task Done
|
|
1540
|
+
const handleMarkTaskDone = async () => {
|
|
1541
|
+
if (!taskId) {
|
|
1542
|
+
toast.error("Please enter a task ID");
|
|
1543
|
+
return;
|
|
1544
|
+
}
|
|
1545
|
+
if (!taskData) {
|
|
1546
|
+
toast.error("Please enter task completion data (JSON)");
|
|
1547
|
+
return;
|
|
1548
|
+
}
|
|
1549
|
+
try {
|
|
1550
|
+
let parsedData;
|
|
1551
|
+
try {
|
|
1552
|
+
parsedData = JSON.parse(taskData);
|
|
1553
|
+
} catch (e) {
|
|
1554
|
+
toast.error("Invalid JSON format");
|
|
1555
|
+
return;
|
|
1556
|
+
}
|
|
1557
|
+
|
|
1558
|
+
const result = await markTaskDoneMutation.mutateAsync({
|
|
1559
|
+
taskId,
|
|
1560
|
+
data: parsedData,
|
|
1561
|
+
});
|
|
1562
|
+
console.log("Task marked as done:", result);
|
|
1563
|
+
setMarkResult(result);
|
|
1564
|
+
toast.success(
|
|
1565
|
+
"Task marked as done successfully! Check console for data."
|
|
1566
|
+
);
|
|
1567
|
+
} catch (error: any) {
|
|
1568
|
+
console.error("Mark task done error:", error);
|
|
1569
|
+
toast.error(`Mark task done failed: ${error.message}`);
|
|
1570
|
+
}
|
|
1571
|
+
};
|
|
1572
|
+
|
|
1573
|
+
return (
|
|
1574
|
+
<Card className="mb-6">
|
|
1575
|
+
<CardHeader>
|
|
1576
|
+
<CardTitle>Mark Task Done Test</CardTitle>
|
|
1577
|
+
<CardDescription>Mark a task as completed</CardDescription>
|
|
1578
|
+
</CardHeader>
|
|
1579
|
+
<CardContent className="space-y-4">
|
|
1580
|
+
<div className="space-y-2">
|
|
1581
|
+
<Label htmlFor="taskId">Task ID</Label>
|
|
1582
|
+
<div className="flex gap-2">
|
|
1583
|
+
<Input
|
|
1584
|
+
id="taskId"
|
|
1585
|
+
value={taskId}
|
|
1586
|
+
onChange={(e) => setTaskId(e.target.value)}
|
|
1587
|
+
placeholder="Enter task ID"
|
|
1588
|
+
/>
|
|
1589
|
+
<Button onClick={handleLoadExample} variant="outline" type="button">
|
|
1590
|
+
Load Example
|
|
1591
|
+
</Button>
|
|
1592
|
+
</div>
|
|
1593
|
+
<p className="text-xs text-muted-foreground">
|
|
1594
|
+
Example:{" "}
|
|
1595
|
+
<button
|
|
1596
|
+
type="button"
|
|
1597
|
+
onClick={handleLoadExample}
|
|
1598
|
+
className="underline text-blue-600 hover:text-blue-800"
|
|
1599
|
+
>
|
|
1600
|
+
{DEFAULT_TASK_ID}
|
|
1601
|
+
</button>
|
|
1602
|
+
</p>
|
|
1603
|
+
</div>
|
|
1604
|
+
|
|
1605
|
+
<div className="space-y-2">
|
|
1606
|
+
<Label htmlFor="taskData">Task Completion Data (JSON)</Label>
|
|
1607
|
+
<textarea
|
|
1608
|
+
id="taskData"
|
|
1609
|
+
value={taskData}
|
|
1610
|
+
onChange={(e) => setTaskData(e.target.value)}
|
|
1611
|
+
placeholder="Enter task completion data as JSON"
|
|
1612
|
+
className="w-full min-h-[150px] p-2 border rounded-md font-mono text-xs"
|
|
1613
|
+
/>
|
|
1614
|
+
<p className="text-xs text-muted-foreground">
|
|
1615
|
+
Example: Click "Load Example" button above to load sample data
|
|
1616
|
+
</p>
|
|
1617
|
+
</div>
|
|
1618
|
+
|
|
1619
|
+
<div className="flex gap-4">
|
|
1620
|
+
<Button
|
|
1621
|
+
onClick={handleMarkTaskDone}
|
|
1622
|
+
disabled={markTaskDoneMutation.isPending || !taskId || !taskData}
|
|
1623
|
+
variant="default"
|
|
1624
|
+
>
|
|
1625
|
+
{markTaskDoneMutation.isPending ? "Marking..." : "Mark Task Done"}
|
|
1626
|
+
</Button>
|
|
1627
|
+
</div>
|
|
1628
|
+
|
|
1629
|
+
{/* Status Messages */}
|
|
1630
|
+
{markTaskDoneMutation.isError && (
|
|
1631
|
+
<p className="text-red-500">
|
|
1632
|
+
Mark Error: {markTaskDoneMutation.error?.message}
|
|
1633
|
+
</p>
|
|
1634
|
+
)}
|
|
1635
|
+
{markTaskDoneMutation.isSuccess && markResult && (
|
|
1636
|
+
<p className="text-green-500">✓ Task marked as done successfully</p>
|
|
1637
|
+
)}
|
|
1638
|
+
|
|
1639
|
+
{/* Mark Result Preview */}
|
|
1640
|
+
{markResult && (
|
|
1641
|
+
<div className="mt-4 p-4 bg-muted rounded-lg">
|
|
1642
|
+
<p className="text-sm font-semibold mb-2">Task Result:</p>
|
|
1643
|
+
<pre className="text-xs overflow-auto max-h-60">
|
|
1644
|
+
{JSON.stringify(markResult, null, 2)}
|
|
1645
|
+
</pre>
|
|
1646
|
+
</div>
|
|
1647
|
+
)}
|
|
1648
|
+
</CardContent>
|
|
1649
|
+
</Card>
|
|
1650
|
+
);
|
|
1651
|
+
}
|
|
1652
|
+
|
|
1653
|
+
// Reassign Task Test Component
|
|
1654
|
+
function ReassignTaskTestSection() {
|
|
1655
|
+
const [taskId, setTaskId] = useState<string>("");
|
|
1656
|
+
const [newAssignee, setNewAssignee] = useState<string>("");
|
|
1657
|
+
const [assigneeType, setAssigneeType] = useState<"USER" | "TEAM">("USER");
|
|
1658
|
+
const [reassignResult, setReassignResult] = useState<any>(null);
|
|
1659
|
+
|
|
1660
|
+
// Reassign Task Hook
|
|
1661
|
+
const reassignTaskMutation = useReassignTask();
|
|
1662
|
+
|
|
1663
|
+
// Handle Load Example
|
|
1664
|
+
const handleLoadExample = () => {
|
|
1665
|
+
setTaskId(DEFAULT_TASK_ID);
|
|
1666
|
+
setNewAssignee(DEFAULT_NEW_ASSIGNEE);
|
|
1667
|
+
setAssigneeType("USER");
|
|
1668
|
+
toast.info(
|
|
1669
|
+
'Example task ID and assignee loaded. Click "Reassign Task" to reassign.'
|
|
1670
|
+
);
|
|
1671
|
+
};
|
|
1672
|
+
|
|
1673
|
+
// Handle Reassign Task
|
|
1674
|
+
const handleReassignTask = async () => {
|
|
1675
|
+
if (!taskId) {
|
|
1676
|
+
toast.error("Please enter a task ID");
|
|
1677
|
+
return;
|
|
1678
|
+
}
|
|
1679
|
+
if (!newAssignee) {
|
|
1680
|
+
toast.error("Please enter a new assignee");
|
|
1681
|
+
return;
|
|
1682
|
+
}
|
|
1683
|
+
try {
|
|
1684
|
+
const result = await reassignTaskMutation.mutateAsync({
|
|
1685
|
+
taskId,
|
|
1686
|
+
newAssignee,
|
|
1687
|
+
assigneeType,
|
|
1688
|
+
});
|
|
1689
|
+
console.log("Task reassigned:", result);
|
|
1690
|
+
setReassignResult(result);
|
|
1691
|
+
toast.success("Task reassigned successfully! Check console for data.");
|
|
1692
|
+
} catch (error: any) {
|
|
1693
|
+
console.error("Reassign task error:", error);
|
|
1694
|
+
toast.error(`Reassign task failed: ${error.message}`);
|
|
1695
|
+
}
|
|
1696
|
+
};
|
|
1697
|
+
|
|
1698
|
+
return (
|
|
1699
|
+
<Card className="mb-6">
|
|
1700
|
+
<CardHeader>
|
|
1701
|
+
<CardTitle>Reassign Task Test</CardTitle>
|
|
1702
|
+
<CardDescription>Reassign a task to a new assignee</CardDescription>
|
|
1703
|
+
</CardHeader>
|
|
1704
|
+
<CardContent className="space-y-4">
|
|
1705
|
+
<div className="space-y-2">
|
|
1706
|
+
<Label htmlFor="taskId">Task ID</Label>
|
|
1707
|
+
<div className="flex gap-2">
|
|
1708
|
+
<Input
|
|
1709
|
+
id="taskId"
|
|
1710
|
+
value={taskId}
|
|
1711
|
+
onChange={(e) => setTaskId(e.target.value)}
|
|
1712
|
+
placeholder="Enter task ID"
|
|
1713
|
+
/>
|
|
1714
|
+
<Button onClick={handleLoadExample} variant="outline" type="button">
|
|
1715
|
+
Load Example
|
|
1716
|
+
</Button>
|
|
1717
|
+
</div>
|
|
1718
|
+
<p className="text-xs text-muted-foreground">
|
|
1719
|
+
Example:{" "}
|
|
1720
|
+
<button
|
|
1721
|
+
type="button"
|
|
1722
|
+
onClick={handleLoadExample}
|
|
1723
|
+
className="underline text-blue-600 hover:text-blue-800"
|
|
1724
|
+
>
|
|
1725
|
+
{DEFAULT_TASK_ID}
|
|
1726
|
+
</button>
|
|
1727
|
+
</p>
|
|
1728
|
+
</div>
|
|
1729
|
+
|
|
1730
|
+
<div className="space-y-2">
|
|
1731
|
+
<Label htmlFor="newAssignee">New Assignee</Label>
|
|
1732
|
+
<Input
|
|
1733
|
+
id="newAssignee"
|
|
1734
|
+
value={newAssignee}
|
|
1735
|
+
onChange={(e) => setNewAssignee(e.target.value)}
|
|
1736
|
+
placeholder="Enter new assignee ID"
|
|
1737
|
+
/>
|
|
1738
|
+
<p className="text-xs text-muted-foreground">
|
|
1739
|
+
Example: {DEFAULT_NEW_ASSIGNEE}
|
|
1740
|
+
</p>
|
|
1741
|
+
</div>
|
|
1742
|
+
|
|
1743
|
+
<div className="space-y-2">
|
|
1744
|
+
<Label htmlFor="assigneeType">Assignee Type</Label>
|
|
1745
|
+
<select
|
|
1746
|
+
id="assigneeType"
|
|
1747
|
+
value={assigneeType}
|
|
1748
|
+
onChange={(e) => setAssigneeType(e.target.value as "USER" | "TEAM")}
|
|
1749
|
+
className="w-full p-2 border rounded-md"
|
|
1750
|
+
>
|
|
1751
|
+
<option value="USER">USER</option>
|
|
1752
|
+
<option value="TEAM">TEAM</option>
|
|
1753
|
+
</select>
|
|
1754
|
+
</div>
|
|
1755
|
+
|
|
1756
|
+
<div className="flex gap-4">
|
|
1757
|
+
<Button
|
|
1758
|
+
onClick={handleReassignTask}
|
|
1759
|
+
disabled={reassignTaskMutation.isPending || !taskId || !newAssignee}
|
|
1760
|
+
variant="default"
|
|
1761
|
+
>
|
|
1762
|
+
{reassignTaskMutation.isPending
|
|
1763
|
+
? "Reassigning..."
|
|
1764
|
+
: "Reassign Task"}
|
|
1765
|
+
</Button>
|
|
1766
|
+
</div>
|
|
1767
|
+
|
|
1768
|
+
{/* Status Messages */}
|
|
1769
|
+
{reassignTaskMutation.isError && (
|
|
1770
|
+
<p className="text-red-500">
|
|
1771
|
+
Reassign Error: {reassignTaskMutation.error?.message}
|
|
1772
|
+
</p>
|
|
1773
|
+
)}
|
|
1774
|
+
{reassignTaskMutation.isSuccess && reassignResult && (
|
|
1775
|
+
<p className="text-green-500">✓ Task reassigned successfully</p>
|
|
1776
|
+
)}
|
|
1777
|
+
|
|
1778
|
+
{/* Reassign Result Preview */}
|
|
1779
|
+
{reassignResult && (
|
|
1780
|
+
<div className="mt-4 p-4 bg-muted rounded-lg">
|
|
1781
|
+
<p className="text-sm font-semibold mb-2">Task Result:</p>
|
|
1782
|
+
<pre className="text-xs overflow-auto max-h-60">
|
|
1783
|
+
{JSON.stringify(reassignResult, null, 2)}
|
|
1784
|
+
</pre>
|
|
1785
|
+
</div>
|
|
1786
|
+
)}
|
|
1787
|
+
</CardContent>
|
|
1788
|
+
</Card>
|
|
1789
|
+
);
|
|
1790
|
+
}
|
|
1791
|
+
|
|
1792
|
+
// Form Data Test Component
|
|
1793
|
+
function FormDataTestSection() {
|
|
1794
|
+
const [formId, setFormId] = useState<string>("");
|
|
1795
|
+
|
|
1796
|
+
// Get Form Data Hook - disabled by default
|
|
1797
|
+
const formDataQuery = useGetFormData(formId || null);
|
|
1798
|
+
|
|
1799
|
+
// Handle Load Example
|
|
1800
|
+
const handleLoadExample = () => {
|
|
1801
|
+
setFormId(DEFAULT_FORM_ID);
|
|
1802
|
+
toast.info('Example form ID loaded. Click "Get Form Data" to fetch.');
|
|
1803
|
+
};
|
|
1804
|
+
|
|
1805
|
+
// Handle Get Form Data
|
|
1806
|
+
const handleGetFormData = async () => {
|
|
1807
|
+
if (!formId) {
|
|
1808
|
+
toast.error("Please enter a form ID");
|
|
1809
|
+
return;
|
|
1810
|
+
}
|
|
1811
|
+
try {
|
|
1812
|
+
const result = await formDataQuery.refetch();
|
|
1813
|
+
if (result.data) {
|
|
1814
|
+
console.log("Form data:", result.data);
|
|
1815
|
+
toast.success("Form data loaded! Check console for data.");
|
|
1816
|
+
}
|
|
1817
|
+
} catch (error: any) {
|
|
1818
|
+
toast.error(`Error: ${error.message}`);
|
|
1819
|
+
}
|
|
1820
|
+
};
|
|
1821
|
+
|
|
1822
|
+
return (
|
|
1823
|
+
<Card className="mb-6">
|
|
1824
|
+
<CardHeader>
|
|
1825
|
+
<CardTitle>Form Data Operations Test</CardTitle>
|
|
1826
|
+
<CardDescription>Get form data by form ID</CardDescription>
|
|
1827
|
+
</CardHeader>
|
|
1828
|
+
<CardContent className="space-y-4">
|
|
1829
|
+
<div className="space-y-2">
|
|
1830
|
+
<Label htmlFor="formId">Form ID</Label>
|
|
1831
|
+
<div className="flex gap-2">
|
|
1832
|
+
<Input
|
|
1833
|
+
id="formId"
|
|
1834
|
+
value={formId}
|
|
1835
|
+
onChange={(e) => setFormId(e.target.value)}
|
|
1836
|
+
placeholder="Enter form ID"
|
|
1837
|
+
/>
|
|
1838
|
+
<Button onClick={handleLoadExample} variant="outline" type="button">
|
|
1839
|
+
Load Example
|
|
1840
|
+
</Button>
|
|
1841
|
+
</div>
|
|
1842
|
+
<p className="text-xs text-muted-foreground">
|
|
1843
|
+
Example:{" "}
|
|
1844
|
+
<button
|
|
1845
|
+
type="button"
|
|
1846
|
+
onClick={handleLoadExample}
|
|
1847
|
+
className="underline text-blue-600 hover:text-blue-800"
|
|
1848
|
+
>
|
|
1849
|
+
{DEFAULT_FORM_ID || "Enter form ID"}
|
|
1850
|
+
</button>
|
|
1851
|
+
</p>
|
|
1852
|
+
</div>
|
|
1853
|
+
|
|
1854
|
+
<div className="flex gap-4">
|
|
1855
|
+
<Button
|
|
1856
|
+
onClick={handleGetFormData}
|
|
1857
|
+
disabled={formDataQuery.isLoading || !formId}
|
|
1858
|
+
variant="default"
|
|
1859
|
+
>
|
|
1860
|
+
{formDataQuery.isLoading ? "Loading..." : "Get Form Data"}
|
|
1861
|
+
</Button>
|
|
1862
|
+
</div>
|
|
1863
|
+
|
|
1864
|
+
{/* Status Messages */}
|
|
1865
|
+
{formDataQuery.isError && (
|
|
1866
|
+
<p className="text-red-500">
|
|
1867
|
+
Get Error: {formDataQuery.error?.message}
|
|
1868
|
+
</p>
|
|
1869
|
+
)}
|
|
1870
|
+
{formDataQuery.isSuccess && formDataQuery.data && (
|
|
1871
|
+
<p className="text-green-500">✓ Form data loaded successfully</p>
|
|
1872
|
+
)}
|
|
1873
|
+
|
|
1874
|
+
{/* Form Data Preview */}
|
|
1875
|
+
{formDataQuery.data && (
|
|
1876
|
+
<div className="mt-4 p-4 bg-muted rounded-lg">
|
|
1877
|
+
<p className="text-sm font-semibold mb-2">Form Data:</p>
|
|
1878
|
+
<pre className="text-xs overflow-auto max-h-60">
|
|
1879
|
+
{JSON.stringify(formDataQuery.data, null, 2)}
|
|
1880
|
+
</pre>
|
|
1881
|
+
</div>
|
|
1882
|
+
)}
|
|
1883
|
+
</CardContent>
|
|
1884
|
+
</Card>
|
|
1885
|
+
);
|
|
1886
|
+
}
|
|
1887
|
+
|
|
1888
|
+
// Main API Test Page Component
|
|
1889
|
+
export default function ApiTestPage() {
|
|
1890
|
+
return (
|
|
1891
|
+
<SidebarProvider
|
|
1892
|
+
style={
|
|
1893
|
+
{
|
|
1894
|
+
"--sidebar-width": "calc(var(--spacing) * 72)",
|
|
1895
|
+
"--header-height": "calc(var(--spacing) * 12)",
|
|
1896
|
+
} as React.CSSProperties
|
|
1897
|
+
}
|
|
1898
|
+
>
|
|
1899
|
+
<AppSidebar variant="inset" />
|
|
1900
|
+
<SidebarInset>
|
|
1901
|
+
<SiteHeader />
|
|
1902
|
+
<div className="flex flex-1 flex-col">
|
|
1903
|
+
<div className="@container/main flex flex-1 flex-col gap-6 p-6">
|
|
1904
|
+
{/* Page Header */}
|
|
1905
|
+
<div className="flex items-center justify-between">
|
|
1906
|
+
<div>
|
|
1907
|
+
<h1 className="text-3xl font-bold tracking-tight">
|
|
1908
|
+
API Test Page
|
|
1909
|
+
</h1>
|
|
1910
|
+
<p className="text-muted-foreground">
|
|
1911
|
+
Test various API endpoints and hooks. All calls are
|
|
1912
|
+
user-initiated.
|
|
1913
|
+
</p>
|
|
1914
|
+
</div>
|
|
1915
|
+
</div>
|
|
1916
|
+
|
|
1917
|
+
{/* Workbook Test Section */}
|
|
1918
|
+
<WorkbookTestSection />
|
|
1919
|
+
|
|
1920
|
+
{/* Task Test Section */}
|
|
1921
|
+
<TaskTestSection />
|
|
1922
|
+
|
|
1923
|
+
{/* Run Recon Test Section */}
|
|
1924
|
+
<RunReconTestSection />
|
|
1925
|
+
|
|
1926
|
+
{/* File Upload/Download Test Section */}
|
|
1927
|
+
<FileUploadTestSection />
|
|
1928
|
+
|
|
1929
|
+
{/* Form Schema Test Section */}
|
|
1930
|
+
<FormSchemaTestSection />
|
|
1931
|
+
|
|
1932
|
+
{/* Form Data Test Section */}
|
|
1933
|
+
<FormDataTestSection />
|
|
1934
|
+
|
|
1935
|
+
{/* Get Audit Logs Test Section */}
|
|
1936
|
+
<GetAuditLogsTestSection />
|
|
1937
|
+
|
|
1938
|
+
{/* Create Audit Log Test Section */}
|
|
1939
|
+
<CreateAuditLogTestSection />
|
|
1940
|
+
|
|
1941
|
+
{/* Get All Templated Pipelines Test Section */}
|
|
1942
|
+
<GetAllTemplatedPipelinesTestSection />
|
|
1943
|
+
|
|
1944
|
+
{/* Get All Recon Test Section */}
|
|
1945
|
+
<GetAllReconTestSection />
|
|
1946
|
+
|
|
1947
|
+
{/* Get Form By ID Test Section */}
|
|
1948
|
+
<GetFormByIdTestSection />
|
|
1949
|
+
|
|
1950
|
+
{/* Create Or Update Form Test Section */}
|
|
1951
|
+
<CreateOrUpdateFormTestSection />
|
|
1952
|
+
|
|
1953
|
+
{/* Mark Task Done Test Section */}
|
|
1954
|
+
<MarkTaskDoneTestSection />
|
|
1955
|
+
|
|
1956
|
+
{/* Reassign Task Test Section */}
|
|
1957
|
+
<ReassignTaskTestSection />
|
|
1958
|
+
</div>
|
|
1959
|
+
</div>
|
|
1960
|
+
</SidebarInset>
|
|
1961
|
+
</SidebarProvider>
|
|
1962
|
+
);
|
|
1963
|
+
}
|