From 71c412cac18e8c7947ef6a32b5ab00eb4780163c Mon Sep 17 00:00:00 2001 From: Douglas Gabriel Date: Thu, 5 Jul 2018 17:16:14 -0300 Subject: [PATCH] Adding Physical Chassis Location LED actions --- .../physical_chassis_controller.rb | 1 + .../toolbar/physical_chassis_list_center.rb | 54 +++++++++++++++++++ .../physical_chassis_summary_center.rb | 54 +++++++++++++++++++ 3 files changed, 109 insertions(+) create mode 100644 app/helpers/application_helper/toolbar/physical_chassis_list_center.rb create mode 100644 app/helpers/application_helper/toolbar/physical_chassis_summary_center.rb diff --git a/app/controllers/physical_chassis_controller.rb b/app/controllers/physical_chassis_controller.rb index 928aa5c74a21..9e16a66962c3 100644 --- a/app/controllers/physical_chassis_controller.rb +++ b/app/controllers/physical_chassis_controller.rb @@ -25,6 +25,7 @@ def textual_group_list ] end helper_method(:textual_group_list) + toolbar('physical_chassis_summary', 'physical_chassis_list') def self.display_methods %w(physical_chassis) diff --git a/app/helpers/application_helper/toolbar/physical_chassis_list_center.rb b/app/helpers/application_helper/toolbar/physical_chassis_list_center.rb new file mode 100644 index 000000000000..a7b57543debc --- /dev/null +++ b/app/helpers/application_helper/toolbar/physical_chassis_list_center.rb @@ -0,0 +1,54 @@ +class ApplicationHelper::Toolbar::PhysicalChassisListCenter < ApplicationHelper::Toolbar::Basic + button_group( + 'physical_chassis_operations', + [ + select( + :physical_chassis_identify_choice, + nil, + N_('Identify LED Operations'), + N_('Identify'), + :items => [ + api_button( + :physical_chassis_blink_loc_led, + nil, + N_('Blink the Identify LED'), + N_('Blink LED'), + :icon => "pficon pficon-connected fa-lg", + :api => { + :action => 'blink_loc_led', + :entity => 'physical_chassis' + }, + :confirm => N_("Blink the Identify LED?"), + :options => {:feature => :blink_loc_led} + ), + api_button( + :physical_chassis_turn_on_loc_led, + nil, + N_('Turn on the Idenfity LED'), + N_('Turn On LED'), + :icon => "pficon pficon-on fa-lg", + :api => { + :action => 'turn_on_loc_led', + :entity => 'physical_chassis' + }, + :confirm => N_("Turn on the Identify LED?"), + :options => {:feature => :turn_on_loc_led} + ), + api_button( + :physical_chassis_turn_off_loc_led, + nil, + N_('Turn off the Identify LED'), + N_('Turn Off LED'), + :icon => "pficon pficon-off fa-lg", + :api => { + :action => 'turn_off_loc_led', + :entity => 'physical_chassis' + }, + :confirm => N_("Turn off the Identify LED?"), + :options => {:feature => :turn_off_loc_led} + ), + ] + ) + ] + ) +end diff --git a/app/helpers/application_helper/toolbar/physical_chassis_summary_center.rb b/app/helpers/application_helper/toolbar/physical_chassis_summary_center.rb new file mode 100644 index 000000000000..8d18f758df74 --- /dev/null +++ b/app/helpers/application_helper/toolbar/physical_chassis_summary_center.rb @@ -0,0 +1,54 @@ +class ApplicationHelper::Toolbar::PhysicalChassisSummaryCenter < ApplicationHelper::Toolbar::Basic + button_group( + 'physical_chassis_operations', + [ + select( + :physical_chassis_identify_choice, + nil, + N_('Identify LED Operations'), + N_('Identify'), + :items => [ + api_button( + :physical_chassis_blink_loc_led, + nil, + N_('Blink the Identify LED'), + N_('Blink LED'), + :icon => "pficon pficon-connected fa-lg", + :api => { + :action => 'blink_loc_led', + :entity => 'physical_chassis' + }, + :confirm => N_("Blink the Identify LED?"), + :options => {:feature => :blink_loc_led} + ), + api_button( + :physical_chassis_turn_on_loc_led, + nil, + N_('Turn on the Idenfity LED'), + N_('Turn On LED'), + :icon => "pficon pficon-on fa-lg", + :api => { + :action => 'turn_on_loc_led', + :entity => 'physical_chassis' + }, + :confirm => N_("Turn on the Identify LED?"), + :options => {:feature => :turn_on_loc_led} + ), + api_button( + :physical_chassis_turn_off_loc_led, + nil, + N_('Turn off the Identify LED'), + N_('Turn Off LED'), + :icon => "pficon pficon-off fa-lg", + :api => { + :action => 'turn_off_loc_led', + :entity => 'physical_chassis' + }, + :confirm => N_("Turn off the Identify LED?"), + :options => {:feature => :turn_off_loc_led} + ), + ] + ) + ] + ) +end