I've created an ignition project that generates JSON files that can be used to create views in other ignition projects. I'm at a point where I'm happy enough with the functionality where further tweaks are low priority and it works well for my company's purposes. The workflow is a little clunky (download the JSON file, open it, select all, Ctrl+C, create a perspective view in designer, Shift+Right Click, Paste JSON), so I'm wondering if there isn't a way I can create the view directly. The view generation project and the target project can always reside on the same gateway, but ideally it would be nice if I could click a button and a view is created in the other project. It's not a show-stopper if I can't, and even if I can, I want to consider the effort it's going to take because as clunky as the procedure is, it's not too bad to document. Any advice on what I should look into?
This doesn’t answer your question, but Periscope has a JSON View component that allows you to directly render a view’s JSON structure.
The view.json structure is passed into the viewJson parameter, and it is rendered like a normal view.
There's no supported way to inject project resources via scripting, but it's possible to do anyways, because scripting.
This thread has some advice:
Though it's mostly got designer-scoped advice, which would only allow you to edit the currently open project.
I would create/update the view resources directly in the file system through gw scoped scripting. You could even build a Java (or perspective) UI to make it easier for the user and send it off to a gw message handler (for the Java version only, although I'm curious if there's another way; you won't need the msg handler through perspective as it's already gw scoped)
After adding the view(s), run system.project.requestScan to read the changes
So you're saying save my generated file as the "view.json" file directly in the gateway file system? I noticed that views also have a resource.json file. Do I need to generate that as well?
Yep, need to generate both as well as the folder path to it. Simple for Claude to code
Sweet. I'll look into it if I get more time later.