Skip to content
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

Merged
merged 2 commits into from Mar 1, 2018
Merged

Commits on Mar 1, 2018

  1. Menu pluggability improvements.

    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
    martinpovolny committed Mar 1, 2018
    Configuration menu
    Copy the full SHA
    928f093 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    01fffca View commit details
    Browse the repository at this point in the history