create-bluecopa-react-app 1.0.21 → 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/package.json
CHANGED
|
@@ -23,6 +23,14 @@ import {
|
|
|
23
23
|
useFileDownload,
|
|
24
24
|
useGetFormSchema,
|
|
25
25
|
useGetFormData,
|
|
26
|
+
useGetAuditLogs,
|
|
27
|
+
useCreateAuditLog,
|
|
28
|
+
useGetAllTemplatedPipelines,
|
|
29
|
+
useGetAllRecon,
|
|
30
|
+
useGetFormById,
|
|
31
|
+
useCreateOrUpdateForm,
|
|
32
|
+
useMarkTaskDone,
|
|
33
|
+
useReassignTask,
|
|
26
34
|
} from "@bluecopa/react";
|
|
27
35
|
|
|
28
36
|
// Default values for examples
|
|
@@ -31,7 +39,7 @@ const DEFAULT_TASK_ID = "0V4Kxc7LhIpUvwZeORaj";
|
|
|
31
39
|
const DEFAULT_WORKFLOW_ID = "MJ02HD1HUJ4VCN66U0V0";
|
|
32
40
|
const DEFAULT_FORM_INSTANCE_ID = "0V5W3KVAWdRnVOZczmSN";
|
|
33
41
|
const DEFAULT_FORM_REVISION = 21949795;
|
|
34
|
-
const DEFAULT_FORM_ID = "";
|
|
42
|
+
const DEFAULT_FORM_ID = "0V5W3KVAWdRnVOZczmSN";
|
|
35
43
|
const DEFAULT_FILE_UPLOAD_PAYLOAD = {
|
|
36
44
|
id: "0URYQ4DIHB1mVzPA87ZW",
|
|
37
45
|
name: "octobereighteennnqq",
|
|
@@ -49,6 +57,26 @@ const DEFAULT_FILE_UPLOAD_PAYLOAD = {
|
|
|
49
57
|
],
|
|
50
58
|
};
|
|
51
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
|
+
|
|
52
80
|
// Workbook Test Component
|
|
53
81
|
function WorkbookTestSection() {
|
|
54
82
|
const [workbookId, setWorkbookId] = useState<string>("");
|
|
@@ -352,7 +380,9 @@ function WorkbookTestSection() {
|
|
|
352
380
|
disabled={saveWorkbookMutation.isPending || !saveWorkbookData}
|
|
353
381
|
variant="default"
|
|
354
382
|
>
|
|
355
|
-
{saveWorkbookMutation.isPending
|
|
383
|
+
{saveWorkbookMutation.isPending
|
|
384
|
+
? "Saving..."
|
|
385
|
+
: "2. Save Workbook"}
|
|
356
386
|
</Button>
|
|
357
387
|
|
|
358
388
|
{/* Status Messages for Save Workbook */}
|
|
@@ -852,7 +882,9 @@ function FormSchemaTestSection() {
|
|
|
852
882
|
<Card className="mb-6">
|
|
853
883
|
<CardHeader>
|
|
854
884
|
<CardTitle>Form Schema Operations Test</CardTitle>
|
|
855
|
-
<CardDescription>
|
|
885
|
+
<CardDescription>
|
|
886
|
+
Get form schema by form instance ID and revision
|
|
887
|
+
</CardDescription>
|
|
856
888
|
</CardHeader>
|
|
857
889
|
<CardContent className="space-y-4">
|
|
858
890
|
<div className="space-y-2">
|
|
@@ -889,14 +921,19 @@ function FormSchemaTestSection() {
|
|
|
889
921
|
placeholder="Enter form revision (e.g., 1)"
|
|
890
922
|
/>
|
|
891
923
|
<p className="text-xs text-muted-foreground">
|
|
892
|
-
Example:
|
|
924
|
+
Example:{" "}
|
|
925
|
+
<code className="bg-muted px-1 rounded">
|
|
926
|
+
{DEFAULT_FORM_REVISION}
|
|
927
|
+
</code>
|
|
893
928
|
</p>
|
|
894
929
|
</div>
|
|
895
930
|
|
|
896
931
|
<div className="flex gap-4">
|
|
897
932
|
<Button
|
|
898
933
|
onClick={handleGetFormSchema}
|
|
899
|
-
disabled={
|
|
934
|
+
disabled={
|
|
935
|
+
formSchemaQuery.isLoading || !formInstanceId || !formRevision
|
|
936
|
+
}
|
|
900
937
|
variant="default"
|
|
901
938
|
>
|
|
902
939
|
{formSchemaQuery.isLoading ? "Loading..." : "Get Form Schema"}
|
|
@@ -910,9 +947,7 @@ function FormSchemaTestSection() {
|
|
|
910
947
|
</p>
|
|
911
948
|
)}
|
|
912
949
|
{formSchemaQuery.isSuccess && formSchemaQuery.data && (
|
|
913
|
-
<p className="text-green-500">
|
|
914
|
-
✓ Form schema loaded successfully
|
|
915
|
-
</p>
|
|
950
|
+
<p className="text-green-500">✓ Form schema loaded successfully</p>
|
|
916
951
|
)}
|
|
917
952
|
|
|
918
953
|
{/* Form Schema Data Preview */}
|
|
@@ -929,32 +964,388 @@ function FormSchemaTestSection() {
|
|
|
929
964
|
);
|
|
930
965
|
}
|
|
931
966
|
|
|
932
|
-
//
|
|
933
|
-
function
|
|
934
|
-
const [
|
|
967
|
+
// Get Audit Logs Test Component
|
|
968
|
+
function GetAuditLogsTestSection() {
|
|
969
|
+
const [auditLogRequest, setAuditLogRequest] = useState<string>("");
|
|
970
|
+
const [auditLogsResult, setAuditLogsResult] = useState<any>(null);
|
|
935
971
|
|
|
936
|
-
// Get
|
|
937
|
-
const
|
|
972
|
+
// Get Audit Logs Hook
|
|
973
|
+
const getAuditLogsMutation = useGetAuditLogs();
|
|
938
974
|
|
|
939
975
|
// Handle Load Example
|
|
940
976
|
const handleLoadExample = () => {
|
|
941
|
-
|
|
977
|
+
setAuditLogRequest(JSON.stringify(DEFAULT_AUDIT_LOG_REQUEST, null, 2));
|
|
942
978
|
toast.info(
|
|
943
|
-
'Example
|
|
979
|
+
'Example audit log request loaded. Click "Get Audit Logs" to fetch.'
|
|
944
980
|
);
|
|
945
981
|
};
|
|
946
982
|
|
|
947
|
-
// Handle Get
|
|
948
|
-
const
|
|
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 () => {
|
|
949
1339
|
if (!formId) {
|
|
950
1340
|
toast.error("Please enter a form ID");
|
|
951
1341
|
return;
|
|
952
1342
|
}
|
|
953
1343
|
try {
|
|
954
|
-
const result = await
|
|
1344
|
+
const result = await formQuery.refetch();
|
|
955
1345
|
if (result.data) {
|
|
956
|
-
|
|
957
|
-
|
|
1346
|
+
setFormResult(result.data);
|
|
1347
|
+
console.log("Form:", result.data);
|
|
1348
|
+
toast.success("Form loaded! Check console for data.");
|
|
958
1349
|
}
|
|
959
1350
|
} catch (error: any) {
|
|
960
1351
|
toast.error(`Error: ${error.message}`);
|
|
@@ -964,8 +1355,8 @@ function FormDataTestSection() {
|
|
|
964
1355
|
return (
|
|
965
1356
|
<Card className="mb-6">
|
|
966
1357
|
<CardHeader>
|
|
967
|
-
<CardTitle>Form
|
|
968
|
-
<CardDescription>Get form
|
|
1358
|
+
<CardTitle>Get Form By ID Test</CardTitle>
|
|
1359
|
+
<CardDescription>Get form details by form ID</CardDescription>
|
|
969
1360
|
</CardHeader>
|
|
970
1361
|
<CardContent className="space-y-4">
|
|
971
1362
|
<div className="space-y-2">
|
|
@@ -995,32 +1386,30 @@ function FormDataTestSection() {
|
|
|
995
1386
|
|
|
996
1387
|
<div className="flex gap-4">
|
|
997
1388
|
<Button
|
|
998
|
-
onClick={
|
|
999
|
-
disabled={
|
|
1389
|
+
onClick={handleGetFormById}
|
|
1390
|
+
disabled={formQuery.isLoading || !formId}
|
|
1000
1391
|
variant="default"
|
|
1001
1392
|
>
|
|
1002
|
-
{
|
|
1393
|
+
{formQuery.isLoading ? "Loading..." : "Get Form By ID"}
|
|
1003
1394
|
</Button>
|
|
1004
1395
|
</div>
|
|
1005
1396
|
|
|
1006
1397
|
{/* Status Messages */}
|
|
1007
|
-
{
|
|
1008
|
-
<p className="text-red-500">
|
|
1009
|
-
Get Error: {formDataQuery.error?.message}
|
|
1010
|
-
</p>
|
|
1398
|
+
{formQuery.isError && (
|
|
1399
|
+
<p className="text-red-500">Get Error: {formQuery.error?.message}</p>
|
|
1011
1400
|
)}
|
|
1012
|
-
{
|
|
1401
|
+
{formQuery.isSuccess && formResult && (
|
|
1013
1402
|
<p className="text-green-500">
|
|
1014
|
-
✓ Form
|
|
1403
|
+
✓ Form loaded successfully (ID: {formResult.id || formId})
|
|
1015
1404
|
</p>
|
|
1016
1405
|
)}
|
|
1017
1406
|
|
|
1018
|
-
{/* Form
|
|
1019
|
-
{
|
|
1407
|
+
{/* Form Result Preview */}
|
|
1408
|
+
{formResult && (
|
|
1020
1409
|
<div className="mt-4 p-4 bg-muted rounded-lg">
|
|
1021
|
-
<p className="text-sm font-semibold mb-2">Form
|
|
1410
|
+
<p className="text-sm font-semibold mb-2">Form Result:</p>
|
|
1022
1411
|
<pre className="text-xs overflow-auto max-h-60">
|
|
1023
|
-
{JSON.stringify(
|
|
1412
|
+
{JSON.stringify(formResult, null, 2)}
|
|
1024
1413
|
</pre>
|
|
1025
1414
|
</div>
|
|
1026
1415
|
)}
|
|
@@ -1029,11 +1418,478 @@ function FormDataTestSection() {
|
|
|
1029
1418
|
);
|
|
1030
1419
|
}
|
|
1031
1420
|
|
|
1032
|
-
//
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
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={
|
|
1037
1893
|
{
|
|
1038
1894
|
"--sidebar-width": "calc(var(--spacing) * 72)",
|
|
1039
1895
|
"--header-height": "calc(var(--spacing) * 12)",
|
|
@@ -1075,6 +1931,30 @@ export default function ApiTestPage() {
|
|
|
1075
1931
|
|
|
1076
1932
|
{/* Form Data Test Section */}
|
|
1077
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 />
|
|
1078
1958
|
</div>
|
|
1079
1959
|
</div>
|
|
1080
1960
|
</SidebarInset>
|
|
@@ -33,8 +33,6 @@ import {
|
|
|
33
33
|
useSubscribeUser,
|
|
34
34
|
useUnsubscribeUser,
|
|
35
35
|
useCheckSubscriptionStatus,
|
|
36
|
-
useGetAuditLogs,
|
|
37
|
-
useCreateAuditLog,
|
|
38
36
|
} from "@bluecopa/react";
|
|
39
37
|
import {
|
|
40
38
|
MessageSquare,
|
|
@@ -54,239 +52,6 @@ const MOCK_USER = {
|
|
|
54
52
|
email: "john@example.com",
|
|
55
53
|
};
|
|
56
54
|
|
|
57
|
-
// Default values for audit log examples
|
|
58
|
-
const DEFAULT_AUDIT_LOG_REQUEST = {
|
|
59
|
-
entityId: "0TOlmUqx0TKseTn8W6gW",
|
|
60
|
-
source: "UI",
|
|
61
|
-
limit: 20,
|
|
62
|
-
};
|
|
63
|
-
|
|
64
|
-
const DEFAULT_AUDIT_RECORD = [
|
|
65
|
-
{
|
|
66
|
-
"source": "UI",
|
|
67
|
-
"userId": "0TOlmUqx0TKseTn8W6gW",
|
|
68
|
-
"entityId": "0TOlmUqx0TKseTn8W6gW",
|
|
69
|
-
"entityType": "Dataset",
|
|
70
|
-
"action": "CREATE",
|
|
71
|
-
"eventType": "API"
|
|
72
|
-
}
|
|
73
|
-
];
|
|
74
|
-
|
|
75
|
-
// Get Audit Logs Test Component
|
|
76
|
-
function GetAuditLogsTestSection() {
|
|
77
|
-
const [auditLogRequest, setAuditLogRequest] = useState<string>("");
|
|
78
|
-
const [auditLogsResult, setAuditLogsResult] = useState<any>(null);
|
|
79
|
-
|
|
80
|
-
// Get Audit Logs Hook
|
|
81
|
-
const getAuditLogsMutation = useGetAuditLogs();
|
|
82
|
-
|
|
83
|
-
// Handle Load Example
|
|
84
|
-
const handleLoadExample = () => {
|
|
85
|
-
setAuditLogRequest(JSON.stringify(DEFAULT_AUDIT_LOG_REQUEST, null, 2));
|
|
86
|
-
toast.info(
|
|
87
|
-
'Example audit log request loaded. Click "Get Audit Logs" to fetch.'
|
|
88
|
-
);
|
|
89
|
-
};
|
|
90
|
-
|
|
91
|
-
// Handle Get Audit Logs
|
|
92
|
-
const handleGetAuditLogs = async () => {
|
|
93
|
-
if (!auditLogRequest) {
|
|
94
|
-
toast.error("Please enter audit log request (JSON)");
|
|
95
|
-
return;
|
|
96
|
-
}
|
|
97
|
-
try {
|
|
98
|
-
let parsedRequest;
|
|
99
|
-
try {
|
|
100
|
-
parsedRequest = JSON.parse(auditLogRequest);
|
|
101
|
-
} catch (e) {
|
|
102
|
-
toast.error("Invalid JSON format");
|
|
103
|
-
return;
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
const result = await getAuditLogsMutation.mutateAsync(parsedRequest);
|
|
107
|
-
setAuditLogsResult(result);
|
|
108
|
-
toast.success("Audit logs loaded! Check console for data.");
|
|
109
|
-
} catch (error: any) {
|
|
110
|
-
console.error("Get audit logs error:", error);
|
|
111
|
-
toast.error(`Get audit logs failed: ${error.message}`);
|
|
112
|
-
}
|
|
113
|
-
};
|
|
114
|
-
|
|
115
|
-
return (
|
|
116
|
-
<Card className="mb-6">
|
|
117
|
-
<CardHeader>
|
|
118
|
-
<CardTitle>Get Audit Logs Operations Test</CardTitle>
|
|
119
|
-
<CardDescription>Get audit logs with filter criteria</CardDescription>
|
|
120
|
-
</CardHeader>
|
|
121
|
-
<CardContent className="space-y-4">
|
|
122
|
-
<div className="space-y-2">
|
|
123
|
-
<Label htmlFor="auditLogRequest">Audit Log Request (JSON)</Label>
|
|
124
|
-
<div className="flex gap-2 mb-2">
|
|
125
|
-
<Button onClick={handleLoadExample} variant="outline" type="button">
|
|
126
|
-
Load Example
|
|
127
|
-
</Button>
|
|
128
|
-
</div>
|
|
129
|
-
<textarea
|
|
130
|
-
id="auditLogRequest"
|
|
131
|
-
value={auditLogRequest}
|
|
132
|
-
onChange={(e) => setAuditLogRequest(e.target.value)}
|
|
133
|
-
placeholder="Enter audit log request JSON"
|
|
134
|
-
className="w-full min-h-[150px] p-2 border rounded-md font-mono text-xs"
|
|
135
|
-
/>
|
|
136
|
-
<p className="text-xs text-muted-foreground">
|
|
137
|
-
Example: Click "Load Example" button above to load sample request
|
|
138
|
-
</p>
|
|
139
|
-
</div>
|
|
140
|
-
|
|
141
|
-
<div className="flex gap-4">
|
|
142
|
-
<Button
|
|
143
|
-
onClick={handleGetAuditLogs}
|
|
144
|
-
disabled={getAuditLogsMutation.isPending || !auditLogRequest}
|
|
145
|
-
variant="default"
|
|
146
|
-
>
|
|
147
|
-
{getAuditLogsMutation.isPending ? "Loading..." : "Get Audit Logs"}
|
|
148
|
-
</Button>
|
|
149
|
-
</div>
|
|
150
|
-
|
|
151
|
-
{/* Status Messages */}
|
|
152
|
-
{getAuditLogsMutation.isError && (
|
|
153
|
-
<p className="text-red-500">
|
|
154
|
-
Get Error: {getAuditLogsMutation.error?.message}
|
|
155
|
-
</p>
|
|
156
|
-
)}
|
|
157
|
-
{getAuditLogsMutation.isSuccess && auditLogsResult && (
|
|
158
|
-
<p className="text-green-500">
|
|
159
|
-
✓ Audit logs loaded successfully (Count:{" "}
|
|
160
|
-
{auditLogsResult.count || 0})
|
|
161
|
-
</p>
|
|
162
|
-
)}
|
|
163
|
-
|
|
164
|
-
{/* Audit Logs Result Preview */}
|
|
165
|
-
{auditLogsResult && (
|
|
166
|
-
<div className="mt-4 p-4 bg-muted rounded-lg">
|
|
167
|
-
<p className="text-sm font-semibold mb-2">Audit Logs Result:</p>
|
|
168
|
-
<pre className="text-xs overflow-auto max-h-60">
|
|
169
|
-
{JSON.stringify(auditLogsResult, null, 2)}
|
|
170
|
-
</pre>
|
|
171
|
-
</div>
|
|
172
|
-
)}
|
|
173
|
-
</CardContent>
|
|
174
|
-
</Card>
|
|
175
|
-
);
|
|
176
|
-
}
|
|
177
|
-
|
|
178
|
-
// Create Audit Log Test Component
|
|
179
|
-
function CreateAuditLogTestSection() {
|
|
180
|
-
const [auditRecords, setAuditRecords] = useState<string>("");
|
|
181
|
-
const [createResult, setCreateResult] = useState<any>(null);
|
|
182
|
-
|
|
183
|
-
// Create Audit Log Hook
|
|
184
|
-
const createAuditLogMutation = useCreateAuditLog();
|
|
185
|
-
|
|
186
|
-
// Handle Load Example
|
|
187
|
-
const handleLoadExample = () => {
|
|
188
|
-
const exampleRecords = DEFAULT_AUDIT_RECORD;
|
|
189
|
-
setAuditRecords(JSON.stringify(exampleRecords, null, 2));
|
|
190
|
-
toast.info(
|
|
191
|
-
'Example audit record loaded. Click "Create Audit Log" to create.'
|
|
192
|
-
);
|
|
193
|
-
};
|
|
194
|
-
|
|
195
|
-
// Handle Create Audit Log
|
|
196
|
-
const handleCreateAuditLog = async () => {
|
|
197
|
-
if (!auditRecords) {
|
|
198
|
-
toast.error("Please enter audit records (JSON array)");
|
|
199
|
-
return;
|
|
200
|
-
}
|
|
201
|
-
try {
|
|
202
|
-
let parsedRecords;
|
|
203
|
-
try {
|
|
204
|
-
parsedRecords = JSON.parse(auditRecords);
|
|
205
|
-
} catch (e) {
|
|
206
|
-
toast.error("Invalid JSON format");
|
|
207
|
-
return;
|
|
208
|
-
}
|
|
209
|
-
|
|
210
|
-
if (!Array.isArray(parsedRecords)) {
|
|
211
|
-
toast.error("Audit records must be an array");
|
|
212
|
-
return;
|
|
213
|
-
}
|
|
214
|
-
|
|
215
|
-
const result = await createAuditLogMutation.mutateAsync({
|
|
216
|
-
auditRecords: parsedRecords,
|
|
217
|
-
});
|
|
218
|
-
console.log("Audit log created:", result);
|
|
219
|
-
setCreateResult(result);
|
|
220
|
-
toast.success("Audit log created successfully! Check console for data.");
|
|
221
|
-
} catch (error: any) {
|
|
222
|
-
console.error("Create audit log error:", error);
|
|
223
|
-
toast.error(`Create audit log failed: ${error.message}`);
|
|
224
|
-
}
|
|
225
|
-
};
|
|
226
|
-
|
|
227
|
-
return (
|
|
228
|
-
<Card className="mb-6">
|
|
229
|
-
<CardHeader>
|
|
230
|
-
<CardTitle>Create Audit Log Operations Test</CardTitle>
|
|
231
|
-
<CardDescription>Create audit log records</CardDescription>
|
|
232
|
-
</CardHeader>
|
|
233
|
-
<CardContent className="space-y-4">
|
|
234
|
-
<div className="space-y-2">
|
|
235
|
-
<Label htmlFor="auditRecords">Audit Records (JSON Array)</Label>
|
|
236
|
-
<div className="flex gap-2 mb-2">
|
|
237
|
-
<Button onClick={handleLoadExample} variant="outline" type="button">
|
|
238
|
-
Load Example
|
|
239
|
-
</Button>
|
|
240
|
-
</div>
|
|
241
|
-
<textarea
|
|
242
|
-
id="auditRecords"
|
|
243
|
-
value={auditRecords}
|
|
244
|
-
onChange={(e) => setAuditRecords(e.target.value)}
|
|
245
|
-
placeholder="Enter audit records as JSON array"
|
|
246
|
-
className="w-full min-h-[200px] p-2 border rounded-md font-mono text-xs"
|
|
247
|
-
/>
|
|
248
|
-
<p className="text-xs text-muted-foreground">
|
|
249
|
-
Example: Click "Load Example" button above to load sample audit
|
|
250
|
-
record
|
|
251
|
-
</p>
|
|
252
|
-
</div>
|
|
253
|
-
|
|
254
|
-
<div className="flex gap-4">
|
|
255
|
-
<Button
|
|
256
|
-
onClick={handleCreateAuditLog}
|
|
257
|
-
disabled={createAuditLogMutation.isPending || !auditRecords}
|
|
258
|
-
variant="default"
|
|
259
|
-
>
|
|
260
|
-
{createAuditLogMutation.isPending
|
|
261
|
-
? "Creating..."
|
|
262
|
-
: "Create Audit Log"}
|
|
263
|
-
</Button>
|
|
264
|
-
</div>
|
|
265
|
-
|
|
266
|
-
{/* Status Messages */}
|
|
267
|
-
{createAuditLogMutation.isError && (
|
|
268
|
-
<p className="text-red-500">
|
|
269
|
-
Create Error: {createAuditLogMutation.error?.message}
|
|
270
|
-
</p>
|
|
271
|
-
)}
|
|
272
|
-
{createAuditLogMutation.isSuccess && createResult && (
|
|
273
|
-
<p className="text-green-500">✓ Audit log created successfully</p>
|
|
274
|
-
)}
|
|
275
|
-
|
|
276
|
-
{/* Create Result Preview */}
|
|
277
|
-
{createResult && (
|
|
278
|
-
<div className="mt-4 p-4 bg-muted rounded-lg">
|
|
279
|
-
<p className="text-sm font-semibold mb-2">Create Result:</p>
|
|
280
|
-
<pre className="text-xs overflow-auto max-h-60">
|
|
281
|
-
{JSON.stringify(createResult, null, 2)}
|
|
282
|
-
</pre>
|
|
283
|
-
</div>
|
|
284
|
-
)}
|
|
285
|
-
</CardContent>
|
|
286
|
-
</Card>
|
|
287
|
-
);
|
|
288
|
-
}
|
|
289
|
-
|
|
290
55
|
// Component types for better organization
|
|
291
56
|
interface ThreadFormProps {
|
|
292
57
|
onThreadCreated: (threadId: string) => void;
|
|
@@ -686,10 +451,6 @@ export default function CommentsPage() {
|
|
|
686
451
|
<SiteHeader />
|
|
687
452
|
<div className="flex flex-1 flex-col">
|
|
688
453
|
<div className="@container/main flex flex-1 flex-col gap-6 p-6">
|
|
689
|
-
{/* Audit Log Test Sections */}
|
|
690
|
-
<GetAuditLogsTestSection />
|
|
691
|
-
<CreateAuditLogTestSection />
|
|
692
|
-
|
|
693
454
|
{/* Page Header */}
|
|
694
455
|
<div className="flex items-center justify-between">
|
|
695
456
|
<div>
|