Merge pull request #3374 from nasa/object-create-fix-9152020

Use ObjectAPI.save in Display Layout and New folder action
This commit is contained in:
Jamie V 2020-09-15 13:02:36 -07:00 committed by GitHub
commit 67749dd2bb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 5 additions and 4 deletions

View File

@ -630,7 +630,7 @@ export default {
object.identifier = identifier;
object.location = parentKeyString;
this.openmct.objects.mutate(object, 'created', Date.now());
this.openmct.objects.save(object);
return object;
},

View File

@ -72,7 +72,8 @@ export default class NewFolderAction {
folderType.definition.initialize(objectModel);
objectModel.name = name || 'New Folder';
this._openmct.objects.mutate(objectModel, 'created', Date.now());
this._openmct.objects.save(objectModel);
composition.add(objectModel);
});
}

View File

@ -79,7 +79,7 @@ describe("the plugin", () => {
spyOn(openmct.$injector, 'get').and.returnValue(mockDialogService);
spyOn(compositionAPI, 'get').and.returnValue(mockComposition);
spyOn(openmct.objects, 'mutate');
spyOn(openmct.objects, 'save');
newFolderAction.invoke(mockObjectPath);
});
@ -89,7 +89,7 @@ describe("the plugin", () => {
});
it('creates a new folder object', () => {
expect(openmct.objects.mutate).toHaveBeenCalled();
expect(openmct.objects.save).toHaveBeenCalled();
});
it('adds new folder object to parent composition', () => {