From 73108465229dc35e18d182ac29742d45340a9d91 Mon Sep 17 00:00:00 2001 From: Madhu Mohan Nelemane Date: Fri, 16 Dec 2016 14:43:36 +0100 Subject: [PATCH] Improvements to Crowbar-UI for Rackscale - Added text boxes to edit PSME server IP and port. --- .../app/controllers/intelrsd_controller.rb | 15 ++++++++---- .../rsd/{show.html.haml => display.html.haml} | 0 .../app/views/rsd/settings.html.haml | 24 +++++++++++++++++++ .../config/locales/intel_rsd/en.yml | 5 ++++ crowbar_framework/config/navigation.rb | 2 +- .../config/routes.d/intel-rsd.routes | 4 +++- intelrsd.yml | 2 +- 7 files changed, 45 insertions(+), 7 deletions(-) rename crowbar_framework/app/views/rsd/{show.html.haml => display.html.haml} (100%) create mode 100644 crowbar_framework/app/views/rsd/settings.html.haml diff --git a/crowbar_framework/app/controllers/intelrsd_controller.rb b/crowbar_framework/app/controllers/intelrsd_controller.rb index 0fb9470aab..5d649d97d5 100644 --- a/crowbar_framework/app/controllers/intelrsd_controller.rb +++ b/crowbar_framework/app/controllers/intelrsd_controller.rb @@ -36,11 +36,18 @@ class RsdController < ApplicationController attr_reader :redfish_client, :logger # Client setup for the class - host = ENV["CROWBAR_REDFISH_HOST"] || "localhost" - port = ENV["CROWBAR_REDFISH_PORT"] || "8443" - @redfish_client = RedfishHelper::RedfishClient.new(host, port) + @host = ENV["CROWBAR_REDFISH_HOST"] || "localhost" + @port = ENV["CROWBAR_REDFISH_PORT"] || "8443" - def show + def settings + @host = @rsd_rest_server + @port = @rsd_server_port + Rails.logger.warn "RackScale Server: #{@host}, Port: #{@port}" + end + + def display + Rails.logger.warn "RackScale Server: #{@host}, Port: #{@port}" + @redfish_client = RedfishHelper::RedfishClient.new(@host, @port) @title = "Welcome to RackScale Design" sys_list = get_all_systems @rsd_systems = "Systems not Available" diff --git a/crowbar_framework/app/views/rsd/show.html.haml b/crowbar_framework/app/views/rsd/display.html.haml similarity index 100% rename from crowbar_framework/app/views/rsd/show.html.haml rename to crowbar_framework/app/views/rsd/display.html.haml diff --git a/crowbar_framework/app/views/rsd/settings.html.haml b/crowbar_framework/app/views/rsd/settings.html.haml new file mode 100644 index 0000000000..a4d4cb5619 --- /dev/null +++ b/crowbar_framework/app/views/rsd/settings.html.haml @@ -0,0 +1,24 @@ +.row + .col-xs-12 + %h1.page-header + = t(".title") + + .btn-group.pull-right + = link_to t(".show"), rsd_display_path, :class => "btn btn-default" + += form_tag rsd_display_path, :role => "form" do |f| + .panel.panel-default + .panel-body + .form-group + %label{ :for => :rsd_rest_server } + = t(".rsd_rest_server") + = text_field_tag :rsd_rest_server, @rsd_rest_server, :class => "form-control", :disabled => nil + + .form-group + %label{ :for => :rsd_server_port } + = t(".rsd_server_port") + = text_field_tag :rsd_server_port, @rsd_server_port, :class => "form-control", :disabled => nil + + .panel-footer.text-right + .btn-group + %input.btn.btn-default{ :type => "submit", :name => "show", :value => t(".show") } diff --git a/crowbar_framework/config/locales/intel_rsd/en.yml b/crowbar_framework/config/locales/intel_rsd/en.yml index bb50a9cb1f..1ea4f8bbda 100644 --- a/crowbar_framework/config/locales/intel_rsd/en.yml +++ b/crowbar_framework/config/locales/intel_rsd/en.yml @@ -19,6 +19,11 @@ en: utils: rsd: 'Intel RackScale' rsd: + settings: + title: 'Intel Rackscale Server Details' + rsd_rest_server: 'PSME Rest Server IP' + rsd_server_port: 'PSME Rest Server Port' + show: 'Show' show: title: 'Intel Rackscale' rsd_header: 'Lists Systems available from Intel RackScale server by talking to the Redfish APIs' diff --git a/crowbar_framework/config/navigation.rb b/crowbar_framework/config/navigation.rb index b39b97b3f4..6634f47cc0 100644 --- a/crowbar_framework/config/navigation.rb +++ b/crowbar_framework/config/navigation.rb @@ -39,7 +39,7 @@ level2.item :repositories, t("nav.utils.repositories"), repositories_path level2.item :backup, t("nav.utils.backup"), backups_path level2.item :logs, t("nav.utils.logs"), utils_path - level2.item :rsd, t("nav.utils.rsd"), rsd_show_path + level2.item :rsd, t("nav.utils.rsd"), rsd_settings_path end end end diff --git a/crowbar_framework/config/routes.d/intel-rsd.routes b/crowbar_framework/config/routes.d/intel-rsd.routes index 078c16fe52..2ea39e527d 100644 --- a/crowbar_framework/config/routes.d/intel-rsd.routes +++ b/crowbar_framework/config/routes.d/intel-rsd.routes @@ -14,5 +14,7 @@ # limitations under the License. # -get 'rsd/show' => 'rsd#show', as: 'rsd_show' +post 'rsd/display' => 'rsd#display', as: 'rsd_display' +get 'rsd/settings' => 'rsd#settings', as: 'rsd_settings' +post 'rsd/show' => 'rsd#show', as: 'rsd_show' post 'rsd/allocate' => 'rsd#allocate', as: 'rsd_allocate' diff --git a/intelrsd.yml b/intelrsd.yml index ba73cf8b70..4350b27ada 100644 --- a/intelrsd.yml +++ b/intelrsd.yml @@ -34,4 +34,4 @@ nav: utils: rsd: order: 91 - route: 'rsd_edit_path' + route: 'rsd_settings_path'