@@ -86,11 +86,11 @@ function addRowFunction()
8686 item = item . replace ( replaceString , "" ) ;
8787 }
8888 }
89- item += "<div style=\"display: inline-block;\" id=\"newRowLocationForWatchList" + countOfClicks + "\"></div>" ;
89+ locationInsert = "newRowLocationForWatchList" + countOfClicks ;
90+ item += "<div style=\"display: inline-block;\" id=\"" + locationInsert + "\"></div>" ;
9091 document . getElementById ( locationInsert ) . outerHTML += item ;
9192 document . getElementById ( 'numberOfRows' ) . value = countOfWatchList ;
9293 countOfAddedFiles ++ ;
93- locationInsert = "newRowLocationForWatchList" + countOfClicks ;
9494}
9595
9696function deleteRowFunction ( currentRow , decreaseCountWatchListNum )
@@ -122,21 +122,36 @@ function updateLaterFolders(currentRow, newValue)
122122 {
123123 var updateItoIMinusOne = i - 1 ;
124124 var elementToUpdate = "rowNumber" + i ;
125- var documentUpdateText = "<li class='watchFolderGroups' id='rowNumber" + updateItoIMinusOne + "' ><span class='leftSpacingserverNames' > Name: </span> " ;
126- var watchListKeyIdFind = "watchListKey" + i ;
127- var previousElementNumIdentifierForKey = document . getElementsByName ( watchListKeyIdFind ) ;
128-
129- documentUpdateText += "<input class='inputWidth300' type='text' name='watchListKey" + updateItoIMinusOne + "' value='" + previousElementNumIdentifierForKey [ 0 ] . value + "'> " ;
125+ let item = $ ( "#hiddenWatchlistFormBlank" ) . html ( ) ;
126+ item = item . replace ( / { { i } } / g , updateItoIMinusOne ) ;
127+ let watchListKeyIdFind = "watchListKey" + i ;
128+ let previousElementNumIdentifierForKey = document . getElementsByName ( watchListKeyIdFind ) [ 0 ] . value ;
129+ item = item . replace ( / { { key } } / g , previousElementNumIdentifierForKey ) ;
130130 for ( var j = 0 ; j < numberOfSubRows ; j ++ )
131131 {
132- var watchListItemIdFind = "watchListItem" + i + "-" + ( j + 1 ) ;
133- var previousElementNumIdentifierForItem = document . getElementsByName ( watchListItemIdFind ) ;
134- documentUpdateText += "<br> <span class='leftSpacingserverNames' > " + arrayOfKeysNonEnc [ j ] + ": </span> <input style='display: none;' type='text' name='watchListItem" + updateItoIMinusOne + "-" + ( j + 1 ) + "-Name' value=" + arrayOfKeysNonEnc [ j ] + "> <input class='inputWidth300' type='text' name='watchListItem" + updateItoIMinusOne + "-" + ( j + 1 ) + "' value='" + previousElementNumIdentifierForItem [ 0 ] . value + "'>" ;
132+ let watchListItemIdFind = "watchListItem" + i + "-" + ( j + 1 ) ;
133+ let previousElementNumIdentifierForItem = document . getElementsByName ( watchListItemIdFind ) [ 0 ] . value ;
134+ let find = "{{" + updateItoIMinusOne + "-" + ( j + 1 ) + "}}" ;
135+ let replaceString = new RegExp ( find , 'g' ) ;
136+
137+ if ( arrayOfKeysNonEnc [ j ] === "type" )
138+ {
139+ item = item . replace ( replaceString , generateTypeSelect ( previousElementNumIdentifierForItem ) ) ;
140+ }
141+ else if ( arrayOfKeysNonEnc [ j ] === "gitType" )
142+ {
143+ item = item . replace ( replaceString , generateGitTypeSelect ( previousElementNumIdentifierForItem ) ) ;
144+ }
145+ else if ( arrayOfKeysNonEnc [ j ] === "Archive" )
146+ {
147+ item = item . replace ( replaceString , generateTrueFalseSelect ( previousElementNumIdentifierForItem ) ) ;
148+ }
149+ else
150+ {
151+ item = item . replace ( replaceString , previousElementNumIdentifierForItem ) ;
152+ }
135153 }
136- documentUpdateText += '<br> <input style="display: none" type="text" name="watchListItem' + updateItoIMinusOne + '-0" value="' + numberOfSubRows + '"> ' ;
137- documentUpdateText += '<span class="leftSpacingserverNames" ></span> <a class="mainLinkClass" onclick="deleteRowFunction(' + updateItoIMinusOne + ', true)">Remove</a><span> | </span><a class="mainLinkClass" onclick="testConnection(dataForWatchFolder' + updateItoIMinusOne + ');" >Check Connection</a>' ;
138- documentUpdateText += '</li>' ;
139- document . getElementById ( elementToUpdate ) . outerHTML = documentUpdateText ;
154+ document . getElementById ( elementToUpdate ) . outerHTML = item ;
140155 }
141156}
142157
0 commit comments