CloudForms UI add new menu button
During the latest CloudForms integration with external system we have needed to add custom page. But first of all we have to add some custom menu button which will be a reference to custom page.
You can find all classes responsible for menu loading in
${VMDB}/app/presenters/menu directory.
Here following files:
| manager.rb | main class Menu::Manager |
| section.rb | top-menu buttons (Services, Clouds, Infrastructure, ...) |
| item.rb | menu buttons (Providers, Clusters, Hosts, ...) |
| default_menu.rb | loads default menu shipped with ManageIQ |
| custom_loader.rb | loads menu buttons from custom YAML files |
${VMDB}/product/menubar/
--- # Custom menubar for Test application # in Infrastructure menu type: item parent: inf id: "test_app" name: "Test Application" feature: "test_app" rbac: feature: test_app href: '/test'
type: item there are currently only 2 supported values:
- section
- item (whatever not "section" is considered to be item)
parent: inf means it will be added to Infrastructure section (full list in default_menu.rb)feature: "test_app" defines associated "Product Feature" rbac: feature: test_app defines list of "Product Features", which make this menu visible. Most of cases it's the same as feature: value.href: '/test' URL routes to application pageAs we specified custom Product Feature "test_app" then we need to create such feature.
Create custom directory
${VMDB}/db/fixtures/miq_product_features/ and create here file feature_test_app.yml.For example, define view access rules 'List' and 'Show' collapsed with common parent rule 'View'.
---
#Test Application
:name: Test Application
:description: Test Application Views and Access Rules
:feature_type: node
:identifier: test_app
:parent:
:children:
- :name: View
:description: View Test Application
:feature_type: view
:identifier: test_app_view
:children:
- :name: List
:description: Display Lists of Test Application
:feature_type: view
:identifier: test_app_list
- :name: Show
:description: Display Individual Items of Test Application
:feature_type: view
:identifier: test_app_show
It allows us to configure roles access to this product feature:Restart CFME:
$> cd /var/www/miq/vmdb/ $> rake evm:restartAfter click on custom button it redirects to specified '/test_app' URL.
TODO: next time custom application page
.png)


patiently waiting for the custom application page creation :)
ReplyDelete