Skip to content

Commit bb716fb

Browse files
authored
Merge pull request #563 from intersystems/fix-542
fix: production config page no longer closes UIs
2 parents caeb46b + 7fc8d0f commit bb716fb

File tree

6 files changed

+58
-12
lines changed

6 files changed

+58
-12
lines changed

CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
2525
- Added feedback to settings page (#550)
2626
- Fix "Home" navigation to point to current namespace (#548)
2727
- Force export of item if it has been modified (#354)
28+
- Production configuration page no longer closes Sync/WebUI when operations there change the production (#542)
2829

2930
## [2.6.0] - 2024-10-07
3031

cls/SourceControl/Git/StreamServer.cls

+5-2
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,13 @@ ClassMethod OnPage() As %Status
88
{
99
if (%stream '= $$$NULLOREF) && $data(%base)#2 {
1010
set sourceControlInclude = ##class(SourceControl.Git.Utils).GetSourceControlInclude()
11+
set bodyAttrs = ##class(SourceControl.Git.Utils).ProductionConfigBodyAttributes()
12+
set configScript = ##class(SourceControl.Git.Utils).ProductionConfigScript()
1113
while '%stream.AtEnd {
12-
set text = %stream.Read()
14+
set text = %stream.Read(1000000)
1315
set text = $replace(text,"{{baseHref}}",..EscapeHTML(%base))
14-
write $replace(text,"{{sourceControlInclude}}",sourceControlInclude)
16+
set text = $replace(text,"{{bodyAttrs}}",bodyAttrs)
17+
write $replace(text,"{{sourceControlInclude}}",sourceControlInclude_$$$NL_configScript)
1518
}
1619
quit $$$OK
1720
}

cls/SourceControl/Git/Utils.cls

+41
Original file line numberDiff line numberDiff line change
@@ -2603,6 +2603,47 @@ ClassMethod GetSourceControlInclude(prefix As %String = {%request.URLPrefix}) As
26032603
1: "")
26042604
}
26052605

2606+
XData ProductionConfigScript [ MimeType = text/javascript ]
2607+
{
2608+
function checkProductionConfigLoad() {
2609+
timerState(false);
2610+
}
2611+
2612+
function checkProductionConfigUnload() {
2613+
timerState(true);
2614+
}
2615+
2616+
function timerState(start) {
2617+
if (window.parent && window.parent.opener && window.parent.opener.zenPage) {
2618+
if (start && window.parent.opener.zenPage.startTimers) {
2619+
window.parent.opener.zenPage.startTimers();
2620+
}
2621+
if (!start && window.parent.opener.zenPage.stopTimers) {
2622+
window.parent.opener.zenPage.stopTimers();
2623+
}
2624+
}
2625+
}
2626+
}
2627+
2628+
ClassMethod ProductionConfigScript() As %String [ CodeMode = objectgenerator ]
2629+
{
2630+
do %code.WriteLine(" set html = ""<script type='text/javascript'>""_$c(13,10)")
2631+
set xdata = ##class(%Dictionary.XDataDefinition).IDKEYOpen(%compiledclass.Name,%compiledmethod.Name,,.sc)
2632+
$$$ThrowOnError(sc)
2633+
while 'xdata.Data.AtEnd {
2634+
set line = xdata.Data.ReadLine()
2635+
do %code.WriteLine(" set html = html_"_$$Quote^%qcr(line)_"_$c(13,10)")
2636+
}
2637+
do %code.WriteLine(" set html = html_$c(13,10)_""</script>""")
2638+
do %code.WriteLine(" quit html")
2639+
quit $$$OK
2640+
}
2641+
2642+
ClassMethod ProductionConfigBodyAttributes() As %String [ CodeMode = expression ]
2643+
{
2644+
"onload='checkProductionConfigLoad()' onbeforeunload='checkProductionConfigUnload()'"
2645+
}
2646+
26062647
ClassMethod UncommittedWithAction() As %Library.DynamicObject
26072648
{
26082649
do ##class(SourceControl.Git.Change).RefreshUncommitted()

csp/sync.csp

+9-8
Original file line numberDiff line numberDiff line change
@@ -84,8 +84,16 @@
8484

8585

8686
</style>
87+
<script type="text/javascript">
88+
function disableInput() {
89+
document.getElementById('syncMsg').disabled = true;
90+
document.getElementById('syncBtn').innerHTML = 'Syncing...';
91+
document.getElementById('syncBtn').disabled = true;
92+
}
93+
</script>
94+
#(##class(SourceControl.Git.Utils).ProductionConfigScript())#
8795
</head>
88-
<body>
96+
<body #(##class(SourceControl.Git.Utils).ProductionConfigBodyAttributes())#>
8997
<server>
9098
set settings = ##class(SourceControl.Git.Settings).%New()
9199

@@ -158,13 +166,6 @@
158166

159167
</div>
160168
</body>
161-
<script type="text/javascript">
162-
function disableInput() {
163-
document.getElementById('syncMsg').disabled = true;
164-
document.getElementById('syncBtn').innerHTML = 'Syncing...';
165-
document.getElementById('syncBtn').disabled = true;
166-
}
167-
</script>
168169
<script language="cache" method="PerformSync" arguments="syncMsg:%String">
169170
&js<document.getElementById('outputContainer').style.display = 'block'>
170171
&js<document.getElementById('outputHeader').style.display = 'block'>

git-webui/release/share/git-webui/webui/index.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
<link rel="stylesheet" type="text/css" href="css/git-webui.css" />
2929
<link rel="icon" href="img/git-icon.png" />
3030
</head>
31-
<body>
31+
<body {{bodyAttrs}}>
3232
<!-- Error modal dialog -->
3333
<div class="modal fade" id="error-modal" tabindex="-1" role="dialog">
3434
<div class="modal-dialog">

git-webui/src/share/git-webui/webui/index.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
<link rel="stylesheet" type="text/css" href="css/git-webui.css" />
2929
<link rel="icon" href="img/git-icon.png" />
3030
</head>
31-
<body>
31+
<body {{bodyAttrs}}>
3232
<!-- Error modal dialog -->
3333
<div class="modal fade" id="error-modal" tabindex="-1" role="dialog">
3434
<div class="modal-dialog">

0 commit comments

Comments
 (0)