Skip to content

Commit 5599867

Browse files
committed
Merge branch 'main' into instance-wide-uncommitted-queue
2 parents 8f61e94 + cedb88b commit 5599867

File tree

16 files changed

+601
-86
lines changed

16 files changed

+601
-86
lines changed

.github/workflows/main.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ jobs:
8585
ls $GITHUB_WORKSPACE/$artifact_dir
8686
8787
- name: Attach CE Artifact
88-
uses: actions/upload-artifact@v3
88+
uses: actions/upload-artifact@v4
8989
if: always()
9090
with:
9191
name: "PreIRISInstallationPackage"
@@ -103,7 +103,7 @@ jobs:
103103
fail: false
104104

105105
- name: Attach the report
106-
uses: actions/upload-artifact@v1
106+
uses: actions/upload-artifact@v4
107107
if: always()
108108
with:
109109
name: ${{ steps.xunit-viewer.outputs.report-name }}

CHANGELOG.md

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,25 @@ All notable changes to this project will be documented in this file.
55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
66
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

8-
98
## [2.5.0] - Unreleased
109

1110
### Added
1211
- New UI for the basic mode Sync (#415)
1312
- Files in uncommitted queue in any namespace warn users when opened except for in VSCode (#370)
13+
- Allow changing namespaces and IPM package context from web UI (#280)
14+
- Support for editing repo from filesystem perspective via web application (#464)
15+
- Support for downloading a VSCode workspace file from web UI
16+
- IncrementalLoad pull event handler will update the running production, if any (#473)
1417

1518
### Fixed
1619
- Instance wide settings are placed in proper global (#444)
20+
- Avoid delay/errors in loading interop JS when there is a URL prefix (e.g., instance name in multi-instance webserver configuration)
21+
- Added proper JS escaping in sync output
22+
- Added support to switch branch in basic mode from menu (#451)
23+
- Pull event handler will not fail when change set includes unmapped files (#453)
24+
- Pull event handler will attempt compile even if there are failures to load (#457)
25+
- Improved logging in preview and when errors occur via WebSocket commands (#467)
26+
- Fixed pull event handler handling of extremely long class names from diff (#467)
1727

1828
## [2.4.1] - 2024-08-02
1929

@@ -162,5 +172,4 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
162172
- #201: fix behavior with CSP files
163173

164174
## [2.0.1] - 2022-06-02
165-
- Last released version before CHANGELOG existed.
166-
175+
- Last released version before CHANGELOG existed.

cls/SourceControl/Git/Extension.cls

Lines changed: 21 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -91,9 +91,13 @@ Method AfterUserAction(Type As %Integer, Name As %String, InternalName As %Strin
9191
if menu '= "%SourceMenu", menu'="%SourceContext" {
9292
quit $$$OK
9393
}
94-
set InternalName = ##class(SourceControl.Git.Utils).NormalizeInternalName(InternalName)
94+
set InternalName = ##class(SourceControl.Git.Utils).NormalizeInternalName(InternalName, .fromWebApp)
9595
set context = ##class(SourceControl.Git.PackageManagerContext).ForInternalName(InternalName)
9696
set ec = ##class(SourceControl.Git.Utils).AfterUserAction(Type, Name, InternalName, .Answer, .Msg, .Reload)
97+
if fromWebApp {
98+
// Force reload and compile of actual item if underlying file has changed
99+
do ..OnBeforeLoad(InternalName,1,1)
100+
}
97101
quit ec
98102
}
99103

@@ -142,6 +146,7 @@ Method OnSourceMenuItem(name As %String, ByRef Enabled As %String, ByRef Display
142146
"Status": 1,
143147
"GitWebUI" : 1,
144148
"NewBranch": 1,
149+
"SwitchBranch": 1,
145150
"Sync": 1,
146151
"": 1,
147152
:-1
@@ -251,12 +256,12 @@ Method OnMenuItem(MenuName As %String, InternalName As %String, SelectedText As
251256

252257
/// This is called before the actual load of data to give the chance
253258
/// to load the item from an external format.
254-
Method OnBeforeLoad(InternalName As %String, verbose As %Boolean) As %Status
259+
Method OnBeforeLoad(InternalName As %String, verbose As %Boolean, compile As %Boolean = 0) As %Status
255260
{
256261
set context = ##class(SourceControl.Git.PackageManagerContext).ForInternalName(InternalName)
257262
set InternalName = ##class(SourceControl.Git.Utils).NormalizeInternalName(InternalName)
258263
if ##class(SourceControl.Git.Utils).IsInSourceControl(InternalName) {
259-
quit ##class(SourceControl.Git.Utils).ImportItem(InternalName,,0)
264+
quit ##class(SourceControl.Git.Utils).ImportItem(InternalName,,0,compile)
260265
}
261266
quit $$$OK
262267
}
@@ -290,14 +295,21 @@ Method OnAfterSave(InternalName As %String, Object As %RegisteredObject = {$$$NU
290295
{
291296
set sc = $$$OK
292297
try {
293-
set InternalName = ##class(SourceControl.Git.Utils).NormalizeInternalName(.InternalName)
298+
set InternalName = ##class(SourceControl.Git.Utils).NormalizeInternalName(.InternalName,.fromWebApp,.fullExternalName)
294299
set context = ##class(SourceControl.Git.PackageManagerContext).ForInternalName(InternalName)
295300
if ##class(SourceControl.Git.Utils).IsNamespaceInGit() && ..IsInSourceControl(InternalName) {
296-
set filename = ##class(SourceControl.Git.Utils).FullExternalName(InternalName)
297-
$$$ThrowOnError(##class(SourceControl.Git.Utils).RemoveRoutineTSH(InternalName))
298-
$$$ThrowOnError(##class(SourceControl.Git.Utils).ExportItem(InternalName))
299-
if '##class(SourceControl.Git.Change).IsUncommitted(filename) {
300-
$$$ThrowOnError(##class(SourceControl.Git.Change).SetUncommitted(filename, "edit", InternalName, $username, "", 1, "", "", 0))
301+
if fromWebApp {
302+
if fullExternalName = ##class(SourceControl.Git.Utils).FullExternalName(InternalName) {
303+
// Reimport item into database
304+
$$$ThrowOnError(##class(SourceControl.Git.Utils).ImportItem(InternalName,,1,1))
305+
}
306+
} else {
307+
set filename = ##class(SourceControl.Git.Utils).FullExternalName(InternalName)
308+
$$$ThrowOnError(##class(SourceControl.Git.Utils).RemoveRoutineTSH(InternalName))
309+
$$$ThrowOnError(##class(SourceControl.Git.Utils).ExportItem(InternalName))
310+
if '##class(SourceControl.Git.Change).IsUncommitted(filename) {
311+
$$$ThrowOnError(##class(SourceControl.Git.Change).SetUncommitted(filename, "edit", InternalName, $username, "", 1, "", "", 0))
312+
}
301313
}
302314
}
303315
} catch e {

cls/SourceControl/Git/PullEventHandler/IncrementalLoad.cls

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,33 +9,38 @@ Parameter DESCRIPTION = "Performs an incremental load and compile of all changes
99

1010
Method OnPull() As %Status
1111
{
12-
set loadSC = $$$OK
12+
set sc = $$$OK
1313
set nFiles = 0
1414

1515
for i=1:1:$get(..ModifiedFiles){
1616
set internalName = ..ModifiedFiles(i).internalName
1717
if ((internalName = "") && (..ModifiedFiles(i).changeType '= "D")) {
1818
write !, ..ModifiedFiles(i).externalName, " was not imported into the database and will not be compiled. "
1919
} elseif (..ModifiedFiles(i).changeType = "D") {
20-
set sc = ..DeleteFile(internalName)
21-
if sc {
20+
set delSC = ..DeleteFile(internalName)
21+
if delSC {
2222
write !, ..ModifiedFiles(i).externalName, " was deleted."
2323
} else {
2424
write !, "WARNING: Deletion of ", ..ModifiedFiles(i).externalName, " failed."
2525
}
2626
} else {
2727
set compilelist(internalName) = ""
2828
set nFiles = nFiles + 1
29-
set loadSC = $$$ADDSC(loadSC,##class(SourceControl.Git.Utils).ImportItem(internalName, 1))
30-
$$$ThrowOnError(loadSC)
29+
set sc = $$$ADDSC(sc,##class(SourceControl.Git.Utils).ImportItem(internalName, 1))
3130
}
3231
}
3332

3433
if (nFiles = 0) {
3534
write !, "Nothing to compile."
3635
quit $$$OK
3736
}
38-
quit $system.OBJ.CompileList(.compilelist, "ck")
37+
set sc = $$$ADDSC(sc,$system.OBJ.CompileList(.compilelist, "ck"))
38+
if $$$comClassDefined("Ens.Director") && ##class(Ens.Director).IsProductionRunning() {
39+
write !,"Updating production... "
40+
set sc = $$$ADDSC(sc,##class(Ens.Director).UpdateProduction())
41+
write "done."
42+
}
43+
quit sc
3944
}
4045

4146
Method DeleteFile(item As %String) As %Status
@@ -71,4 +76,3 @@ Method DeleteFile(item As %String) As %Status
7176
}
7277

7378
}
74-

cls/SourceControl/Git/Settings.cls

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,9 @@ Property defaultMergeBranch As %String [ InitialExpression = {##class(SourceCont
4747
/// Compile using the configured pull event handler when "Import All" is run
4848
Property compileOnImport As %Boolean [ InitialExpression = {##class(SourceControl.Git.Utils).CompileOnImport()} ];
4949

50+
/// Define a namespace-level web application allowing access to multiple git repos across separate namespaces
51+
Property namespaceLevelGitWebApp As %Boolean [ InitialExpression = {##class(SourceControl.Git.Settings).HasNamespaceWebApp()} ];
52+
5053
/// Warn when an item has uncommitted changes in a different namespace in this instance
5154
Property warnInstanceWideUncommitted As %Boolean [ InitialExpression = {##class(SourceControl.Git.Utils).WarnInstanceWideUncommitted()} ];
5255

@@ -164,6 +167,75 @@ ClassMethod Configure() As %Boolean [ CodeMode = objectgenerator ]
164167
do %code.WriteLine(" quit 1")
165168
}
166169

170+
Method ConfigureNamespaceWebApplication()
171+
{
172+
Set root = ##class(%Library.File).NormalizeDirectory(##class(SourceControl.Git.Utils).TempFolder())
173+
Set deleteWebApp = ..HasNamespaceWebApp(.appDirectory) && '..namespaceLevelGitWebApp
174+
Set createWebApp = ..namespaceLevelGitWebApp && '..HasNamespaceWebApp()
175+
Do ..WebAppOperation("/git/"_$Namespace_"/", createWebApp, deleteWebApp, root)
176+
}
177+
178+
Method WebAppOperation(name, create As %Boolean, delete As %Boolean, root As %String) [ Private ]
179+
{
180+
Set namespace = $Namespace
181+
New $Namespace
182+
Set $Namespace = "%SYS"
183+
If $Extract(name) = "/" {
184+
Set name = $Extract(name,1,*-1)
185+
}
186+
If delete {
187+
If ##class(Security.Applications).Exists(name) {
188+
$$$ThrowOnError(##class(Security.Applications).Delete(name))
189+
Write !,"Removed web application "_name
190+
}
191+
Quit
192+
}
193+
194+
// These are the only things we want to coerce.
195+
Set props("AutheEnabled")=0 // No auth methods enabled = impossible to use
196+
Set props("InbndWebServicesEnabled")=0
197+
Set props("ServeFiles")=0
198+
Set props("Enabled")=1
199+
Set props("Name")=name
200+
Set props("NameSpace")=namespace
201+
Set props("Path")=root
202+
Set props("Type")=2
203+
Set props("Recurse")=1
204+
If create {
205+
Write !,"Creating web application: "_name_"... "
206+
$$$ThrowOnError(##class(Security.Applications).Create(name,.props))
207+
Write "done."
208+
} ElseIf ##class(Security.Applications).Exists(name) {
209+
Write !,"Web application '"_name_"' already exists."
210+
$$$ThrowOnError(##class(Security.Applications).Get(name,.existingProps))
211+
Set changes = 0
212+
Set key = ""
213+
For {
214+
Set key = $Order(props(key),1,value)
215+
Quit:key=""
216+
If (value '= $Get(existingProps(key))) {
217+
Write !,"Changing "_key_": "_$Get(existingProps(key))_" -> "_value
218+
Set changes = 1
219+
}
220+
}
221+
If changes {
222+
$$$ThrowOnError(##class(Security.Applications).Modify(name,.props))
223+
Write !,"Web application '"_name_"' updated."
224+
} Else {
225+
Write !,"No changes made to web application."
226+
}
227+
}
228+
}
229+
230+
ClassMethod HasNamespaceWebApp(Output webAppDirectory) As %Boolean
231+
{
232+
Set webAppDirectory = $System.CSP.GetFileName("/git/"_$Namespace_"/")
233+
If (webAppDirectory '= "") {
234+
Set webAppDirectory = ##class(%Library.File).NormalizeDirectory(webAppDirectory)
235+
}
236+
Quit (webAppDirectory '= "")
237+
}
238+
167239
Method OnAfterConfigure() As %Boolean
168240
{
169241
set defaultPromptFlag = $$$DisableBackupCharMask + $$$TrapCtrlCMask + $$$EnableQuitCharMask + $$$DisableHelpCharMask + $$$DisableHelpContextCharMask + $$$TrapErrorMask
@@ -190,6 +262,8 @@ Method OnAfterConfigure() As %Boolean
190262
}
191263
}
192264

265+
do ..ConfigureNamespaceWebApplication()
266+
193267
set gitDir = ##class(%File).NormalizeDirectory(..namespaceTemp)_".git"
194268
if '##class(%File).DirectoryExists(gitDir) {
195269
set list(1) = "Initialize empty repo"

cls/SourceControl/Git/StreamServer.cls

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ Class SourceControl.Git.StreamServer Extends %CSP.StreamServer
77
ClassMethod OnPage() As %Status
88
{
99
if (%stream '= $$$NULLOREF) && $data(%base)#2 {
10-
set sourceControlInclude = ##class(SourceControl.Git.Utils).GetSourceControlInclude()
10+
set sourceControlInclude = ##class(SourceControl.Git.Utils).GetSourceControlInclude(%request.URLPrefix)
1111
while '%stream.AtEnd {
1212
set text = %stream.Read()
1313
set text = $replace(text,"{{baseHref}}",..EscapeHTML(%base))
@@ -19,4 +19,3 @@ ClassMethod OnPage() As %Status
1919
}
2020

2121
}
22-

0 commit comments

Comments
 (0)