Preview action on domain object composed of viewable domain objects #5180
-
I'm working on moving to the new(er) API in version 1. In the old API, if I wanted to preview a domain object representing a view which was composed of other domain obejcts, I could do the following: openmct.$injector.get('objectService').getObjects([key])
.then((objs) => {
const preview = objs[key].getCapability('action').getActions({ key: 'mct-preview-action' })[0]
action.perform()
}) With the new API, I'm assuming I would do something like: const obj = await openmct.objects.get(key)
const actions = await openmct.actions.get([obj])
actions.applicableActions.preview.callBack() But this code only works for some domain objects, and I'm really not sure why. When it doesn't work I get the following errors in the console:
I suspect it's because I'm not providing a view but I'm having trouble finding documentation on this feature. Any ideas? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 7 replies
-
I believe you could do something like this: import PreviewAction fom "@/ui/preview/PreviewAction.js";
const previewAction = new PreviewAction(openmct);
const objectPath = await openmct.objects.getOriginalPath(domainObject.identifier);
previewAction.invoke(objectPath); We're going to be updating PreviewAction soon so that it will reuse any components that are already in the DOM (to enhance performance), but that should be a backward compatible change. |
Beta Was this translation helpful? Give feedback.
Hi @jordan-bonecutter!
I believe you could do something like this:
We're going to be updating PreviewAction soon so that it will reuse any components that are already in the DOM (to enhance performance), but that should be a backward compatible change.