mirror of
https://github.com/nasa/openmct.git
synced 2024-12-20 21:53:08 +00:00
Updated check for edit mode on create
This commit is contained in:
parent
1e7964855a
commit
708aa7dcba
@ -67,6 +67,19 @@ define(
|
|||||||
this.$q = $q;
|
this.$q = $q;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Get a count of views which are not flagged as non-editable.
|
||||||
|
function countEditableViews(domainObject) {
|
||||||
|
var views = domainObject && domainObject.useCapability('view'),
|
||||||
|
count = 0;
|
||||||
|
|
||||||
|
// A view is editable unless explicitly flagged as not
|
||||||
|
(views || []).forEach(function (view) {
|
||||||
|
count += (view.editable !== false) ? 1 : 0;
|
||||||
|
});
|
||||||
|
|
||||||
|
return count;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new object of the given type.
|
* Create a new object of the given type.
|
||||||
* This will prompt for user input first.
|
* This will prompt for user input first.
|
||||||
@ -85,7 +98,7 @@ define(
|
|||||||
model.location = parentObject.getId();
|
model.location = parentObject.getId();
|
||||||
});
|
});
|
||||||
|
|
||||||
if (newObject.hasCapability('composition') && this.type.getKey()!=='folder') {
|
if (countEditableViews(editableObject) > 0) {
|
||||||
this.navigationService.setNavigation(editableObject);
|
this.navigationService.setNavigation(editableObject);
|
||||||
} else {
|
} else {
|
||||||
return editableObject.getCapability('action').perform('save');
|
return editableObject.getCapability('action').perform('save');
|
||||||
|
Loading…
Reference in New Issue
Block a user