Skip to content

Commit 302efe4

Browse files
committed
Merge branch 'main' into issue-356
2 parents e11692f + bb716fb commit 302efe4

File tree

7 files changed

+75
-13
lines changed

7 files changed

+75
-13
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1313
- Added change context option to pull page (#468)
1414
- Added favorite namespaces setting for a user (#468, #510)
1515
- Added environment awareness in configuration, and showing of environment name in UI (#124)
16+
- Added "Export System Default Settings" menu item (#544)
1617

1718
### Fixed
1819
- Fixed display of other users' username in workspace view on Unix (#530)
@@ -24,6 +25,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
2425
- Added feedback to settings page (#550)
2526
- Fix "Home" navigation to point to current namespace (#548)
2627
- 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)
2729
- Remove leading/trailing spaces from input to Configure() (#356)
2830

2931
## [2.6.0] - 2024-10-07

cls/SourceControl/Git/Extension.cls

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ XData Menu
2929
<MenuItem Name="NewBranch" />
3030
<MenuItem Name="SwitchBranch" />
3131
<MenuItem Separator="true"/>
32+
<MenuItem Name="ExportSystemDefaults" />
3233
<MenuItem Name="Export" />
3334
<MenuItem Name="ExportForce" />
3435
<MenuItem Name="Import" />
@@ -125,6 +126,7 @@ Method LocalizeName(name As %String) As %String
125126
"Settings":$$$Text("@Settings@Settings"),
126127
"Init":$$$Text("@Init@Initialize"),
127128
"GitWebUI":$$$Text("@GitWebUI@Launch Git UI"),
129+
"ExportSystemDefaults":$$$Text("@ExportSystemDefaults@Export System Default Settings"),
128130
"Export":$$$Text("@Export@Export All"),
129131
"ExportForce":$$$Text("@ExportForce@Export All (Force)"),
130132
"Import":$$$Text("@Import@Import All"),
@@ -160,6 +162,11 @@ Method OnSourceMenuItem(name As %String, ByRef Enabled As %String, ByRef Display
160162
quit ..OnSourceMenuContextItem(InternalName,name,.Enabled,.DisplayName)
161163
}
162164

165+
if name = "ExportSystemDefaults" {
166+
set Enabled = ##class(%Library.EnsembleMgr).IsEnsembleNamespace()
167+
quit $$$OK
168+
}
169+
163170
if ##class(SourceControl.Git.Utils).BasicMode() {
164171
set Enabled = $CASE(name,
165172
"Status": 1,
@@ -171,7 +178,6 @@ Method OnSourceMenuItem(name As %String, ByRef Enabled As %String, ByRef Display
171178
"Sync": 1,
172179
"": 1,
173180
:-1
174-
175181
)
176182
} else {
177183
set Enabled = $CASE(name,

cls/SourceControl/Git/StreamServer.cls

Lines changed: 5 additions & 2 deletions
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

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -258,6 +258,8 @@ ClassMethod UserAction(InternalName As %String, MenuName As %String, ByRef Targe
258258
if ec {
259259
write !,"==export done==",!
260260
}
261+
} elseif (menuItemName = "ExportSystemDefaults") {
262+
set ec = ..ExportSystemDefaults()
261263
} elseif (menuItemName = "Import") {
262264
set ec = ..ImportAll()
263265
set Reload = 1
@@ -1622,6 +1624,13 @@ ClassMethod ExportAll(force As %Boolean = 0) As %Status
16221624
quit ..ExportRoutines(force)
16231625
}
16241626

1627+
ClassMethod ExportSystemDefaults() As %Status
1628+
{
1629+
new %SourceControl
1630+
do ##class(%Studio.SourceControl.Interface).SourceControlCreate()
1631+
quit %SourceControl.OnAfterSave("Ens.Config.DefaultSettings.ESD")
1632+
}
1633+
16251634
/// if <var>force</var> = 1 then we import item even if timestamp in system is newer
16261635
ClassMethod ImportAll(force As %Boolean = 0) As %Status
16271636
{
@@ -2594,6 +2603,47 @@ ClassMethod GetSourceControlInclude(prefix As %String = {%request.URLPrefix}) As
25942603
1: "")
25952604
}
25962605

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+
25972647
ClassMethod UncommittedWithAction() As %Library.DynamicObject
25982648
{
25992649
do ##class(SourceControl.Git.Change).RefreshUncommitted()

csp/sync.csp

Lines changed: 9 additions & 8 deletions
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

Lines changed: 1 addition & 1 deletion
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

Lines changed: 1 addition & 1 deletion
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)