@capillarytech/creatives-library 7.1.4 → 7.1.5
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 +1 -1
- package/v2Containers/FTP/index.js +36 -6
package/package.json
CHANGED
|
@@ -373,17 +373,47 @@ export class FTP extends React.Component {
|
|
|
373
373
|
const tags = getTreeStructuredTags({tagsList: (metaEntities.tags || {}).standard, offerDetails: selectedOfferDetails});
|
|
374
374
|
const clonnedTagsTree = cloneDeep(tags);
|
|
375
375
|
headerTagList.map((headerTag) => {
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
376
|
+
clonnedTagsTree.map((tag, index) => {
|
|
377
|
+
if (!isEmpty(tag.children)) { //if we have subtags it will first resolve subtag values.
|
|
378
|
+
const subTags = this.disableUsedSubTag(tag.children, headerTag);
|
|
379
|
+
clonnedTagsTree[index] = {
|
|
380
|
+
...clonnedTagsTree[index],
|
|
381
|
+
children: subTags,
|
|
382
|
+
};
|
|
383
|
+
} else { // If first level itself is leaf node then I will match the usedtag value and disable it accordingly.
|
|
384
|
+
const pos = findIndex(clonnedTagsTree, {value: headerTag.tag});
|
|
385
|
+
if (pos > -1) {
|
|
386
|
+
clonnedTagsTree[pos] = {
|
|
387
|
+
disabled: true,
|
|
388
|
+
...clonnedTagsTree[pos],
|
|
389
|
+
};
|
|
390
|
+
}
|
|
391
|
+
}
|
|
392
|
+
});
|
|
393
|
+
});
|
|
394
|
+
this.setState({tagsTree: clonnedTagsTree});
|
|
395
|
+
};
|
|
396
|
+
|
|
397
|
+
disableUsedSubTag = (subTags, headerTag) => {
|
|
398
|
+
const clonnedSubTags = cloneDeep(subTags);
|
|
399
|
+
clonnedSubTags.map((tag, index) => {
|
|
400
|
+
if (!isEmpty(tag.children)) { //Using recursion here to dig deep into further level if they have subtags.
|
|
401
|
+
//if we still have subtags, it will call same function to resolved deepest subtag value first.
|
|
402
|
+
const subTags1 = this.disableUsedSubTag(tag.children, headerTag);
|
|
403
|
+
clonnedSubTags[index] = {
|
|
404
|
+
...clonnedSubTags[index],
|
|
405
|
+
children: subTags1,
|
|
406
|
+
};
|
|
407
|
+
} else if (isEqual(tag.value, headerTag.tag)) { // when Leaf node, it will match usedtag value and disable usedtags from tags tree.
|
|
408
|
+
clonnedSubTags[index] = {
|
|
379
409
|
disabled: true,
|
|
380
|
-
...
|
|
410
|
+
...clonnedSubTags[index],
|
|
381
411
|
};
|
|
382
412
|
}
|
|
383
413
|
return null;
|
|
384
414
|
});
|
|
385
|
-
|
|
386
|
-
}
|
|
415
|
+
return clonnedSubTags;
|
|
416
|
+
}
|
|
387
417
|
|
|
388
418
|
handleManageFTPSettings = () => {
|
|
389
419
|
const path = `/exports/configurations`;
|