killbill-kpm-ui 4.0.1 → 4.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ec68f4e8f2efd24f629624d36d3cea3b4f7f1cbfbd25cfe348b00dcbf329e95c
4
- data.tar.gz: ebeceb134d5d336fefbfc8bf218b71930eaf76e0383503eb3f0170306b78d986
3
+ metadata.gz: 3058de80c2d277d18556fbcf0b361203bb65859956266cd39532e97b1d78d878
4
+ data.tar.gz: 5112d0511883b2083f3c58c435d88324718bbc776ef822757570f58dca3e52ff
5
5
  SHA512:
6
- metadata.gz: 3d63f61c68844bad706921dc7d159e17c59cf38be9567406505d4423bf517352507bee177a7ebfae26f7d31b1914a49d4e4c9819881d6de67872638879b99105
7
- data.tar.gz: 0e495fe2dcd29e93bf9eb5a81e25a7c6472afac978311eb9e6321c572b130ec614a8596bc294188fb033370e2d29267aaeca86cfafb11a99ef0940f83b14d86f
6
+ metadata.gz: '099d94f25430bce25313e8f5637882daa2990f187928ef1062c9678186ca1935b30faa9b847b01aa9780f02506f66398004af8ab3669fa2aa050d810f32635b4'
7
+ data.tar.gz: f24666f75b89b7eb8417245d9e6b3adab3d786611984851912b9351db529cd6d5c7d0c6ab0286e55db2d2b4947489becae39bd934b4a097bbe7e56ab31bdaa76
@@ -5,9 +5,29 @@ require 'kpm/client'
5
5
  module KPM
6
6
  class PluginsController < EngineController
7
7
  def index
8
- nodes_by_kb_version, @kb_version = killbill_version
8
+ nodes_by_kb_version, @kb_version, nodes_info = killbill_version
9
9
  @warning_message = ''
10
10
  @plugins = {}
11
+
12
+ @installed_plugin_keys = Set.new
13
+ # Map of installed plugin_key => highest installed version found across nodes
14
+ @installed_plugins = {}
15
+ (nodes_info || []).each do |node_info|
16
+ (node_info.plugins_info || []).each do |plugin_info|
17
+ next if plugin_info.plugin_key.nil?
18
+
19
+ @installed_plugin_keys.add(plugin_info.plugin_key)
20
+ next if plugin_info.version.nil?
21
+
22
+ current = @installed_plugins[plugin_info.plugin_key]
23
+ begin
24
+ @installed_plugins[plugin_info.plugin_key] = plugin_info.version if current.nil? || Gem::Version.new(plugin_info.version) > Gem::Version.new(current)
25
+ rescue ArgumentError
26
+ @installed_plugins[plugin_info.plugin_key] ||= plugin_info.version
27
+ end
28
+ end
29
+ end
30
+
11
31
  if !nodes_by_kb_version.nil? && nodes_by_kb_version.size > 1
12
32
  @warning_message = different_versions_warning_message(nodes_by_kb_version)
13
33
  else
@@ -35,14 +55,14 @@ module KPM
35
55
 
36
56
  def killbill_version
37
57
  nodes_info = ::KillBillClient::Model::NodesInfo.nodes_info(options_for_klient)
38
- return nil if nodes_info.blank?
58
+ return [nil, nil, []] if nodes_info.blank?
39
59
 
40
60
  first_node_version = nodes_info.first.kb_version
41
61
  nodes_by_kb_version = {}
42
62
  nodes_info.each do |node|
43
63
  nodes_by_kb_version[node.kb_version] = "#{nodes_by_kb_version[node.kb_version] || ''} #{node.node_name}"
44
64
  end
45
- [nodes_by_kb_version, first_node_version.scan(/(\d+\.\d+)(\.\d)?/).flatten[0]]
65
+ [nodes_by_kb_version, first_node_version.scan(/(\d+\.\d+)(\.\d)?/).flatten[0], nodes_info]
46
66
  end
47
67
  end
48
68
  end
@@ -12,7 +12,18 @@
12
12
  <tr>
13
13
  <td><%= name %></td>
14
14
  <td><%= version %></td>
15
- <td><%= link_to 'Install', plugin_install_path(:plugin_key => name), :method => :post, :title => 'Install' %></td>
15
+ <td>
16
+ <% if @installed_plugin_keys.include?(name) %>
17
+ <% installed_version = @installed_plugins && @installed_plugins[name] %>
18
+ <% if installed_version.present? && version.present? && Gem::Version.correct?(installed_version) && Gem::Version.new(installed_version) < Gem::Version.new(version) %>
19
+ <%= link_to 'Update', plugin_install_path(:plugin_key => name), :method => :post, :title => 'Update' %>
20
+ <% else %>
21
+ <span class="label label-success">Installed</span>
22
+ <% end %>
23
+ <% else %>
24
+ <%= link_to 'Install', plugin_install_path(:plugin_key => name), :method => :post, :title => 'Install' %>
25
+ <% end %>
26
+ </td>
16
27
  </tr>
17
28
  <% end %>
18
29
  </tbody>
data/lib/kpm/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module KPM
4
- VERSION = '4.0.1'
4
+ VERSION = '4.0.3'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: killbill-kpm-ui
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.0.1
4
+ version: 4.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kill Bill core team
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2026-02-26 00:00:00.000000000 Z
11
+ date: 2026-04-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: killbill-assets-ui