Skip to content

Commit dccbf6b

Browse files
committed
Added a checkbox to allow taking a snapshot upon unlocking optionally
1 parent 6339b8d commit dccbf6b

File tree

3 files changed

+32
-5
lines changed

3 files changed

+32
-5
lines changed

js/pages/concept-sets/components/modal/snapshot-lock-modal.html

+8-1
Original file line numberDiff line numberDiff line change
@@ -44,13 +44,20 @@
4444
The following will happen:
4545
<ul>
4646
<li>Concept Set read-only mode will be disabled</li>
47+
<li>Optional: Take a snapshot after unlock</li>
4748
</ul>
4849
</p>
50+
<div class="checkbox-container">
51+
<input type="checkbox" class="form-control snapshot-checkbox"
52+
data-bind="checked: takeSnapshotWhenUnlocking, enable: true" />
53+
<label for="snapshotCheckbox" class="snapshot-label">Take snapshot</label>
54+
</div>
4955
<p class="modal-text" style="margin-top: 20px;"><strong>Unlock confirmation message*:</strong></p>
5056
<textarea class="form-control large-text-input"
5157
data-bind="textInput: snapshotDescriptionMessage, enable: true" rows="4"></textarea>
5258
<div class="center-buttons">
53-
<button class="btn btn-success btn-sm" data-bind="click: unlockConceptSet, enable: canExecuteActions()"
59+
<button class="btn btn-success btn-sm"
60+
data-bind="click: () => unlockConceptSet(takeSnapshotWhenUnlocking()), enable: canExecuteActions()"
5461
style="background-color: green">Confirm</button>
5562
<button class="btn btn-primary btn-sm" data-bind="click: () => isModalShown(false)"
5663
style="background-color: blue">Cancel</button>

js/pages/concept-sets/components/modal/snapshot-lock-modal.js

+6-4
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ define([
2626
super(params);
2727
this.isModalShown = params.isModalShown;
2828
this.isLocked = params.isLocked;
29+
this.takeSnapshotWhenUnlocking = ko.observable(false);
2930
this.currentConceptSetId = params.currentConceptSetId;
3031
this.currentVocabularyVersion = params.currentVocabularyVersion;
3132
this.currentVocabularySchema = ko.observable();
@@ -57,12 +58,13 @@ define([
5758
}
5859

5960

60-
createSnapshotActionRequest(action) {
61+
createSnapshotActionRequest(action, takeSnapshot = true) {
6162
return {
6263
sourceKey: sharedState.sourceKeyOfVocabUrl(),
6364
action: action,
6465
user: authApi.subject(),
65-
message: this.snapshotDescriptionMessage()
66+
message: this.snapshotDescriptionMessage(),
67+
takeSnapshot: takeSnapshot
6668
};
6769
}
6870

@@ -89,8 +91,8 @@ define([
8991
.catch(error => console.error(`Error creating snapshot: ${error}`));
9092
}
9193

92-
unlockConceptSet() {
93-
const request = this.createSnapshotActionRequest("UNLOCK");
94+
unlockConceptSet(takeSnapshot) {
95+
const request = this.createSnapshotActionRequest("UNLOCK", takeSnapshot);
9496
conceptSetService.invokeConceptSetSnapshotAction(this.currentConceptSetId(), request)
9597
.then(() => {
9698
this.isLocked(false);

js/pages/concept-sets/components/modal/snapshot-lock-modal.less

+18
Original file line numberDiff line numberDiff line change
@@ -119,4 +119,22 @@
119119

120120
.ui-autocomplete {
121121
z-index: 10000;
122+
}
123+
124+
.snapshot-label {
125+
margin: 0;
126+
}
127+
128+
.checkbox-container {
129+
display: flex;
130+
align-items: center;
131+
justify-content: flex-start;
132+
margin-top: 10px;
133+
font-size: 16px;
134+
}
135+
136+
.snapshot-checkbox {
137+
width: 16px;
138+
height: 16px;
139+
margin-right: 8px;
122140
}

0 commit comments

Comments
 (0)