We are trying to add/append few more widgets to the existing Dashboard (Operations > Dashboard) but not successful. Is that allowed to do ? if so how do we add our Application related widgets to Dashboard ?
If we pick morpheus-dashboard plugin code and update the widgets its working, but overwriting existing dashboard is not ideal thing i believe. can you please guide us how do we achieve this @david
This is the code for the dashboard used in latest versions of Morpheus
It looks like adding widgets to the existing dashboard while retaining all the existing widgets would is possible, either by adding to an existing section or creating a new section. Just modify this code and rebuild.
Broadly, the changes needed are these:
Create your new provider/s, template and script for JS, following an existing widget provider example
Register the new provider in the MorpheusHomeDashboardPlugin.groovy file, following the approach used to register other providers.
To add as a new section, create a new key in the dashboardItemGroups dict/map of the HomeDashboardProvider.groovy provider. This represents the section. Let’s call it “custom”.
Add the code/s of your new provider/s as as a array on that key
What should be the code to give permissions here. For example, my main plugin provider code is xyz should we provide that or anything am missing here rtn.setPermission(getMorpheus().getPermission().getByCode("admin-health").blockingGet());
The code once modified is your code. You can submit pull requests to the Morpheus plugin repo of course.
If you want to manage internally and it will be internal teams contributing then version control should facilitate that too.
From what I could determine, category was a meta type HTML wrapper. - so it can be anything. The widget providers provide all the properties needed for the UI beyond that.
The Operations > Dashboard role permission will display the page UI. So your XYZ dashboard widget provider will be visible by default, unless you attach other permission requirements via the code you show above.
Those are not definitive answers, I’m just reviewing the code. If you want to dig into this, please open a Technical Request.
Sorry for asking few more queries for better understanding!
Can i assume that, the second approach which i tried will not work ?
To which repo we should push the modified dashboard code ?
Our application code (custom REST endpoints) in xyz plugin jar file, and this modified dashboard code in other jar file. If i want to fire an API call from dashboard jar to xyz plugin jar, will that be possible ?
If updating morpheus-dashboards repo code is the only way, then how do call our rest api services which are defined in other jar file ? And to which repo we need to push the code ?
While adding widgets, we are required to change/add css, how do we add our custom css ?
Is there any storybook/framework link for UI components reference ?
Fork the repo, remove all the widget providers you don’t need and add your own. That’s the way I would go. Building ground up is possible, but likely offers more opportunity for error. Subtract from what works.
Your widget will presumably make the call to the REST API endpoint? You will keep your changes in your repo. You mention that is a JAR file, so if that is a custom controller, you will likely need to develop a cookie based authentication since that is UI.
They can be loaded as scripts but I typically add inline in the html view. Use !Important to prevent override.