From 2262e41f68678c55abee0fb583120cd4746d3050 Mon Sep 17 00:00:00 2001 From: Elijah Tamarchenko Date: Tue, 8 Apr 2025 11:01:13 -0400 Subject: [PATCH 1/2] Fix environment --- CHANGELOG.md | 3 +++ cls/SourceControl/Git/Settings.cls | 2 +- cls/_zpkg/isc/sc/git/SystemMode.cls | 26 ++++++++++++++++++++++++++ module.xml | 2 +- 4 files changed, 31 insertions(+), 2 deletions(-) create mode 100644 cls/_zpkg/isc/sc/git/SystemMode.cls diff --git a/CHANGELOG.md b/CHANGELOG.md index c22c866a..a7e9c759 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Pull event handler that does an IPM uninstall and load to handle deletes (#631) - Partial support for production decomposition with the new interoperability editors +### Fixed +- Changing system mode (environment name) in setting spersists after instance restart (#655) + ## [2.10.0] - 2025-02-10 ### Added diff --git a/cls/SourceControl/Git/Settings.cls b/cls/SourceControl/Git/Settings.cls index 02aa8bf4..d70a2f81 100644 --- a/cls/SourceControl/Git/Settings.cls +++ b/cls/SourceControl/Git/Settings.cls @@ -159,7 +159,7 @@ Method %Save() As %Status set @storage@("settings", "user", $username, "basicMode") = ..basicMode } try { - do $SYSTEM.Version.SystemMode(..environmentName) + do ##class(%zpkg.isc.sc.git.SystemMode).SetSystemMode(..environmentName) } catch e { // no-op; user might not have privileges. } diff --git a/cls/_zpkg/isc/sc/git/SystemMode.cls b/cls/_zpkg/isc/sc/git/SystemMode.cls new file mode 100644 index 00000000..03c3ea95 --- /dev/null +++ b/cls/_zpkg/isc/sc/git/SystemMode.cls @@ -0,0 +1,26 @@ +Class %zpkg.isc.sc.git.SystemMode +{ + ClassMethod SetEnvironment(environment As %String) As %Status [ NotInheritable, Private ] +{ + $$$AddAllRoleTemporary + do $SYSTEM.Version.SystemMode(environment) + set nm = $NAMESPACE + zn "%SYS" + set obj = ##class(Config.Startup).Open() + set obj.SystemMode = environment + do obj.%Save() + zn nm + + return $$$OK +} + +ClassMethod SetSystemMode(environment As %String) As %Status [ NotInheritable ] +{ + try { + do ..SetEnvironment(environment) + } catch e { + return e.AsStatus() + } + return $$$OK +} +} \ No newline at end of file diff --git a/module.xml b/module.xml index 14518da8..3ae81b72 100644 --- a/module.xml +++ b/module.xml @@ -3,7 +3,7 @@ git-source-control - 2.10.0 + 2.11.0 Server-side source control extension for use of Git on InterSystems platforms git source control studio vscode module From 060371c4b155a87945a91c4a47e7e681aba709d4 Mon Sep 17 00:00:00 2001 From: Elijah Tamarchenko Date: Tue, 8 Apr 2025 15:21:52 -0400 Subject: [PATCH 2/2] Update namespace changing --- cls/_zpkg/isc/sc/git/SystemMode.cls | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/cls/_zpkg/isc/sc/git/SystemMode.cls b/cls/_zpkg/isc/sc/git/SystemMode.cls index 03c3ea95..54ca3951 100644 --- a/cls/_zpkg/isc/sc/git/SystemMode.cls +++ b/cls/_zpkg/isc/sc/git/SystemMode.cls @@ -4,14 +4,11 @@ Class %zpkg.isc.sc.git.SystemMode { $$$AddAllRoleTemporary do $SYSTEM.Version.SystemMode(environment) - set nm = $NAMESPACE - zn "%SYS" + new $namespace + set $namespace = "%SYS" set obj = ##class(Config.Startup).Open() set obj.SystemMode = environment - do obj.%Save() - zn nm - - return $$$OK + return obj.%Save() } ClassMethod SetSystemMode(environment As %String) As %Status [ NotInheritable ]