Skip to content

Commit bfb2559

Browse files
committed
Merge branch 'main' into issue-548
2 parents d0b8102 + d27c893 commit bfb2559

File tree

3 files changed

+69
-4
lines changed

3 files changed

+69
-4
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1717
- Fix left-sidebar spacing (#525)
1818
- Fixed slowness loading some CSP pages with multiple instances sharing a webserver (#540)
1919
- Prevent direct commits to default merge branch in basic mode (#484)
20+
- Fixed git path configuration (#463)
21+
- Added feedback to settings page (#550)
2022
- Fix "Home" navigation to point to current namespace (#548)
2123

2224
## [2.6.0] - 2024-10-07

cls/SourceControl/Git/Settings.cls

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,13 @@ ClassMethod Configure() As %Boolean [ CodeMode = objectgenerator ]
170170
set propertyDef = ##class(%Dictionary.PropertyDefinition).%OpenId("SourceControl.Git.Settings||"_property_"")
171171
if ((propertyDef) && (propertyDef.Type = "%Boolean")) {
172172
do %code.WriteLine(" set response = ##class(%Library.Prompt).GetYesNo("_promptQuoted_",.value,,"_defaultPromptFlag_")")
173+
} elseif ((propertyDef) && (propertyDef.Name = "gitBinPath")) {
174+
do %code.WriteLine(" set valid = 0")
175+
do %code.WriteLine(" while ('valid) {")
176+
do %code.WriteLine(" set response = ##class(%Library.Prompt).GetString("_promptQuoted_",.value,,,,"_defaultPromptFlag_")")
177+
do %code.WriteLine(" set status = inst.ConfigureBinPath(.value)")
178+
do %code.WriteLine(" if (status) { set valid = 1 }")
179+
do %code.WriteLine(" }")
173180
} elseif ((propertyDef) && (propertyDef.Name = "basicMode")) {
174181
set basicModePromptFlag = defaultPromptFlag + $$$MatchExactArrayMask + $$$InitialDisplayMask
175182
do %code.WriteLine(" set list(1) = ""Yes""")
@@ -341,4 +348,36 @@ Method OnAfterConfigure() As %Boolean
341348
}
342349
}
343350

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

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>
@@ -134,7 +155,13 @@ body {
134155
do settings.%Save()
135156
}
136157
</server>
137-
<div class = 'container'>
158+
<div class = 'container'>
159+
<csp:if condition='$D(%request.Data("gitsettings",1)) && (##class(SourceControl.Git.Utils).NeedSettings() = 0)'>
160+
<div class = "alert">
161+
<span class="closebtn" onclick="this.parentElement.style.display='none';">&times;</span>
162+
<strong>Success!</strong> Your changes have been saved.
163+
</div>
164+
</csp:if>
138165
<form id="settingsForm" method='post'>
139166
<input type="hidden" name="Namespace" value="#(..EscapeHTML(namespace))#" />
140167
<input type="hidden" name="gitsettings" value="1" />
@@ -574,9 +601,6 @@ body {
574601
</div>
575602

576603
</form>
577-
<csp:if condition='$D(%request.Data("gitsettings",1)) && (##class(SourceControl.Git.Utils).NeedSettings() = 0)'>
578-
<em>Settings saved. Click cross in the upper-right corner to close the settings window.</em>
579-
</csp:if>
580604
</div>
581605
<script src="js/polyfills.js"></script>
582606
<script src="js/jquery.min.js"></script>

0 commit comments

Comments
 (0)