Skip to content

Commit 1d5b58c

Browse files
authored
Merge branch 'main' into fix-468
2 parents 13ff63d + d27c893 commit 1d5b58c

File tree

3 files changed

+70
-5
lines changed

3 files changed

+70
-5
lines changed

CHANGELOG.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1919
- Fix left-sidebar spacing (#525)
2020
- Fixed slowness loading some CSP pages with multiple instances sharing a webserver (#540)
2121
- Prevent direct commits to default merge branch in basic mode (#484)
22-
- Fixed GetContexts utils function to exclude implied namespaces from the list of namespaces(#468)
22+
- Fixed GetContexts utils function to exclude implied namespaces from the list of namespaces (#468)
23+
- Fixed git path configuration (#463)
24+
- Added feedback to settings page (#550)
2325

2426
## [2.6.0] - 2024-10-07
2527

cls/SourceControl/Git/Settings.cls

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,13 @@ ClassMethod Configure() As %Boolean [ CodeMode = objectgenerator ]
176176
set propertyDef = ##class(%Dictionary.PropertyDefinition).%OpenId("SourceControl.Git.Settings||"_property_"")
177177
if ((propertyDef) && (propertyDef.Type = "%Boolean")) {
178178
do %code.WriteLine(" set response = ##class(%Library.Prompt).GetYesNo("_promptQuoted_",.value,,"_defaultPromptFlag_")")
179+
} elseif ((propertyDef) && (propertyDef.Name = "gitBinPath")) {
180+
do %code.WriteLine(" set valid = 0")
181+
do %code.WriteLine(" while ('valid) {")
182+
do %code.WriteLine(" set response = ##class(%Library.Prompt).GetString("_promptQuoted_",.value,,,,"_defaultPromptFlag_")")
183+
do %code.WriteLine(" set status = inst.ConfigureBinPath(.value)")
184+
do %code.WriteLine(" if (status) { set valid = 1 }")
185+
do %code.WriteLine(" }")
179186
} elseif ((propertyDef) && (propertyDef.Name = "basicMode")) {
180187
set basicModePromptFlag = defaultPromptFlag + $$$MatchExactArrayMask + $$$InitialDisplayMask
181188
do %code.WriteLine(" set list(1) = ""Yes""")
@@ -347,4 +354,36 @@ Method OnAfterConfigure() As %Boolean
347354
}
348355
}
349356

357+
Method ConfigureBinPath(ByRef path As %String) As %Boolean
358+
{
359+
if (path = "") { return 1 }
360+
// Sometimes path is quoted
361+
set path = $replace(path,"""","")
362+
if (##class(%File).DirectoryExists(path)) {
363+
set gitFile = $case($$$isWINDOWS,1:"git.exe",:"git")
364+
set path = ##class(%File).Construct(path, gitFile)
365+
}
366+
367+
if (##class(%File).Exists(path)) {
368+
// no-op
369+
} else {
370+
write !, "The entered path is not a valid path, please try again"
371+
return 0
372+
}
373+
try {
374+
set sysStorage = ##class(SourceControl.Git.Utils).%SYSNamespaceStorage()
375+
kill @sysStorage@("%gitBinPath")
376+
if (..gitBinPath '= "") {
377+
set @sysStorage@("%gitBinPath") = path
378+
}
379+
kill ^||GitVersion
380+
// Get and write the version
381+
set gitExists = ##class(SourceControl.Git.Utils).GitBinExists(.version)
382+
write !, "You are now using "_version
383+
} catch e {
384+
// no-op, user may not have privileges
385+
}
386+
return 1
387+
}
388+
350389
}

csp/gitprojectsettings.csp

Lines changed: 28 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,27 @@ body {
6868
padding-left: 4px;
6969
}
7070

71+
.alert {
72+
padding: 20px;
73+
background-color: #04AA6D;;
74+
color: white;
75+
}
76+
77+
.closebtn {
78+
margin-left: 15px;
79+
color: white;
80+
font-weight: bold;
81+
float: right;
82+
font-size: 22px;
83+
line-height: 20px;
84+
cursor: pointer;
85+
transition: 0.3s;
86+
}
87+
88+
.closebtn:hover {
89+
color: black;
90+
}
91+
7192
</style>
7293
</head>
7394
<body>
@@ -146,7 +167,13 @@ body {
146167
do settings.%Save()
147168
}
148169
</server>
149-
<div class = 'container'>
170+
<div class = 'container'>
171+
<csp:if condition='$D(%request.Data("gitsettings",1)) && (##class(SourceControl.Git.Utils).NeedSettings() = 0)'>
172+
<div class = "alert">
173+
<span class="closebtn" onclick="this.parentElement.style.display='none';">&times;</span>
174+
<strong>Success!</strong> Your changes have been saved.
175+
</div>
176+
</csp:if>
150177
<form id="settingsForm" method='post'>
151178
<input type="hidden" name="Namespace" value="#(..EscapeHTML(namespace))#" />
152179
<input type="hidden" name="gitsettings" value="1" />
@@ -607,9 +634,6 @@ body {
607634
</div>
608635

609636
</form>
610-
<csp:if condition='$D(%request.Data("gitsettings",1)) && (##class(SourceControl.Git.Utils).NeedSettings() = 0)'>
611-
<em>Settings saved. Click cross in the upper-right corner to close the settings window.</em>
612-
</csp:if>
613637
</div>
614638
<script src="js/polyfills.js"></script>
615639
<script src="js/jquery.min.js"></script>

0 commit comments

Comments
 (0)