[Actions] Update to use isPersistable API Method (#4432)

* added persistance check to edit properties action
* adding persistence check in browse bar as well as reverting passing in openmct in bundle and now passing it in through appliesTo method
* adding other actions that need to be persistable
* adding persistance check to set primary location action

Co-authored-by: Andrew Henry <akhenry@gmail.com>
This commit is contained in:
Jamie V
2021-12-06 12:42:22 -08:00
committed by GitHub
parent 420edb75f8
commit 7b53cad2c5
10 changed files with 83 additions and 31 deletions

View File

@ -83,7 +83,8 @@ export default class NewFolderAction {
}
appliesTo(objectPath) {
let domainObject = objectPath[0];
let isPersistable = this._openmct.objects.isPersistable(domainObject.identifier);
return domainObject.type === 'folder';
return domainObject.type === 'folder' && isPersistable;
}
}

View File

@ -78,6 +78,7 @@ describe("the plugin", () => {
spyOn(openmct.$injector, 'get').and.returnValue(mockDialogService);
spyOn(compositionAPI, 'get').and.returnValue(mockComposition);
spyOn(openmct.objects, 'save').and.returnValue(Promise.resolve(true));
spyOn(openmct.objects, 'isPersistable').and.returnValue(true);
return newFolderAction.invoke(mockObjectPath);
});
@ -93,5 +94,11 @@ describe("the plugin", () => {
it('adds new folder object to parent composition', () => {
expect(mockComposition.add).toHaveBeenCalled();
});
it('checks if the domainObject is persistable', () => {
newFolderAction.appliesTo(mockObjectPath);
expect(openmct.objects.isPersistable).toHaveBeenCalled();
});
});
});