Skip to content

Commit

Permalink
Merge pull request #1724 from AparnaKarve/generic_object_ui
Browse files Browse the repository at this point in the history
Generic Objects UI
  • Loading branch information
martinpovolny committed Jul 26, 2017
2 parents 93b8e1f + 773fa67 commit 9ee2310
Show file tree
Hide file tree
Showing 14 changed files with 163 additions and 770 deletions.

This file was deleted.

79 changes: 0 additions & 79 deletions app/controllers/generic_object_controller.rb

This file was deleted.

29 changes: 29 additions & 0 deletions app/controllers/generic_object_definition_controller.rb
@@ -0,0 +1,29 @@
class GenericObjectDefinitionController < ApplicationController
before_action :check_privileges
before_action :get_session_data

after_action :cleanup_action
after_action :set_session_data

include Mixins::GenericListMixin
include Mixins::GenericSessionMixin
include Mixins::GenericShowMixin

menu_section :automate

def self.display_methods
%w(generic_objects)
end

def self.model
GenericObjectDefinition
end

private

def textual_group_list
[%i(relationships)]
end

helper_method :textual_group_list
end
3 changes: 3 additions & 0 deletions app/helpers/generic_object_definition_helper.rb
@@ -0,0 +1,3 @@
module GenericObjectDefinitionHelper
include_concern 'TextualSummary'
end
17 changes: 17 additions & 0 deletions app/helpers/generic_object_definition_helper/textual_summary.rb
@@ -0,0 +1,17 @@
module GenericObjectDefinitionHelper::TextualSummary
include TextualMixins::TextualName

def textual_group_relationships
TextualGroup.new(_("Relationships"), %i(generic_objects))
end

def textual_generic_objects
num = @record.number_of(:generic_objects)
h = {:label => _("Instances"), :value => num}
if role_allows?(:feature => "generic_object_view") && num > 0
h.update(:link => url_for_only_path(:action => 'show', :id => @record, :display => 'generic_objects'),
:title => _('Show all Instances'))
end
h
end
end
7 changes: 1 addition & 6 deletions app/presenters/menu/default_menu.rb
Expand Up @@ -236,16 +236,11 @@ def ansible_menu_section
end

def automate_menu_section
generic_object_item = if ::Settings.product.generic_object == true
Menu::Item.new('generic_object', N_('Generic Objects'), 'generic_object_explorer', {:feature => 'generic_object_explorer'}, '/generic_object/explorer')
else
nil
end
Menu::Section.new(:automate, N_("Automate"), 'fa fa-recycle', [
Menu::Item.new('miq_ae_class', N_('Explorer'), 'miq_ae_class_explorer', {:feature => 'miq_ae_domain_view'}, '/miq_ae_class/explorer'),
Menu::Item.new('miq_ae_tools', N_('Simulation'), 'miq_ae_class_simulation', {:feature => 'miq_ae_class_simulation'}, '/miq_ae_tools/resolve'),
Menu::Item.new('miq_ae_customization', N_('Customization'), 'miq_ae_customization_explorer', {:feature => 'miq_ae_customization_explorer'}, '/miq_ae_customization/explorer'),
generic_object_item,
Menu::Item.new('generic_object_definitions', N_('Generic Objects'), 'generic_object_definitions', {:feature => 'generic_object_definition'}, '/generic_object_definition'),
Menu::Item.new('miq_ae_export', N_('Import / Export'), 'miq_ae_class_import_export', {:feature => 'miq_ae_class_import_export'}, '/miq_ae_tools/import_export'),
Menu::Item.new('miq_ae_logs', N_('Log'), 'miq_ae_class_log', {:feature => 'miq_ae_class_log'}, '/miq_ae_tools/log'),
Menu::Item.new('miq_request_ae', N_('Requests'), nil, {:feature => 'miq_request_show_list'}, "/miq_request?typ=ae")
Expand Down
62 changes: 0 additions & 62 deletions app/views/generic_object/explorer.html.haml

This file was deleted.

5 changes: 5 additions & 0 deletions app/views/generic_object_definition/show.html.haml
@@ -0,0 +1,5 @@
#main_div
- if %w(generic_objects).include?(@display)
= render :partial => "layouts/gtl", :locals => {:action_url => "show/#{@record.id}"}
- else
= render :partial => 'layouts/textual_groups_generic'
2 changes: 2 additions & 0 deletions app/views/generic_object_definition/show_list.html.haml
@@ -0,0 +1,2 @@
#main_div
= render :partial => 'layouts/gtl'
11 changes: 3 additions & 8 deletions config/routes.rb
Expand Up @@ -2043,17 +2043,12 @@
x_post
},

:generic_object => {
:generic_object_definition => {
:get => %w(
all_object_data
explorer
object_data
tree_data
show
show_list
),
:post => %w(
create
delete
save
)
},

Expand Down

0 comments on commit 9ee2310

Please sign in to comment.