diff --git a/app/controllers/application_controller/tags.rb b/app/controllers/application_controller/tags.rb index 4777ec662455..08e966d94a26 100644 --- a/app/controllers/application_controller/tags.rb +++ b/app/controllers/application_controller/tags.rb @@ -93,7 +93,7 @@ def tagging_edit_tags_cancel add_flash(_("Tag Edit was cancelled by the user")) session[:tag_items] = nil # reset tag_items in session @edit = nil # clean out the saved info - if tagging_explorer_controller? + if tagging_explorer_controller? && @lastaction != 'show_list' @sb[:action] = nil replace_right_cell else @@ -109,7 +109,7 @@ def tagging_edit_tags_save tagging_save_tags @edit = nil # clean out the saved info - if tagging_explorer_controller? + if tagging_explorer_controller? && @lastaction != 'show_list' @sb[:action] = nil replace_right_cell else diff --git a/app/controllers/infra_networking_controller.rb b/app/controllers/infra_networking_controller.rb index 5d038d4a8928..849f0ed309ff 100644 --- a/app/controllers/infra_networking_controller.rb +++ b/app/controllers/infra_networking_controller.rb @@ -11,6 +11,10 @@ class InfraNetworkingController < ApplicationController include Mixins::CustomButtonDialogFormMixin include Mixins::BreadcrumbsMixin + INFRA_X_BUTTON_ALLOWED_ACTIONS = { + "infra_networking_tag" => :infra_networking_tag + }.freeze + def self.model Switch end @@ -20,8 +24,10 @@ def self.table_name end def show_list - @center_toolbar = 'infra_networking' + @lastaction = "showlist" + @center_toolbar = 'infra_networkings' process_show_list(:dbname => :switch, :gtl_dbname => :switch, :named_scope => :shareable) + render :layout => "application" end alias_method :index, :show_list @@ -30,6 +36,10 @@ def tagging_explorer_controller? @explorer end + def show_searchbar? + true + end + def tree_select @lastaction = "explorer" @sb[:action] = nil @@ -75,6 +85,11 @@ def load_or_clear_adv_search end end + def show + assert_privileges("infra_networking_view") + @switch = @record = identify_record(params[:id], Switch) + end + def x_show assert_privileges("infra_networking_view") @switch = @record = identify_record(params[:id], Switch) @@ -119,6 +134,8 @@ def tagging def button if params[:pressed] == "custom_button" custom_buttons + else + tag(self.class.model) end end @@ -299,6 +316,11 @@ def replace_right_cell(options = {}) return end + if params[:action] == 'button' && params[:pressed] == 'infra_networking_tag' + tagging + return + end + if action_type == "dialog_form_button_pressed" presenter = set_custom_button_dialog_presenter(options) render :json => presenter.for_render diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 839ef9893eac..48d7a4bc3620 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -234,7 +234,7 @@ def view_to_url(view, parent = nil) if association.nil? controller, action = db_to_controller(view.db) if controller == "switch" && action == "show" - return url_for_only_path(:action => "x_show") + "/" + return url_for_only_path(:action => action) end if controller == "ems_cloud" && action == "show" return ems_clouds_path diff --git a/app/views/infra_networking/show.html.haml b/app/views/infra_networking/show.html.haml new file mode 100644 index 000000000000..054620ef3441 --- /dev/null +++ b/app/views/infra_networking/show.html.haml @@ -0,0 +1,2 @@ +#main_div + = render :partial => "layouts/textual_groups_generic" diff --git a/app/views/infra_networking/show_list.html.haml b/app/views/infra_networking/show_list.html.haml index 55c7fc4e34c6..9a6963312e0e 100644 --- a/app/views/infra_networking/show_list.html.haml +++ b/app/views/infra_networking/show_list.html.haml @@ -1,2 +1,10 @@ -#main-div - = render :partial => 'layouts/x_gtl' +- content_for :search do + = render(:partial => "layouts/x_adv_searchbox") + = render(:partial => 'layouts/quick_search') + +-# Showing a list of switches +#main_div + = render(:partial => 'layouts/gtl') +-# Show Search box +:javascript + #{javascript_show_if_exists("adv_searchbox_div")} diff --git a/config/routes.rb b/config/routes.rb index eb4e9af7fbdd..d6f5786e5095 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -1791,6 +1791,7 @@ tagging tagging_edit x_show + show ), :post => %w( button