Selaa lähdekoodia

changes at UI end for highlighter

VISHAL BHANUSHALI 3 kuukautta sitten
vanhempi
commit
8f224ca698
1 muutettua tiedostoa jossa 17 lisäystä ja 10 poistoa
  1. 17 10
      content_quality_tool_public/static/js/attr-extraction.js

+ 17 - 10
content_quality_tool_public/static/js/attr-extraction.js

@@ -1655,15 +1655,15 @@ function renderMandatoryComparisonTable(attributes, title, productType) {
             });
             
             // Add AI values not found in possibleValues as new selected options
-            // selectedValues.forEach(aiVal => {
-            //     if (!attr?.possibleValues.includes(aiVal)) {
-            //         const newOpt = document.createElement('option');
-            //         newOpt.value = aiVal;
-            //         newOpt.textContent = aiVal;
-            //         newOpt.selected = true;
-            //         select.appendChild(newOpt);
-            //     }
-            // });
+            selectedValues.forEach(aiVal => {
+                if (!attr?.possibleValues.includes(aiVal)) {
+                    const newOpt = document.createElement('option');
+                    newOpt.value = aiVal;
+                    newOpt.textContent = aiVal;
+                    newOpt.selected = true;
+                    select.appendChild(newOpt);
+                }
+            });
 
 
             aiTd.appendChild(select);
@@ -2522,6 +2522,8 @@ function renderInlineForTable() {
         //     .map(v => v?.value?.toString()?.trim())
         //     .filter(Boolean);
 
+        // const attrConfig = attributesFullData.find(item => item.attribute_name === key);
+
         const mandatoryValues = Object.values(mandatoryData)
             // 1. Use flatMap to iterate over the outer array AND flatten the inner arrays.
             //    'arr' here is the array like [ { value: 'Pullover', ... } ]
@@ -2674,7 +2676,8 @@ function submitAttributes() {
         body: raw
     })
     .then(response => response.json())
-    .then(data => {
+    .then(async data => {
+        await delay(5000); // waits for 3 seconds
         // console.log("response data",data); 
         API_RESPONSE_AI = data;   
         renderInlineAttributes();
@@ -3369,4 +3372,8 @@ function renderSimpleAttributeCards(attributes, title) {
 
     section.appendChild(cardsContainer);
     return section;
+}
+
+function delay(ms) {
+    return new Promise(resolve => setTimeout(resolve, ms));
 }