Skip to content

Commit 3d4fa56

Browse files
author
ksaduest
committed
updated for #709
1 parent c71bab2 commit 3d4fa56

File tree

3 files changed

+25
-5
lines changed

3 files changed

+25
-5
lines changed

cls/SourceControl/Git/Extension.cls

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -181,14 +181,17 @@ Method OnSourceMenuItem(name As %String, ByRef Enabled As %String, ByRef Display
181181
quit $$$OK
182182
}
183183

184+
set settings = ##class(SourceControl.Git.Settings).%New()
185+
if settings.lockBranch set BranchLocked = 1
186+
184187
if ##class(SourceControl.Git.Utils).BasicMode() {
185188
set Enabled = $CASE(name,
186189
"Status": 1,
187190
"GitWebUI" : 1,
188191
"Import": 1,
189192
"ImportForce": 1,
190-
"NewBranch": 1,
191-
"SwitchBranch": 1,
193+
"NewBranch": 1-BranchLocked,
194+
"SwitchBranch": 1-BranchLocked,
192195
"Sync": 1,
193196
"": 1,
194197
:-1
@@ -202,8 +205,8 @@ Method OnSourceMenuItem(name As %String, ByRef Enabled As %String, ByRef Display
202205
"ExportForce": 1,
203206
"Import": 1,
204207
"ImportForce": 1,
205-
"NewBranch": 1,
206-
"SwitchBranch": 1,
208+
"NewBranch": 1-BranchLocked,
209+
"SwitchBranch": 1-BranchLocked,
207210
"Push": 1,
208211
"PushForce": 1,
209212
"Fetch": 1,

cls/SourceControl/Git/Settings.cls

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,9 @@ Property warnInstanceWideUncommitted As %Boolean [ InitialExpression = {##class(
6262
/// The name of the environment (DEVELOPMENT, TEST, LIVE)
6363
Property environmentName As %String(MAXLEN = "") [ InitialExpression = {##class(SourceControl.Git.Utils).EnvironmentName()} ];
6464

65+
/// Whether the branch should or should not be locked down from changing namespaces
66+
Property lockBranch As %Boolean [ InitialExpression = {##class(SourceControl.Git.Utils).LockBranch()} ];
67+
6568
Property Mappings [ MultiDimensional ];
6669

6770
Property favoriteNamespaces As %DynamicArray;
@@ -153,6 +156,7 @@ Method %Save() As %Status
153156
set @storage@("settings", "warnInstanceWideUncommitted") = ..warnInstanceWideUncommitted
154157
set @storage@("settings", "basicMode") = ..systemBasicMode
155158
set @storage@("settings", "environmentName") = ..environmentName
159+
set @storage@("settings", "lockBranch") = ..lockBranch
156160
if ..basicMode = "system" {
157161
kill @storage@("settings", "user", $username, "basicMode")
158162
} else {
@@ -506,7 +510,7 @@ Method RetrieveDefaults() As %Boolean
506510
Method SaveDefaults() As %Boolean
507511
{
508512
set defaults = {}
509-
set items = $lb("gitBinPath", "pullEventClass", "percentClassReplace", "environmentName", "systemBasicMode", "defaultMergeBranch", "mappedItemsReadOnly", "compileOnImport")
513+
set items = $lb("gitBinPath", "pullEventClass", "percentClassReplace", "environmentName", "systemBasicMode", "defaultMergeBranch", "mappedItemsReadOnly", "compileOnImport", "lockBranch")
510514
for i=1:1:$LISTLENGTH(items) {
511515
set property = $listget(items,i)
512516
do defaults.%Set(property, $property($this, property))

csp/gitprojectsettings.csp

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,7 @@ body {
126126
set settings.compileOnImport = ($Get(%request.Data("compileOnImport", 1)) = 1)
127127
set settings.decomposeProductions = ($Get(%request.Data("decomposeProductions", 1)) = 1)
128128
set settings.decomposeProdAllowIDE = ($Get(%request.Data("decomposeProdAllowIDE", 1)) = 1)
129+
set settings.lockBranch = ($Get(%request.Data("lockBranch", 1)) = 1)
129130

130131
if ($Get(%request.Data("basicMode", 1)) = 1) {
131132
set settings.basicMode = 1
@@ -477,6 +478,18 @@ body {
477478
</div>
478479
</div>
479480
</div>
481+
<div class="form-group row mb-3">
482+
<label for="lockBranch" class="offset-sm-1 col-sm-3 col-form-label" data-toggle="tooltip" data-placement="top"
483+
title="If true, namespace will not have the option to create a New Branch or Switch Branch in source control menu">
484+
Lock Branch</label>
485+
<div class="col-sm-7">
486+
<div class="custom-control custom-switch custom-switch-no-border">
487+
<input class="custom-control-input" name="lockBranch" type="checkbox"
488+
id="lockBranch" #($select(settings.lockBranch:"checked",1:""))# value="1">
489+
<label class="custom-control-label" for="lockBranch"></label>
490+
</div>
491+
</div>
492+
</div>
480493

481494
<div class="form-group row mb-3 mapping-input-group">
482495
<div class="offset-sm-1 col-sm-3">

0 commit comments

Comments
 (0)