Skip to content

Commit

Permalink
Add script to lock object sub-tree and fix object locking bugs (#7855)
Browse files Browse the repository at this point in the history
* Script for locking an object tree

* Show lock button if locked

* Do not allow properties editing of locked objects

* Remove package-lock.json

* Added p-debounce

* Allow duplication of locked objects

* Better user feedback

* Add semaphores to prevent file handle exhaustion

* Leverage official Apache Couch library - nano. Clean up dependencies. Default to environment variables for couch config. Simplify batching mechanism to make it synchronouse

* Added lock user attribution

* Remove unused code

* Modify open script for adding auth design doc

* Added script for creating auth design doc

* Add css class for disallow unlock

* Add user attribution to lock button

* Fix import

* Typo

* User it was locked by, not current user. Wow.

* Closes #7877
- Front-end sanding and shimming: displays <span> instead of button when domainObject.disallowUnlock.

* Fixed bug where lock is shown even if object is not locked

---------

Co-authored-by: Charles Hacskaylo <[email protected]>
Co-authored-by: Jesse Mazzella <[email protected]>
  • Loading branch information
3 people authored Oct 10, 2024
1 parent c43ef64 commit 703186a
Show file tree
Hide file tree
Showing 8 changed files with 370 additions and 12 deletions.
94 changes: 94 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@
"moment": "2.30.1",
"moment-duration-format": "2.3.2",
"moment-timezone": "0.5.41",
"nano": "10.1.4",
"npm-run-all2": "6.1.2",
"nyc": "15.1.0",
"painterro": "1.2.87",
Expand Down Expand Up @@ -156,4 +157,4 @@
"keywords": [
"nasa"
]
}
}
6 changes: 3 additions & 3 deletions src/plugins/duplicate/DuplicateAction.js
Original file line number Diff line number Diff line change
Expand Up @@ -109,8 +109,9 @@ class DuplicateAction {
let currentParentKeystring = this.openmct.objects.makeKeyString(currentParent.identifier);
let parentCandidateKeystring = this.openmct.objects.makeKeyString(parentCandidate.identifier);
let objectKeystring = this.openmct.objects.makeKeyString(this.object.identifier);
const isLocked = parentCandidate.locked === true;

if (!this.openmct.objects.isPersistable(parentCandidate.identifier)) {
if (isLocked || !this.openmct.objects.isPersistable(parentCandidate.identifier)) {
return false;
}

Expand Down Expand Up @@ -139,10 +140,9 @@ class DuplicateAction {
const parentType = parent && this.openmct.types.get(parent.type);
const child = objectPath[0];
const childType = child && this.openmct.types.get(child.type);
const locked = child.locked ? child.locked : parent && parent.locked;
const isPersistable = this.openmct.objects.isPersistable(child.identifier);

if (locked || !isPersistable) {
if (!isPersistable) {
return false;
}

Expand Down
2 changes: 1 addition & 1 deletion src/plugins/formActions/EditPropertiesAction.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ class EditPropertiesAction extends PropertiesAction {
const definition = this._getTypeDefinition(object.type);
const persistable = this.openmct.objects.isPersistable(object.identifier);

return persistable && definition && definition.creatable;
return persistable && definition && definition.creatable && !object.locked;
}

invoke(objectPath) {
Expand Down
9 changes: 9 additions & 0 deletions src/plugins/inspectorViews/properties/PropertiesComponent.vue
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,8 @@ export default {
const createdTimestamp = this.domainObject.created;
const createdBy = this.domainObject.createdBy ? this.domainObject.createdBy : UNKNOWN_USER;
const modifiedBy = this.domainObject.modifiedBy ? this.domainObject.modifiedBy : UNKNOWN_USER;
const locked = this.domainObject.locked;
const lockedBy = this.domainObject.lockedBy ?? UNKNOWN_USER;
const modifiedTimestamp = this.domainObject.modified
? this.domainObject.modified
: this.domainObject.created;
Expand Down Expand Up @@ -148,6 +150,13 @@ export default {
});
}
if (locked === true) {
details.push({
name: 'Locked By',
value: lockedBy
});
}
if (version) {
details.push({
name: 'Version',
Expand Down
Loading

0 comments on commit 703186a

Please sign in to comment.