From 09c4e610afd4fbc4a8db9aebaf99b480f98663f4 Mon Sep 17 00:00:00 2001 From: Deep Tailor Date: Tue, 15 Sep 2020 09:29:37 -0700 Subject: [PATCH 1/2] use objects.save in display layouts and new folder --- src/plugins/displayLayout/components/DisplayLayout.vue | 2 +- src/plugins/newFolderAction/newFolderAction.js | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/plugins/displayLayout/components/DisplayLayout.vue b/src/plugins/displayLayout/components/DisplayLayout.vue index 509c50533d..4b96c74831 100644 --- a/src/plugins/displayLayout/components/DisplayLayout.vue +++ b/src/plugins/displayLayout/components/DisplayLayout.vue @@ -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; }, diff --git a/src/plugins/newFolderAction/newFolderAction.js b/src/plugins/newFolderAction/newFolderAction.js index 6232ac5a5a..e2e3f4857f 100644 --- a/src/plugins/newFolderAction/newFolderAction.js +++ b/src/plugins/newFolderAction/newFolderAction.js @@ -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); }); } From 81ed9169f1a675b94886cda1dc77daa8a8f527fc Mon Sep 17 00:00:00 2001 From: Deep Tailor Date: Tue, 15 Sep 2020 09:46:17 -0700 Subject: [PATCH 2/2] update unit tests --- src/plugins/newFolderAction/pluginSpec.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/plugins/newFolderAction/pluginSpec.js b/src/plugins/newFolderAction/pluginSpec.js index f2daf4a7fc..7e152633f2 100644 --- a/src/plugins/newFolderAction/pluginSpec.js +++ b/src/plugins/newFolderAction/pluginSpec.js @@ -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', () => {