diff --git a/.rubocop.yml b/.rubocop.yml index b25398e..c85ebfe 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -1,3 +1,9 @@ +require: + - rubocop-performance + - rubocop-rails + - rubocop-rspec + - rubocop-thread_safety + inherit_mode: merge: - Exclude @@ -8,6 +14,7 @@ AllCops: - 'app/controllers/kpm/engine_controller.rb' # Too much magic going on NewCops: enable SuggestExtensions: false + TargetRubyVersion: 3.2 Gemspec/RequiredRubyVersion: Enabled: false @@ -51,3 +58,34 @@ Style/Documentation: Style/EmptyElse: EnforcedStyle: empty + +# Rails cops +Rails: + Enabled: true + +Rails/I18nLocaleTexts: + Enabled: false + +Rails/SkipsModelValidations: + Enabled: false + +# RSpec cops +RSpec: + Enabled: true + +RSpec/MultipleExpectations: + Enabled: false + +RSpec/ExampleLength: + Enabled: false + +# Performance cops +Performance: + Enabled: true + +# Thread Safety cops +ThreadSafety: + Enabled: true + +ThreadSafety/ClassAndModuleAttributes: + Enabled: false diff --git a/Gemfile b/Gemfile index 8f489d1..bed68ee 100644 --- a/Gemfile +++ b/Gemfile @@ -24,6 +24,10 @@ group :development do gem 'puma' gem 'rake' gem 'rubocop' + gem 'rubocop-performance' + gem 'rubocop-rails' + gem 'rubocop-rspec' + gem 'rubocop-thread_safety' gem 'simplecov' gem 'sprockets-rails' end diff --git a/app/assets/stylesheets/kpm/kpm.css b/app/assets/stylesheets/kpm/kpm.css index 3377040..e73b58f 100644 --- a/app/assets/stylesheets/kpm/kpm.css +++ b/app/assets/stylesheets/kpm/kpm.css @@ -41,6 +41,12 @@ /* app/views/kpm/nodes_info/_nodes_table.html.erb */ +.nodes-separator { + border: none; + border-top: 0.1875rem solid #d2d6db; + margin: 1.5rem 0; +} + .nodes-info b { font-weight: 600; font-size: 0.875rem; @@ -60,6 +66,31 @@ /* app/views/kpm/nodes_info/_official_plugins.html.erb */ +.official-plugins-data .node-group { + margin-bottom: 1.5rem; +} + +.official-plugins-data .node-group-header { + display: flex; + align-items: center; + padding: 0.5rem 0; + margin-bottom: 0.25rem; + border-bottom: 0.125rem solid #e9eaeb; +} + +.official-plugins-data .node-group-label { + font-weight: 600; + font-size: 0.875rem; + line-height: 1.25rem; + color: #414651; + text-transform: uppercase; + letter-spacing: 0.05em; +} + +.official-plugins-data .node-group .official-plugin:last-child { + border-bottom: none; +} + .official-plugins-data .official-plugin { padding: 1rem 0; display: flex; diff --git a/app/controllers/kpm/nodes_info_controller.rb b/app/controllers/kpm/nodes_info_controller.rb index 2f6b255..e4b04fe 100644 --- a/app/controllers/kpm/nodes_info_controller.rb +++ b/app/controllers/kpm/nodes_info_controller.rb @@ -8,7 +8,7 @@ class NodesInfoController < EngineController include ActionController::Live def index - @installing = !params[:i].blank? + @installing = params[:i].present? @nodes_info = ::KillBillClient::Model::NodesInfo.nodes_info(options_for_klient) diff --git a/app/views/kpm/nodes_info/_nodes_table.html.erb b/app/views/kpm/nodes_info/_nodes_table.html.erb index f805f62..f478e9b 100644 --- a/app/views/kpm/nodes_info/_nodes_table.html.erb +++ b/app/views/kpm/nodes_info/_nodes_table.html.erb @@ -1,5 +1,6 @@ <%- has_kpm_plugin = kpm_plugin_installed?(nodes_info) %> -<% nodes_info.each do |node_info| %> +<% nodes_info.each_with_index do |node_info, index| %> + <%= content_tag :hr, nil, class: 'nodes-separator' if index > 0 %>
@@ -28,5 +29,5 @@

Commons: <%= node_info.common_version %>

-
+ <% end %> diff --git a/app/views/kpm/nodes_info/_official_plugins.html.erb b/app/views/kpm/nodes_info/_official_plugins.html.erb index 0cd0379..77cf150 100644 --- a/app/views/kpm/nodes_info/_official_plugins.html.erb +++ b/app/views/kpm/nodes_info/_official_plugins.html.erb @@ -2,6 +2,10 @@ <%- has_kpm_plugin = kpm_plugin_installed?(nodes_info) %> <% nodes_info.each do |node_info| %> <% unless (node_info.plugins_info || []).empty? %> +
+
+ Node: <%= node_info.node_name %> +
<% node_info.plugins_info.each do |plugin_info| %>
@@ -51,6 +55,7 @@
<% end %> +
<% end %> <% end %> diff --git a/config/routes.rb b/config/routes.rb index 370a9f6..38e87e1 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -7,12 +7,12 @@ resources :plugins, only: [:index] scope '/nodes_info' do - match '/refresh' => 'nodes_info#refresh', :via => :get, :as => 'nodes_info_refresh' - match '/plugin/install' => 'nodes_info#install_plugin', :via => :post, :as => 'plugin_install' - match '/plugin/install_from_fs' => 'nodes_info#install_plugin_from_fs', :via => :post, :as => 'plugin_install_from_fs' - match '/plugin/uninstall' => 'nodes_info#uninstall_plugin', :via => :post, :as => 'plugin_uninstall' - match '/plugin/start' => 'nodes_info#start_plugin', :via => :post, :as => 'plugin_start' - match '/plugin/stop' => 'nodes_info#stop_plugin', :via => :post, :as => 'plugin_stop' - match '/plugin/restart' => 'nodes_info#restart_plugin', :via => :post, :as => 'plugin_restart' + get '/refresh' => 'nodes_info#refresh', :as => 'nodes_info_refresh' + post '/plugin/install' => 'nodes_info#install_plugin', :as => 'plugin_install' + post '/plugin/install_from_fs' => 'nodes_info#install_plugin_from_fs', :as => 'plugin_install_from_fs' + post '/plugin/uninstall' => 'nodes_info#uninstall_plugin', :as => 'plugin_uninstall' + post '/plugin/start' => 'nodes_info#start_plugin', :as => 'plugin_start' + post '/plugin/stop' => 'nodes_info#stop_plugin', :as => 'plugin_stop' + post '/plugin/restart' => 'nodes_info#restart_plugin', :as => 'plugin_restart' end end diff --git a/test/test_helper.rb b/test/test_helper.rb index 84def50..e26e2cf 100644 --- a/test/test_helper.rb +++ b/test/test_helper.rb @@ -11,7 +11,7 @@ Minitest.backtrace_filter = Minitest::BacktraceFilter.new # Load support files -Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].sort.each { |f| require f } +Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each { |f| require f } # Load fixtures from the engine if ActiveSupport::TestCase.respond_to?(:fixture_path=)