Skip to content

Commit 789b7d0

Browse files
committed
enh: settings page includes connection test of remote
1 parent c4cbb64 commit 789b7d0

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

CHANGELOG.md

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

1010
### Added
1111
- Expanded Baseline Export to include custom HL7, X12, ASTM schemas and Lookup Tables (#693)
12+
- Settings page includes a test of the connection to the remote (#746)
1213

1314
### Fixed
1415
- Deletes are now properly owned by the user who did the delete (#729)

csp/gitprojectsettings.csp

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,9 @@ body {
191191
set successfullySavedSettings = 1
192192
}
193193
set remote = ##class(SourceControl.Git.Utils).GetRedactedRemote()
194+
if (remote'="") && (##class(SourceControl.Git.Utils).RunGitCommandWithInput("ls-remote",,.errStream,,"origin")'=0) {
195+
set remoteConnectionError = errStream.Read()
196+
}
194197
} catch err {
195198
do err.Log()
196199
&html<<div class="error alert-danger">An error occurred and has been logged to the application error log.</div>>
@@ -324,7 +327,7 @@ body {
324327
set placeholder = $Select($system.Version.GetOS()="Windows":"(e.g. C:\Users\ExampleUser\.ssh\id_rsa)",
325328
1:"(e.g., /home/user/.ssh/id_rsa)")
326329
</server>
327-
<input type="text" class="#(class)#" id="privateKeyFile" name="privateKeyFile" value='#(..EscapeHTML(settings.privateKeyFile))#' placeholder=#(placeholder)#/>
330+
<input type="text" class="#(class)#" id="privateKeyFile" name="privateKeyFile" value='#(..EscapeHTML(settings.privateKeyFile))#' placeholder="#(..EscapeHTML(placeholder))#"/>
328331
<div class = "#(divClass)#">
329332
#(feedbackText)#
330333
<pre id="sshOutput"></pre>
@@ -424,10 +427,16 @@ body {
424427
<div class="form-group row mb-3">
425428
<label for="remoteRepo" class="offset-sm-1 col-sm-3 col-form-label" data-toggle="tooltip" data-placement="top" title="Url to Remote repository (origin)"><b>Remote Repository</b></label>
426429
<div class="col-sm-7">
427-
<input type="text" class="form-control" id="remoteRepo" name="remoteRepo" value='#(..EscapeHTML($get(remote)))#' placeholder="ex. git@github.com:User/UserRepo.git"/>
430+
<input type="text" class='form-control #($select($get(remote)="":"",$get(remoteConnectionError)="":"is-valid",1:"is-invalid"))#' id="remoteRepo" name="remoteRepo" value='#(..EscapeHTML($get(remote)))#' placeholder="e.g. git@github.com:User/UserRepo.git"/>
428431
<div class = "neutral-feedback">
429432
(Username is redacted)
430433
</div>
434+
<div class="invalid-feedback">
435+
Unable to contact remote: #(..EscapeHTML($get(remoteConnectionError)))#
436+
</div>
437+
<div class="valid-feedback">
438+
Connection successful
439+
</div>
431440
</div>
432441
</div>
433442

0 commit comments

Comments
 (0)