From 66c69360d51eb7999532fdeeea3be957212aceb5 Mon Sep 17 00:00:00 2001 From: Pravin Barton <9560941+isc-pbarton@users.noreply.github.com> Date: Tue, 13 May 2025 10:26:54 -0400 Subject: [PATCH 1/3] port EPG179 - IsProductionClass Loads Class Export without Overwriting Class Definition --- CHANGELOG.md | 1 + cls/SourceControl/Git/Production.cls | 18 ++++++++++++++++-- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a2ae3915..0eda4b80 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Fixed - Deletes are now properly owned by the user who did the delete (#729) - Pull page output now displays better when pull preview shows a lot of changes (#740) +- Fixed loop of loading classes with compilation errors in Studio (#766) ## [2.11.0] - 2025-04-23 diff --git a/cls/SourceControl/Git/Production.cls b/cls/SourceControl/Git/Production.cls index 5b08c145..a5fb4ae1 100644 --- a/cls/SourceControl/Git/Production.cls +++ b/cls/SourceControl/Git/Production.cls @@ -380,10 +380,24 @@ ClassMethod IsProductionClass(className As %String, nameMethod As %String) As %B if ##class(%File).Exists(settingsPTDFilename) { return 1 } - // check if there is a class export for this Production, load it for class definition + // uses temporary flag to load item without loading into database (since the item may not be + // compilable or not have been intended for import yet). Then check for Production Definition + // XData. Approach taken from CvtXmlToClientDoc method in %Api.Atelier.v1 set filename = $classmethod(##class(%Studio.SourceControl.Interface).SourceControlClassGet(), nameMethod, className_".CLS") if ##class(%File).Exists(filename) && (##class(%File).GetFileSize(filename) '= 0) { - $$$ThrowOnError($System.OBJ.Load(filename)) + try { + set ^||%oddDEF=1 + $$$ThrowOnError($system.OBJ.Load(filename, "-d")) + // class XDatas are stored in ^||%oddDEF("","x","") after temp load + set hasProdDef = $data(^||%oddDEF(className,$$$cCLASSxdata,"ProductionDefinition")) + kill ^||%oddDEF + if hasProdDef { + return 1 + } + } catch err { + kill ^||%oddDEF + throw err + } } // if Production exists as a class definition on the server, check if extending Ens.Production set classDef = ##class(%Dictionary.ClassDefinition).%OpenId(className) From d7e6e2feeeedef96563bec140d60f9dec783e47a Mon Sep 17 00:00:00 2001 From: Pravin Barton <9560941+isc-pbarton@users.noreply.github.com> Date: Tue, 13 May 2025 11:06:00 -0400 Subject: [PATCH 2/3] fix: temp load to check if production no longer errors out if internal name is null --- CHANGELOG.md | 1 + cls/SourceControl/Git/Production.cls | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0eda4b80..35c9c423 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Deletes are now properly owned by the user who did the delete (#729) - Pull page output now displays better when pull preview shows a lot of changes (#740) - Fixed loop of loading classes with compilation errors in Studio (#766) +- Fixed error popup when creating new record map or other interop items (#753) ## [2.11.0] - 2025-04-23 diff --git a/cls/SourceControl/Git/Production.cls b/cls/SourceControl/Git/Production.cls index a5fb4ae1..c40c1eeb 100644 --- a/cls/SourceControl/Git/Production.cls +++ b/cls/SourceControl/Git/Production.cls @@ -384,7 +384,7 @@ ClassMethod IsProductionClass(className As %String, nameMethod As %String) As %B // compilable or not have been intended for import yet). Then check for Production Definition // XData. Approach taken from CvtXmlToClientDoc method in %Api.Atelier.v1 set filename = $classmethod(##class(%Studio.SourceControl.Interface).SourceControlClassGet(), nameMethod, className_".CLS") - if ##class(%File).Exists(filename) && (##class(%File).GetFileSize(filename) '= 0) { + if ##class(%File).Exists(filename) && '##class(%File).DirectoryExists(filename) && (##class(%File).GetFileSize(filename) '= 0) { try { set ^||%oddDEF=1 $$$ThrowOnError($system.OBJ.Load(filename, "-d")) From 7d52f33d0e2793492352c061d213e57c8c878cd4 Mon Sep 17 00:00:00 2001 From: Pravin Barton <9560941+isc-pbarton@users.noreply.github.com> Date: Tue, 13 May 2025 11:52:05 -0400 Subject: [PATCH 3/3] refactor: more defensive coding when getting external name for items --- cls/SourceControl/Git/Utils.cls | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/cls/SourceControl/Git/Utils.cls b/cls/SourceControl/Git/Utils.cls index ce372070..564f3562 100644 --- a/cls/SourceControl/Git/Utils.cls +++ b/cls/SourceControl/Git/Utils.cls @@ -1251,9 +1251,12 @@ ClassMethod IsInSourceControl(InternalName As %String, ByRef sourceControlItem A quit isInSourceControl } -ClassMethod FullExternalName(ByRef InternalName As %String, ByRef MappingExists As %Boolean) As %String [ CodeMode = expression ] +ClassMethod FullExternalName(ByRef InternalName As %String, ByRef MappingExists As %Boolean) As %String { -..TempFolder()_..ExternalName(.InternalName, .MappingExists) + set externalName = ..ExternalName(.InternalName, .MappingExists) + return $select( + externalName="":"", + 1: ..TempFolder()_externalName) } ClassMethod NormalizeInternalName(ByRef name As %String, Output fromWebApp As %Boolean = 0, Output cspFilename) As %String @@ -3198,4 +3201,3 @@ ClassMethod IsSchemaStandard(pName As %String = "") As %Boolean [ Internal ] } } -