mirror of
https://github.com/nasa/openmct.git
synced 2025-03-23 12:35:48 +00:00
Fix object creation (#4675)
* Save the object before adding it to the parent so that transaction committing works properly * Fix object creation - composition policy changes
This commit is contained in:
parent
936b88363c
commit
433f1bf28e
@ -39,8 +39,10 @@ export default class ConditionSetViewProvider {
|
||||
return isConditionSet && this.openmct.router.isNavigatedObject(objectPath);
|
||||
}
|
||||
|
||||
canEdit(domainObject) {
|
||||
return domainObject.type === 'conditionSet';
|
||||
canEdit(domainObject, objectPath) {
|
||||
const isConditionSet = domainObject.type === 'conditionSet';
|
||||
|
||||
return isConditionSet && this.openmct.router.isNavigatedObject(objectPath);
|
||||
}
|
||||
|
||||
view(domainObject, objectPath) {
|
||||
|
@ -99,6 +99,7 @@ export default class CreateAction extends PropertiesAction {
|
||||
*/
|
||||
async _navigateAndEdit(domainObject, parentDomainObjectpath) {
|
||||
let objectPath;
|
||||
let self = this;
|
||||
if (parentDomainObjectpath) {
|
||||
objectPath = parentDomainObjectpath && [domainObject].concat(parentDomainObjectpath);
|
||||
} else {
|
||||
@ -110,13 +111,18 @@ export default class CreateAction extends PropertiesAction {
|
||||
.reverse()
|
||||
.join('/');
|
||||
|
||||
this.openmct.router.navigate(url);
|
||||
function editObject() {
|
||||
const objectView = self.openmct.objectViews.get(domainObject, objectPath)[0];
|
||||
const canEdit = objectView && objectView.canEdit && objectView.canEdit(domainObject, objectPath);
|
||||
|
||||
const objectView = this.openmct.objectViews.get(domainObject, objectPath)[0];
|
||||
const canEdit = objectView && objectView.canEdit && objectView.canEdit(domainObject, objectPath);
|
||||
if (canEdit) {
|
||||
this.openmct.editor.edit();
|
||||
if (canEdit) {
|
||||
self.openmct.editor.edit();
|
||||
}
|
||||
}
|
||||
|
||||
this.openmct.router.once('afterNavigation', editObject);
|
||||
|
||||
this.openmct.router.navigate(url);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -29,10 +29,9 @@ define(
|
||||
}
|
||||
|
||||
SummaryWidgetsCompositionPolicy.prototype.allow = function (parent, child) {
|
||||
const parentType = parent.getCapability('type');
|
||||
const newStyleChild = child.useCapability('adapter');
|
||||
const parentType = parent.type;
|
||||
|
||||
if (parentType.instanceOf('summary-widget') && !this.openmct.telemetry.isTelemetryObject(newStyleChild)) {
|
||||
if (parentType === 'summary-widget' && !this.openmct.telemetry.isTelemetryObject(child)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -445,6 +445,10 @@ export default {
|
||||
}
|
||||
|
||||
// sorting composition items
|
||||
if (!a.name || !b.name) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (a.name.toLowerCase()
|
||||
> b.name.toLowerCase()) {
|
||||
return 1;
|
||||
|
Loading…
x
Reference in New Issue
Block a user