mirror of
https://github.com/nasa/openmct.git
synced 2024-12-19 13:17:53 +00:00
Don't allow Move and Duplicate actions on non creatable objects (#3518)
* Prevent copy and move actions for non creatable objects * Remove unneeded code * Remove prototype typo * Allow duplicating an object only if it is creatable Co-authored-by: Deep Tailor <deep.j.tailor@nasa.gov>
This commit is contained in:
parent
acea18fa70
commit
176226ddef
@ -143,13 +143,16 @@ export default class DuplicateAction {
|
||||
let parent = objectPath[1];
|
||||
let parentType = parent && this.openmct.types.get(parent.type);
|
||||
let child = objectPath[0];
|
||||
let childType = child && this.openmct.types.get(child.type);
|
||||
let locked = child.locked ? child.locked : parent && parent.locked;
|
||||
|
||||
if (locked) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return parentType
|
||||
return childType
|
||||
&& childType.definition.creatable
|
||||
&& parentType
|
||||
&& parentType.definition.creatable
|
||||
&& Array.isArray(parent.composition);
|
||||
}
|
||||
|
@ -154,6 +154,7 @@ export default class MoveAction {
|
||||
let parent = objectPath[1];
|
||||
let parentType = parent && this.openmct.types.get(parent.type);
|
||||
let child = objectPath[0];
|
||||
let childType = child && this.openmct.types.get(child.type);
|
||||
|
||||
if (child.locked || (parent && parent.locked)) {
|
||||
return false;
|
||||
@ -161,6 +162,8 @@ export default class MoveAction {
|
||||
|
||||
return parentType
|
||||
&& parentType.definition.creatable
|
||||
&& childType
|
||||
&& childType.definition.creatable
|
||||
&& Array.isArray(parent.composition);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user