killbill-kpm-ui 1.0.1 → 1.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/controllers/kpm/plugins_controller.rb +36 -7
- data/app/views/kpm/plugins/_plugins_table.html.erb +41 -37
- data/lib/kpm/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2d36d5716f6a5803657904f97c6f2874f266af1e
|
4
|
+
data.tar.gz: 5d0eefbbfe86ed48efd6eeec07575a47de3ddad7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8164906e17512ba0fb89b4447ae929da383f276a361d1922854853871707f6332cdfd6cb4f7344d7dc67c96238efe2bec947ce961df9a43d3baec09121940b23
|
7
|
+
data.tar.gz: fbf349a46acf0eccf9386830bdc45f36df1058953875a4e271aaf4a2b27b4bfd329627d107c4b69f8d4f434fa6ccad80133aa9b137188e59d3dac04d2e9cf877
|
@@ -4,16 +4,45 @@ module KPM
|
|
4
4
|
class PluginsController < EngineController
|
5
5
|
|
6
6
|
def index
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
7
|
+
nodes_by_kb_version, @kb_version = killbill_version
|
8
|
+
@warning_message = ''
|
9
|
+
plugins = []
|
10
|
+
if nodes_by_kb_version.size > 1
|
11
|
+
@warning_message = different_versions_warning_message(nodes_by_kb_version)
|
12
|
+
else
|
13
|
+
begin
|
14
|
+
plugins = ::Killbill::KPM::KPMClient.get_available_plugins(true, options_for_klient)
|
15
|
+
rescue => e
|
16
|
+
# No connectivity, GitHub down, ...
|
17
|
+
Rails.logger.warn("Unable to get latest plugins, trying built-in directory: #{e.inspect}")
|
18
|
+
plugins = ::Killbill::KPM::KPMClient.get_available_plugins(false, options_for_klient)
|
19
|
+
end
|
20
|
+
plugins.select! { |plugin_key, info| info['versions'].keys.include?(@kb_version) }
|
13
21
|
end
|
14
|
-
|
15
22
|
@plugins = Hash[plugins.sort]
|
16
23
|
end
|
17
24
|
|
25
|
+
private
|
26
|
+
|
27
|
+
def different_versions_warning_message(nodes_by_kb_version)
|
28
|
+
message = '<b>Warning!</b> Unable to find plugins to install, different versions of Kill Bill were found:<ul>'
|
29
|
+
nodes_by_kb_version.each do |version, node_name|
|
30
|
+
message = "#{message} <li><b>#{version}:</b> #{node_name}</li>"
|
31
|
+
end
|
32
|
+
"#{message}</ul>"
|
33
|
+
end
|
34
|
+
|
35
|
+
def killbill_version
|
36
|
+
nodes_info = ::KillBillClient::Model::NodesInfo.nodes_info(options_for_klient)
|
37
|
+
return nil if nodes_info.blank?
|
38
|
+
|
39
|
+
first_node_version = nodes_info.first.kb_version
|
40
|
+
nodes_by_kb_version = {}
|
41
|
+
nodes_info.each do |node|
|
42
|
+
nodes_by_kb_version[node.kb_version] = "#{(nodes_by_kb_version[node.kb_version] || '')} #{node.node_name}"
|
43
|
+
end
|
44
|
+
[nodes_by_kb_version, first_node_version.scan(/(\d+\.\d+)(\.\d)?/).flatten[0]]
|
45
|
+
end
|
46
|
+
|
18
47
|
end
|
19
48
|
end
|
@@ -1,41 +1,45 @@
|
|
1
|
-
|
2
|
-
<
|
3
|
-
|
4
|
-
<
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
<
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
1
|
+
<% if @warning_message.blank? %>
|
2
|
+
<table id="plugins-table" class="table table-condensed table-striped mobile-data">
|
3
|
+
<thead>
|
4
|
+
<tr>
|
5
|
+
<th>Name</th>
|
6
|
+
<th>Type</th>
|
7
|
+
<th>Version</th>
|
8
|
+
<th>Required configuration</th>
|
9
|
+
<th></th>
|
10
|
+
</tr>
|
11
|
+
</thead>
|
12
|
+
<tbody>
|
13
|
+
<% plugins.each do |name, details| %>
|
14
|
+
<tr>
|
15
|
+
<td><%= name %></td>
|
16
|
+
<td><%= details['type'] %></td>
|
17
|
+
<td>
|
18
|
+
<% unless details['versions'].nil? %>
|
19
|
+
<% details['versions'].each do |kb_version, plugin_version| %>
|
20
|
+
<% if kb_version.eql?(@kb_version) %>
|
21
|
+
 <%= plugin_version %>
|
21
22
|
<% end %>
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
</table>
|
23
|
+
<% end %>
|
24
|
+
<% end %>
|
25
|
+
</td>
|
26
|
+
<td>
|
27
|
+
<% unless (details['require'] || []).empty? %>
|
28
|
+
<ul>
|
29
|
+
<% details['require'].each do |property| %>
|
30
|
+
<li><%= property %></li>
|
31
|
+
<% end %>
|
32
|
+
</ul>
|
33
|
+
<% end %>
|
34
|
+
</td>
|
35
|
+
<td><%= link_to '<i class="fa fa-cloud-download"></i>'.html_safe, plugin_install_path(:plugin_key => name), :method => :post, :title => 'Install' %></td>
|
36
|
+
</tr>
|
37
|
+
<% end %>
|
38
|
+
</tbody>
|
39
|
+
</table>
|
40
|
+
<% else %>
|
41
|
+
<div class="alert alert-warning" role="alert"><%= @warning_message.html_safe %></div>
|
42
|
+
<% end %>
|
39
43
|
|
40
44
|
<%= javascript_tag do %>
|
41
45
|
$(document).ready(function() {
|
data/lib/kpm/version.rb
CHANGED
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: 1.0.
|
4
|
+
version: 1.0.2
|
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: 2018-
|
11
|
+
date: 2018-07-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|