Im using WSO2 Governance Registry 5.2.0.
When I create a new artifact type, it containt a lot of new fields (You create and define this XML in the CARBON ADMIN CONSOLE). So in the PUBLISHER you can see the new fields, create and consult a new item of the artifact.
But the problem is in the STORE, I cannot see the this new fields. So in order to do this, I made the custom fields available by modifying GREG_HOME>/repository/deployment/server/jaggeryapps/store/extensions/app/greg-store-defaults/themes/store/partials/asset-attributes.hbs file. Thanks to Malintha's Blog,
This is perhaps an answer, but it will get much worse if for each artifact I have to edit the file to add the fields, editing this file will get a lot worse over the time...
So my question is: Is there a way to create a custom theme (*.hbs, etc) for each new artifact I create?
THANKS!
As far as I understand your in the development phase of the project that you have to create registry extensions(RXTs) and showing up the data in G-Reg Store. As far as I know there is no easy dynamic way that you can do this, either you have to extend the default hbs files. Like you have done using Malintha's blog. This is okay if there is a minor change to be done, However this is not the recommended way because if there is a migration to do such as moving to all new WSO2 G-Reg 5.3.0 you might face lot of trouble if you updated the out of the box files in G-Reg 5.2.0, Therefore I suggest you to write asset extensions(GREG_HOME/repository/deployment/server/jaggeryapps/store/extensions/assets
) for each and every rxt that you are going to introduce. There is plenty of blog posts that can help you.
Please find the below list of blog posts(I will update the list if I found any).
How to view the json payload sent to the Store UI in GREG 5.1.0
WSO2GREG-5.2.0- WRITING EXTENSION TO REPLICATE MORE ARTIFACT METADATA IN STORE
Note:
There is no much difference between 5.1.0 and 5.2.0.(5.2.0 is more stable)
You can start(learn) creating a new extension by simply extending restservice.rxt and the relevant asset extension(GREG_HOME/repository/deployment/server/jaggeryapps/store/extensions/assets/restservice), I prefer you to use this blog post and start from there.
If there is a lot of development to be done I prefer you to seek help from WSO2 experts from they're official portal, if not you can always stick to stackoverflow.
来源:https://stackoverflow.com/questions/38921784/how-to-create-a-custom-asset-attributes-hbs-for-each-new-artifact-for-the-store