@izara_frontend/shared-complex-filter 1.0.1

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.
@@ -0,0 +1,2013 @@
1
+ import React, {
2
+ useContext,
3
+ useState,
4
+ useEffect,
5
+ useRef,
6
+ useCallback,
7
+ } from "react";
8
+ import {
9
+ IzaraDivStyle,
10
+ IzaraButtonStyle,
11
+ createStyleDefualtTags,
12
+ createStyleTags,
13
+ } from "@izaraFrontends/styles";
14
+ import { useImmer } from "use-immer";
15
+
16
+ // import {
17
+ // getObjectSchema,
18
+ // reformatObjectSchema,
19
+ // } from "@izara_project/izara-shared-service-schemas";
20
+
21
+ // import { get_objectLinksSchema } from "../../../../izara-frontend-lib-core-page-output-config_rut/configPageOutputSection/getSchemaNewLibrary/getObjectSchemaQuery";
22
+ // import {
23
+ // collectObjectLinksWithRequestProperties,
24
+ // collectObjectSchemaWithHierarchy,
25
+ // } from "@izara_frontend/service-schemas";
26
+
27
+ import { useDispatch, useSelector } from "react-redux";
28
+ import { nanoid } from "nanoid";
29
+ import { ModalRequiredData } from "./modalRequiredData";
30
+ // import _, { flatMap, last } from "lodash";
31
+ // var hash = require("object-hash");
32
+
33
+ function createObjTypeConcat(objType) {
34
+ console.log("objType:sdsadwsd ", objType);
35
+ return `${objType?.serviceTag}_${objType?.objectType}`;
36
+ }
37
+ function createRelTypeConcat(relType) {
38
+ console.log("objType:sdsadwsd ", relType);
39
+ return `${relType?.serviceTag}_${relType?.relationshipTag}`;
40
+ }
41
+ function objTypeFromObjTypeConcat(objTypeConcat) {
42
+ console.log("objTypeConcat:aeaeaeww ", objTypeConcat);
43
+ let result = objTypeConcat.split("_");
44
+
45
+ if (result.length !== 2) {
46
+ throw Error("objTypeConcat invalid");
47
+ }
48
+
49
+ return {
50
+ serviceTag: result[0],
51
+ objectType: result[1],
52
+ };
53
+ }
54
+
55
+ export function findLogicalRoot(activeId, logicalElementObj) {
56
+ const prevId = logicalElementObj[activeId]?.previousLogicalElementId;
57
+ console.log("prevId:sdasdaszc ", prevId);
58
+ console.log("activeId:sdasdaszc ", activeId);
59
+
60
+ if (prevId) {
61
+ if (
62
+ logicalElementObj[prevId]?.logicalElementType === "childComplexFilter"
63
+ ) {
64
+ if (activeId === logicalElementObj[prevId].childLogicalElementId) {
65
+ return activeId;
66
+ } else {
67
+ return findLogicalRoot(prevId, logicalElementObj);
68
+ }
69
+ } else {
70
+ return findLogicalRoot(prevId, logicalElementObj);
71
+ }
72
+ }
73
+ return activeId;
74
+ }
75
+
76
+ export const OutputListLogicalElement = ({
77
+ logicalElementObj,
78
+ setLogicalElementObj,
79
+ logicalElementId,
80
+ logicalElementOutput,
81
+ setLogicalElementOutput,
82
+ handleAddLogicalElement,
83
+ hadleActiveLogicalElement,
84
+ }) => {
85
+ console.log("logicalElementId:dfdfsdgffdgfd ", logicalElementId);
86
+ // function loopFindLastLogicalElement(nextLogicalElementId) {
87
+ // console.log(
88
+ // "logicalElementObj[nextLogicalElementId]:asdsfcxvdsf ",
89
+ // logicalElementObj[nextLogicalElementId]
90
+ // );
91
+
92
+ // if (logicalElementObj[nextLogicalElementId].nextLogicalElementId === null) {
93
+ // console.log("nextLogicalElementId:xxczxvcxvcxb ", nextLogicalElementId);
94
+ // return nextLogicalElementId;
95
+ // } else {
96
+ // return loopFindLastLogicalElement(
97
+ // logicalElementObj[nextLogicalElementId].nextLogicalElementId
98
+ // );
99
+ // }
100
+ // }
101
+ function handelRemoveLogical(startKey) {
102
+ const toDelete = new Set();
103
+
104
+ function loopLogical(key) {
105
+ if (!logicalElementObj[key]) return;
106
+
107
+ const current = logicalElementObj[key];
108
+
109
+ if (current.nextLogicalElementId) {
110
+ loopLogical(current.nextLogicalElementId);
111
+ }
112
+
113
+ if (current.childLogicalElementId) {
114
+ loopLogical(current.childLogicalElementId);
115
+ }
116
+
117
+ toDelete.add(key);
118
+ }
119
+ loopLogical(startKey);
120
+
121
+ setLogicalElementOutput((logicalElementOutput) => {
122
+ logicalElementOutput.active =
123
+ logicalElementObj[startKey].previousLogicalElementId;
124
+ });
125
+
126
+ setLogicalElementObj((logicalElementObj) => {
127
+ console.log("toDelete:awscxzzvbm ", toDelete);
128
+ for (const keyDelete of toDelete) {
129
+ logicalElementObj[
130
+ logicalElementObj[keyDelete].previousLogicalElementId
131
+ ].nextLogicalElementId = null;
132
+
133
+ delete logicalElementObj[keyDelete];
134
+ }
135
+ });
136
+ }
137
+
138
+ return (
139
+ <>
140
+ {logicalElementId && (
141
+ <>
142
+ <IzaraDivStyle
143
+ styletags={createStyleDefualtTags("gridColumn", "", "311")}
144
+ >
145
+ <button
146
+ disabled={logicalElementId === logicalElementOutput.active}
147
+ onClick={(e) => hadleActiveLogicalElement(logicalElementId)}
148
+ >
149
+ {logicalElementObj[logicalElementId]?.operation ? (
150
+ <>{logicalElementObj[logicalElementId].operation}</>
151
+ ) : (
152
+ <>{logicalElementId}</>
153
+ // <>{logicalElementObj[logicalElementId].logicalElementType}</>
154
+ )}
155
+ </button>
156
+
157
+ <>
158
+ {logicalElementId === logicalElementOutput.active && (
159
+ <button onClick={(e) => handelRemoveLogical(logicalElementId)}>
160
+ x
161
+ </button>
162
+ )}
163
+ </>
164
+ </IzaraDivStyle>
165
+
166
+ {logicalElementObj[logicalElementId]?.nextLogicalElementId && (
167
+ <>
168
+ <OutputListLogicalElement
169
+ logicalElementObj={logicalElementObj}
170
+ setLogicalElementObj={setLogicalElementObj}
171
+ logicalElementId={
172
+ logicalElementObj[logicalElementId].nextLogicalElementId
173
+ }
174
+ logicalElementOutput={logicalElementOutput}
175
+ setLogicalElementOutput={setLogicalElementOutput}
176
+ handleAddLogicalElement={handleAddLogicalElement}
177
+ hadleActiveLogicalElement={hadleActiveLogicalElement}
178
+ />
179
+ </>
180
+ )}
181
+ </>
182
+ )}
183
+ </>
184
+ );
185
+ };
186
+
187
+ export const ModalLogicalElement = ({
188
+ titleModel,
189
+ statusModal,
190
+ objTypeMain,
191
+ createFilterElement,
192
+ parentOutputId,
193
+ nameReducer,
194
+ keyUseCase, //not sure keyRequestProperties
195
+ valueUserTag,
196
+ perParentIdentifierFieldname,
197
+ successFunction,
198
+ collectObjectLinksWithRequestProperties,
199
+ collectObjectSchemaWithHierarchy,
200
+ objConfigUseCase,
201
+ }) => {
202
+ // console.log("keyUseCase:dfecvxvd ", keyUseCase);
203
+ if (!objTypeMain) {
204
+ objTypeMain = objConfigUseCase.objType;
205
+ }
206
+
207
+ console.log("successFunction: sdxcxcaAD", successFunction);
208
+ console.log("objConfigUseCase:adxzvcxbxb ", objConfigUseCase, valueUserTag);
209
+
210
+ if (!valueUserTag) {
211
+ if (objConfigUseCase?.valueUserTags) {
212
+ valueUserTag = objConfigUseCase.valueUserTags;
213
+ } else {
214
+ valueUserTag = {};
215
+ }
216
+ }
217
+
218
+ const a = Object.fromEntries(
219
+ Object.entries(valueUserTag).filter(
220
+ ([_, val]) =>
221
+ "defaultValue" in val || "perParentIdentifierFieldname" in val,
222
+ ),
223
+ );
224
+
225
+ console.log("valueUserTag:sxzcvxcb ", a);
226
+
227
+ const dispatch = useDispatch();
228
+ const [modalSettingRequiredData, setModalSettingRequiredData] =
229
+ useState(false);
230
+ const [allObjTypesLinkConfigs, collectRequireLinksFn, collectLinksOpt] =
231
+ collectObjectLinksWithRequestProperties(); // allObjTypesLinkConfigs
232
+
233
+ const [resultFieldName, getObjSchemaHieFn, collectLinksOpt2] =
234
+ collectObjectSchemaWithHierarchy();
235
+
236
+ console.log("objConfigUseCase:dsfevcxvzxc ", objConfigUseCase);
237
+
238
+ console.log(
239
+ "dataRelationship:wsxzx data ",
240
+ allObjTypesLinkConfigs,
241
+ resultFieldName,
242
+ );
243
+ const [initialLogicalElementId, setInitialLogicalElementId] = useState(
244
+ objConfigUseCase ? objConfigUseCase.initialLogicalElementId : "",
245
+ );
246
+ const [logicalElementObj, setLogicalElementObj] = useImmer(
247
+ objConfigUseCase ? objConfigUseCase.logicalElements : {},
248
+ );
249
+
250
+ const [logicalElementOutput, setLogicalElementOutput] = useImmer({
251
+ status: true,
252
+ active: objConfigUseCase ? objConfigUseCase.initialLogicalElementId : "",
253
+ });
254
+
255
+ const [valueDataUserTags, setValueDataUserTags] = useImmer(valueUserTag);
256
+ const [newUserTags, setNewUserTags] = useImmer({});
257
+ const [newUserTagsRequestProperties, setNewUserTagsRequestProperties] =
258
+ useImmer({});
259
+
260
+ console.log(
261
+ "logicalElementOutput: awscxzzvbm",
262
+ initialLogicalElementId,
263
+ logicalElementOutput,
264
+ logicalElementObj,
265
+ );
266
+
267
+ useEffect(() => {
268
+ collectRequireLinksFn(objTypeMain);
269
+ getObjSchemaHieFn(objTypeMain);
270
+ }, []);
271
+
272
+ console.log("objTypeMain:sdwdxzxzxcc ", objTypeMain);
273
+ function createArrObjTypeLogical(activeId, logicalElementObj) {
274
+ const result = {
275
+ arrOutput: [],
276
+ lastObjtype: "",
277
+ };
278
+
279
+ function loopLogical(id) {
280
+ console.log("logicalElementObj:xsadfdfds ", logicalElementObj, id);
281
+ const currentLogical = logicalElementObj[id];
282
+ console.log("currentLogical:createArrObjTypeLogical ", currentLogical);
283
+
284
+ if (!currentLogical) return;
285
+ if (currentLogical.previousLogicalElementId !== null) {
286
+ console.log("IF:createArrObjTypeLogical");
287
+
288
+ loopLogical(currentLogical.previousLogicalElementId);
289
+ }
290
+ console.log(
291
+ "createArrObjTypeLogical",
292
+ id,
293
+ logicalElementObj[currentLogical.previousLogicalElementId]
294
+ ?.childLogicalElementId,
295
+ );
296
+ if (
297
+ id ===
298
+ logicalElementObj[currentLogical.previousLogicalElementId]
299
+ ?.childLogicalElementId
300
+ ) {
301
+ let objTypeOutput;
302
+ if (logicalElementObj[id]?.objType) {
303
+ objTypeOutput = createObjTypeConcat(currentLogical.objType);
304
+ } else {
305
+ objTypeOutput = createObjTypeConcat(
306
+ logicalElementObj[currentLogical.previousLogicalElementId]
307
+ .pathLinkType.objType,
308
+ );
309
+ }
310
+ console.log("objTypeOutput:createArrObjTypeLogical", objTypeOutput);
311
+
312
+ result.lastObjtype = objTypeOutput;
313
+ result.arrOutput.push({ [objTypeOutput]: id });
314
+ }
315
+ }
316
+
317
+ loopLogical(activeId);
318
+
319
+ console.log("result:createArrObjTypeLogical ", result);
320
+ return result;
321
+ }
322
+
323
+ function findObjTypeStep(activeId, logicalElementObj) {
324
+ let result = null;
325
+
326
+ function loop(id) {
327
+ console.log("id:wdsfdfdf ", id);
328
+ const current = logicalElementObj[id];
329
+ console.log("current:sadfdf ", current);
330
+ if (!current) return;
331
+
332
+ if (
333
+ current.logicalElementType === "childComplexFilter" ||
334
+ current.logicalElementType === "logical"
335
+ // !current.previousLogicalElementId
336
+ ) {
337
+ result = current.objType || null;
338
+ return;
339
+ }
340
+
341
+ const prevId = current.previousLogicalElementId;
342
+ console.log("prevId:findObjTypeStep ", prevId);
343
+
344
+ if (!prevId) {
345
+ if (current.objType) {
346
+ result = current.objType;
347
+ }
348
+ return;
349
+ }
350
+
351
+ const prev = logicalElementObj[prevId];
352
+ if (!prev) return;
353
+
354
+ // ถ้า previous มี childLogicalElementId === currentId แสดงว่า current เป็น child ของ prev หยุด (ไม่ข้ามขึ้น)
355
+ if (prev.childLogicalElementId === id) {
356
+ // แต่ถ้ามี objType ของตัวเอง ใช้ตัวเอง
357
+ if (current.objType) {
358
+ result = current.objType;
359
+ }
360
+
361
+ return;
362
+ }
363
+
364
+ // ถ้า previous มี objType ใช้เลย
365
+ if (prev.objType) {
366
+ result = prev.objType;
367
+ return;
368
+ }
369
+
370
+ // ไม่เข้าเงื่อนไขไหน เดินย้อนขึ้นต่อ
371
+ loop(prevId);
372
+ }
373
+
374
+ loop(activeId);
375
+ return result;
376
+ }
377
+
378
+ function findObjTypeStepChild(activeId, logicalElementObj) {
379
+ let result = null;
380
+
381
+ function loop(id) {
382
+ console.log("id:wdsfdfdf ", id);
383
+ const current = logicalElementObj[id];
384
+ // console.log("current:sadfdf ", current);
385
+ // if (!current) {
386
+ // result = null;
387
+ // return;
388
+ // } else {
389
+ // result = current.objType;
390
+ // return;
391
+ // }
392
+
393
+ // if (
394
+ // current.logicalElementType === "childComplexFilter" ||
395
+ // current.logicalElementType === "logical"
396
+ // // !current.previousLogicalElementId
397
+ // ) {
398
+ // result = current.objType || null;
399
+ // return;
400
+ // }
401
+
402
+ const prevId = current.previousLogicalElementId;
403
+ console.log("prevId:findObjTypeStep ", prevId);
404
+
405
+ if (!prevId) {
406
+ if (current.objType) {
407
+ result = current.objType;
408
+ }
409
+ return;
410
+ }
411
+
412
+ const prev = logicalElementObj[prevId];
413
+ if (!prev) return;
414
+
415
+ // ถ้า previous มี childLogicalElementId === currentId แสดงว่า current เป็น child ของ prev หยุด (ไม่ข้ามขึ้น)
416
+ if (prev.childLogicalElementId === id) {
417
+ // แต่ถ้ามี objType ของตัวเอง ใช้ตัวเอง
418
+ if (current.objType) {
419
+ result = current.objType;
420
+ }
421
+
422
+ return;
423
+ }
424
+
425
+ // ถ้า previous มี objType ใช้เลย
426
+ if (prev.objType) {
427
+ result = prev.objType;
428
+ return;
429
+ }
430
+
431
+ // ไม่เข้าเงื่อนไขไหน เดินย้อนขึ้นต่อ
432
+ loop(prevId);
433
+ }
434
+
435
+ loop(activeId);
436
+ return result;
437
+ }
438
+
439
+ async function handleLogicalElementTypeChange(e) {
440
+ let logicalElementType = e.target.value;
441
+ let mainLoigcalObj = objTemplateLogicalElement(
442
+ logicalElementType,
443
+ logicalElementObj[logicalElementOutput.active].previousLogicalElementId,
444
+ logicalElementObj[logicalElementOutput.active].nextLogicalElementId,
445
+ );
446
+ let logicalObj = {};
447
+ console.log("dfofjdf", logicalElementObj[logicalElementOutput.active]);
448
+
449
+ setLogicalElementOutput((logicalElementOutput) => {
450
+ logicalElementOutput.status = false;
451
+ });
452
+
453
+ let objType;
454
+ objType = objTypeMain;
455
+
456
+ if (
457
+ createArrObjTypeLogical(logicalElementOutput.active, logicalElementObj)
458
+ .lastObjtype !== ""
459
+ ) {
460
+ objType = objTypeFromObjTypeConcat(
461
+ createArrObjTypeLogical(logicalElementOutput.active, logicalElementObj)
462
+ .lastObjtype,
463
+ );
464
+ }
465
+
466
+ if (logicalElementType === "childComplexFilter") {
467
+ logicalObj = {
468
+ ...mainLoigcalObj,
469
+ objType: objType,
470
+ pathLinkType: {
471
+ objType: "",
472
+ relType: "",
473
+ direction: "",
474
+ },
475
+ childLogicalElementId: null,
476
+ };
477
+ }
478
+ if (logicalElementType === "translateIds") {
479
+ logicalObj = {
480
+ ...mainLoigcalObj,
481
+ objType: objType,
482
+ pathLinkType: {
483
+ objType: "",
484
+ relType: "",
485
+ direction: "",
486
+ },
487
+ childIdentifiers: [],
488
+ };
489
+ }
490
+
491
+ if (logicalElementType === "logical") {
492
+ logicalObj = {
493
+ ...mainLoigcalObj,
494
+ objType: objType,
495
+ // fieldName: "",
496
+ // comparison: "",
497
+ // valueUserTag: "",
498
+ };
499
+ }
500
+
501
+ if (
502
+ logicalElementType === "openBracket" ||
503
+ logicalElementType === "closeBracket"
504
+ ) {
505
+ setLogicalElementOutput((logicalElementOutput) => {
506
+ logicalElementOutput.status = true;
507
+ });
508
+ }
509
+
510
+ setLogicalElementObj((logicalElementObj) => {
511
+ logicalElementObj[logicalElementOutput.active] = {
512
+ ...mainLoigcalObj,
513
+ ...logicalObj,
514
+ };
515
+ });
516
+ }
517
+
518
+ function handleOperationChange(e) {
519
+ let operation = e.target.value;
520
+
521
+ setLogicalElementObj((logicalElementObj) => {
522
+ logicalElementObj[logicalElementOutput.active].operation = operation;
523
+ });
524
+
525
+ setLogicalElementOutput((logicalElementOutput) => {
526
+ logicalElementOutput.status = true;
527
+ });
528
+ }
529
+
530
+ function objTemplateLogicalElement(
531
+ logicalElementType,
532
+ previousLogicalElementId,
533
+ nextLogicalElementId,
534
+ ) {
535
+ let objTemplate = {
536
+ logicalElementType: logicalElementType,
537
+ previousLogicalElementId: previousLogicalElementId,
538
+ nextLogicalElementId: nextLogicalElementId,
539
+ };
540
+
541
+ return objTemplate;
542
+ }
543
+
544
+ function handelSelectRelTypeAndDirection(e) {
545
+ let relType = e.target.value;
546
+ let index = e.target.selectedIndex - 1;
547
+ let objTypeConcat = createObjTypeConcat(
548
+ logicalElementObj[logicalElementOutput.active].objType,
549
+ );
550
+
551
+ setLogicalElementObj((logicalElementObj) => {
552
+ logicalElementObj[logicalElementOutput.active].pathLinkType = {
553
+ relType: JSON.parse(relType),
554
+ objType: allObjTypesLinkConfigs[objTypeConcat][index].other.objType,
555
+ direction: allObjTypesLinkConfigs[objTypeConcat][index].base.direction,
556
+ };
557
+
558
+ if (allObjTypesLinkConfigs[objTypeConcat][index]?.requestProperties) {
559
+ let requestProperties = {};
560
+ for (const key in allObjTypesLinkConfigs[objTypeConcat][index]
561
+ ?.requestProperties) {
562
+ requestProperties[key] = "";
563
+ }
564
+ logicalElementObj[logicalElementOutput.active].requestProperties =
565
+ requestProperties;
566
+ } else {
567
+ delete logicalElementObj[logicalElementOutput.active].requestProperties;
568
+ }
569
+ });
570
+ setLogicalElementOutput((logicalElementOutput) => {
571
+ logicalElementOutput.status = true;
572
+ });
573
+ }
574
+
575
+ function handleAddLogicalElement(action) {
576
+ const uuid = nanoid(10);
577
+
578
+ console.log("action:asfdsgsdg ", action);
579
+ if (action === "addChild") {
580
+ collectRequireLinksFn(
581
+ logicalElementObj[logicalElementOutput.active].pathLinkType.objType,
582
+ );
583
+ getObjSchemaHieFn(
584
+ logicalElementObj[logicalElementOutput.active].pathLinkType.objType,
585
+ );
586
+ }
587
+
588
+ setLogicalElementObj((logicalElementObj) => {
589
+ if (Object.keys(logicalElementObj).length === 0) {
590
+ setInitialLogicalElementId(uuid);
591
+ logicalElementObj[uuid] = objTemplateLogicalElement(
592
+ "newLogicalElement",
593
+ null,
594
+ null,
595
+ );
596
+ } else {
597
+ if (action === "addParent") {
598
+ if (
599
+ logicalElementObj[logicalElementOutput.active]
600
+ .nextLogicalElementId !== null
601
+ ) {
602
+ logicalElementObj[uuid] = objTemplateLogicalElement(
603
+ "newLogicalElement",
604
+ logicalElementOutput.active,
605
+ logicalElementObj[logicalElementOutput.active]
606
+ .nextLogicalElementId,
607
+ );
608
+
609
+ logicalElementObj[
610
+ logicalElementOutput.active
611
+ ].nextLogicalElementId = uuid;
612
+ } else {
613
+ logicalElementObj[
614
+ logicalElementOutput.active
615
+ ].nextLogicalElementId = uuid;
616
+
617
+ logicalElementObj[uuid] = objTemplateLogicalElement(
618
+ "newLogicalElement",
619
+ logicalElementOutput.active,
620
+ null,
621
+ );
622
+ }
623
+ }
624
+
625
+ if (action === "addChild") {
626
+ logicalElementObj[uuid] = objTemplateLogicalElement(
627
+ "newLogicalElement",
628
+ logicalElementOutput.active,
629
+ null,
630
+ );
631
+ logicalElementObj[logicalElementOutput.active].childLogicalElementId =
632
+ uuid;
633
+ }
634
+ }
635
+ });
636
+
637
+ setLogicalElementOutput((logicalElementOutput) => {
638
+ logicalElementOutput.status = false;
639
+ logicalElementOutput.active = uuid;
640
+ });
641
+ }
642
+
643
+ function hadleActiveLogicalElement(key) {
644
+ setLogicalElementOutput((logicalElementOutput) => {
645
+ logicalElementOutput.active = key;
646
+ });
647
+ }
648
+
649
+ function hadelActiveTopParent(objType) {
650
+ console.log("objType:sdsacascz ", objType);
651
+ setLogicalElementOutput((logicalElementOutput) => {
652
+ logicalElementOutput.active = Object.values(objType)[0];
653
+ });
654
+ }
655
+
656
+ console.log(
657
+ "afsofiud",
658
+ createArrObjTypeLogical(logicalElementOutput.active, logicalElementObj),
659
+ );
660
+
661
+ function handleSelectFieldName(e, type) {
662
+ let value = e.target.value;
663
+
664
+ setLogicalElementObj((logicalElementObj) => {
665
+ logicalElementObj[logicalElementOutput.active][type] = value;
666
+ });
667
+
668
+ if (
669
+ type === "partitionKeyValueUserTag" ||
670
+ type === "sortKeyValueUserTags"
671
+ ) {
672
+ if (value === "createUserTag") {
673
+ setNewUserTags((newUserTags) => {
674
+ newUserTags.name = "";
675
+ newUserTags.obj = {
676
+ defaultValue: "",
677
+ };
678
+ });
679
+
680
+ setLogicalElementOutput((logicalElementOutput) => {
681
+ logicalElementOutput.status = "createUserTag";
682
+ });
683
+ } else {
684
+ setLogicalElementOutput((logicalElementOutput) => {
685
+ logicalElementOutput.status = false;
686
+ });
687
+ }
688
+ }
689
+ }
690
+
691
+ function handleUpdateNameNewValue(e) {
692
+ setNewUserTags((newUserTags) => {
693
+ newUserTags.name = e.target.value;
694
+ });
695
+ }
696
+
697
+ function handleUpdateNewValue(e, type) {
698
+ console.log("type: safddfdgcxg", type, newUserTags);
699
+
700
+ setNewUserTags((newUserTags) => {
701
+ newUserTags.obj[type] = e.target.value;
702
+ });
703
+ }
704
+
705
+ function handleUpdateNewValueRequestProperties(
706
+ e,
707
+ type,
708
+ keyRequestProperties,
709
+ ) {
710
+ setNewUserTagsRequestProperties((newUserTagsRequestProperties) => {
711
+ newUserTagsRequestProperties[keyRequestProperties][type] = e.target.value;
712
+ });
713
+ }
714
+
715
+ function handleSelectCreateNewValue(e) {
716
+ let type = e.target.value;
717
+ console.log("type:fgrgdfgfdh ", type);
718
+
719
+ setNewUserTags((newUserTags) => {
720
+ if (type === "valueUserTag") {
721
+ newUserTags.obj = {
722
+ defaultValue: "",
723
+ };
724
+ } else {
725
+ newUserTags.obj = {
726
+ valueSource: "perParentIdentifier",
727
+ perParentIdentifierFieldname: "",
728
+ };
729
+
730
+ if (
731
+ resultFieldName[createObjTypeConcat(objTypeMain)].identifiers
732
+ .length === 1
733
+ ) {
734
+ newUserTags.obj.perParentIdentifierFieldname =
735
+ perParentIdentifierFieldname[0].fieldName;
736
+ }
737
+ }
738
+ });
739
+
740
+ // setNewUserTags({});
741
+ }
742
+
743
+ console.log(
744
+ "newUserTags:sadsxczvbbvb ",
745
+ newUserTagsRequestProperties,
746
+ valueDataUserTags,
747
+ );
748
+
749
+ function handleCreateNewValue(e) {
750
+ setLogicalElementObj((logicalElementObj) => {
751
+ logicalElementObj[logicalElementOutput.active].valueUserTag =
752
+ newUserTags.nameUserTag;
753
+ });
754
+
755
+ setValueDataUserTags((valueDataUserTags) => {
756
+ valueDataUserTags[newUserTags.name] = newUserTags.obj;
757
+ });
758
+
759
+ setLogicalElementOutput((logicalElementOutput) => {
760
+ logicalElementOutput.status = true;
761
+ });
762
+ setNewUserTags({});
763
+ }
764
+
765
+ function handleCreateNewValueRequestProperties(e, keyRequestProperties) {
766
+ setLogicalElementObj((logicalElementObj) => {
767
+ logicalElementObj[logicalElementOutput.active].requestProperties[
768
+ keyRequestProperties
769
+ ] = newUserTags.nameUserTag;
770
+ });
771
+
772
+ setValueDataUserTags((valueDataUserTags) => {
773
+ valueDataUserTags[
774
+ newUserTagsRequestProperties[keyRequestProperties].name
775
+ ] = {
776
+ defaultValue:
777
+ newUserTagsRequestProperties[keyRequestProperties].defaultValue,
778
+ };
779
+ });
780
+
781
+ setLogicalElementOutput((logicalElementOutput) => {
782
+ logicalElementOutput.status = true;
783
+ });
784
+
785
+ setNewUserTagsRequestProperties((newUserTagsRequestProperties) => {
786
+ newUserTagsRequestProperties[keyRequestProperties] = {};
787
+ });
788
+ }
789
+
790
+ console.log("newUserTags: ", newUserTags);
791
+ const logicalElementType = [
792
+ "openBracket",
793
+ "closeBracket",
794
+ "childComplexFilter",
795
+ "operation",
796
+ "traversal",
797
+ "translateIds",
798
+ ];
799
+
800
+ const operation = ["AND", "OR"];
801
+ let comparison = [
802
+ "equals",
803
+ "greaterThan",
804
+ "greaterThanEquals",
805
+ "lessThan",
806
+ "lessThanEquals",
807
+ "highLow",
808
+ "high",
809
+ "low",
810
+ "izaraSyntax",
811
+ ];
812
+
813
+ function handelCreateFilterElement() {
814
+ if (createFilterElement) {
815
+ createFilterElement(
816
+ createObjTypeConcat(objTypeMain),
817
+ initialLogicalElementId,
818
+ logicalElementObj,
819
+ valueDataUserTags,
820
+ keyUseCase,
821
+ );
822
+ } else {
823
+ dispatch(
824
+ successFunction({
825
+ parentOutputId: parentOutputId,
826
+ // keyElement,
827
+ initialLogicalElementId: initialLogicalElementId,
828
+ logicalElements: logicalElementObj,
829
+ valueDataUserTags: valueDataUserTags,
830
+ }),
831
+ );
832
+ }
833
+ statusModal(false);
834
+ }
835
+
836
+ function handleValueSelect(e, key) {
837
+ let value = e.target.value;
838
+
839
+ if (value === "createUserTag") {
840
+ setLogicalElementObj((logicalElementObj) => {
841
+ logicalElementObj[logicalElementOutput.active].requestProperties[key] =
842
+ null;
843
+ });
844
+
845
+ setNewUserTagsRequestProperties((newUserTagsRequestProperties) => {
846
+ newUserTagsRequestProperties[key] = {};
847
+ });
848
+ } else {
849
+ setLogicalElementObj((logicalElementObj) => {
850
+ logicalElementObj[logicalElementOutput.active].requestProperties[key] =
851
+ value;
852
+ });
853
+ }
854
+ }
855
+
856
+ function statusModalSettingRequiredData(status) {
857
+ setModalSettingRequiredData(status);
858
+ }
859
+
860
+ function sussessComplexFilterTypeTraversal(arrTraversalSteps) {
861
+ setLogicalElementObj((logicalElementObj) => {
862
+ logicalElementObj[logicalElementOutput.active].traversalSteps =
863
+ arrTraversalSteps;
864
+ });
865
+
866
+ dispatch();
867
+ }
868
+
869
+ console.log("createFilterElement:fsdfbcsdfe", createFilterElement);
870
+ console.log("valueDataUserTags: ", valueDataUserTags);
871
+
872
+ console.log("logicalElementObj:dfcxvxzzcs ", logicalElementObj);
873
+
874
+ return (
875
+ <div>
876
+ <IzaraDivStyle styletags={createStyleDefualtTags("modal", "", "main")}>
877
+ <IzaraDivStyle styletags={createStyleDefualtTags("modal", "", "box")}>
878
+ <IzaraDivStyle
879
+ styletags={createStyleDefualtTags("gridColumn", "", "1")}
880
+ >
881
+ <h2>{titleModel}</h2>
882
+ <hr></hr>
883
+ <IzaraDivStyle
884
+ styletags={createStyleDefualtTags("pagination", "", "template")}
885
+ >
886
+ {initialLogicalElementId && (
887
+ <>
888
+ <a
889
+ onClick={(e) =>
890
+ hadelActiveTopParent({
891
+ [createObjTypeConcat(objTypeMain)]:
892
+ initialLogicalElementId,
893
+ })
894
+ }
895
+ >
896
+ {createObjTypeConcat(objTypeMain)}
897
+ </a>
898
+ {createArrObjTypeLogical(
899
+ logicalElementOutput.active,
900
+ logicalElementObj,
901
+ ).arrOutput.map((objType, index) => (
902
+ <>
903
+ /
904
+ <a onClick={(e) => hadelActiveTopParent(objType)}>
905
+ {Object.keys(objType)}
906
+ </a>
907
+ </>
908
+ ))}
909
+ </>
910
+ )}
911
+ </IzaraDivStyle>
912
+
913
+ <IzaraDivStyle
914
+ styletags={createStyleDefualtTags("background", "scroll", "div")}
915
+ >
916
+ <fieldset>
917
+ <legend>logicalElement list</legend>
918
+
919
+ <IzaraDivStyle
920
+ styletags={createStyleDefualtTags(
921
+ "gridTab",
922
+ "",
923
+ "logicalElment",
924
+ )}
925
+ >
926
+ <IzaraDivStyle
927
+ styletags={createStyleDefualtTags(
928
+ "pagination",
929
+ "",
930
+ "template",
931
+ )}
932
+ >
933
+ {initialLogicalElementId && (
934
+ <OutputListLogicalElement
935
+ logicalElementObj={logicalElementObj}
936
+ setLogicalElementObj={setLogicalElementObj}
937
+ logicalElementId={findLogicalRoot(
938
+ logicalElementOutput.active,
939
+ logicalElementObj,
940
+ )}
941
+ logicalElementOutput={logicalElementOutput}
942
+ setLogicalElementOutput={setLogicalElementOutput}
943
+ handleAddLogicalElement={handleAddLogicalElement}
944
+ hadleActiveLogicalElement={hadleActiveLogicalElement}
945
+ />
946
+ )}
947
+ </IzaraDivStyle>
948
+ <button
949
+ disabled={!allObjTypesLinkConfigs && !resultFieldName}
950
+ onClick={(e) => handleAddLogicalElement("addParent")}
951
+ >
952
+ add
953
+ </button>
954
+ </IzaraDivStyle>
955
+ </fieldset>
956
+ </IzaraDivStyle>
957
+
958
+ <IzaraDivStyle
959
+ styletags={createStyleDefualtTags("gridColumn", "", "1")}
960
+ >
961
+ <div>
962
+ {Object.keys(logicalElementObj).length !== 0 ? (
963
+ <>
964
+ <IzaraDivStyle
965
+ styletags={createStyleDefualtTags(
966
+ "background",
967
+ "scroll",
968
+ "div",
969
+ )}
970
+ >
971
+ <>
972
+ <IzaraDivStyle
973
+ styletags={createStyleDefualtTags(
974
+ "gridColumn",
975
+ "",
976
+ "11",
977
+ )}
978
+ >
979
+ <fieldset>
980
+ <legend>logicalElementType</legend>
981
+ <select
982
+ onChange={(e) => {
983
+ handleLogicalElementTypeChange(e);
984
+ }}
985
+ value={
986
+ logicalElementObj[logicalElementOutput.active]
987
+ .logicalElementType
988
+ }
989
+ >
990
+ <option
991
+ disabled={
992
+ logicalElementObj[logicalElementOutput.active]
993
+ .logicalElementType !== "newLogicalElement"
994
+ }
995
+ value={""}
996
+ >
997
+ ---choose---
998
+ </option>
999
+ {logicalElementType.map((key, id) => (
1000
+ <option key={key} value={key}>
1001
+ {key}
1002
+ </option>
1003
+ ))}
1004
+ {/* {console.log(
1005
+ resultFieldName[
1006
+ logicalElementObj[logicalElementOutput.active]
1007
+ .previousLogicalElementId === null
1008
+ ? createObjTypeConcat(objTypeMain)
1009
+ : createArrObjTypeLogical(
1010
+ logicalElementOutput.active,
1011
+ logicalElementObj,
1012
+ ).lastObjtype
1013
+ ]?.identifiers,
1014
+ createArrObjTypeLogical(
1015
+ logicalElementOutput.active,
1016
+ logicalElementObj,
1017
+ ).lastObjtype,
1018
+ "ssdawdafafff",
1019
+ )} */}
1020
+ {resultFieldName && (
1021
+ <>
1022
+ {resultFieldName[
1023
+ logicalElementObj[
1024
+ logicalElementOutput.active
1025
+ ].previousLogicalElementId === null
1026
+ ? createObjTypeConcat(objTypeMain)
1027
+ : createArrObjTypeLogical(
1028
+ logicalElementOutput.active,
1029
+ logicalElementObj,
1030
+ ).lastObjtype
1031
+ ]?.identifiers.some(
1032
+ (identifier) =>
1033
+ identifier.type === "partitionKey",
1034
+ ) && <option value="logical">logical</option>}
1035
+ </>
1036
+ )}
1037
+ </select>
1038
+ </fieldset>
1039
+ </IzaraDivStyle>
1040
+ <IzaraDivStyle
1041
+ styletags={createStyleDefualtTags(
1042
+ "gridColumn",
1043
+ "",
1044
+ "1",
1045
+ )}
1046
+ >
1047
+ {logicalElementObj[logicalElementOutput.active]
1048
+ .logicalElementType === "childComplexFilter" && (
1049
+ <IzaraDivStyle
1050
+ styletags={createStyleDefualtTags(
1051
+ "background",
1052
+ "scroll",
1053
+ "div",
1054
+ )}
1055
+ >
1056
+ {console.log(
1057
+ allObjTypesLinkConfigs,
1058
+ "foopesofods",
1059
+ )}
1060
+
1061
+ {!allObjTypesLinkConfigs[
1062
+ logicalElementObj[logicalElementOutput.active]
1063
+ .previousLogicalElementId === null
1064
+ ? createObjTypeConcat(objTypeMain)
1065
+ : createObjTypeConcat(
1066
+ findObjTypeStep(
1067
+ logicalElementOutput.active,
1068
+ logicalElementObj,
1069
+ ),
1070
+ )
1071
+ ] ? (
1072
+ <IzaraDivStyle
1073
+ styletags={createStyleDefualtTags(
1074
+ "loadingCircle",
1075
+ "20px",
1076
+ "template",
1077
+ )}
1078
+ ></IzaraDivStyle>
1079
+ ) : (
1080
+ <>
1081
+ <p> relationship type:</p>
1082
+ <select
1083
+ value={JSON.stringify(
1084
+ logicalElementObj[
1085
+ logicalElementOutput.active
1086
+ ].pathLinkType.relType,
1087
+ )}
1088
+ onChange={(e) =>
1089
+ handelSelectRelTypeAndDirection(e)
1090
+ }
1091
+ >
1092
+ <option
1093
+ disabled={
1094
+ logicalElementObj[
1095
+ logicalElementOutput.active
1096
+ ].pathLinkType.relType !== ""
1097
+ }
1098
+ value=""
1099
+ >
1100
+ -- relType --
1101
+ </option>
1102
+
1103
+ {allObjTypesLinkConfigs[
1104
+ createObjTypeConcat(
1105
+ logicalElementObj[
1106
+ logicalElementOutput.active
1107
+ ].objType,
1108
+ )
1109
+ ].map((data, index) => (
1110
+ <>
1111
+ <option
1112
+ key={index}
1113
+ value={JSON.stringify(data.relType)}
1114
+ >
1115
+ {createRelTypeConcat(data.relType)}
1116
+ </option>
1117
+ </>
1118
+ ))}
1119
+ </select>
1120
+
1121
+ {logicalElementObj[
1122
+ logicalElementOutput.active
1123
+ ]?.pathLinkType.objType && (
1124
+ <>
1125
+ <p> object type:</p>
1126
+ <span>
1127
+ {createObjTypeConcat(
1128
+ logicalElementObj[
1129
+ logicalElementOutput.active
1130
+ ].pathLinkType.objType,
1131
+ )}
1132
+ </span>
1133
+ <p>direction</p>
1134
+ <span>
1135
+ {
1136
+ logicalElementObj[
1137
+ logicalElementOutput.active
1138
+ ].pathLinkType.direction
1139
+ }
1140
+ </span>
1141
+ </>
1142
+ )}
1143
+ </>
1144
+ )}
1145
+
1146
+ {allObjTypesLinkConfigs[
1147
+ createObjTypeConcat(
1148
+ logicalElementObj[logicalElementOutput.active]
1149
+ .objType,
1150
+ )
1151
+ ].map((data, index) => (
1152
+ <>
1153
+ {_.isEqual(
1154
+ data.relType,
1155
+ logicalElementObj[
1156
+ logicalElementOutput.active
1157
+ ]?.pathLinkType.relType,
1158
+ ) && (
1159
+ <>
1160
+ {data.requestProperties && (
1161
+ <>
1162
+ {Object.keys(
1163
+ data.requestProperties,
1164
+ ).map(
1165
+ (keyRequestProperties, index) => (
1166
+ <>
1167
+ <p>{keyRequestProperties}</p>
1168
+ <select
1169
+ onChange={(e) =>
1170
+ handleValueSelect(
1171
+ e,
1172
+ keyRequestProperties,
1173
+ )
1174
+ }
1175
+ value={
1176
+ logicalElementObj[
1177
+ logicalElementOutput
1178
+ .active
1179
+ ].requestProperties[
1180
+ keyRequestProperties
1181
+ ]
1182
+ }
1183
+ >
1184
+ <option value="">
1185
+ -- choose --
1186
+ </option>
1187
+ {Object.entries(
1188
+ valueDataUserTags,
1189
+ )
1190
+ .filter(
1191
+ ([key, val]) =>
1192
+ "defaultValue" in val,
1193
+ )
1194
+ .map(([key, val]) => (
1195
+ <option
1196
+ key={key}
1197
+ value={key}
1198
+ >
1199
+ {val.defaultValue
1200
+ ? key
1201
+ : ""}
1202
+ </option>
1203
+ ))}
1204
+ <option value="createUserTag">
1205
+ create new userTag
1206
+ </option>
1207
+ </select>
1208
+
1209
+ {logicalElementObj[
1210
+ logicalElementOutput.active
1211
+ ].requestProperties[
1212
+ keyRequestProperties
1213
+ ] === null && (
1214
+ <>
1215
+ <p>createUserTag </p>
1216
+ <fieldset>
1217
+ <legend>
1218
+ nameUserTag
1219
+ </legend>
1220
+
1221
+ <input
1222
+ onChange={(e) =>
1223
+ handleUpdateNewValueRequestProperties(
1224
+ e,
1225
+ "name",
1226
+ keyRequestProperties,
1227
+ )
1228
+ }
1229
+ ></input>
1230
+ </fieldset>
1231
+ <fieldset>
1232
+ <legend>
1233
+ defaultValue
1234
+ </legend>
1235
+
1236
+ <input
1237
+ onChange={(e) =>
1238
+ handleUpdateNewValueRequestProperties(
1239
+ e,
1240
+ "defaultValue",
1241
+ keyRequestProperties,
1242
+ )
1243
+ }
1244
+ ></input>
1245
+ </fieldset>
1246
+ <IzaraDivStyle
1247
+ styletags={createStyleDefualtTags(
1248
+ "gridColumn",
1249
+ "",
1250
+ "11",
1251
+ )}
1252
+ >
1253
+ <button
1254
+ onClick={(e) =>
1255
+ handleCreateNewValueRequestProperties(
1256
+ e,
1257
+ keyRequestProperties,
1258
+ )
1259
+ }
1260
+ >
1261
+ create
1262
+ </button>
1263
+ </IzaraDivStyle>
1264
+ </>
1265
+ )}
1266
+ </>
1267
+ ),
1268
+ )}
1269
+ </>
1270
+ )}
1271
+ </>
1272
+ )}
1273
+ <></>
1274
+ </>
1275
+ ))}
1276
+ <br></br>
1277
+ {logicalElementObj[logicalElementOutput.active]
1278
+ .childLogicalElementId === null ? (
1279
+ <button
1280
+ onClick={(e) =>
1281
+ handleAddLogicalElement("addChild")
1282
+ }
1283
+ >
1284
+ create Child
1285
+ </button>
1286
+ ) : (
1287
+ <button
1288
+ onClick={(e) =>
1289
+ hadleActiveLogicalElement(
1290
+ logicalElementObj[
1291
+ logicalElementOutput.active
1292
+ ].childLogicalElementId,
1293
+ )
1294
+ }
1295
+ >
1296
+ view Child
1297
+ </button>
1298
+ )}
1299
+ </IzaraDivStyle>
1300
+ )}
1301
+ {logicalElementObj[logicalElementOutput.active]
1302
+ .logicalElementType === "translateIds" && (
1303
+ <IzaraDivStyle
1304
+ styletags={createStyleDefualtTags(
1305
+ "background",
1306
+ "scroll",
1307
+ "div",
1308
+ )}
1309
+ >
1310
+ {!allObjTypesLinkConfigs[
1311
+ logicalElementObj[logicalElementOutput.active]
1312
+ .previousLogicalElementId === null
1313
+ ? createObjTypeConcat(objTypeMain)
1314
+ : createObjTypeConcat(
1315
+ findObjTypeStep(
1316
+ logicalElementOutput.active,
1317
+ logicalElementObj,
1318
+ ),
1319
+ )
1320
+ ] ? (
1321
+ <IzaraDivStyle
1322
+ styletags={createStyleDefualtTags(
1323
+ "loadingCircle",
1324
+ "20px",
1325
+ "template",
1326
+ )}
1327
+ ></IzaraDivStyle>
1328
+ ) : (
1329
+ <>
1330
+ <p> relationship type:</p>
1331
+ <select
1332
+ value={JSON.stringify(
1333
+ logicalElementObj[
1334
+ logicalElementOutput.active
1335
+ ].pathLinkType.relType,
1336
+ )}
1337
+ onChange={(e) =>
1338
+ handelSelectRelTypeAndDirection(e)
1339
+ }
1340
+ >
1341
+ <option
1342
+ disabled={
1343
+ logicalElementObj[
1344
+ logicalElementOutput.active
1345
+ ].pathLinkType.relType !== ""
1346
+ }
1347
+ value=""
1348
+ >
1349
+ -- relType --
1350
+ </option>
1351
+
1352
+ {allObjTypesLinkConfigs[
1353
+ createObjTypeConcat(
1354
+ logicalElementObj[
1355
+ logicalElementOutput.active
1356
+ ].objType,
1357
+ )
1358
+ ].map((data, index) => (
1359
+ <>
1360
+ <option
1361
+ key={index}
1362
+ value={JSON.stringify(data.relType)}
1363
+ >
1364
+ {createRelTypeConcat(data.relType)}
1365
+ </option>
1366
+ </>
1367
+ ))}
1368
+ </select>
1369
+
1370
+ {logicalElementObj[
1371
+ logicalElementOutput.active
1372
+ ]?.pathLinkType.objType && (
1373
+ <>
1374
+ <p> object type:</p>
1375
+ <span>
1376
+ {createObjTypeConcat(
1377
+ logicalElementObj[
1378
+ logicalElementOutput.active
1379
+ ].pathLinkType.objType,
1380
+ )}
1381
+ </span>
1382
+ <p>direction</p>
1383
+ <span>
1384
+ {
1385
+ logicalElementObj[
1386
+ logicalElementOutput.active
1387
+ ].pathLinkType.direction
1388
+ }
1389
+ </span>
1390
+ </>
1391
+ )}
1392
+ </>
1393
+ )}
1394
+
1395
+ {allObjTypesLinkConfigs[
1396
+ createObjTypeConcat(
1397
+ logicalElementObj[logicalElementOutput.active]
1398
+ .objType,
1399
+ )
1400
+ ].map((data, index) => (
1401
+ <>
1402
+ {_.isEqual(
1403
+ data.relType,
1404
+ logicalElementObj[
1405
+ logicalElementOutput.active
1406
+ ]?.pathLinkType.relType,
1407
+ ) && (
1408
+ <>
1409
+ {data.requestProperties && (
1410
+ <>
1411
+ {Object.keys(
1412
+ data.requestProperties,
1413
+ ).map(
1414
+ (keyRequestProperties, index) => (
1415
+ <>
1416
+ <p>{keyRequestProperties}</p>
1417
+ <select
1418
+ onChange={(e) =>
1419
+ handleValueSelect(
1420
+ e,
1421
+ keyRequestProperties,
1422
+ )
1423
+ }
1424
+ value={
1425
+ logicalElementObj[
1426
+ logicalElementOutput
1427
+ .active
1428
+ ].requestProperties[
1429
+ keyRequestProperties
1430
+ ]
1431
+ }
1432
+ >
1433
+ <option value="">
1434
+ -- choose --
1435
+ </option>
1436
+ {Object.entries(
1437
+ valueDataUserTags,
1438
+ )
1439
+ .filter(
1440
+ ([key, val]) =>
1441
+ "defaultValue" in val,
1442
+ )
1443
+ .map(([key, val]) => (
1444
+ <option
1445
+ key={key}
1446
+ value={key}
1447
+ >
1448
+ {val.defaultValue
1449
+ ? key
1450
+ : ""}
1451
+ </option>
1452
+ ))}
1453
+ <option value="createUserTag">
1454
+ create new userTag
1455
+ </option>
1456
+ </select>
1457
+
1458
+ {logicalElementObj[
1459
+ logicalElementOutput.active
1460
+ ].requestProperties[
1461
+ keyRequestProperties
1462
+ ] === null && (
1463
+ <>
1464
+ <p>createUserTag </p>
1465
+ <fieldset>
1466
+ <legend>
1467
+ nameUserTag
1468
+ </legend>
1469
+
1470
+ <input
1471
+ onChange={(e) =>
1472
+ handleUpdateNewValueRequestProperties(
1473
+ e,
1474
+ "name",
1475
+ keyRequestProperties,
1476
+ )
1477
+ }
1478
+ ></input>
1479
+ </fieldset>
1480
+ <fieldset>
1481
+ <legend>
1482
+ defaultValue
1483
+ </legend>
1484
+
1485
+ <input
1486
+ onChange={(e) =>
1487
+ handleUpdateNewValueRequestProperties(
1488
+ e,
1489
+ "defaultValue",
1490
+ keyRequestProperties,
1491
+ )
1492
+ }
1493
+ ></input>
1494
+ </fieldset>
1495
+ <IzaraDivStyle
1496
+ styletags={createStyleDefualtTags(
1497
+ "gridColumn",
1498
+ "",
1499
+ "11",
1500
+ )}
1501
+ >
1502
+ <button
1503
+ onClick={(e) =>
1504
+ handleCreateNewValueRequestProperties(
1505
+ e,
1506
+ keyRequestProperties,
1507
+ )
1508
+ }
1509
+ >
1510
+ create
1511
+ </button>
1512
+ </IzaraDivStyle>
1513
+ </>
1514
+ )}
1515
+ </>
1516
+ ),
1517
+ )}
1518
+ </>
1519
+ )}
1520
+ </>
1521
+ )}
1522
+ <></>
1523
+ </>
1524
+ ))}
1525
+ </IzaraDivStyle>
1526
+ )}
1527
+ {logicalElementObj[logicalElementOutput.active]
1528
+ .logicalElementType === "logical" && (
1529
+ <>
1530
+ {resultFieldName && (
1531
+ <>
1532
+ {!resultFieldName[
1533
+ logicalElementObj[
1534
+ logicalElementOutput.active
1535
+ ].previousLogicalElementId === null
1536
+ ? createObjTypeConcat(objTypeMain)
1537
+ : createObjTypeConcat(
1538
+ findObjTypeStep(
1539
+ logicalElementOutput.active,
1540
+ logicalElementObj,
1541
+ ),
1542
+ )
1543
+ ] ? (
1544
+ <IzaraDivStyle
1545
+ styletags={createStyleDefualtTags(
1546
+ "loadingCircle",
1547
+ "20px",
1548
+ "template",
1549
+ )}
1550
+ ></IzaraDivStyle>
1551
+ ) : (
1552
+ <>
1553
+ <IzaraDivStyle
1554
+ styletags={createStyleDefualtTags(
1555
+ "background",
1556
+ "scroll",
1557
+ "div",
1558
+ )}
1559
+ >
1560
+ {/* <p> fieldname:</p>
1561
+ <select
1562
+ value={
1563
+ logicalElementObj[
1564
+ logicalElementOutput.active
1565
+ ].fieldName
1566
+ }
1567
+ onChange={(e) => {
1568
+ handleSelectFieldName(
1569
+ e,
1570
+ "fieldName"
1571
+ );
1572
+ }}
1573
+ >
1574
+ <option value="">
1575
+ -- fieldName --
1576
+ </option>
1577
+ {Object.keys(
1578
+ resultFieldName[
1579
+ logicalElementObj[
1580
+ logicalElementOutput.active
1581
+ ].previousLogicalElementId ===
1582
+ null
1583
+ ? createObjTypeConcat(
1584
+ objTypeMain
1585
+ )
1586
+ : createObjTypeConcat(
1587
+ findObjTypeStep(
1588
+ logicalElementOutput.active,
1589
+ logicalElementObj
1590
+ )
1591
+ )
1592
+ ].fieldNames
1593
+ ).map((key) => (
1594
+ <option key={key} value={key}>
1595
+ {key}
1596
+ </option>
1597
+ ))}
1598
+ </select> */}
1599
+
1600
+ {resultFieldName[
1601
+ logicalElementObj[
1602
+ logicalElementOutput.active
1603
+ ].previousLogicalElementId === null
1604
+ ? createObjTypeConcat(objTypeMain)
1605
+ : createObjTypeConcat(
1606
+ findObjTypeStep(
1607
+ logicalElementOutput.active,
1608
+ logicalElementObj,
1609
+ ),
1610
+ )
1611
+ ].identifiers.map(
1612
+ (identifier, index) => (
1613
+ <>
1614
+ {/* {JSON.stringify(identifier.type)} */}
1615
+ {identifier.type ===
1616
+ "partitionKey" ? (
1617
+ <>
1618
+ partitionKeyValueUserTag :
1619
+ <select
1620
+ onChange={(e) =>
1621
+ handleSelectFieldName(
1622
+ e,
1623
+ "partitionKeyValueUserTag",
1624
+ )
1625
+ }
1626
+ value={
1627
+ logicalElementObj[
1628
+ logicalElementOutput
1629
+ .active
1630
+ ].partitionKeyValueUserTag
1631
+ }
1632
+ >
1633
+ <option value="">
1634
+ -- choose --
1635
+ </option>
1636
+ <option value="createUserTag">
1637
+ create new userTag
1638
+ </option>
1639
+ {perParentIdentifierFieldname ? (
1640
+ <>
1641
+ {Object.entries(
1642
+ valueDataUserTags,
1643
+ )
1644
+ .filter(
1645
+ ([key, val]) =>
1646
+ "defaultValue" ||
1647
+ "perParentIdentifierFieldname" in
1648
+ val,
1649
+ )
1650
+ .map(([key, val]) => (
1651
+ <option
1652
+ key={key}
1653
+ value={key}
1654
+ >
1655
+ {key}
1656
+ {/* {val.defaultValue ||
1657
+ val.perParentIdentifierFieldname
1658
+ ? key
1659
+ : ""} */}
1660
+ </option>
1661
+ ))}
1662
+ </>
1663
+ ) : (
1664
+ <>
1665
+ {Object.entries(
1666
+ valueDataUserTags,
1667
+ )
1668
+ .filter(
1669
+ ([key, val]) =>
1670
+ "defaultValue" in
1671
+ val,
1672
+ )
1673
+ .map(([key, val]) => (
1674
+ <option
1675
+ key={key}
1676
+ value={key}
1677
+ >
1678
+ {val.defaultValue
1679
+ ? key
1680
+ : ""}
1681
+ </option>
1682
+ ))}
1683
+ </>
1684
+ )}
1685
+ </select>
1686
+ </>
1687
+ ) : (
1688
+ <>
1689
+ <p> comparison:</p>
1690
+
1691
+ <select
1692
+ value={
1693
+ logicalElementObj[
1694
+ logicalElementOutput
1695
+ .active
1696
+ ].comparison
1697
+ }
1698
+ onChange={(e) => {
1699
+ handleSelectFieldName(
1700
+ e,
1701
+ "comparison",
1702
+ );
1703
+ }}
1704
+ >
1705
+ <option
1706
+ disabled={
1707
+ logicalElementObj[
1708
+ logicalElementOutput
1709
+ .active
1710
+ ].comparison !== ""
1711
+ }
1712
+ value=""
1713
+ >
1714
+ choose comparison
1715
+ </option>
1716
+
1717
+ {comparison.map((key) => (
1718
+ <option
1719
+ key={key}
1720
+ value={key}
1721
+ >
1722
+ {key}
1723
+ </option>
1724
+ ))}
1725
+ </select>
1726
+ <p>sortKeyValueUserTags :</p>
1727
+
1728
+ <select
1729
+ onChange={(e) =>
1730
+ handleSelectFieldName(
1731
+ e,
1732
+ "sortKeyValueUserTags",
1733
+ )
1734
+ }
1735
+ value={
1736
+ logicalElementObj[
1737
+ logicalElementOutput
1738
+ .active
1739
+ ].valueUserTag
1740
+ }
1741
+ >
1742
+ <option value="">
1743
+ -- choose --
1744
+ </option>
1745
+ <option value="createUserTag">
1746
+ create new userTag
1747
+ </option>
1748
+ {perParentIdentifierFieldname ? (
1749
+ <>
1750
+ {Object.entries(
1751
+ valueDataUserTags,
1752
+ )
1753
+ .filter(
1754
+ ([key, val]) =>
1755
+ "defaultValue" ||
1756
+ "perParentIdentifierFieldname" in
1757
+ val,
1758
+ )
1759
+ .map(([key, val]) => (
1760
+ <option
1761
+ key={key}
1762
+ value={key}
1763
+ >
1764
+ {key}
1765
+ {/* {val.defaultValue ||
1766
+ val.perParentIdentifierFieldname
1767
+ ? key
1768
+ : ""} */}
1769
+ </option>
1770
+ ))}
1771
+ </>
1772
+ ) : (
1773
+ <>
1774
+ {Object.entries(
1775
+ valueDataUserTags,
1776
+ )
1777
+ .filter(
1778
+ ([key, val]) =>
1779
+ "defaultValue" in
1780
+ val,
1781
+ )
1782
+ .map(([key, val]) => (
1783
+ <option
1784
+ key={key}
1785
+ value={key}
1786
+ >
1787
+ {val.defaultValue
1788
+ ? key
1789
+ : ""}
1790
+ </option>
1791
+ ))}
1792
+ </>
1793
+ )}
1794
+ </select>
1795
+ </>
1796
+ )}
1797
+ </>
1798
+ ),
1799
+ )}
1800
+
1801
+ {logicalElementOutput.status ===
1802
+ "createUserTag" && (
1803
+ <>
1804
+ <hr></hr>
1805
+ <p>createUserTag </p>
1806
+ {perParentIdentifierFieldname && (
1807
+ <select
1808
+ onChange={(e) =>
1809
+ handleSelectCreateNewValue(e)
1810
+ }
1811
+ >
1812
+ <option value="defaultValue">
1813
+ defaultValue
1814
+ </option>
1815
+ <option value="perParentIdentifier">
1816
+ perParentIdentifier
1817
+ </option>
1818
+ </select>
1819
+ )}
1820
+ <fieldset>
1821
+ <legend>nameUserTag</legend>
1822
+
1823
+ <input
1824
+ onChange={(e) =>
1825
+ handleUpdateNameNewValue(e)
1826
+ }
1827
+ ></input>
1828
+ </fieldset>
1829
+
1830
+ {newUserTags.obj.hasOwnProperty(
1831
+ "defaultValue",
1832
+ ) ? (
1833
+ <>
1834
+ <fieldset>
1835
+ <legend>defaultValue</legend>
1836
+
1837
+ <input
1838
+ onChange={(e) =>
1839
+ handleUpdateNewValue(
1840
+ e,
1841
+ "defaultValue",
1842
+ )
1843
+ }
1844
+ ></input>
1845
+ </fieldset>
1846
+ </>
1847
+ ) : (
1848
+ <>
1849
+ <fieldset>
1850
+ <legend>
1851
+ perParentIdentifierFieldname
1852
+ </legend>
1853
+
1854
+ <select
1855
+ onChange={(e) =>
1856
+ handleUpdateNewValue(
1857
+ e,
1858
+ "perParentIdentifierFieldname",
1859
+ )
1860
+ }
1861
+ >
1862
+ {perParentIdentifierFieldname.map(
1863
+ (identifier, index) => (
1864
+ <option>
1865
+ {identifier.fieldName}
1866
+ </option>
1867
+ ),
1868
+ )}
1869
+ </select>
1870
+ </fieldset>
1871
+ </>
1872
+ )}
1873
+
1874
+ <IzaraDivStyle
1875
+ styletags={createStyleDefualtTags(
1876
+ "gridColumn",
1877
+ "",
1878
+ "11",
1879
+ )}
1880
+ >
1881
+ <button
1882
+ onClick={(e) =>
1883
+ handleCreateNewValue(e)
1884
+ }
1885
+ >
1886
+ create
1887
+ </button>
1888
+ </IzaraDivStyle>
1889
+ </>
1890
+ )}
1891
+ </IzaraDivStyle>
1892
+ </>
1893
+ )}
1894
+ </>
1895
+ )}
1896
+ </>
1897
+ )}
1898
+ {logicalElementObj[logicalElementOutput.active]
1899
+ .logicalElementType === "traversal" && (
1900
+ <>
1901
+ {modalSettingRequiredData && (
1902
+ <ModalRequiredData
1903
+ statusModalSettingRequiredData={
1904
+ statusModalSettingRequiredData
1905
+ }
1906
+ objConfigUseCase={objConfigUseCase}
1907
+ // objTypeMain={objConfig.pageOutputMainConfigUseCase.objType}
1908
+ nameReducer={nameReducer}
1909
+ parentOutputId={parentOutputId}
1910
+ // userTags={objConfig.pageOutputMainConfigUseCase.values}
1911
+ // sortFieldStatus={"fromSortField"}
1912
+ // successRequiredDataConfig={
1913
+ // successRequiredDataConfig
1914
+ // }
1915
+ collectObjectLinksWithRequestProperties={
1916
+ collectObjectLinksWithRequestProperties
1917
+ }
1918
+ collectObjectSchemaWithHierarchy={
1919
+ collectObjectSchemaWithHierarchy
1920
+ }
1921
+ // keyRequiredData={
1922
+ // modalSettingRequiredData === true
1923
+ // ? ""
1924
+ // : modalSettingRequiredData
1925
+ // }
1926
+ />
1927
+ )}
1928
+ <fieldset></fieldset>
1929
+
1930
+ <button
1931
+ onClick={() =>
1932
+ statusModalSettingRequiredData("traversal")
1933
+ }
1934
+ >
1935
+ add traversal
1936
+ </button>
1937
+ </>
1938
+ )}
1939
+ </IzaraDivStyle>
1940
+ </>
1941
+ </IzaraDivStyle>
1942
+
1943
+ {logicalElementObj[logicalElementOutput.active]
1944
+ .logicalElementType === "operation" && (
1945
+ <IzaraDivStyle
1946
+ styletags={createStyleDefualtTags(
1947
+ "background",
1948
+ "scroll",
1949
+ "div",
1950
+ )}
1951
+ >
1952
+ <fieldset>
1953
+ <legend>operation</legend>
1954
+ <select
1955
+ onChange={handleOperationChange}
1956
+ value={
1957
+ logicalElementObj[logicalElementOutput.active]
1958
+ .operation
1959
+ }
1960
+ >
1961
+ <option>--- choose ---</option>
1962
+ {operation.map((key, id) => (
1963
+ <option key={key}>{key}</option>
1964
+ ))}
1965
+ </select>
1966
+ </fieldset>
1967
+ </IzaraDivStyle>
1968
+ )}
1969
+ </>
1970
+ ) : (
1971
+ <>not found select</>
1972
+ )}
1973
+ </div>
1974
+ </IzaraDivStyle>
1975
+
1976
+ <IzaraDivStyle
1977
+ styletags={createStyleDefualtTags("gridColumn", "", "11")}
1978
+ >
1979
+ <IzaraButtonStyle
1980
+ styletags={createStyleDefualtTags("modal", "", "button")}
1981
+ type="button"
1982
+ onClick={(e) => handelCreateFilterElement()}
1983
+ >
1984
+ save
1985
+ </IzaraButtonStyle>
1986
+
1987
+ <IzaraButtonStyle
1988
+ styletags={createStyleDefualtTags("modal", "", "button")}
1989
+ type="button"
1990
+ onClick={(e) => statusModal(false)}
1991
+ >
1992
+ cancel
1993
+ </IzaraButtonStyle>
1994
+ </IzaraDivStyle>
1995
+ </IzaraDivStyle>
1996
+ </IzaraDivStyle>
1997
+ </IzaraDivStyle>
1998
+ </div>
1999
+ );
2000
+ };
2001
+
2002
+ export const TraversalComponent = ({ fieldName }) => {
2003
+ return (
2004
+ <div>
2005
+ <fieldset>
2006
+ <legend>hopsPassObjType</legend>
2007
+ <input type="checkbox" />
2008
+ </fieldset>
2009
+
2010
+ {type === "fieldValueUserTags" && <></>}
2011
+ </div>
2012
+ );
2013
+ };