Skip to content

fix: production config page no longer closes UIs #563

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Oct 22, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -24,6 +24,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Added feedback to settings page (#550)
- Fix "Home" navigation to point to current namespace (#548)
- Force export of item if it has been modified (#354)
- Production configuration page no longer closes Sync/WebUI when operations there change the production (#542)

## [2.6.0] - 2024-10-07

7 changes: 5 additions & 2 deletions cls/SourceControl/Git/StreamServer.cls
Original file line number Diff line number Diff line change
@@ -8,10 +8,13 @@ ClassMethod OnPage() As %Status
{
if (%stream '= $$$NULLOREF) && $data(%base)#2 {
set sourceControlInclude = ##class(SourceControl.Git.Utils).GetSourceControlInclude()
set bodyAttrs = ##class(SourceControl.Git.Utils).ProductionConfigBodyAttributes()
set configScript = ##class(SourceControl.Git.Utils).ProductionConfigScript()
while '%stream.AtEnd {
set text = %stream.Read()
set text = %stream.Read(1000000)
set text = $replace(text,"{{baseHref}}",..EscapeHTML(%base))
write $replace(text,"{{sourceControlInclude}}",sourceControlInclude)
set text = $replace(text,"{{bodyAttrs}}",bodyAttrs)
write $replace(text,"{{sourceControlInclude}}",sourceControlInclude_$$$NL_configScript)
}
quit $$$OK
}
41 changes: 41 additions & 0 deletions cls/SourceControl/Git/Utils.cls
Original file line number Diff line number Diff line change
@@ -2594,6 +2594,47 @@ ClassMethod GetSourceControlInclude(prefix As %String = {%request.URLPrefix}) As
1: "")
}

XData ProductionConfigScript [ MimeType = text/javascript ]
{
function checkProductionConfigLoad() {
timerState(false);
}

function checkProductionConfigUnload() {
timerState(true);
}

function timerState(start) {
if (window.parent && window.parent.opener && window.parent.opener.zenPage) {
if (start && window.parent.opener.zenPage.startTimers) {
window.parent.opener.zenPage.startTimers();
}
if (!start && window.parent.opener.zenPage.stopTimers) {
window.parent.opener.zenPage.stopTimers();
}
}
}
}

ClassMethod ProductionConfigScript() As %String [ CodeMode = objectgenerator ]
{
do %code.WriteLine(" set html = ""<script type='text/javascript'>""_$c(13,10)")
set xdata = ##class(%Dictionary.XDataDefinition).IDKEYOpen(%compiledclass.Name,%compiledmethod.Name,,.sc)
$$$ThrowOnError(sc)
while 'xdata.Data.AtEnd {
set line = xdata.Data.ReadLine()
do %code.WriteLine(" set html = html_"_$$Quote^%qcr(line)_"_$c(13,10)")
}
do %code.WriteLine(" set html = html_$c(13,10)_""</script>""")
do %code.WriteLine(" quit html")
quit $$$OK
}

ClassMethod ProductionConfigBodyAttributes() As %String [ CodeMode = expression ]
{
"onload='checkProductionConfigLoad()' onbeforeunload='checkProductionConfigUnload()'"
}

ClassMethod UncommittedWithAction() As %Library.DynamicObject
{
do ##class(SourceControl.Git.Change).RefreshUncommitted()
17 changes: 9 additions & 8 deletions csp/sync.csp
Original file line number Diff line number Diff line change
@@ -84,8 +84,16 @@


</style>
<script type="text/javascript">
function disableInput() {
document.getElementById('syncMsg').disabled = true;
document.getElementById('syncBtn').innerHTML = 'Syncing...';
document.getElementById('syncBtn').disabled = true;
}
</script>
#(##class(SourceControl.Git.Utils).ProductionConfigScript())#
</head>
<body>
<body #(##class(SourceControl.Git.Utils).ProductionConfigBodyAttributes())#>
<server>
set settings = ##class(SourceControl.Git.Settings).%New()

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

</div>
</body>
<script type="text/javascript">
function disableInput() {
document.getElementById('syncMsg').disabled = true;
document.getElementById('syncBtn').innerHTML = 'Syncing...';
document.getElementById('syncBtn').disabled = true;
}
</script>
<script language="cache" method="PerformSync" arguments="syncMsg:%String">
&js<document.getElementById('outputContainer').style.display = 'block'>
&js<document.getElementById('outputHeader').style.display = 'block'>
2 changes: 1 addition & 1 deletion git-webui/release/share/git-webui/webui/index.html
Original file line number Diff line number Diff line change
@@ -28,7 +28,7 @@
<link rel="stylesheet" type="text/css" href="css/git-webui.css" />
<link rel="icon" href="img/git-icon.png" />
</head>
<body>
<body {{bodyAttrs}}>
<!-- Error modal dialog -->
<div class="modal fade" id="error-modal" tabindex="-1" role="dialog">
<div class="modal-dialog">
2 changes: 1 addition & 1 deletion git-webui/src/share/git-webui/webui/index.html
Original file line number Diff line number Diff line change
@@ -28,7 +28,7 @@
<link rel="stylesheet" type="text/css" href="css/git-webui.css" />
<link rel="icon" href="img/git-icon.png" />
</head>
<body>
<body {{bodyAttrs}}>
<!-- Error modal dialog -->
<div class="modal fade" id="error-modal" tabindex="-1" role="dialog">
<div class="modal-dialog">