mirror of
https://github.com/nasa/openmct.git
synced 2025-06-18 15:18:12 +00:00
[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:
@ -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;
|
||||
}
|
||||
}
|
||||
|
@ -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();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
Reference in New Issue
Block a user