killbill-kpm-ui 1.0.0 → 2.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +2 -1
- data/Rakefile +3 -5
- data/app/assets/javascripts/kpm/logs_refresh.js +48 -0
- data/app/assets/stylesheets/kpm/nodes_info.css +23 -0
- data/app/controllers/kpm/engine_controller.rb +7 -7
- data/app/controllers/kpm/nodes_info_controller.rb +62 -25
- data/app/controllers/kpm/plugins_controller.rb +37 -8
- data/app/helpers/kpm/application_helper.rb +14 -0
- data/app/views/kpm/nodes_info/_logs_table.html.erb +23 -26
- data/app/views/kpm/nodes_info/_nodes_table.html.erb +9 -11
- data/app/views/kpm/nodes_info/index.html.erb +33 -30
- data/app/views/kpm/plugins/_form.html.erb +13 -13
- data/app/views/kpm/plugins/_plugins_table.html.erb +22 -38
- data/app/views/kpm/plugins/index.html.erb +1 -1
- data/config/routes.rb +5 -4
- data/lib/kpm.rb +10 -10
- data/lib/kpm/client.rb +28 -14
- data/lib/kpm/engine.rb +2 -0
- data/lib/kpm/version.rb +3 -1
- data/lib/tasks/kpm_tasks.rake +2 -0
- data/test/integration/navigation_test.rb +2 -2
- data/test/kpm_test.rb +2 -1
- data/test/test_helper.rb +7 -5
- metadata +103 -48
- data/app/views/kpm/nodes_info/index.js.erb +0 -4
- data/test/dummy/log/test.log +0 -21
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 525be1974e3fff33c6523e2042ee3c6510e40c7c
|
4
|
+
data.tar.gz: 0c8ca1aac74c3d99e1908a1b829561d96dfbf8a2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ec09d119fb4f1a3355530918236e83c32c4ed12775dc705e23888100cde1bedfeb8ac3f9ea5a64f56dd007e9bc652838fb4ea91e26d7845a2d9f62f3ee3e3d3c
|
7
|
+
data.tar.gz: 873f1e309fff26406e1022c85c23a1cf97f80e3f8dc2bf9bebfa1fabdf90645a25aa906e90c0876c812b5f20a2b02d491fcf7fa2cd3ca20337564584e91d5c35
|
data/README.md
CHANGED
data/Rakefile
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
begin
|
2
4
|
require 'bundler/setup'
|
3
5
|
rescue LoadError
|
@@ -14,14 +16,11 @@ RDoc::Task.new(:rdoc) do |rdoc|
|
|
14
16
|
rdoc.rdoc_files.include('lib/**/*.rb')
|
15
17
|
end
|
16
18
|
|
17
|
-
APP_RAKEFILE = File.expand_path(
|
19
|
+
APP_RAKEFILE = File.expand_path('test/dummy/Rakefile', __dir__)
|
18
20
|
load 'rails/tasks/engine.rake'
|
19
21
|
|
20
|
-
|
21
22
|
load 'rails/tasks/statistics.rake'
|
22
23
|
|
23
|
-
|
24
|
-
|
25
24
|
require 'bundler/gem_tasks'
|
26
25
|
|
27
26
|
require 'rake/testtask'
|
@@ -33,5 +32,4 @@ Rake::TestTask.new(:test) do |t|
|
|
33
32
|
t.verbose = false
|
34
33
|
end
|
35
34
|
|
36
|
-
|
37
35
|
task default: :test
|
@@ -0,0 +1,48 @@
|
|
1
|
+
function refreshLogLine(log) {
|
2
|
+
var table = window.logsDataTable;
|
3
|
+
if (table === null) {
|
4
|
+
return;
|
5
|
+
}
|
6
|
+
|
7
|
+
var levelLabel = 'success';
|
8
|
+
if (log['level'] === 'ERROR') {
|
9
|
+
levelLabel = 'danger';
|
10
|
+
} else if (log['level'] === 'WARNING') {
|
11
|
+
levelLabel = 'warning';
|
12
|
+
}
|
13
|
+
|
14
|
+
var newDate = new Date();
|
15
|
+
newDate.setTime(log['time']);
|
16
|
+
var newRow = $('<tr>')
|
17
|
+
.append($('<td>').text(newDate.toISOString()))
|
18
|
+
.append($('<td>')
|
19
|
+
.append($('<span>')
|
20
|
+
.attr('class', 'label label-' + levelLabel)
|
21
|
+
.text(log['level'])
|
22
|
+
)
|
23
|
+
)
|
24
|
+
.append($('<td>')
|
25
|
+
.append($('<pre>')
|
26
|
+
.text(log['message'])
|
27
|
+
)
|
28
|
+
);
|
29
|
+
|
30
|
+
// Enforce ordering on refresh to remove oldest entry (expected at the bottom)
|
31
|
+
table.order([0, 'desc']).draw();
|
32
|
+
|
33
|
+
// length needs to match pageLength in initializer
|
34
|
+
if (table.column(0).data().length >= 100) {
|
35
|
+
table.row($('tr:last')).remove();
|
36
|
+
}
|
37
|
+
|
38
|
+
table.rows.add(newRow).draw();
|
39
|
+
}
|
40
|
+
|
41
|
+
function refreshLogs(url) {
|
42
|
+
var source = new EventSource(url);
|
43
|
+
source.addEventListener('refresh', function (e) {
|
44
|
+
if (e['data'] !== 'heartbeat') {
|
45
|
+
refreshLogLine(JSON.parse(e.data));
|
46
|
+
}
|
47
|
+
});
|
48
|
+
}
|
@@ -0,0 +1,23 @@
|
|
1
|
+
#nodes-table th:first-of-type,
|
2
|
+
#nodes-table td:first-of-type,
|
3
|
+
#logs-table th:first-of-type,
|
4
|
+
#logs-table td:first-of-type {
|
5
|
+
padding-left: 8px;
|
6
|
+
}
|
7
|
+
|
8
|
+
#nodes-table ul {
|
9
|
+
list-style-type: none;
|
10
|
+
margin: 0;
|
11
|
+
padding: 0;
|
12
|
+
}
|
13
|
+
|
14
|
+
#logs-table pre {
|
15
|
+
white-space: pre-wrap; /* css-3 */
|
16
|
+
white-space: -moz-pre-wrap; /* Mozilla, since 1999 */
|
17
|
+
white-space: -o-pre-wrap; /* Opera 7 */
|
18
|
+
word-wrap: break-word; /* Internet Explorer 5.5+ */
|
19
|
+
}
|
20
|
+
|
21
|
+
#logs-form {
|
22
|
+
margin-bottom: 15px;
|
23
|
+
}
|
@@ -1,6 +1,7 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module KPM
|
2
4
|
class EngineController < ApplicationController
|
3
|
-
|
4
5
|
layout :get_layout
|
5
6
|
|
6
7
|
def get_layout
|
@@ -17,13 +18,12 @@ module KPM
|
|
17
18
|
def options_for_klient
|
18
19
|
user = current_tenant_user
|
19
20
|
{
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
21
|
+
:username => user[:username],
|
22
|
+
:password => user[:password],
|
23
|
+
:session_id => user[:session_id],
|
24
|
+
:api_key => user[:api_key],
|
25
|
+
:api_secret => user[:api_secret]
|
25
26
|
}
|
26
27
|
end
|
27
|
-
|
28
28
|
end
|
29
29
|
end
|
@@ -1,14 +1,21 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'kpm/client'
|
2
4
|
|
3
5
|
module KPM
|
4
6
|
class NodesInfoController < EngineController
|
7
|
+
helper :all
|
8
|
+
include ActionController::Live
|
5
9
|
|
6
10
|
def index
|
11
|
+
@installing = !params[:i].blank?
|
12
|
+
|
7
13
|
@nodes_info = ::KillBillClient::Model::NodesInfo.nodes_info(options_for_klient)
|
8
14
|
|
9
15
|
# For convenience, put pure OSGI bundles at the bottom
|
10
16
|
@nodes_info.each do |node_info|
|
11
17
|
next if node_info.plugins_info.nil?
|
18
|
+
|
12
19
|
node_info.plugins_info.sort! do |a, b|
|
13
20
|
if osgi_bundle?(a) && !osgi_bundle?(b)
|
14
21
|
1
|
@@ -20,32 +27,58 @@ module KPM
|
|
20
27
|
end
|
21
28
|
end
|
22
29
|
|
23
|
-
@
|
30
|
+
@kb_host = params[:kb_host] || KillBillClient::API.base_uri
|
31
|
+
@last_event_id = params[:last_event_id]
|
32
|
+
end
|
24
33
|
|
25
|
-
|
26
|
-
|
27
|
-
|
34
|
+
def refresh
|
35
|
+
response.headers['Content-Type'] = 'text/event-stream'
|
36
|
+
|
37
|
+
last_event_id_ref = Concurrent::AtomicReference.new(request.headers['Last-Event-Id'] || params[:last_event_id])
|
38
|
+
sse = nil
|
39
|
+
sse_client = nil
|
40
|
+
begin
|
41
|
+
# Kaui -> Browser
|
42
|
+
sse = ActionController::Live::SSE.new(response.stream, retry: 300, event: 'refresh')
|
43
|
+
|
44
|
+
# Kill Bill -> Kaui
|
45
|
+
sse_client = ::Killbill::KPM::KPMClient.stream_osgi_logs(sse, params[:kb_host], last_event_id_ref)
|
46
|
+
|
47
|
+
i = 0
|
48
|
+
# We force the browser to reconnect periodically (ensures clients don't block the server shutdown sequence)
|
49
|
+
while i < 6 # 30s
|
50
|
+
i += 1
|
51
|
+
# Keep the thread alive (Kill Bill should send us a heartbeat as well though)
|
52
|
+
# Note that we set the id as the last log id, so that we can easily resume
|
53
|
+
sse.write('heartbeat', id: last_event_id_ref.get)
|
54
|
+
sleep 5
|
55
|
+
end
|
56
|
+
rescue ActionController::Live::ClientDisconnected
|
57
|
+
# ignored
|
58
|
+
ensure
|
59
|
+
begin
|
60
|
+
begin
|
61
|
+
sse_client&.close
|
62
|
+
rescue StandardError
|
63
|
+
# ignored
|
64
|
+
end
|
65
|
+
sse&.close
|
66
|
+
ensure
|
67
|
+
# Clear dead DB connections
|
68
|
+
# Very lame, but I couldn't do better... Rails will checkout a DB connection
|
69
|
+
# whenever a new Thread is spawn and ActiveRecord::Base.clear_active_connections!
|
70
|
+
# didn't seem to do the trick: the number of active and dead connections kept growing:
|
71
|
+
# connections = ActiveRecord::Base.connection_pool.instance_eval { @connections }
|
72
|
+
# busy = connections.count { |c| c.in_use? }
|
73
|
+
# dead = connections.count { |c| c.in_use? && !c.owner.alive? }
|
74
|
+
ActiveRecord::Base.connection_pool.reap
|
75
|
+
end
|
28
76
|
end
|
29
77
|
end
|
30
78
|
|
31
79
|
def install_plugin
|
32
|
-
|
33
|
-
|
34
|
-
]
|
35
|
-
trigger_node_plugin_command('INSTALL_PLUGIN', command_properties)
|
36
|
-
|
37
|
-
redirect_to :action => :index
|
38
|
-
end
|
39
|
-
|
40
|
-
def install_plugin_from_fs
|
41
|
-
::Killbill::KPM::KPMClient.install_plugin(params.require(:key),
|
42
|
-
params.require(:version),
|
43
|
-
params.require(:type),
|
44
|
-
params.require(:plugin).original_filename,
|
45
|
-
params.require(:plugin).read,
|
46
|
-
options_for_klient)
|
47
|
-
|
48
|
-
redirect_to :action => :index
|
80
|
+
trigger_node_plugin_command('INSTALL_PLUGIN')
|
81
|
+
redirect_to nodes_info_index_path(i: 1)
|
49
82
|
end
|
50
83
|
|
51
84
|
def uninstall_plugin
|
@@ -70,21 +103,25 @@ module KPM
|
|
70
103
|
|
71
104
|
private
|
72
105
|
|
73
|
-
def trigger_node_plugin_command(command_type, command_properties=[])
|
106
|
+
def trigger_node_plugin_command(command_type, command_properties = [])
|
107
|
+
# No need to pass kbVersion -- Kill Bill will figure it out
|
74
108
|
command_properties << build_node_command_property('pluginKey', params[:plugin_key])
|
75
109
|
command_properties << build_node_command_property('pluginName', params[:plugin_name])
|
76
110
|
command_properties << build_node_command_property('pluginVersion', params[:plugin_version])
|
111
|
+
command_properties << build_node_command_property('pluginType', params[:plugin_type])
|
112
|
+
command_properties << build_node_command_property('pluginUri', params[:plugin_uri])
|
113
|
+
command_properties << build_node_command_property('forceDownload', params[:force_download] == '1')
|
77
114
|
|
78
115
|
trigger_node_command(command_type, command_properties)
|
79
116
|
end
|
80
117
|
|
81
|
-
def trigger_node_command(command_type, command_properties=[])
|
118
|
+
def trigger_node_command(command_type, command_properties = [])
|
82
119
|
node_command = ::KillBillClient::Model::NodeCommandAttributes.new
|
83
|
-
node_command.
|
120
|
+
node_command.is_system_command_type = true
|
84
121
|
node_command.node_command_type = command_type
|
85
122
|
node_command.node_command_properties = command_properties
|
86
123
|
|
87
|
-
# TODO Can we actually use node_name?
|
124
|
+
# TODO: Can we actually use node_name?
|
88
125
|
local_node_only = false
|
89
126
|
|
90
127
|
::KillBillClient::Model::NodesInfo.trigger_node_command(node_command,
|
@@ -1,19 +1,48 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'kpm/client'
|
2
4
|
|
3
5
|
module KPM
|
4
6
|
class PluginsController < EngineController
|
5
|
-
|
6
7
|
def index
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
8
|
+
nodes_by_kb_version, @kb_version = killbill_version
|
9
|
+
@warning_message = ''
|
10
|
+
@plugins = {}
|
11
|
+
if !nodes_by_kb_version.nil? && nodes_by_kb_version.size > 1
|
12
|
+
@warning_message = different_versions_warning_message(nodes_by_kb_version)
|
13
|
+
else
|
14
|
+
full_kb_version = nodes_by_kb_version.nil? ? 'LATEST' : nodes_by_kb_version.keys.first
|
15
|
+
begin
|
16
|
+
plugins_metadata = ::Killbill::KPM::KPMClient.get_available_plugins(full_kb_version, true, options_for_klient)
|
17
|
+
rescue StandardError => e
|
18
|
+
# No connectivity or version not in Nexus
|
19
|
+
Rails.logger.warn("Unable to get latest plugins for version #{full_kb_version}: #{e.inspect}")
|
20
|
+
plugins_metadata = ::Killbill::KPM::KPMClient.get_available_plugins('LATEST', false, options_for_klient)
|
21
|
+
end
|
22
|
+
@plugins = Hash[plugins_metadata['plugins'].sort]
|
13
23
|
end
|
24
|
+
end
|
25
|
+
|
26
|
+
private
|
14
27
|
|
15
|
-
|
28
|
+
def different_versions_warning_message(nodes_by_kb_version)
|
29
|
+
message = '<b>Warning!</b> Unable to find plugins to install, different versions of Kill Bill were found:<ul>'
|
30
|
+
nodes_by_kb_version.each do |version, node_name|
|
31
|
+
message = "#{message} <li><b>#{version}:</b> #{node_name}</li>"
|
32
|
+
end
|
33
|
+
"#{message}</ul>"
|
16
34
|
end
|
17
35
|
|
36
|
+
def killbill_version
|
37
|
+
nodes_info = ::KillBillClient::Model::NodesInfo.nodes_info(options_for_klient)
|
38
|
+
return nil if nodes_info.blank?
|
39
|
+
|
40
|
+
first_node_version = nodes_info.first.kb_version
|
41
|
+
nodes_by_kb_version = {}
|
42
|
+
nodes_info.each do |node|
|
43
|
+
nodes_by_kb_version[node.kb_version] = "#{(nodes_by_kb_version[node.kb_version] || '')} #{node.node_name}"
|
44
|
+
end
|
45
|
+
[nodes_by_kb_version, first_node_version.scan(/(\d+\.\d+)(\.\d)?/).flatten[0]]
|
46
|
+
end
|
18
47
|
end
|
19
48
|
end
|
@@ -1,4 +1,18 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module KPM
|
2
4
|
module ApplicationHelper
|
5
|
+
# Return true if the KPM plugin is on at least one node
|
6
|
+
# (INSTALL_PLUGIN and UNINSTALL_PLUGIN are handled by KPM plugin, not by the core)
|
7
|
+
def kpm_plugin_installed?(nodes_info)
|
8
|
+
nodes_info.each do |node_info|
|
9
|
+
next if (node_info.plugins_info || []).empty?
|
10
|
+
|
11
|
+
node_info.plugins_info.each do |plugin_info|
|
12
|
+
return true if plugin_info.plugin_name == 'org.kill-bill.billing.killbill-platform-osgi-bundles-kpm'
|
13
|
+
end
|
14
|
+
end
|
15
|
+
false
|
16
|
+
end
|
3
17
|
end
|
4
18
|
end
|
@@ -2,42 +2,39 @@
|
|
2
2
|
<thead>
|
3
3
|
<tr>
|
4
4
|
<th>Time</th>
|
5
|
-
<th>Name</th>
|
6
5
|
<th>Level</th>
|
7
6
|
<th>Message</th>
|
8
7
|
</tr>
|
9
8
|
</thead>
|
10
9
|
<tbody>
|
11
|
-
<% logs.each do |log| %>
|
12
|
-
<tr>
|
13
|
-
<td>
|
14
|
-
<% unless log['time'].blank? %>
|
15
|
-
<%= DateTime.strptime(log['time'].to_s, '%Q').strftime('%Y-%m-%d %H:%M:%S') %>
|
16
|
-
<% end %>
|
17
|
-
</td>
|
18
|
-
<td><%= log['name'] %></td>
|
19
|
-
<td>
|
20
|
-
<% if log['level'] == 'ERROR' %>
|
21
|
-
<span class="label label-danger"><%= log['level'] %></span>
|
22
|
-
<% elsif log['level'] == 'WARNING' %>
|
23
|
-
<span class="label label-warning"><%= log['level'] %></span>
|
24
|
-
<% else %>
|
25
|
-
<span class="label label-success"><%= log['level'] %></span>
|
26
|
-
<% end %>
|
27
|
-
</td>
|
28
|
-
<td><pre><%= log['message'] %></pre></td>
|
29
|
-
</tr>
|
30
|
-
<% end %>
|
31
10
|
</tbody>
|
32
11
|
</table>
|
33
12
|
|
13
|
+
<%= form_tag url_for, :method => 'get', :format => :js, :id => 'kb_host-form', :class => 'form-horizontal', :style => 'display: none;' do %>
|
14
|
+
<div id="logs-form">
|
15
|
+
<div class="form-inline">
|
16
|
+
<%= text_field_tag :kb_host, kb_host, :class => 'form-control' %>
|
17
|
+
<%= button_tag '', :type => 'submit', :class => 'glyphicon glyphicon-search' %>
|
18
|
+
</div>
|
19
|
+
</div>
|
20
|
+
<% end %>
|
21
|
+
|
34
22
|
<%= javascript_tag do %>
|
35
23
|
$(document).ready(function() {
|
36
|
-
$('#logs-table').
|
37
|
-
"
|
38
|
-
|
39
|
-
|
40
|
-
|
24
|
+
window.logsDataTable = $('#logs-table').DataTable({
|
25
|
+
"columns": [
|
26
|
+
{ "width": "165px" }, /* ISO String is constant in width */
|
27
|
+
{ "width": "60px" }, /* Log levels are bounded in width */
|
28
|
+
null,
|
29
|
+
],
|
30
|
+
"dom": "<'row'<'col-md-6'><'col-md-6'f>>t<'row'<'col-md-6'><'col-md-6'>>",
|
31
|
+
"ordering": true,
|
32
|
+
"pageLength": 100
|
41
33
|
});
|
34
|
+
|
35
|
+
var kbHostForm = $('#kb_host-form').detach();
|
36
|
+
var leftOfSearchBox = $("#logs-table_wrapper > div:nth-child(1) > div:nth-child(1)");
|
37
|
+
kbHostForm.appendTo(leftOfSearchBox);
|
38
|
+
kbHostForm.show();
|
42
39
|
});
|
43
40
|
<% end %>
|
@@ -1,26 +1,21 @@
|
|
1
1
|
<table id="nodes-table" class="table table-condensed table-striped mobile-data">
|
2
2
|
<thead>
|
3
3
|
<tr>
|
4
|
-
<th>Node
|
5
|
-
<th>
|
6
|
-
<th>Updated date</th>
|
4
|
+
<th>Node</th>
|
5
|
+
<th>Uptime</th>
|
7
6
|
<th>Kill Bill version</th>
|
8
7
|
<th>Dependencies</th>
|
9
8
|
<th>Plugins</th>
|
10
9
|
</tr>
|
11
10
|
</thead>
|
12
11
|
<tbody>
|
12
|
+
<%- has_kpm_plugin = kpm_plugin_installed?(nodes_info) %>
|
13
13
|
<% nodes_info.each do |node_info| %>
|
14
14
|
<tr>
|
15
15
|
<td><%= node_info.node_name %></td>
|
16
16
|
<td>
|
17
17
|
<% unless node_info.boot_time.blank? %>
|
18
|
-
<%= time_ago_in_words(DateTime.parse(node_info.boot_time)) %>
|
19
|
-
<% end %>
|
20
|
-
</td>
|
21
|
-
<td>
|
22
|
-
<% unless node_info.last_updated_date.blank? %>
|
23
|
-
<%= time_ago_in_words(DateTime.parse(node_info.last_updated_date)) %> ago
|
18
|
+
<%= time_ago_in_words(DateTime.parse(node_info.boot_time)) %>
|
24
19
|
<% end %>
|
25
20
|
</td>
|
26
21
|
<td><%= node_info.kb_version %></td>
|
@@ -39,12 +34,15 @@
|
|
39
34
|
<li>
|
40
35
|
<%= plugin_info.plugin_name %> <%= plugin_info.version %> <span class="label label-<%= plugin_info.state == 'RUNNING' ? 'success' : (plugin_info.state == 'INSTALLED' ? 'warning' : 'danger') %>"><%= plugin_info.state %></span>
|
41
36
|
<% if plugin_info.state == 'RUNNING' %>
|
37
|
+
<%-# If there is not plugin_key, this is most likely a pure OSGI bundle. In that case, we don't want to allow stopping it as we would lose track of it (once it's removed from the OSGI bundle registry, we don't know about it anymore) -%>
|
38
|
+
<% unless plugin_info.plugin_key.nil? %>
|
42
39
|
<%= link_to '<i class="fa fa-pause"></i>'.html_safe, plugin_stop_path(:plugin_key => plugin_info.plugin_key, :plugin_name => plugin_info.plugin_name, :plugin_version => plugin_info.version), :method => :post, :title => 'Stop', :remote => true, :class => 'plugin-link' %>
|
43
|
-
|
40
|
+
<% end %>
|
41
|
+
<%= link_to '<i class="fa fa-refresh"></i>'.html_safe, plugin_restart_path(:plugin_key => plugin_info.plugin_key, :plugin_name => plugin_info.plugin_name, :plugin_version => plugin_info.version), :method => :post, :title => 'Restart', :remote => true, :class => 'plugin-link' %>
|
44
42
|
<% elsif plugin_info.state == 'INSTALLED' || plugin_info.state == 'STOPPED' %>
|
45
43
|
<%= link_to '<i class="fa fa-play"></i>'.html_safe, plugin_start_path(:plugin_key => plugin_info.plugin_key, :plugin_name => plugin_info.plugin_name, :plugin_version => plugin_info.version), :method => :post, :title => 'Start', :remote => true, :class => 'plugin-link' %>
|
46
44
|
<% end %>
|
47
|
-
<%
|
45
|
+
<% if !plugin_info.version.nil? && has_kpm_plugin %>
|
48
46
|
<%= link_to '<i class="fa fa-eject"></i>'.html_safe, plugin_uninstall_path(:plugin_key => plugin_info.plugin_key, :plugin_name => plugin_info.plugin_name, :plugin_version => plugin_info.version), :method => :post, :title => 'Uninstall', :remote => true, :class => 'plugin-link' %>
|
49
47
|
<% end %>
|
50
48
|
</li>
|
@@ -2,7 +2,15 @@
|
|
2
2
|
|
3
3
|
<div class="column-block">
|
4
4
|
|
5
|
-
<h1>Configured instances
|
5
|
+
<h1>Configured instances
|
6
|
+
<div id="install-in-progress" class="btn btn-xs text-success" style="display: none;"><i class="fa fa-refresh"></i> Operation in progress</div>
|
7
|
+
<%= link_to('<i class="fa fa-refresh"></i> Operation complete, reload page'.html_safe, url_for, :id => "reload-page", :class => 'btn btn-xs text-success', :style => "display: none;") %>
|
8
|
+
<% if kpm_plugin_installed?(@nodes_info) %>
|
9
|
+
<div class="pull-right">
|
10
|
+
<%= link_to 'Install new plugin', plugins_path %>
|
11
|
+
</div>
|
12
|
+
<% end %>
|
13
|
+
</h1>
|
6
14
|
|
7
15
|
<div id="nodes-table-wrapper">
|
8
16
|
<%= render :partial => 'kpm/nodes_info/nodes_table', :locals => {:nodes_info => @nodes_info} %>
|
@@ -10,41 +18,22 @@
|
|
10
18
|
|
11
19
|
</div>
|
12
20
|
|
13
|
-
<div class="column-block">
|
14
|
-
|
15
|
-
<h1><%= link_to 'Install new plugin', plugins_path %></h1>
|
16
|
-
|
17
|
-
</div>
|
18
|
-
|
19
21
|
<div class="column-block">
|
20
22
|
|
21
23
|
<h1>Logs</h1>
|
22
24
|
|
23
25
|
<div id="logs-table-wrapper">
|
24
|
-
<%= render :partial => 'kpm/nodes_info/logs_table', :locals => {:
|
26
|
+
<%= render :partial => 'kpm/nodes_info/logs_table', :locals => {:kb_host => @kb_host} %>
|
25
27
|
</div>
|
26
28
|
|
27
29
|
</div>
|
28
|
-
|
29
30
|
</div>
|
30
31
|
|
31
32
|
<%= javascript_tag do %>
|
32
33
|
$(document).ready(function() {
|
33
|
-
|
34
|
-
});
|
35
|
-
|
36
|
-
function scheduleRefresh() {
|
37
|
-
var timer = setTimeout(refreshAll, 1500);
|
38
|
-
|
39
|
-
// Stop refreshing when user clicks through logs
|
40
|
-
$('#logs-table_wrapper a').one('click', function() {
|
41
|
-
clearTimeout(timer);
|
42
|
-
});
|
34
|
+
refreshLogs('<%= nodes_info_refresh_path(:kb_host => @kb_host, :last_event_id => @last_event_id, :format => :js) %>');
|
43
35
|
|
44
36
|
$('.plugin-link').one('ajax:beforeSend', function() {
|
45
|
-
// Disable the refresh
|
46
|
-
clearTimeout(timer);
|
47
|
-
|
48
37
|
// Prevent other clicks
|
49
38
|
$('.plugin-link').removeAttr('data-remote')
|
50
39
|
.removeAttr('data-method')
|
@@ -53,16 +42,30 @@
|
|
53
42
|
// Spin
|
54
43
|
$(this).children().addClass('fa-spin');
|
55
44
|
});
|
56
|
-
|
57
45
|
$('.plugin-link').one('ajax:complete', function() {
|
58
46
|
// Delay a bit, to give time for the plugin state to change before the next refresh
|
59
|
-
setTimeout(
|
47
|
+
setTimeout(fakeOperationComplete, 6000);
|
60
48
|
});
|
61
|
-
}
|
62
49
|
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
50
|
+
<%- if @installing %>
|
51
|
+
// Prevent other clicks
|
52
|
+
$('.plugin-link').removeAttr('data-remote')
|
53
|
+
.removeAttr('data-method')
|
54
|
+
.removeAttr('href')
|
55
|
+
$('#nodes-table-wrapper').css({ opacity: 0.5 });
|
56
|
+
|
57
|
+
$('#install-in-progress').show();
|
58
|
+
$('#install-in-progress').children().addClass('fa-spin');
|
59
|
+
|
60
|
+
setTimeout(fakeOperationComplete, 6000);
|
61
|
+
<% end %>
|
62
|
+
|
63
|
+
function fakeOperationComplete() {
|
64
|
+
$('#install-in-progress').hide();
|
65
|
+
|
66
|
+
$('.plugin-link').children().removeClass('fa-spin');
|
67
|
+
$('#nodes-table-wrapper').fadeTo("slow", 0.5);
|
68
|
+
$('#reload-page').fadeIn("slow");
|
69
|
+
}
|
70
|
+
});
|
68
71
|
<% end %>
|
@@ -1,34 +1,34 @@
|
|
1
|
-
<%= form_tag
|
1
|
+
<%= form_tag plugin_install_path, :class => 'form-horizontal' do %>
|
2
2
|
<div class="form-group">
|
3
|
-
<%= label_tag :
|
3
|
+
<%= label_tag :plugin_key, 'Plugin key', :class => 'col-sm-2 control-label' %>
|
4
4
|
<div class="col-sm-9">
|
5
|
-
<%= text_field_tag :
|
5
|
+
<%= text_field_tag :plugin_key, '', :class => 'form-control', :placeholder => 'Unique identifier for this plugin, e.g. myCompany:myPluginName', :required => true %>
|
6
6
|
</div>
|
7
7
|
</div>
|
8
8
|
<div class="form-group">
|
9
|
-
<%= label_tag :
|
9
|
+
<%= label_tag :plugin_version, 'Version', :class => 'col-sm-2 control-label' %>
|
10
10
|
<div class="col-sm-9">
|
11
|
-
<%= text_field_tag :
|
11
|
+
<%= text_field_tag :plugin_version, '', :class => 'form-control', :placeholder => 'Plugin version', :required => true %>
|
12
|
+
</div>
|
13
|
+
</div>
|
14
|
+
<div class="form-group">
|
15
|
+
<%= label_tag :plugin_uri, 'URI', :class => 'col-sm-2 control-label' %>
|
16
|
+
<div class="col-sm-9">
|
17
|
+
<%= text_field_tag :plugin_uri, '', :class => 'form-control', :placeholder => 'HTTP(S) url accessible from all Kill Bill nodes', :required => true %>
|
12
18
|
</div>
|
13
19
|
</div>
|
14
20
|
<div class='form-group'>
|
15
21
|
<div class="col-sm-offset-2 col-sm-10">
|
16
22
|
<% %w(java ruby).each do |type| %>
|
17
23
|
<div class="checkbox">
|
18
|
-
<%= label_tag :
|
19
|
-
<%= radio_button_tag :
|
24
|
+
<%= label_tag :plugin_type do %>
|
25
|
+
<%= radio_button_tag :plugin_type, type, (type == 'java') %>
|
20
26
|
<%= type %>
|
21
27
|
<% end %>
|
22
28
|
</div>
|
23
29
|
<% end %>
|
24
30
|
</div>
|
25
31
|
</div>
|
26
|
-
<div class="form-group">
|
27
|
-
<%= label_tag :plugin, 'Plugin', :class => 'col-sm-2 control-label' %>
|
28
|
-
<div class="col-sm-10">
|
29
|
-
<%= file_field_tag 'plugin', :class => 'form-control' %>
|
30
|
-
</div>
|
31
|
-
</div>
|
32
32
|
<div class="form-group">
|
33
33
|
<div class="col-sm-offset-2 col-sm-10">
|
34
34
|
<%= submit_tag 'Install', :class => 'btn btn-default' %>
|
@@ -1,41 +1,25 @@
|
|
1
|
-
|
2
|
-
<
|
3
|
-
|
4
|
-
<
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
<% end %>
|
24
|
-
</td>
|
25
|
-
<td>
|
26
|
-
<% unless (details['require'] || []).empty? %>
|
27
|
-
<ul>
|
28
|
-
<% details['require'].each do |property| %>
|
29
|
-
<li><%= property %></li>
|
30
|
-
<% end %>
|
31
|
-
</ul>
|
32
|
-
<% end %>
|
33
|
-
</td>
|
34
|
-
<td><%= link_to '<i class="fa fa-cloud-download"></i>'.html_safe, plugin_install_path(:plugin_key => name), :method => :post, :title => 'Install' %></td>
|
35
|
-
</tr>
|
36
|
-
<% end %>
|
37
|
-
</tbody>
|
38
|
-
</table>
|
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>Version</th>
|
7
|
+
<th></th>
|
8
|
+
</tr>
|
9
|
+
</thead>
|
10
|
+
<tbody>
|
11
|
+
<% plugins.each do |name, version| %>
|
12
|
+
<tr>
|
13
|
+
<td><%= name %></td>
|
14
|
+
<td><%= version %></td>
|
15
|
+
<td><%= link_to '<i class="fa fa-cloud-download"></i>'.html_safe, plugin_install_path(:plugin_key => name), :method => :post, :title => 'Install' %></td>
|
16
|
+
</tr>
|
17
|
+
<% end %>
|
18
|
+
</tbody>
|
19
|
+
</table>
|
20
|
+
<% else %>
|
21
|
+
<div class="alert alert-warning" role="alert"><%= @warning_message.html_safe %></div>
|
22
|
+
<% end %>
|
39
23
|
|
40
24
|
<%= javascript_tag do %>
|
41
25
|
$(document).ready(function() {
|
data/config/routes.rb
CHANGED
@@ -1,11 +1,13 @@
|
|
1
|
-
|
1
|
+
# frozen_string_literal: true
|
2
2
|
|
3
|
+
KPM::Engine.routes.draw do
|
3
4
|
root to: 'nodes_info#index'
|
4
5
|
|
5
|
-
resources :nodes_info, :
|
6
|
-
resources :plugins, :
|
6
|
+
resources :nodes_info, only: [:index]
|
7
|
+
resources :plugins, only: [:index]
|
7
8
|
|
8
9
|
scope '/nodes_info' do
|
10
|
+
match '/refresh' => 'nodes_info#refresh', :via => :get, :as => 'nodes_info_refresh'
|
9
11
|
match '/plugin/install' => 'nodes_info#install_plugin', :via => :post, :as => 'plugin_install'
|
10
12
|
match '/plugin/install_from_fs' => 'nodes_info#install_plugin_from_fs', :via => :post, :as => 'plugin_install_from_fs'
|
11
13
|
match '/plugin/uninstall' => 'nodes_info#uninstall_plugin', :via => :post, :as => 'plugin_uninstall'
|
@@ -13,5 +15,4 @@ KPM::Engine.routes.draw do
|
|
13
15
|
match '/plugin/stop' => 'nodes_info#stop_plugin', :via => :post, :as => 'plugin_stop'
|
14
16
|
match '/plugin/restart' => 'nodes_info#restart_plugin', :via => :post, :as => 'plugin_restart'
|
15
17
|
end
|
16
|
-
|
17
18
|
end
|
data/lib/kpm.rb
CHANGED
@@ -1,24 +1,24 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'kpm/engine'
|
2
4
|
|
3
5
|
module KPM
|
4
|
-
|
5
6
|
mattr_accessor :current_tenant_user
|
6
7
|
mattr_accessor :layout
|
7
8
|
|
8
|
-
self.current_tenant_user = lambda { |
|
9
|
+
self.current_tenant_user = lambda { |_session, _user|
|
9
10
|
{
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
11
|
+
username: 'admin',
|
12
|
+
password: 'password',
|
13
|
+
session_id: nil,
|
14
|
+
api_key: KillBillClient.api_key,
|
15
|
+
api_secret: KillBillClient.api_secret
|
15
16
|
}
|
16
17
|
}
|
17
18
|
|
18
|
-
def self.config
|
19
|
+
def self.config
|
19
20
|
{
|
20
|
-
|
21
|
+
layout: layout || 'kpm/layouts/kpm_application'
|
21
22
|
}
|
22
23
|
end
|
23
|
-
|
24
24
|
end
|
data/lib/kpm/client.rb
CHANGED
@@ -1,31 +1,45 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'ld-eventsource'
|
4
|
+
|
1
5
|
module Killbill
|
2
6
|
module KPM
|
3
|
-
|
4
7
|
class KPMClient < KillBillClient::Model::Resource
|
5
|
-
|
6
8
|
KILLBILL_KPM_PREFIX = '/plugins/killbill-kpm'
|
7
9
|
KILLBILL_OSGI_LOGGER_PREFIX = '/plugins/killbill-osgi-logger'
|
8
10
|
|
9
11
|
class << self
|
12
|
+
def get_available_plugins(kb_version_maybe_snapshot, latest = true, options = {})
|
13
|
+
# Mostly useful for Kill Bill developers: get the latest version before the current snapshot
|
14
|
+
# (we rarely deploy SNAPSHOT jars)
|
15
|
+
captures = kb_version_maybe_snapshot.scan(/0.(\d+)(\.)?(\d+)?(-SNAPSHOT)?/)
|
16
|
+
# [["20", ".", "1", "-SNAPSHOT"]]
|
17
|
+
kb_version = if !captures.nil? && !captures.first.nil? && !captures.first[3].nil?
|
18
|
+
if captures.first[2].to_i.positive?
|
19
|
+
'0.' + captures.first[0] + '.' + (captures.first[2].to_i - 1).to_s
|
20
|
+
else
|
21
|
+
'0.' + (captures.first[0].to_i - 1).to_s + '.0'
|
22
|
+
end
|
23
|
+
else
|
24
|
+
kb_version_maybe_snapshot
|
25
|
+
end
|
10
26
|
|
11
|
-
def get_available_plugins(latest=true, options = {})
|
12
27
|
path = "#{KILLBILL_KPM_PREFIX}/plugins"
|
13
|
-
response = KillBillClient::API.get path, { :
|
14
|
-
JSON.parse(response.body)
|
15
|
-
end
|
16
|
-
|
17
|
-
def get_osgi_logs(options = {})
|
18
|
-
response = KillBillClient::API.get KILLBILL_OSGI_LOGGER_PREFIX, {}, options
|
28
|
+
response = KillBillClient::API.get path, { kbVersion: kb_version, latest: latest }, options
|
19
29
|
JSON.parse(response.body)
|
20
30
|
end
|
21
31
|
|
22
|
-
def
|
23
|
-
|
24
|
-
|
32
|
+
def stream_osgi_logs(writer, host, last_event_id_ref)
|
33
|
+
url = host
|
34
|
+
url = "http://#{url}" unless url.starts_with?('http:')
|
35
|
+
SSE::Client.new(url + KILLBILL_OSGI_LOGGER_PREFIX, last_event_id: last_event_id_ref.get, logger: Rails.logger) do |client|
|
36
|
+
client.on_event do |event|
|
37
|
+
writer.write(event.data, id: event.id)
|
38
|
+
last_event_id_ref.set(event.id)
|
39
|
+
end
|
40
|
+
end
|
25
41
|
end
|
26
42
|
end
|
27
|
-
|
28
43
|
end
|
29
|
-
|
30
44
|
end
|
31
45
|
end
|
data/lib/kpm/engine.rb
CHANGED
data/lib/kpm/version.rb
CHANGED
data/lib/tasks/kpm_tasks.rake
CHANGED
@@ -1,7 +1,8 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'test_helper'
|
2
4
|
|
3
5
|
class NavigationTest < ActionDispatch::IntegrationTest
|
4
|
-
|
5
6
|
include KPM::Engine.routes.url_helpers
|
6
7
|
|
7
8
|
test 'can see the nodes info page' do
|
@@ -14,4 +15,3 @@ class NavigationTest < ActionDispatch::IntegrationTest
|
|
14
15
|
assert_response :success
|
15
16
|
end
|
16
17
|
end
|
17
|
-
|
data/test/kpm_test.rb
CHANGED
data/test/test_helper.rb
CHANGED
@@ -1,19 +1,21 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
# Configure Rails Environment
|
2
|
-
ENV[
|
4
|
+
ENV['RAILS_ENV'] = 'test'
|
3
5
|
|
4
|
-
require File.expand_path(
|
5
|
-
require
|
6
|
+
require File.expand_path('../test/dummy/config/environment.rb', __dir__)
|
7
|
+
require 'rails/test_help'
|
6
8
|
|
7
9
|
# Filter out Minitest backtrace while allowing backtrace from other libraries
|
8
10
|
# to be shown.
|
9
11
|
Minitest.backtrace_filter = Minitest::BacktraceFilter.new
|
10
12
|
|
11
13
|
# Load support files
|
12
|
-
Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each { |f| require f }
|
14
|
+
Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].sort.each { |f| require f }
|
13
15
|
|
14
16
|
# Load fixtures from the engine
|
15
17
|
if ActiveSupport::TestCase.respond_to?(:fixture_path=)
|
16
|
-
ActiveSupport::TestCase.fixture_path = File.expand_path(
|
18
|
+
ActiveSupport::TestCase.fixture_path = File.expand_path('fixtures', __dir__)
|
17
19
|
ActionDispatch::IntegrationTest.fixture_path = ActiveSupport::TestCase.fixture_path
|
18
20
|
ActiveSupport::TestCase.fixtures :all
|
19
21
|
end
|
metadata
CHANGED
@@ -1,29 +1,29 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: killbill-kpm-ui
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 2.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:
|
11
|
+
date: 2021-05-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
|
-
name: rails
|
14
|
+
name: jquery-datatables-rails
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '
|
19
|
+
version: '3.3'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '
|
26
|
+
version: '3.3'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: jquery-rails
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -39,33 +39,47 @@ dependencies:
|
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '4.3'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
|
-
name:
|
42
|
+
name: ld-eventsource
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
45
|
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version:
|
47
|
+
version: 1.0.1
|
48
48
|
type: :runtime
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version:
|
54
|
+
version: 1.0.1
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
|
-
name:
|
56
|
+
name: rails
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
|
-
- - "
|
59
|
+
- - "~>"
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version: '
|
61
|
+
version: '5.1'
|
62
62
|
type: :runtime
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
|
-
- - "
|
66
|
+
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version: '
|
68
|
+
version: '5.1'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: sass-rails
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - "~>"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '5.0'
|
76
|
+
type: :runtime
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '5.0'
|
69
83
|
- !ruby/object:Gem::Dependency
|
70
84
|
name: font-awesome-rails
|
71
85
|
requirement: !ruby/object:Gem::Requirement
|
@@ -86,22 +100,22 @@ dependencies:
|
|
86
100
|
requirements:
|
87
101
|
- - "~>"
|
88
102
|
- !ruby/object:Gem::Version
|
89
|
-
version: '
|
103
|
+
version: '3.2'
|
90
104
|
type: :runtime
|
91
105
|
prerelease: false
|
92
106
|
version_requirements: !ruby/object:Gem::Requirement
|
93
107
|
requirements:
|
94
108
|
- - "~>"
|
95
109
|
- !ruby/object:Gem::Version
|
96
|
-
version: '
|
110
|
+
version: '3.2'
|
97
111
|
- !ruby/object:Gem::Dependency
|
98
|
-
name:
|
112
|
+
name: twitter-bootstrap-rails
|
99
113
|
requirement: !ruby/object:Gem::Requirement
|
100
114
|
requirements:
|
101
115
|
- - ">="
|
102
116
|
- !ruby/object:Gem::Version
|
103
117
|
version: '0'
|
104
|
-
type: :
|
118
|
+
type: :runtime
|
105
119
|
prerelease: false
|
106
120
|
version_requirements: !ruby/object:Gem::Requirement
|
107
121
|
requirements:
|
@@ -109,7 +123,35 @@ dependencies:
|
|
109
123
|
- !ruby/object:Gem::Version
|
110
124
|
version: '0'
|
111
125
|
- !ruby/object:Gem::Dependency
|
112
|
-
name:
|
126
|
+
name: gem-release
|
127
|
+
requirement: !ruby/object:Gem::Requirement
|
128
|
+
requirements:
|
129
|
+
- - "~>"
|
130
|
+
- !ruby/object:Gem::Version
|
131
|
+
version: '2.2'
|
132
|
+
type: :development
|
133
|
+
prerelease: false
|
134
|
+
version_requirements: !ruby/object:Gem::Requirement
|
135
|
+
requirements:
|
136
|
+
- - "~>"
|
137
|
+
- !ruby/object:Gem::Version
|
138
|
+
version: '2.2'
|
139
|
+
- !ruby/object:Gem::Dependency
|
140
|
+
name: json
|
141
|
+
requirement: !ruby/object:Gem::Requirement
|
142
|
+
requirements:
|
143
|
+
- - ">="
|
144
|
+
- !ruby/object:Gem::Version
|
145
|
+
version: 1.8.6
|
146
|
+
type: :development
|
147
|
+
prerelease: false
|
148
|
+
version_requirements: !ruby/object:Gem::Requirement
|
149
|
+
requirements:
|
150
|
+
- - ">="
|
151
|
+
- !ruby/object:Gem::Version
|
152
|
+
version: 1.8.6
|
153
|
+
- !ruby/object:Gem::Dependency
|
154
|
+
name: listen
|
113
155
|
requirement: !ruby/object:Gem::Requirement
|
114
156
|
requirements:
|
115
157
|
- - ">="
|
@@ -123,7 +165,7 @@ dependencies:
|
|
123
165
|
- !ruby/object:Gem::Version
|
124
166
|
version: '0'
|
125
167
|
- !ruby/object:Gem::Dependency
|
126
|
-
name:
|
168
|
+
name: rake
|
127
169
|
requirement: !ruby/object:Gem::Requirement
|
128
170
|
requirements:
|
129
171
|
- - ">="
|
@@ -137,19 +179,33 @@ dependencies:
|
|
137
179
|
- !ruby/object:Gem::Version
|
138
180
|
version: '0'
|
139
181
|
- !ruby/object:Gem::Dependency
|
140
|
-
name:
|
182
|
+
name: rubocop
|
183
|
+
requirement: !ruby/object:Gem::Requirement
|
184
|
+
requirements:
|
185
|
+
- - "~>"
|
186
|
+
- !ruby/object:Gem::Version
|
187
|
+
version: 0.88.0
|
188
|
+
type: :development
|
189
|
+
prerelease: false
|
190
|
+
version_requirements: !ruby/object:Gem::Requirement
|
191
|
+
requirements:
|
192
|
+
- - "~>"
|
193
|
+
- !ruby/object:Gem::Version
|
194
|
+
version: 0.88.0
|
195
|
+
- !ruby/object:Gem::Dependency
|
196
|
+
name: simplecov
|
141
197
|
requirement: !ruby/object:Gem::Requirement
|
142
198
|
requirements:
|
143
199
|
- - ">="
|
144
200
|
- !ruby/object:Gem::Version
|
145
|
-
version:
|
201
|
+
version: '0'
|
146
202
|
type: :development
|
147
203
|
prerelease: false
|
148
204
|
version_requirements: !ruby/object:Gem::Requirement
|
149
205
|
requirements:
|
150
206
|
- - ">="
|
151
207
|
- !ruby/object:Gem::Version
|
152
|
-
version:
|
208
|
+
version: '0'
|
153
209
|
description: Rails UI plugin for the KPM plugin.
|
154
210
|
email: killbilling-users@googlegroups.com
|
155
211
|
executables: []
|
@@ -161,9 +217,11 @@ files:
|
|
161
217
|
- Rakefile
|
162
218
|
- app/assets/javascripts/application.js
|
163
219
|
- app/assets/javascripts/kpm/kpm.js
|
220
|
+
- app/assets/javascripts/kpm/logs_refresh.js
|
164
221
|
- app/assets/stylesheets/application.css
|
165
222
|
- app/assets/stylesheets/bootstrap_and_overrides.css
|
166
223
|
- app/assets/stylesheets/kpm/kpm.css
|
224
|
+
- app/assets/stylesheets/kpm/nodes_info.css
|
167
225
|
- app/controllers/kpm/engine_controller.rb
|
168
226
|
- app/controllers/kpm/nodes_info_controller.rb
|
169
227
|
- app/controllers/kpm/plugins_controller.rb
|
@@ -172,7 +230,6 @@ files:
|
|
172
230
|
- app/views/kpm/nodes_info/_logs_table.html.erb
|
173
231
|
- app/views/kpm/nodes_info/_nodes_table.html.erb
|
174
232
|
- app/views/kpm/nodes_info/index.html.erb
|
175
|
-
- app/views/kpm/nodes_info/index.js.erb
|
176
233
|
- app/views/kpm/plugins/_form.html.erb
|
177
234
|
- app/views/kpm/plugins/_plugins_table.html.erb
|
178
235
|
- app/views/kpm/plugins/index.html.erb
|
@@ -213,7 +270,6 @@ files:
|
|
213
270
|
- test/dummy/config/locales/en.yml
|
214
271
|
- test/dummy/config/routes.rb
|
215
272
|
- test/dummy/config/secrets.yml
|
216
|
-
- test/dummy/log/test.log
|
217
273
|
- test/integration/navigation_test.rb
|
218
274
|
- test/kpm_test.rb
|
219
275
|
- test/test_helper.rb
|
@@ -242,38 +298,37 @@ signing_key:
|
|
242
298
|
specification_version: 4
|
243
299
|
summary: Kill Bill KPM UI mountable engine
|
244
300
|
test_files:
|
301
|
+
- test/kpm_test.rb
|
245
302
|
- test/test_helper.rb
|
246
303
|
- test/integration/navigation_test.rb
|
247
|
-
- test/dummy/
|
248
|
-
- test/dummy/
|
249
|
-
- test/dummy/
|
250
|
-
- test/dummy/
|
304
|
+
- test/dummy/config.ru
|
305
|
+
- test/dummy/bin/yarn
|
306
|
+
- test/dummy/bin/update
|
307
|
+
- test/dummy/bin/rake
|
308
|
+
- test/dummy/bin/setup
|
309
|
+
- test/dummy/bin/bundle
|
310
|
+
- test/dummy/bin/rails
|
251
311
|
- test/dummy/config/routes.rb
|
252
|
-
- test/dummy/config/
|
253
|
-
- test/dummy/config/environments/production.rb
|
254
|
-
- test/dummy/config/environments/development.rb
|
255
|
-
- test/dummy/config/initializers/new_framework_defaults_5_1.rb
|
256
|
-
- test/dummy/config/initializers/inflections.rb
|
257
|
-
- test/dummy/config/initializers/assets.rb
|
258
|
-
- test/dummy/config/initializers/backtrace_silencers.rb
|
259
|
-
- test/dummy/config/initializers/killbill_client.rb
|
260
|
-
- test/dummy/config/initializers/filter_parameter_logging.rb
|
312
|
+
- test/dummy/config/boot.rb
|
261
313
|
- test/dummy/config/initializers/mime_types.rb
|
262
314
|
- test/dummy/config/initializers/application_controller_renderer.rb
|
263
|
-
- test/dummy/config/initializers/
|
315
|
+
- test/dummy/config/initializers/killbill_client.rb
|
316
|
+
- test/dummy/config/initializers/assets.rb
|
264
317
|
- test/dummy/config/initializers/session_store.rb
|
265
318
|
- test/dummy/config/initializers/wrap_parameters.rb
|
266
|
-
- test/dummy/config/
|
319
|
+
- test/dummy/config/initializers/filter_parameter_logging.rb
|
320
|
+
- test/dummy/config/initializers/cookies_serializer.rb
|
321
|
+
- test/dummy/config/initializers/new_framework_defaults_5_1.rb
|
322
|
+
- test/dummy/config/initializers/backtrace_silencers.rb
|
323
|
+
- test/dummy/config/initializers/inflections.rb
|
324
|
+
- test/dummy/config/locales/en.yml
|
325
|
+
- test/dummy/config/secrets.yml
|
326
|
+
- test/dummy/config/environment.rb
|
327
|
+
- test/dummy/config/environments/production.rb
|
328
|
+
- test/dummy/config/environments/development.rb
|
329
|
+
- test/dummy/config/environments/test.rb
|
267
330
|
- test/dummy/config/application.rb
|
268
|
-
- test/dummy/Rakefile
|
269
331
|
- test/dummy/README.rdoc
|
332
|
+
- test/dummy/Rakefile
|
270
333
|
- test/dummy/app/controllers/application_controller.rb
|
271
334
|
- test/dummy/app/helpers/application_helper.rb
|
272
|
-
- test/dummy/config.ru
|
273
|
-
- test/dummy/bin/rake
|
274
|
-
- test/dummy/bin/bundle
|
275
|
-
- test/dummy/bin/update
|
276
|
-
- test/dummy/bin/setup
|
277
|
-
- test/dummy/bin/yarn
|
278
|
-
- test/dummy/bin/rails
|
279
|
-
- test/kpm_test.rb
|
@@ -1,4 +0,0 @@
|
|
1
|
-
$('#nodes-table-wrapper').html("<%= escape_javascript(render :partial => 'kpm/nodes_info/nodes_table', :locals => {:nodes_info => @nodes_info}) %>");
|
2
|
-
$('#logs-table-wrapper').html("<%= escape_javascript(render :partial => 'kpm/nodes_info/logs_table', :locals => {:logs => @logs}) %>");
|
3
|
-
|
4
|
-
scheduleRefresh();
|
data/test/dummy/log/test.log
DELETED
@@ -1,21 +0,0 @@
|
|
1
|
-
---------------------------------
|
2
|
-
KPMTest: test_can_load_KPM_module
|
3
|
-
---------------------------------
|
4
|
-
------------------------------------------------
|
5
|
-
NavigationTest: test_can_see_the_nodes_info_page
|
6
|
-
------------------------------------------------
|
7
|
-
Started GET "/kpm" for 127.0.0.1 at 2018-05-18 09:08:53 +0000
|
8
|
-
Processing by KPM::NodesInfoController#index as HTML
|
9
|
-
Request method='GET', uri='http://127.0.0.1:8080/1.0/kb/nodesInfo'
|
10
|
-
accept='application/json', user-agent='killbill/2.2.3; ruby 2.4.2p198 (2017-09-14 revision 59899) [x86_64-linux]', accept-encoding='gzip;q=1.0,deflate;q=0.6,identity;q=0.3', x-killbill-apikey='bob', x-killbill-apisecret='lazar', authorization='Basic [FILTERED]'
|
11
|
-
Completed 500 Internal Server Error in 1ms
|
12
|
-
---------------------------------------
|
13
|
-
NavigationTest: test_can_restart_bundle
|
14
|
-
---------------------------------------
|
15
|
-
Started POST "/kpm/nodes_info/plugin/restart?plugin_name=org.apache.felix.shell" for 127.0.0.1 at 2018-05-18 09:08:53 +0000
|
16
|
-
Processing by KPM::NodesInfoController#restart_plugin as HTML
|
17
|
-
Parameters: {"plugin_name"=>"org.apache.felix.shell"}
|
18
|
-
Request method='POST', uri='http://127.0.0.1:8080/1.0/kb/nodesInfo?localNodeOnly=false'
|
19
|
-
accept='application/json', user-agent='killbill/2.2.3; ruby 2.4.2p198 (2017-09-14 revision 59899) [x86_64-linux]', accept-encoding='gzip;q=1.0,deflate;q=0.6,identity;q=0.3', x-killbill-apikey='bob', x-killbill-apisecret='lazar', authorization='Basic [FILTERED]', content-type='application/json', x-killbill-createdby='admin'
|
20
|
-
requestBody='{"systemCommandType":true,"nodeCommandType":"RESTART_PLUGIN","nodeCommandProperties":[{"key":"pluginKey"},{"key":"pluginName","value":"org.apache.felix.shell"},{"key":"pluginVersion"}]}'
|
21
|
-
Completed 500 Internal Server Error in 1ms
|