Module: Kaui::PluginHelper

Defined in:
app/helpers/kaui/plugin_helper.rb

Constant Summary collapse

CONFIGABLE_PLUGINS =
%w[analytics avatax email-notifications deposit payment-test aviate].freeze

Instance Method Summary collapse

Instance Method Details

#installed_plugin_namesObject



11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'app/helpers/kaui/plugin_helper.rb', line 11

def installed_plugin_names
  plugins = []
  nodes_info = KillBillClient::Model::NodesInfo.nodes_info(Kaui.current_tenant_user_options(current_user, session)) || []
  plugins_info = nodes_info.empty? ? [] : (nodes_info.first.plugins_info || [])
  plugins_info.each do |plugin|
    next unless plugin.state == 'RUNNING'

    plugin_name = plugin.plugin_name
    plugin_key = plugin_name.gsub('-plugin', '')

    # Handle special cases
    plugin_path = case plugin_name
                  when /email-notifications/
                    '/kenui'
                  when /payment-test/
                    '/payment_test'
                  else
                    "/#{plugin_key}"
                  end
    plugin_path = nil unless CONFIGABLE_PLUGINS.include?(plugin_key)
    plugins << { name: plugin_name, path: plugin_path } if plugin_path
  end
  plugins
end

#plugin_repositoryObject



7
8
9
# File 'app/helpers/kaui/plugin_helper.rb', line 7

def plugin_repository
  installed_plugins
end