[Actions] Restrict mutating actions
Restrict actions which cause mutation of domain objects to types of domain objects which can be created. (This does not include Packet or Telemetry Point, WTD-723.)
This commit is contained in:
@@ -80,9 +80,14 @@ define(
|
||||
RemoveAction.appliesTo = function (context) {
|
||||
var object = (context || {}).domainObject,
|
||||
contextCapability = object && object.getCapability("context"),
|
||||
parent = contextCapability && contextCapability.getParent();
|
||||
parent = contextCapability && contextCapability.getParent(),
|
||||
parentType = parent.getCapability('type'),
|
||||
parentCreatable = parentType && parentType.hasFeature('creation');
|
||||
|
||||
// Only creatable types should be modifiable
|
||||
return parent !== undefined &&
|
||||
Array.isArray(parent.getModel().composition);
|
||||
Array.isArray(parent.getModel().composition) &&
|
||||
parentCreatable;
|
||||
};
|
||||
|
||||
return RemoveAction;
|
||||
|
||||
Reference in New Issue
Block a user