Skip to content

Commit b9ac45d

Browse files
authored
Merge pull request #277 from isc-pbarton/fix-mappings-ui
Fix adding mappings through the settings web UI
2 parents 84b78d6 + afb1eab commit b9ac45d

File tree

2 files changed

+46
-38
lines changed

2 files changed

+46
-38
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1212

1313
### Fixed
1414
- Studio export path doesn't get weird mixed slahes on Windows (#252)
15+
- Fixed bug with adding mappings through the Settings page (#270)
1516
- Pulling add/delete of multiple non-IRIS files no longer causes error (#273)
1617

1718
## [2.2.0] - 2023-06-05

csp/gitprojectsettings.csp

Lines changed: 45 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -71,11 +71,13 @@ body {
7171
set param = "NoFolders"
7272
kill settings.Mappings
7373

74-
while ( $Get(%request.Data("MappingsExt",i)) '= "" ){
75-
if ($Get(%request.Data(param,i)) = "NoFolders"){
76-
set settings.Mappings($Get(%request.Data("MappingsExt",i)), $Get(%request.Data("MappingsCov",i)), $Get(%request.Data(param,i))) = 1
74+
while ( $Data(%request.Data("MappingsExt",i)) ){
75+
if ($get(%request.Data("MappingsExt",i)) '= "") {
76+
if ($Get(%request.Data(param,i)) = "NoFolders"){
77+
set settings.Mappings($Get(%request.Data("MappingsExt",i)), $Get(%request.Data("MappingsCov",i)), $Get(%request.Data(param,i))) = 1
78+
}
79+
set settings.Mappings($Get(%request.Data("MappingsExt",i)), $Get(%request.Data("MappingsCov",i))) = $Get(%request.Data("MappingsPath",i))
7780
}
78-
set settings.Mappings($Get(%request.Data("MappingsExt",i)), $Get(%request.Data("MappingsCov",i))) = $Get(%request.Data("MappingsPath",i))
7981
set i = i+1
8082
}
8183
do settings.%Save()
@@ -259,7 +261,43 @@ body {
259261
</svg>
260262
</button>
261263
</div>
264+
<script language="cache" method="MakeMappingRow" arguments="extKey,covKey,mapPath,noFolders,checked,activated,tooltipTitle,idx,isTemplate">
265+
&html<<div class="voca col-sm-7" #($select(isTemplate:"hidden",1:""))#>
266+
<div class = "input-group mb-1">
267+
<input type="text" class="form-control required" id="MappingsExt" name="MappingsExt" value="#(extKey)#" placeholder="Extension" #($select(isTemplate:"",1:"required"))#>
268+
<input type="text" class="form-control required" id="MappingsCov" name="MappingsCov" value="#(covKey)#" placeholder="Coverage" #($select(isTemplate:"",1:"required"))#>
269+
<input type="text" class="form-control required" id="MappingsPath" name="MappingsPath" value="#(mapPath)#" placeholder="Relative path" #($select(isTemplate:"",1:"required"))#>
270+
<input type="text" class="form-control" id="NoFolders" name="NoFolders" value="#(noFolders)#" placeholder="To folder, or not to folder, that is the question." readonly>
271+
<div class="custom-control custom-switch" data-delay='{"show":"1000", "hide":"100"}' data-toggle="tooltip" data-placement="top" title="#(tooltipTitle)#">
272+
<input type="checkbox" class="#("custom-control-input"_activated)#" id="#("noFoldersSwitch"_idx)#" #(checked)#>
273+
<label class="custom-control-label" for="#("noFoldersSwitch"_idx)#">>
274+
275+
if (checked '= ""){
276+
&html<<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" fill="#007bff" class="bi bi-folder-fill" viewBox="0 0 16 16">
277+
<path d="M9.828 3h3.982a2 2 0 0 1 1.992 2.181l-.637 7A2 2 0 0 1 13.174 14H2.825a2 2 0 0 1-1.991-1.819l-.637-7a1.99 1.99 0 0 1 .342-1.31L.5 3a2 2 0 0 1 2-2h3.672a2 2 0 0 1 1.414.586l.828.828A2 2 0 0 0 9.828 3zm-8.322.12C1.72 3.042 1.95 3 2.19 3h5.396l-.707-.707A1 1 0 0 0 6.172 2H2.5a1 1 0 0 0-1 .981l.006.139z"/>
278+
</svg>>
279+
} else{
280+
&html<<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" fill="currentColor" class="bi bi-folder-x" viewBox="0 0 16 16">
281+
<path d="M.54 3.87.5 3a2 2 0 0 1 2-2h3.672a2 2 0 0 1 1.414.586l.828.828A2 2 0 0 0 9.828 3h3.982a2 2 0 0 1 1.992 2.181L15.546 8H14.54l.265-2.91A1 1 0 0 0 13.81 4H2.19a1 1 0 0 0-.996 1.09l.637 7a1 1 0 0 0 .995.91H9v1H2.826a2 2 0 0 1-1.991-1.819l-.637-7a1.99 1.99 0 0 1 .342-1.31zm6.339-1.577A1 1 0 0 0 6.172 2H2.5a1 1 0 0 0-1 .981l.006.139C1.72 3.042 1.95 3 2.19 3h5.396l-.707-.707z"/>
282+
<path d="M11.854 10.146a.5.5 0 0 0-.707.708L12.293 12l-1.146 1.146a.5.5 0 0 0 .707.708L13 12.707l1.146 1.147a.5.5 0 0 0 .708-.708L13.707 12l1.147-1.146a.5.5 0 0 0-.707-.708L13 11.293l-1.146-1.147z"/>
283+
</svg>>
284+
}
285+
286+
&html<</label>
287+
</div>
288+
<div class="input-group-append">
289+
<button type="button" class="btn btn-remove" >
290+
<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" fill="#dc3545" class="bi bi-dash-circle-fill" viewBox="0 0 16 16">
291+
<path d="M16 8A8 8 0 1 1 0 8a8 8 0 0 1 16 0zM4.5 7.5a.5.5 0 0 0 0 1h7a.5.5 0 0 0 0-1h-7z"></path>
292+
</svg>
293+
</button>
294+
</div>
295+
</div>
296+
</div>>
297+
</script>
262298
<script language="cache" runat=server>
299+
// make a hidden template row
300+
do ..MakeMappingRow("","","","","checked"," active","","",1)
263301
set extKey = ""
264302
set idx = 1
265303
for {
@@ -292,40 +330,7 @@ body {
292330
set noFolders = """"""
293331
set tooltipTitle = """Switch off to store files in a flat directory structure."""
294332
}
295-
296-
&html<<div class="voca col-sm-7">
297-
<div class = "input-group mb-1">
298-
<input type="text" class="form-control" id="MappingsExt" name="MappingsExt" value=#(extKey)# placeholder="Extension" required>
299-
<input type="text" class="form-control" id="MappingsCov" name="MappingsCov" value=#(covKey)# placeholder="Coverage" required>
300-
<input type="text" class="form-control" id="MappingsPath" name="MappingsPath" value=#(mapPath)# placeholder="Relative path" required>
301-
<input type="text" class="form-control" id="NoFolders" name="NoFolders" value=#(noFolders)# placeholder="To folder, or not to folder, that is the question." readonly>
302-
<div class="custom-control custom-switch" data-delay='{"show":"1000", "hide":"100"}' data-toggle="tooltip" data-placement="top" title=#(tooltipTitle)#>
303-
<input type="checkbox" class="#("custom-control-input"_activated)#" id=#("noFoldersSwitch"_idx)# #(checked)#>
304-
<label class="custom-control-label" for=#("noFoldersSwitch"_idx)#>>
305-
306-
if (checked '= ""){
307-
&html<<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" fill="#007bff" class="bi bi-folder-fill" viewBox="0 0 16 16">
308-
<path d="M9.828 3h3.982a2 2 0 0 1 1.992 2.181l-.637 7A2 2 0 0 1 13.174 14H2.825a2 2 0 0 1-1.991-1.819l-.637-7a1.99 1.99 0 0 1 .342-1.31L.5 3a2 2 0 0 1 2-2h3.672a2 2 0 0 1 1.414.586l.828.828A2 2 0 0 0 9.828 3zm-8.322.12C1.72 3.042 1.95 3 2.19 3h5.396l-.707-.707A1 1 0 0 0 6.172 2H2.5a1 1 0 0 0-1 .981l.006.139z"/>
309-
</svg>>
310-
} else{
311-
&html<<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" fill="currentColor" class="bi bi-folder-x" viewBox="0 0 16 16">
312-
<path d="M.54 3.87.5 3a2 2 0 0 1 2-2h3.672a2 2 0 0 1 1.414.586l.828.828A2 2 0 0 0 9.828 3h3.982a2 2 0 0 1 1.992 2.181L15.546 8H14.54l.265-2.91A1 1 0 0 0 13.81 4H2.19a1 1 0 0 0-.996 1.09l.637 7a1 1 0 0 0 .995.91H9v1H2.826a2 2 0 0 1-1.991-1.819l-.637-7a1.99 1.99 0 0 1 .342-1.31zm6.339-1.577A1 1 0 0 0 6.172 2H2.5a1 1 0 0 0-1 .981l.006.139C1.72 3.042 1.95 3 2.19 3h5.396l-.707-.707z"/>
313-
<path d="M11.854 10.146a.5.5 0 0 0-.707.708L12.293 12l-1.146 1.146a.5.5 0 0 0 .707.708L13 12.707l1.146 1.147a.5.5 0 0 0 .708-.708L13.707 12l1.147-1.146a.5.5 0 0 0-.707-.708L13 11.293l-1.146-1.147z"/>
314-
</svg>>
315-
}
316-
317-
&html<</label>
318-
</div>
319-
<div class="input-group-append">
320-
<button type="button" class="btn btn-remove" >
321-
<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" fill="#dc3545" class="bi bi-dash-circle-fill" viewBox="0 0 16 16">
322-
<path d="M16 8A8 8 0 1 1 0 8a8 8 0 0 1 16 0zM4.5 7.5a.5.5 0 0 0 0 1h7a.5.5 0 0 0 0-1h-7z"></path>
323-
</svg>
324-
</button>
325-
</div>
326-
</div>
327-
</div>>
328-
333+
do ..MakeMappingRow(extKey,covKey,mapPath,noFolders,checked,activated,tooltipTitle,idx,0)
329334
set idx = idx + 1
330335
}
331336
}
@@ -452,6 +457,8 @@ $(function()
452457
$(newEntry.children().children(".custom-control").children()[1]).attr("for", newID)
453458
newEntry.children().children(".custom-control").children()[0].id = newID
454459
newEntry.find('input').val('');
460+
newEntry.attr('hidden',false);
461+
newEntry.children().children(".required").attr("required","required");
455462

456463
newEntry.appendTo(controlForm);
457464
$(("#"+newID)).click(toggleNoFolders);

0 commit comments

Comments
 (0)