Skip to content

Commit 79254da

Browse files
author
Jakcpto
committed
Prefix Support for Addons and Themes
1 parent 55523da commit 79254da

File tree

2 files changed

+21
-21
lines changed

2 files changed

+21
-21
lines changed

MDX2JSON/REST.cls

Lines changed: 21 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,6 @@ ClassMethod Test() As %Status
123123
set obj.Parent = ##class(MDX2JSON.Tests).#LastCommit
124124
set obj.ParentTS = ##class(MDX2JSON.Tests).#LastCommitTS
125125
set obj.DefaultApp = $System.CSP.GetDefaultApp($Namespace)
126-
set obj.CurrentApp = $get(%request.Application)
127126
set obj.Mappings = ..GetMappings()
128127
if $$$Debug {
129128
set obj.Roles = $Roles
@@ -155,6 +154,7 @@ ClassMethod saveWidget() As %Status
155154
return ##class(MDX2JSON.Utils).AddWidget(widgetData,dashboardData,key)
156155
}
157156

157+
158158
/// Get all data sources including "pivot", "kpi", "worksheets","metrics"
159159
ClassMethod GetListDataSources(Source) As %Status
160160
{
@@ -193,6 +193,7 @@ ClassMethod GetListDataSources(Source) As %Status
193193
quit tSC
194194
}
195195

196+
196197
ClassMethod GetDataSource() As %Status
197198
{
198199
return ##class(MDX2JSON.Utils).GetDataSource($$$R("DataSource"))
@@ -281,7 +282,7 @@ ClassMethod WriteFiltersForDataSource() As %Status
281282
return st
282283
}
283284

284-
/// Execute requests from kpi
285+
///Execute requests from kpi
285286
ClassMethod KPIExecute() As %Status
286287
{
287288
try{
@@ -420,14 +421,20 @@ ClassMethod WritePivotVariablesForCube(Cube As %String) As %Status
420421
ClassMethod WriteAddons() As %Status
421422
{
422423
#dim sc As %Status = $$$OK
423-
424-
set defaultApp = $System.CSP.GetDefaultApp($Namespace)
425-
set prefix = $piece(defaultApp, "/csp", 1)
424+
425+
set currentApp = $ZConvert($Get(%request.CgiEnvs("SCRIPT_NAME"), ""), "L")
426+
set prefix = $piece(currentApp, "/mdx2json", 1)
426427
set app = prefix _ "/dsw"
427428
set path = $system.CSP.GetFileName(app _ "/")
428429
set path = ##class(%File).NormalizeDirectory(path)
429430
set path = ##class(%File).SubDirectoryName(path, "addons", $$$YES)
430431
set url = app _ "/addons/"
432+
433+
// Check if path exists
434+
if '##class(%File).Exists(path) {
435+
set sc = $$$ERROR($$$GeneralError, "Addons directory does not exist: "_path_". Probably different prefixes for MDX2JSON and DSW applications.")
436+
quit sc
437+
}
431438

432439
#dim rs As %SQL.ClassQueryResultSet = ##class(%File).FileSetFunc(path, "*.js")
433440

@@ -448,14 +455,20 @@ ClassMethod WriteThemes() As %Status
448455
{
449456
#dim sc As %Status = $$$OK
450457

451-
set defaultApp = $System.CSP.GetDefaultApp($Namespace)
452-
set prefix = $piece(defaultApp, "/csp", 1)
458+
set currentApp = $ZConvert($Get(%request.CgiEnvs("SCRIPT_NAME"), ""), "L")
459+
set prefix = $piece(currentApp, "/mdx2json", 1)
453460
set app = prefix _ "/dsw"
454461
set path = $system.CSP.GetFileName(app _ "/")
455462
set path = ##class(%File).NormalizeDirectory(path)
456463
set path = ##class(%File).SubDirectoryName(path, "themes", $$$YES)
457464
set url = app _ "/themes/"
458465

466+
// Check if path exists
467+
if '##class(%File).Exists(path) {
468+
set sc = $$$ERROR($$$GeneralError, "Themes directory does not exist: "_path_". Probably different prefixes for MDX2JSON and DSW applications.")
469+
quit sc
470+
}
471+
459472
#dim rs As %SQL.ClassQueryResultSet = ##class(%File).FileSetFunc(path, "*.css")
460473

461474
set list = $$$NewDynDTList
@@ -477,4 +490,4 @@ ClassMethod WriteJSONfromKPI() As %Status [ CodeMode = objectgenerator ]
477490
do %code.Write(base)
478491
}
479492

480-
}
493+
}

docker-compose.yaml

Lines changed: 0 additions & 13 deletions
This file was deleted.

0 commit comments

Comments
 (0)