Skip to content

Commit

Permalink
De explorization of infra networkng show page
Browse files Browse the repository at this point in the history
  • Loading branch information
akhilkr128 committed Jan 2, 2023
1 parent 4c991d9 commit c8ce43d
Show file tree
Hide file tree
Showing 6 changed files with 39 additions and 6 deletions.
4 changes: 2 additions & 2 deletions app/controllers/application_controller/tags.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
24 changes: 23 additions & 1 deletion app/controllers/infra_networking_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -30,6 +36,10 @@ def tagging_explorer_controller?
@explorer
end

def show_searchbar?
true
end

def tree_select
@lastaction = "explorer"
@sb[:action] = nil
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -119,6 +134,8 @@ def tagging
def button
if params[:pressed] == "custom_button"
custom_buttons
else
tag(self.class.model)
end
end

Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion app/helpers/application_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions app/views/infra_networking/show.html.haml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#main_div
= render :partial => "layouts/textual_groups_generic"
12 changes: 10 additions & 2 deletions app/views/infra_networking/show_list.html.haml
Original file line number Diff line number Diff line change
@@ -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")}
1 change: 1 addition & 0 deletions config/routes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1791,6 +1791,7 @@
tagging
tagging_edit
x_show
show
),
:post => %w(
button
Expand Down

0 comments on commit c8ce43d

Please sign in to comment.