New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Menu pluggability improvements #3347
Conversation
b9fb7b9
to
f927b49
Compare
f927b49
to
07368c5
Compare
Allow plugins to add items and sections at a given position in a existing section. Examples: initializer 'plugin' do # create custom section with 2 custom items Menu::CustomLoader.register( Menu::Section.new(:spike, N_('Plugin'), 'fa fa-map-pin', [ Menu::Item.new('plug1', N_('Test'), 'miq_report', {:feature => 'miq_report', :any => true}, '/plug'), Menu::Item.new('plug2', N_('Demo'), 'miq_report', {:feature => 'miq_report', :any => true}, '/demo') ]) ) # create custom item placed in an existing section 'vi' (Cloud Intel) Menu::CustomLoader.register( Menu::Item.new('plug3', N_('Plug Item'), 'miq_report', {:feature => 'miq_report', :any => true}, '/demo', :default, :vi) ) # create custom section and place it before existing section 'compute' (Compute) Menu::CustomLoader.register( Menu::Section.new(:spike3, N_('Plugin 2'), 'fa fa-map-pin', [ Menu::Item.new('plug4', N_('Demo'), 'miq_report', {:feature => 'miq_report', :any => true}, '/demo') ], :default, :compute) ) # create custom section and place it inside an existing section 'compute' (Compute), before existing subsection 'clo' (Cloud) Menu::CustomLoader.register( # Struct.new(:id, :name, :icon, :items, :placement, :before, :type, :href, :parent_id Menu::Section.new(:spike3, N_('Nested section after'), 'fa fa-map-pin', [ Menu::Item.new('plug5', N_('Test item'), 'miq_report', {:feature => 'miq_report', :any => true}, '/demo') ], :default, :clo, :default, nil, :compute) ) end
@ZitaNemeckova, @himdel : added the specs. Should be good to merge. I can change the interface to work with hashes (to have named arguments) but it can by also done in a separate PR. |
LGTM 👍 (except for the failing spec :P) |
ac190d5
to
a727485
Compare
Checked commits martinpovolny/manageiq-ui-classic@928f093~...01fffca with ruby 2.3.3, rubocop 0.52.0, haml-lint 0.20.0, and yamllint 1.10.0 spec/presenters/menu/custom_loader_spec.rb
|
Tested with https://github.com/priley86/miq_v2v_ui_plugin/pull/48, works just fine 👍 |
#3963: Together with #3683, fixes menu for v2v in gaprindashvili. Then #3726 is needed to fix a bug here.
|
Menu pluggability improvements (cherry picked from commit 19b59d9)
Gaprindashvili backport details:
|
Expand menu pluggability:
Details and examples can be seen in the commit message.
TODO: