You can add new modules in your gateway that have components.
If there is no module of it yet you can try create one, tho that isnt all that easy.
I think this is an example tho it might be outdated
As @victordcq mentioned, the SDK would be the way to accomplish this.
A precautionary note: a Perspective component is probably the most difficult thing you could attempt to do with the Ignition SDK at this time. Do not underestimate the amount of work it will be, especially if you are not already a developer with frontend experience.
Thanks for pointing me in the right direction. I suspected a module would be necessary, but wanted to double check.
Kevin, with that being said, do you think the difficulty remains if the component is already made? I’m imagining I would just need to expose its already-made properties and methods. Do you have any advice on this?
No I’m not the right person to ask. @PerryAJ maybe.
Many of the components people ‘add’ to perspective are ‘already made’ in the sense that they are part of a react component library - but having a react component is only a small part of getting it to work in the context of Perspective.
The example in the repo @victordcq linked is definitely the place to start. The Image component example is implemented to demonstrate what is essentially the ‘bare minimum’ needed for a simple component, but as Kevin hinted, there’s a non-trivial level of knowledge required to really understand what’s happening.
The TL;DR is:
- create a component in js file
- make that js file available to the java classpath
- tell perspective api about your component in appropriate places when your module is loaded
At a high level, that looks something like:
- In your web code - create an implementation of Component (from the node package we publish:
@inductiveautomation/perspective-client). This wraps the react component from your library, which would look something like the Image Component Example, except you’d use your component instead of
- On the web (js) side: Create a
Componentand register it with the client side that represents your bundled into a .js file that’s ultimately packaged into your module as a java-accessible resource. See where it’s registered in the example here
- Register your components with the appropriate Java-side Perspective
ComponentRegistry, so that the perspective system is aware they exist. This occurs by creating and registering
ComponentDescriptorsin Java. Registering in the GatewayHook is a minimal requirement, and designer has a similar API for components that need special UI or state in the designer.
That’s not a comprehensive list, but should give you broad idea of what’s required. The other example components have varying levels of complexity and demonstrate functionality beyond the ‘bare minimum’. Unfortunately, even the ‘simplest’ component has a fair amount of domain knowledge and complexity required - seems that’s inescapable when building a toolkit to build other toolkits like this.
Thanks for the reply, Perry! Seems I have a LOT of reading to do.