killbill-kpm-ui 4.0.3 → 4.0.4
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 +4 -4
- data/app/assets/stylesheets/kpm/kpm.css +31 -0
- data/app/assets/stylesheets/kpm/nodes_info.css +14 -0
- data/app/controllers/kpm/nodes_info_controller.rb +40 -1
- data/app/views/kpm/nodes_info/_form_plugin_config.html.erb +64 -0
- data/app/views/kpm/nodes_info/_nodes_table.html.erb +3 -2
- data/app/views/kpm/nodes_info/_official_plugins.html.erb +27 -0
- data/app/views/kpm/nodes_info/index.html.erb +1 -1
- data/config/routes.rb +8 -7
- data/lib/kpm/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: d38283eaf5f069611c6cdc2efa0336215781d00d993cb60c3edf86bd0d845b2d
|
|
4
|
+
data.tar.gz: aebb0ad2b619dd0686e92f7e5965a8026cfe9c614b96812587926ca4cf164ac9
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 82269060072dcddbb742abe0efb52133430c50cd5a7ea8bebd27cf030b45cd9252e35155df7b4c965bf04824ac53ab2380be2b1ec356df767b9e87f21532e538
|
|
7
|
+
data.tar.gz: 91fbee537d8b6c2af497244f30a8767ecf21862c1d9151d0437172559891d99f2d1e830fec8643088d08f92589e6a0fa0c6815e053c1082e7e372e33b89f8802
|
|
@@ -41,6 +41,12 @@
|
|
|
41
41
|
|
|
42
42
|
/* app/views/kpm/nodes_info/_nodes_table.html.erb */
|
|
43
43
|
|
|
44
|
+
.nodes-separator {
|
|
45
|
+
border: none;
|
|
46
|
+
border-top: 0.1875rem solid #d2d6db;
|
|
47
|
+
margin: 1.5rem 0;
|
|
48
|
+
}
|
|
49
|
+
|
|
44
50
|
.nodes-info b {
|
|
45
51
|
font-weight: 600;
|
|
46
52
|
font-size: 0.875rem;
|
|
@@ -60,6 +66,31 @@
|
|
|
60
66
|
|
|
61
67
|
/* app/views/kpm/nodes_info/_official_plugins.html.erb */
|
|
62
68
|
|
|
69
|
+
.official-plugins-data .node-group {
|
|
70
|
+
margin-bottom: 1.5rem;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
.official-plugins-data .node-group-header {
|
|
74
|
+
display: flex;
|
|
75
|
+
align-items: center;
|
|
76
|
+
padding: 0.5rem 0;
|
|
77
|
+
margin-bottom: 0.25rem;
|
|
78
|
+
border-bottom: 0.125rem solid #e9eaeb;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
.official-plugins-data .node-group-label {
|
|
82
|
+
font-weight: 600;
|
|
83
|
+
font-size: 0.875rem;
|
|
84
|
+
line-height: 1.25rem;
|
|
85
|
+
color: #414651;
|
|
86
|
+
text-transform: uppercase;
|
|
87
|
+
letter-spacing: 0.05em;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
.official-plugins-data .node-group .official-plugin:last-child {
|
|
91
|
+
border-bottom: none;
|
|
92
|
+
}
|
|
93
|
+
|
|
63
94
|
.official-plugins-data .official-plugin {
|
|
64
95
|
padding: 1rem 0;
|
|
65
96
|
display: flex;
|
|
@@ -21,3 +21,17 @@
|
|
|
21
21
|
#logs-form {
|
|
22
22
|
margin-bottom: 15px;
|
|
23
23
|
}
|
|
24
|
+
|
|
25
|
+
/* Plugin config modal */
|
|
26
|
+
.plugin-config-modal .close-button {
|
|
27
|
+
background: none;
|
|
28
|
+
border: none;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
.plugin-config-modal .config-label {
|
|
32
|
+
margin-top: 10px;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
.plugin-config-modal .config-textarea {
|
|
36
|
+
height: 10rem;
|
|
37
|
+
}
|
|
@@ -8,7 +8,7 @@ module KPM
|
|
|
8
8
|
include ActionController::Live
|
|
9
9
|
|
|
10
10
|
def index
|
|
11
|
-
@installing =
|
|
11
|
+
@installing = params[:i].present?
|
|
12
12
|
|
|
13
13
|
@nodes_info = ::KillBillClient::Model::NodesInfo.nodes_info(options_for_klient)
|
|
14
14
|
|
|
@@ -29,6 +29,17 @@ module KPM
|
|
|
29
29
|
|
|
30
30
|
@kb_host = params[:kb_host] || KillBillClient::API.base_uri
|
|
31
31
|
@last_event_id = params[:last_event_id]
|
|
32
|
+
|
|
33
|
+
@tenant_plugin_config = {}
|
|
34
|
+
begin
|
|
35
|
+
raw_tenant_config = ::KillBillClient::Model::Tenant.search_tenant_config('PLUGIN_CONFIG_', options_for_klient)
|
|
36
|
+
@tenant_plugin_config = raw_tenant_config.each_with_object({}) do |e, hsh|
|
|
37
|
+
plugin_name = e.key.gsub('PLUGIN_CONFIG_', '')
|
|
38
|
+
hsh[plugin_name] = e.values[0]
|
|
39
|
+
end
|
|
40
|
+
rescue StandardError => e
|
|
41
|
+
Rails.logger.warn("Unable to fetch tenant plugin config: #{e.inspect}")
|
|
42
|
+
end
|
|
32
43
|
end
|
|
33
44
|
|
|
34
45
|
def refresh
|
|
@@ -96,6 +107,34 @@ module KPM
|
|
|
96
107
|
head :ok
|
|
97
108
|
end
|
|
98
109
|
|
|
110
|
+
def upload_plugin_config
|
|
111
|
+
plugin_name = params[:plugin_name]
|
|
112
|
+
plugin_config = params[:plugin_config]
|
|
113
|
+
|
|
114
|
+
if plugin_name.blank?
|
|
115
|
+
flash[:error] = 'Plugin name cannot be blank'
|
|
116
|
+
elsif plugin_config.blank?
|
|
117
|
+
flash[:error] = 'Plugin configuration cannot be blank'
|
|
118
|
+
else
|
|
119
|
+
begin
|
|
120
|
+
user = current_tenant_user
|
|
121
|
+
::KillBillClient::Model::Tenant.upload_tenant_plugin_config(
|
|
122
|
+
plugin_name,
|
|
123
|
+
plugin_config.gsub(/\r\n?/, "\n"),
|
|
124
|
+
user[:username],
|
|
125
|
+
nil,
|
|
126
|
+
nil,
|
|
127
|
+
options_for_klient
|
|
128
|
+
)
|
|
129
|
+
flash[:notice] = 'Plugin configuration was successfully uploaded'
|
|
130
|
+
rescue StandardError => e
|
|
131
|
+
flash[:error] = "Failed to upload plugin configuration: #{e.message}"
|
|
132
|
+
end
|
|
133
|
+
end
|
|
134
|
+
|
|
135
|
+
redirect_to nodes_info_index_path
|
|
136
|
+
end
|
|
137
|
+
|
|
99
138
|
def restart_plugin
|
|
100
139
|
trigger_node_plugin_command('RESTART_PLUGIN')
|
|
101
140
|
head :ok
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
<% modal_id = "plugin_config_modal_#{plugin_info.plugin_name.gsub(/[^a-zA-Z0-9]/, '_')}" %>
|
|
2
|
+
<% plugin_name = plugin_info.plugin_name %>
|
|
3
|
+
<% plugin_key = plugin_info.plugin_key %>
|
|
4
|
+
<% config_lookup_keys = [
|
|
5
|
+
plugin_key,
|
|
6
|
+
plugin_name,
|
|
7
|
+
plugin_name.to_s.gsub('killbill-', ''),
|
|
8
|
+
plugin_name.to_s.gsub(':', '-')
|
|
9
|
+
].compact.uniq %>
|
|
10
|
+
<% existing_config = config_lookup_keys.lazy.map { |key| tenant_plugin_config[key] }.find(&:present?) || '' %>
|
|
11
|
+
|
|
12
|
+
<div class="modal fade plugin-config-modal" id="<%= modal_id %>" tabindex="-1" role="dialog"
|
|
13
|
+
aria-labelledby="<%= modal_id %>_label" aria-hidden="true">
|
|
14
|
+
<div class="modal-dialog modal-lg" role="document">
|
|
15
|
+
<div class="modal-content">
|
|
16
|
+
|
|
17
|
+
<div class="modal-header">
|
|
18
|
+
<h5 class="modal-title d-flex align-items-center gap-3" id="<%= modal_id %>_label">
|
|
19
|
+
<span class="icon-container">
|
|
20
|
+
<svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
21
|
+
<path d="M12.9163 9.99967C12.9163 11.6105 11.6105 12.9163 9.99967 12.9163C8.38884 12.9163 7.08301 11.6105 7.08301 9.99967C7.08301 8.38884 8.38884 7.08301 9.99967 7.08301C11.6105 7.08301 12.9163 8.38884 12.9163 9.99967Z" stroke="#414651" stroke-width="1.5"/>
|
|
22
|
+
<path d="M8.14378 2.2368L7.50038 4.16699L6.20051 4.98913L4.07368 4.46288C3.71712 4.37466 3.34485 4.53028 3.15718 4.84603L2.02034 6.7586C1.81548 7.10327 1.8851 7.54496 2.18605 7.80988L3.67783 9.12316V10.8775L2.18652 12.1907C1.88563 12.4557 1.81606 12.8973 2.0209 13.2419L3.15778 15.1546C3.34545 15.4703 3.71773 15.626 4.07428 15.5377L6.20112 15.0115L7.43253 15.7021L8.02033 17.7321C8.1235 18.0884 8.44979 18.3337 8.82079 18.3337H11.1806C11.5515 18.3337 11.8779 18.0884 11.981 17.7321L12.5689 15.7021L13.7996 15.0115L15.9265 15.5377C16.283 15.626 16.6553 15.4703 16.843 15.1546L18.0013 13.2058C18.1964 12.8777 18.1435 12.4588 17.873 12.1895L16.3678 10.6909L16.3684 9.30974L17.8735 7.81114C18.1441 7.54178 18.197 7.123 18.002 6.79482L16.8435 4.84603C16.6559 4.53028 16.2836 4.37466 15.927 4.46288L13.8002 4.98913L12.5004 4.16699L11.857 2.2368C11.7435 1.89652 11.4251 1.66699 11.0664 1.66699H8.93438C8.57563 1.66699 8.2572 1.89652 8.14378 2.2368Z" stroke="#414651" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
|
|
23
|
+
</svg>
|
|
24
|
+
</span>
|
|
25
|
+
<strong class="ms-1"><%= plugin_name %></strong>
|
|
26
|
+
</h5>
|
|
27
|
+
<button type="button" class="close close-button custom-hover" data-bs-dismiss="modal" aria-label="Close">
|
|
28
|
+
<span aria-hidden="true">
|
|
29
|
+
<svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
30
|
+
<path d="M15.8337 4.1665L4.16699 15.8332M4.16699 4.1665L15.8337 15.8332" stroke="#A4A7AE" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
|
|
31
|
+
</svg>
|
|
32
|
+
</span>
|
|
33
|
+
</button>
|
|
34
|
+
</div>
|
|
35
|
+
|
|
36
|
+
<%= form_tag(plugin_upload_config_path, method: :post, class: 'form-horizontal') do %>
|
|
37
|
+
<%= hidden_field_tag :plugin_name, plugin_name %>
|
|
38
|
+
|
|
39
|
+
<div class="modal-body">
|
|
40
|
+
<div class="form-group d-flex pb-3 border-bottom mb-3">
|
|
41
|
+
<%= label_tag "plugin_config_#{modal_id}", 'Configuration', class: 'col-sm-2 control-label config-label' %>
|
|
42
|
+
<div class="col-sm-10">
|
|
43
|
+
<textarea name="plugin_config"
|
|
44
|
+
id="plugin_config_<%= modal_id %>"
|
|
45
|
+
rows="25"
|
|
46
|
+
class="form-control config-textarea"
|
|
47
|
+
placeholder="Enter plugin configuration ..."><%= existing_config %></textarea>
|
|
48
|
+
</div>
|
|
49
|
+
</div>
|
|
50
|
+
</div>
|
|
51
|
+
|
|
52
|
+
<div class="d-flex justify-content-end px-3 pb-3">
|
|
53
|
+
<%= render "kaui/components/button/button", {
|
|
54
|
+
label: 'Upload',
|
|
55
|
+
variant: "outline-secondary d-inline-flex align-items-center gap-1",
|
|
56
|
+
type: "submit",
|
|
57
|
+
html_class: "kaui-dropdown custom-hover m-0"
|
|
58
|
+
} %>
|
|
59
|
+
</div>
|
|
60
|
+
<% end %>
|
|
61
|
+
|
|
62
|
+
</div>
|
|
63
|
+
</div>
|
|
64
|
+
</div>
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
<%- has_kpm_plugin = kpm_plugin_installed?(nodes_info) %>
|
|
2
|
-
<% nodes_info.
|
|
2
|
+
<% nodes_info.each_with_index do |node_info, index| %>
|
|
3
|
+
<%= content_tag :hr, nil, class: 'nodes-separator' if index > 0 %>
|
|
3
4
|
<div class="row nodes-info">
|
|
4
5
|
<div class="col-sm-6">
|
|
5
6
|
<div class="mb-3">
|
|
@@ -28,5 +29,5 @@
|
|
|
28
29
|
<p>Commons: <%= node_info.common_version %></p>
|
|
29
30
|
</div>
|
|
30
31
|
</div>
|
|
31
|
-
|
|
32
|
+
</div>
|
|
32
33
|
<% end %>
|
|
@@ -2,6 +2,10 @@
|
|
|
2
2
|
<%- has_kpm_plugin = kpm_plugin_installed?(nodes_info) %>
|
|
3
3
|
<% nodes_info.each do |node_info| %>
|
|
4
4
|
<% unless (node_info.plugins_info || []).empty? %>
|
|
5
|
+
<div class="node-group">
|
|
6
|
+
<div class="node-group-header">
|
|
7
|
+
<span class="node-group-label">Node: <%= node_info.node_name %></span>
|
|
8
|
+
</div>
|
|
5
9
|
<% node_info.plugins_info.each do |plugin_info| %>
|
|
6
10
|
<div class="official-plugin ">
|
|
7
11
|
<div class="d-flex align-items-center">
|
|
@@ -40,6 +44,16 @@
|
|
|
40
44
|
<path d="M5.66667 14.667L5 12.9682C5.79477 13.3928 6.7026 13.6336 7.66667 13.6336C10.7963 13.6336 13.3333 11.0966 13.3333 7.96695C13.3333 6.77282 12.964 5.58055 12.3333 4.66699" stroke="#A4A7AE" stroke-linecap="round" stroke-linejoin="round"/>
|
|
41
45
|
</svg>
|
|
42
46
|
Restart'.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' %>
|
|
47
|
+
<% plugin_config_modal_id = "plugin_config_modal_#{plugin_info.plugin_name.gsub(/[^a-zA-Z0-9]/, '_')}" %>
|
|
48
|
+
<a href="#<%= plugin_config_modal_id %>"
|
|
49
|
+
class="plugin-link"
|
|
50
|
+
data-bs-toggle="modal"
|
|
51
|
+
data-bs-target="#<%= plugin_config_modal_id %>">
|
|
52
|
+
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
53
|
+
<path d="M8 10a2 2 0 1 0 0-4 2 2 0 0 0 0 4z" stroke="#A4A7AE" stroke-linecap="round" stroke-linejoin="round"/>
|
|
54
|
+
<path d="M13.293 8.58A5.36 5.36 0 0 0 13.333 8a5.36 5.36 0 0 0-.04-.58l1.254-.98a.333.333 0 0 0 .08-.42l-1.187-2.053a.333.333 0 0 0-.406-.147l-1.48.593a4.693 4.693 0 0 0-1-.58L10.333 2.4A.333.333 0 0 0 10 2.067H7.667A.333.333 0 0 0 7.333 2.4l-.22 1.413a4.693 4.693 0 0 0-1 .58l-1.48-.593a.333.333 0 0 0-.406.147L3.04 6.02a.333.333 0 0 0 .08.42l1.254.98A5.464 5.464 0 0 0 4.333 8a5.464 5.464 0 0 0 .04.58L3.12 9.56a.333.333 0 0 0-.08.42l1.187 2.053c.08.147.253.2.406.147l1.48-.593c.307.22.64.42 1 .58l.22 1.413c.04.187.187.32.334.32H10a.333.333 0 0 0 .333-.32l.22-1.413a4.693 4.693 0 0 0 1-.58l1.48.593c.153.053.327 0 .406-.147l1.187-2.053a.333.333 0 0 0-.08-.42l-1.253-.98z" stroke="#A4A7AE" stroke-linecap="round" stroke-linejoin="round"/>
|
|
55
|
+
</svg> Config
|
|
56
|
+
</a>
|
|
43
57
|
<% if !plugin_info.version.nil? && has_kpm_plugin %>
|
|
44
58
|
<%= link_to '<svg width="16" height="16" viewBox="0 0 448 512" fill="#A4A7AE" xmlns="http://www.w3.org/2000/svg">
|
|
45
59
|
<path d="M224 32C217.7 32 211.7 34.5 207 39L23 223C13.7 232.2 13.7 247.8 23 257C32.2 266.3 47.8 266.3 57 257L224 90.98L391 257C400.2 266.3 415.8 266.3 425 257C434.3 247.8 434.3 232.2 425 223L241 39C236.3 34.5 230.3 32 224 32ZM64 320C55.16 320 48 327.2 48 336V368C48 376.8 55.16 384 64 384H384C392.8 384 400 376.8 400 368V336C400 327.2 392.8 320 384 320H64Z"/>
|
|
@@ -51,10 +65,23 @@
|
|
|
51
65
|
</div>
|
|
52
66
|
</div>
|
|
53
67
|
<% end %>
|
|
68
|
+
</div>
|
|
54
69
|
<% end %>
|
|
55
70
|
<% end %>
|
|
56
71
|
</div>
|
|
57
72
|
|
|
73
|
+
<%# Render plugin config modals once per unique plugin name to avoid duplicate DOM ids in multi-node setups %>
|
|
74
|
+
<% rendered_modal_names = [] %>
|
|
75
|
+
<% nodes_info.each do |node_info| %>
|
|
76
|
+
<% (node_info.plugins_info || []).each do |plugin_info| %>
|
|
77
|
+
<% next unless plugin_info.state == 'RUNNING' %>
|
|
78
|
+
<% next if rendered_modal_names.include?(plugin_info.plugin_name) %>
|
|
79
|
+
<% rendered_modal_names << plugin_info.plugin_name %>
|
|
80
|
+
<%= render partial: 'kpm/nodes_info/form_plugin_config',
|
|
81
|
+
locals: { plugin_info: plugin_info, tenant_plugin_config: tenant_plugin_config } %>
|
|
82
|
+
<% end %>
|
|
83
|
+
<% end %>
|
|
84
|
+
|
|
58
85
|
<%= javascript_tag do %>
|
|
59
86
|
function toggleDropdown(button) {
|
|
60
87
|
const dropdown = button.closest(".dropdown");
|
|
@@ -55,7 +55,7 @@
|
|
|
55
55
|
<!-- Plugin Sections -->
|
|
56
56
|
<div id="official-plugins-table">
|
|
57
57
|
<div class="official-plugins-table" style="display: block;">
|
|
58
|
-
<%= render partial: 'kpm/nodes_info/official_plugins', locals: { nodes_info: @nodes_info } %>
|
|
58
|
+
<%= render partial: 'kpm/nodes_info/official_plugins', locals: { nodes_info: @nodes_info, tenant_plugin_config: @tenant_plugin_config } %>
|
|
59
59
|
</div>
|
|
60
60
|
</div>
|
|
61
61
|
|
data/config/routes.rb
CHANGED
|
@@ -7,12 +7,13 @@ KPM::Engine.routes.draw do
|
|
|
7
7
|
resources :plugins, only: [:index]
|
|
8
8
|
|
|
9
9
|
scope '/nodes_info' do
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
10
|
+
get '/refresh' => 'nodes_info#refresh', :as => 'nodes_info_refresh'
|
|
11
|
+
post '/plugin/install' => 'nodes_info#install_plugin', :as => 'plugin_install'
|
|
12
|
+
post '/plugin/install_from_fs' => 'nodes_info#install_plugin_from_fs', :as => 'plugin_install_from_fs'
|
|
13
|
+
post '/plugin/uninstall' => 'nodes_info#uninstall_plugin', :as => 'plugin_uninstall'
|
|
14
|
+
post '/plugin/start' => 'nodes_info#start_plugin', :as => 'plugin_start'
|
|
15
|
+
post '/plugin/stop' => 'nodes_info#stop_plugin', :as => 'plugin_stop'
|
|
16
|
+
post '/plugin/restart' => 'nodes_info#restart_plugin', :as => 'plugin_restart'
|
|
17
|
+
post '/plugin/config' => 'nodes_info#upload_plugin_config', :as => 'plugin_upload_config'
|
|
17
18
|
end
|
|
18
19
|
end
|
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: 4.0.
|
|
4
|
+
version: 4.0.4
|
|
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-
|
|
11
|
+
date: 2026-06-03 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: killbill-assets-ui
|
|
@@ -90,6 +90,7 @@ files:
|
|
|
90
90
|
- app/views/kaui/components/button/_button.html.erb
|
|
91
91
|
- app/views/kaui/layouts/kaui_setting_sidebar.html.erb
|
|
92
92
|
- app/views/kpm/layouts/kpm_application.html.erb
|
|
93
|
+
- app/views/kpm/nodes_info/_form_plugin_config.html.erb
|
|
93
94
|
- app/views/kpm/nodes_info/_logs_table.html.erb
|
|
94
95
|
- app/views/kpm/nodes_info/_nodes_table.html.erb
|
|
95
96
|
- app/views/kpm/nodes_info/_official_plugins.html.erb
|