@integry/sdk 4.6.95 → 4.6.97
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
|
@@ -240,21 +240,9 @@ const ListBox = (props: ListBoxProps) => {
|
|
|
240
240
|
|
|
241
241
|
useEffect(() => {
|
|
242
242
|
if (query && isSearchable) {
|
|
243
|
-
const filtered =
|
|
244
|
-
.
|
|
245
|
-
|
|
246
|
-
scoreFn: (keysResult) => {
|
|
247
|
-
const nameResult = keysResult[0];
|
|
248
|
-
const tagsResult = keysResult[1];
|
|
249
|
-
// assign higher score to name result
|
|
250
|
-
const score = Math.max(
|
|
251
|
-
nameResult ? nameResult.score + 100 : -Infinity,
|
|
252
|
-
tagsResult ? tagsResult.score : -Infinity,
|
|
253
|
-
);
|
|
254
|
-
return score;
|
|
255
|
-
},
|
|
256
|
-
})
|
|
257
|
-
.map((el) => el.obj);
|
|
243
|
+
const filtered = items.filter((item) =>
|
|
244
|
+
item.value.toLowerCase().includes(query.toLowerCase()),
|
|
245
|
+
);
|
|
258
246
|
setHighlightedIndex(-1);
|
|
259
247
|
setSortedFilteredItems(filtered);
|
|
260
248
|
if (filtered.length === 1) setHighlightedIndex(0);
|
|
@@ -403,6 +403,9 @@ const findParentWithAppIcon = (
|
|
|
403
403
|
|
|
404
404
|
return parentWithIcon;
|
|
405
405
|
};
|
|
406
|
+
|
|
407
|
+
// Update the TagList component to add the "add tag" button functionality
|
|
408
|
+
|
|
406
409
|
const TagList = ({
|
|
407
410
|
tags,
|
|
408
411
|
searchTerm,
|
|
@@ -424,6 +427,9 @@ const TagList = ({
|
|
|
424
427
|
Record<string, boolean>
|
|
425
428
|
>({});
|
|
426
429
|
|
|
430
|
+
// Track which node is being hovered
|
|
431
|
+
const [hoveredNode, setHoveredNode] = useState<string | null>(null);
|
|
432
|
+
|
|
427
433
|
// Handle arrays by converting them to objects with indices as keys
|
|
428
434
|
const processedTags = Array.isArray(tags)
|
|
429
435
|
? arrayToObject(tags)
|
|
@@ -628,6 +634,47 @@ const TagList = ({
|
|
|
628
634
|
return textModified.replace(regex, '<mark>$1</mark>');
|
|
629
635
|
};
|
|
630
636
|
|
|
637
|
+
const extractStepsFromOutputPath = (pathToExtract: string) => {
|
|
638
|
+
const parts = pathToExtract.split('.'); // Split the string by dots
|
|
639
|
+
|
|
640
|
+
// Find the first occurrence of 'output'
|
|
641
|
+
const firstOutputIndex = parts.indexOf('output');
|
|
642
|
+
|
|
643
|
+
if (firstOutputIndex === -1 || firstOutputIndex === 0) {
|
|
644
|
+
return ''; // Return empty if 'output' is not found or it's at the start
|
|
645
|
+
}
|
|
646
|
+
|
|
647
|
+
// Get the step name (part before the first 'output')
|
|
648
|
+
const stepName = parts[firstOutputIndex - 1];
|
|
649
|
+
|
|
650
|
+
// Get all parts after the first 'output', including any other 'output' keys
|
|
651
|
+
const remainingParts = parts.slice(firstOutputIndex + 1);
|
|
652
|
+
|
|
653
|
+
// If there are remaining parts, combine the step name with them
|
|
654
|
+
if (remainingParts.length > 0) {
|
|
655
|
+
return `${stepName}.${remainingParts.join('.')}`;
|
|
656
|
+
}
|
|
657
|
+
|
|
658
|
+
// If there are no remaining parts, just return the step name
|
|
659
|
+
return stepName;
|
|
660
|
+
};
|
|
661
|
+
|
|
662
|
+
// Function to handle selecting a tag
|
|
663
|
+
const handleSelectTag = (
|
|
664
|
+
key: string,
|
|
665
|
+
value: unknown,
|
|
666
|
+
currentPath: string,
|
|
667
|
+
) => {
|
|
668
|
+
const tagPath = `${activeTab}.${extractStepsFromOutputPath(currentPath)}`;
|
|
669
|
+
onSelect({
|
|
670
|
+
currentPath: tagPath
|
|
671
|
+
.replace(/\bparameters\.parameters\b/g, 'parameters')
|
|
672
|
+
.replace(/\bauthorization\.authorization\b/g, 'authorization'),
|
|
673
|
+
key,
|
|
674
|
+
value: escapeHTMLIfNeeded(value),
|
|
675
|
+
});
|
|
676
|
+
};
|
|
677
|
+
|
|
631
678
|
// Update the filterTags function with proper type checking
|
|
632
679
|
const filterTags = (
|
|
633
680
|
tagsToFilter: Record<string, unknown> | unknown[],
|
|
@@ -743,31 +790,6 @@ const TagList = ({
|
|
|
743
790
|
? filterTags(processedTags, searchTerm, path)
|
|
744
791
|
: processedTags;
|
|
745
792
|
|
|
746
|
-
const extractStepsFromOutputPath = (pathToExtract: string) => {
|
|
747
|
-
const parts = pathToExtract.split('.'); // Split the string by dots
|
|
748
|
-
|
|
749
|
-
// Find the first occurrence of 'output'
|
|
750
|
-
const firstOutputIndex = parts.indexOf('output');
|
|
751
|
-
|
|
752
|
-
if (firstOutputIndex === -1 || firstOutputIndex === 0) {
|
|
753
|
-
return ''; // Return empty if 'output' is not found or it's at the start
|
|
754
|
-
}
|
|
755
|
-
|
|
756
|
-
// Get the step name (part before the first 'output')
|
|
757
|
-
const stepName = parts[firstOutputIndex - 1];
|
|
758
|
-
|
|
759
|
-
// Get all parts after the first 'output', including any other 'output' keys
|
|
760
|
-
const remainingParts = parts.slice(firstOutputIndex + 1);
|
|
761
|
-
|
|
762
|
-
// If there are remaining parts, combine the step name with them
|
|
763
|
-
if (remainingParts.length > 0) {
|
|
764
|
-
return `${stepName}.${remainingParts.join('.')}`;
|
|
765
|
-
}
|
|
766
|
-
|
|
767
|
-
// If there are no remaining parts, just return the step name
|
|
768
|
-
return stepName;
|
|
769
|
-
};
|
|
770
|
-
|
|
771
793
|
// Simplified rendering to fix syntax issues
|
|
772
794
|
return html`
|
|
773
795
|
<ul style="padding-left: ${1 * 20}px;">
|
|
@@ -873,22 +895,18 @@ const TagList = ({
|
|
|
873
895
|
toggleOutputExpand(key, e);
|
|
874
896
|
} else {
|
|
875
897
|
// For leaf nodes, select the value
|
|
876
|
-
|
|
877
|
-
currentPath,
|
|
878
|
-
)}`;
|
|
879
|
-
onSelect({
|
|
880
|
-
currentPath: tagPath
|
|
881
|
-
.replace(/\bparameters\.parameters\b/g, 'parameters')
|
|
882
|
-
.replace(
|
|
883
|
-
/\bauthorization\.authorization\b/g,
|
|
884
|
-
'authorization',
|
|
885
|
-
),
|
|
886
|
-
key,
|
|
887
|
-
value: escapeHTMLIfNeeded(value),
|
|
888
|
-
});
|
|
898
|
+
handleSelectTag(key, value, currentPath);
|
|
889
899
|
}
|
|
890
900
|
};
|
|
891
901
|
|
|
902
|
+
// Check if this is an edge node (leaf node with no children)
|
|
903
|
+
const isEdgeNode = !hasChildren;
|
|
904
|
+
|
|
905
|
+
// Determine if we should show the add tag button
|
|
906
|
+
// Don't show for step name nodes, only for non-edge nodes that aren't step names
|
|
907
|
+
const shouldShowAddButton =
|
|
908
|
+
!isEdgeNode && hoveredNode === key && !isStep;
|
|
909
|
+
|
|
892
910
|
return html`
|
|
893
911
|
<li key=${key} class="${nodeMatches ? styles.searchMatch : ''}">
|
|
894
912
|
<div
|
|
@@ -905,22 +923,12 @@ const TagList = ({
|
|
|
905
923
|
toggleOutputExpand(key, e);
|
|
906
924
|
} else {
|
|
907
925
|
// For leaf nodes, select the value
|
|
908
|
-
|
|
909
|
-
currentPath,
|
|
910
|
-
)}`;
|
|
911
|
-
onSelect({
|
|
912
|
-
currentPath: tagPath
|
|
913
|
-
.replace(/\bparameters\.parameters\b/g, 'parameters')
|
|
914
|
-
.replace(
|
|
915
|
-
/\bauthorization\.authorization\b/g,
|
|
916
|
-
'authorization',
|
|
917
|
-
),
|
|
918
|
-
key,
|
|
919
|
-
value: escapeHTMLIfNeeded(value),
|
|
920
|
-
});
|
|
926
|
+
handleSelectTag(key, value, currentPath);
|
|
921
927
|
}
|
|
922
928
|
}}
|
|
923
929
|
class="${styles.listItemContent}"
|
|
930
|
+
onMouseEnter=${() => setHoveredNode(key)}
|
|
931
|
+
onMouseLeave=${() => setHoveredNode(null)}
|
|
924
932
|
>
|
|
925
933
|
${!isStep ? html`<${TypeIcon} value=${value} />` : ''}
|
|
926
934
|
${isTagNode(value) && value.appIcon
|
|
@@ -991,8 +999,35 @@ const TagList = ({
|
|
|
991
999
|
</span>
|
|
992
1000
|
</span>`
|
|
993
1001
|
: ''}
|
|
994
|
-
|
|
995
|
-
|
|
1002
|
+
|
|
1003
|
+
<!-- Add Tag button for non-edge nodes that aren't step names -->
|
|
1004
|
+
${shouldShowAddButton
|
|
1005
|
+
? html`
|
|
1006
|
+
<button
|
|
1007
|
+
class="${styles.addTagButton}"
|
|
1008
|
+
onClick=${(e: Event) => {
|
|
1009
|
+
e.stopPropagation();
|
|
1010
|
+
handleSelectTag(key, value, currentPath);
|
|
1011
|
+
}}
|
|
1012
|
+
title="Add this tag"
|
|
1013
|
+
>
|
|
1014
|
+
<svg
|
|
1015
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
1016
|
+
width="16"
|
|
1017
|
+
height="16"
|
|
1018
|
+
viewBox="0 0 24 24"
|
|
1019
|
+
fill="none"
|
|
1020
|
+
stroke="currentColor"
|
|
1021
|
+
strokeWidth="2"
|
|
1022
|
+
strokeLinecap="round"
|
|
1023
|
+
strokeLinejoin="round"
|
|
1024
|
+
>
|
|
1025
|
+
<path d="M12 5v14"></path>
|
|
1026
|
+
<path d="M5 12h14"></path>
|
|
1027
|
+
</svg>
|
|
1028
|
+
</button>
|
|
1029
|
+
`
|
|
1030
|
+
: ''}
|
|
996
1031
|
|
|
997
1032
|
<!-- Expand/collapse icon for arrays -->
|
|
998
1033
|
${Array.isArray(value) && value.length > 0
|
|
@@ -255,6 +255,45 @@
|
|
|
255
255
|
margin-right: 3px;
|
|
256
256
|
order: 2;
|
|
257
257
|
}
|
|
258
|
+
|
|
259
|
+
// Add this to your styles.module.scss file
|
|
260
|
+
.addTagButton {
|
|
261
|
+
display: flex;
|
|
262
|
+
align-items: center;
|
|
263
|
+
justify-content: center;
|
|
264
|
+
background-color: #4f46e5;
|
|
265
|
+
color: white;
|
|
266
|
+
border: none;
|
|
267
|
+
border-radius: 4px;
|
|
268
|
+
width: 24px;
|
|
269
|
+
height: 24px;
|
|
270
|
+
cursor: pointer;
|
|
271
|
+
transition: background-color 0.2s, opacity 0.2s;
|
|
272
|
+
position: absolute;
|
|
273
|
+
right: 12px; // Reduced from 32px to 8px to position it closer to the right edge
|
|
274
|
+
opacity: 0.9;
|
|
275
|
+
animation: fadeIn 0.2s ease-in-out;
|
|
276
|
+
z-index: 10; // Ensure it appears above other elements
|
|
277
|
+
|
|
278
|
+
&:hover {
|
|
279
|
+
background-color: #4338ca;
|
|
280
|
+
opacity: 1;
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
svg {
|
|
284
|
+
width: 14px;
|
|
285
|
+
height: 14px;
|
|
286
|
+
}
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
@keyframes fadeIn {
|
|
290
|
+
from {
|
|
291
|
+
opacity: 0;
|
|
292
|
+
}
|
|
293
|
+
to {
|
|
294
|
+
opacity: 0.9;
|
|
295
|
+
}
|
|
296
|
+
}
|
|
258
297
|
}
|
|
259
298
|
}
|
|
260
299
|
}
|