Skip to content

Commit 6b6a760

Browse files
committed
enh: settings page has control to lock / unlock namespace for edits
1 parent aef7832 commit 6b6a760

File tree

3 files changed

+33
-2
lines changed

3 files changed

+33
-2
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,11 @@ All notable changes to this project will be documented in this file.
55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
66
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

8+
## [2.14.0] - Unreleased
9+
10+
### Added
11+
- Option to lock/unlock namespace is now available on the settings page (#650)
12+
813
## [2.13.1] - 2025-09-16
914

1015
### Fixed

csp/gitprojectsettings.csp

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,7 @@ body {
119119
}
120120

121121
if ('settings.settingsUIReadOnly) {
122+
do ##class(SourceControl.Git.Utils).Locked($get(%request.Data("lockNamespace",1)))
122123
for param="gitBinPath","namespaceTemp","privateKeyFile","pullEventClass","percentClassReplace", "defaultMergeBranch","environmentName","mappingsToken" {
123124
set $Property(settings,param) = $Get(%request.Data(param,1))
124125
}
@@ -215,7 +216,7 @@ body {
215216
<strong>Success!</strong> Your changes have been saved.
216217
</div>
217218
</csp:if>
218-
<form id="settingsForm" method='post'>
219+
<form id="settingsForm" method='post' onsubmit="return validateForm();">
219220
<input type="hidden" name="Namespace" value="#(..EscapeHTML(namespace))#" />
220221
<input type="hidden" name="gitsettings" value="1" />
221222
<div class="col-sm-12"><br></div>
@@ -515,6 +516,18 @@ body {
515516
</div>
516517
</div>
517518
</div>
519+
<div class="form-group row mb-3">
520+
<label for="lockNamespace" class="offset-sm-1 col-sm-3 col-form-label" data-toggle="tooltip" data-placement="top"
521+
title="If true, any source-controlled code or configuration may not be directly edited in this namespace">
522+
Lock Edits in Namespace</label>
523+
<div class="col-sm-7">
524+
<div class="custom-control custom-switch custom-switch-no-border">
525+
<input class="custom-control-input" name="lockNamespace" type="checkbox"
526+
id="lockNamespace" #($select(##class(SourceControl.Git.Utils).Locked():"checked",1:""))# value="1">
527+
<label class="custom-control-label" for="lockNamespace"></label>
528+
</div>
529+
</div>
530+
</div>
518531
<div class="form-group row mb-3">
519532
<label for="mappingsToken" class="offset-sm-1 col-sm-3 col-form-label" data-toggle="tooltip" data-placement="top" title="(Optional) A namespace-specific string that may be included in mapping configurations as <token> to support multi-namespace repositories">Mappings Token</label>
520533
<div class="col-sm-7">
@@ -806,6 +819,19 @@ function showOutput(target) {
806819
}
807820
}
808821

822+
function validateForm() {
823+
var confirmText = "";
824+
var lockNamespaceInitValue = #(''##class(SourceControl.Git.Utils).Locked())#;
825+
var cbLockNamespace = document.getElementById("lockNamespace");
826+
if (!cbLockNamespace) return true;
827+
if (cbLockNamespace.checked && (lockNamespaceInitValue !== 1)) {
828+
confirmText = "Are you sure? This will lock any source-controlled items from being edited in this namespace.";
829+
} else if (!cbLockNamespace.checked && (lockNamespaceInitValue == 1)) {
830+
confirmText = "Are you sure? This will allow edits of source-controlled items in this namespace.";
831+
}
832+
return confirmText ? confirm(confirmText) : true;
833+
}
834+
809835
$(function () {
810836
$('[data-toggle="tooltip"]').tooltip({
811837
trigger: 'hover'

module.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<Document name="git-source-control.ZPM">
44
<Module>
55
<Name>git-source-control</Name>
6-
<Version>2.13.1</Version>
6+
<Version>2.14.0</Version>
77
<Description>Server-side source control extension for use of Git on InterSystems platforms</Description>
88
<Keywords>git source control studio vscode</Keywords>
99
<Packaging>module</Packaging>

0 commit comments

Comments
 (0)