Changeset 7662


Ignore:
Timestamp:
Mar 20, 2019, 8:55:45 AM (3 years ago)
Author:
Nicklas Nordborg
Message:

Fixes #2165: "Auto generate" should have an option to not overwrite exiting mappings in the "Test with file" function

Location:
trunk/www/common/plugin
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/www/common/plugin/parse_file.js

    r7660 r7662  
    9797  }
    9898 
    99   parse.setColumnMapping = function(mappingName, expression)
     99  parse.setColumnMapping = function(mappingName, expression, overwrite)
    100100  {
    101101    var frm = document.forms['mappings'];
    102102    var field = 'mapping.'+mappingName+'.expression';
    103     frm[field].value = expression;
    104     window.parent.TestWithFile.setFormValue(field, expression);
     103    if (overwrite || frm[field].value == '')
     104    {
     105      frm[field].value = expression;
     106      window.parent.TestWithFile.setFormValue(field, expression);
     107    }
    105108  }
    106109 
     
    144147    var target = event.currentTarget;
    145148    var mappingName = Data.get(target, 'mapping');
    146     parse.setColumnMapping(mappingName, '');
     149    parse.setColumnMapping(mappingName, '', true);
    147150  }
    148151 
     
    156159    var expression = parse.getMappingExpressionForHeader(columnIndex);
    157160
    158     parse.setColumnMapping(mappingName, expression);
     161    parse.setColumnMapping(mappingName, expression, true);
    159162  }
    160163 
     
    163166    var frm = document.forms['mappings'];
    164167    var minScore = parseFloat(frm.similarity.value);
     168    var overwrite = frm.overwrite.checked;
    165169    for (var i = 0; i < fuzzyMatches.length; i++)
    166170    {
     
    177181          expression = '';
    178182        }
    179         parse.setColumnMapping(match.name, expression);
     183        parse.setColumnMapping(match.name, expression, overwrite);
    180184      }
    181185    }
  • trunk/www/common/plugin/parse_file.jsp

    r7661 r7662  
    501501          {
    502502            %>
    503             <td style="padding-left: 4px;">
     503            <td style="padding-left: 1em;">
    504504            <base:button id="btnFuzzyMatches" title="Auto generate"
    505505              tooltip="Generate mappings by finding the best match between Property and File column"/>
     506              Similarity score:
     507              <input type="text" id="similarityScore" name="similarity" value="0.85" style="width: 4em;">
     508              (0 = bad; 1 = good)
    506509            </td>
    507             <td style="padding-left: 4px; width: 50%;">
    508               Similarity score:
    509               <input type="text" id="similarityScore" name="similarity" value="0.85">
    510               (0 = bad; 1 = good)
     510            <td style="padding-left: 1em;">
     511              <label><input type="checkbox" name="overwrite" checked>Overwrite existing mappings</label>
    511512            </td>
    512513            <%
Note: See TracChangeset for help on using the changeset viewer.