Skip to content

Commit cf5f781

Browse files
authored
Merge pull request #953 from intersystems/feature/952-cross-namespace-ipm-context
enh: include cross-namespace IPM packages in contexts list
2 parents 97d492e + d371a56 commit cf5f781

4 files changed

Lines changed: 31 additions & 13 deletions

File tree

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1010
### Added
1111
- Import of decomposed production items now has a brief timeout in case another deploy is in progress (#949)
1212
- Option to view an individual file's history in the source control menu (#960)
13+
- Change context menu now lists IPM packages from all Git-enabled namespaces, prefixed with the namespace name (#952)
1314

1415
### Fixed
1516
- Changes to % routines mapped to the current namespace may now be added to source control and committed (#944)

cls/SourceControl/Git/Utils.cls

Lines changed: 20 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2813,18 +2813,28 @@ ClassMethod GetContexts(onlyNamespaces As %Boolean) As %DynamicArray
28132813

28142814
set name = ""
28152815

2816-
// Using embedded for backwards compatability
2816+
// Using embedded instead of ExecDirectNoPriv() for backwards compatability
28172817
if '(onlyNamespaces) {
28182818
&sql(DECLARE C1 CURSOR FOR SELECT name into :name from %Library.RoutineMgr_StudioOpenDialog('*.ZPM'))
2819-
&sql(OPEN C1)
2820-
throw:SQLCODE<0 ##class(%Exception.SQL).CreateFromSQLCODE(SQLCODE, %msg)
2821-
&sql(FETCH C1)
2822-
while(SQLCODE = 0) {
2823-
set package = name
2824-
do contexts.%Push(package)
2825-
&sql(FETCH C1)
2819+
new $namespace
2820+
set ptr = 0
2821+
while $listnext(namespaces,ptr,ns) {
2822+
if '($FIND(ns,"^^")) {
2823+
try {
2824+
set $NAMESPACE = ns
2825+
&sql(OPEN C1)
2826+
throw:(SQLCODE<0) ##class(%Exception.SQL).CreateFromSQLCODE(SQLCODE, %msg)
2827+
&sql(FETCH C1)
2828+
while (SQLCODE = 0) {
2829+
do contexts.%Push(ns_":"_name)
2830+
&sql(FETCH C1)
2831+
}
2832+
&sql(CLOSE C1)
2833+
} catch e {
2834+
// skip inaccessible namespaces
2835+
}
2836+
}
28262837
}
2827-
&sql(CLOSE C1)
28282838
}
28292839

28302840
return contexts
@@ -3397,3 +3407,4 @@ ClassMethod IsSchemaStandard(pName As %String = "") As %Boolean [ Internal ]
33973407
}
33983408

33993409
}
3410+

git-webui/release/share/git-webui/webui/js/git-webui.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -724,10 +724,11 @@ webui.SideBarView = function(mainView, noEventHandlers) {
724724
}
725725

726726
self.getCurrentContext = function() {
727+
// URL pattern here is like webuidriver.csp/<namespace>/<InternalName of selected item>
727728
var args = window.location.href.split("webuidriver.csp/")[1].split("?")[0].split("/");
728729
var context = args[0];
729730
if (args[1] && (args[1].indexOf(".ZPM") != -1)) {
730-
context = args[1];
731+
context = args[0] + ":" + args[1];
731732
}
732733
return context;
733734
}
@@ -737,7 +738,9 @@ webui.SideBarView = function(mainView, noEventHandlers) {
737738
var args = urlParts[1].split("?")[0].split("/");
738739
var querySuffix = window.location.search || "";
739740
if (context.indexOf(".ZPM") != -1) {
740-
args[1] = context;
741+
var parts = context.split(":");
742+
args[0] = parts[0];
743+
args[1] = parts[1];
741744
} else {
742745
args[0] = context;
743746
args[1] = "";

git-webui/src/share/git-webui/webui/js/git-webui.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -724,10 +724,11 @@ webui.SideBarView = function(mainView, noEventHandlers) {
724724
}
725725

726726
self.getCurrentContext = function() {
727+
// URL pattern here is like webuidriver.csp/<namespace>/<InternalName of selected item>
727728
var args = window.location.href.split("webuidriver.csp/")[1].split("?")[0].split("/");
728729
var context = args[0];
729730
if (args[1] && (args[1].indexOf(".ZPM") != -1)) {
730-
context = args[1];
731+
context = args[0] + ":" + args[1];
731732
}
732733
return context;
733734
}
@@ -737,7 +738,9 @@ webui.SideBarView = function(mainView, noEventHandlers) {
737738
var args = urlParts[1].split("?")[0].split("/");
738739
var querySuffix = window.location.search || "";
739740
if (context.indexOf(".ZPM") != -1) {
740-
args[1] = context;
741+
var parts = context.split(":");
742+
args[0] = parts[0];
743+
args[1] = parts[1];
741744
} else {
742745
args[0] = context;
743746
args[1] = "";

0 commit comments

Comments
 (0)