mirror of
https://github.com/fluent/fluentd-ui.git
synced 2026-05-13 23:06:10 +02:00
Merge pull request #243 from fluent/save-owned-plugin-config
Save owned plugin config properly
This commit is contained in:
commit
6da22693c2
@ -45,7 +45,13 @@ class Fluentd
|
||||
elements = []
|
||||
sections.to_h.each do |key, section_params|
|
||||
if %w(parse format buffer storage).include?(key)
|
||||
section_params["0"] = { "@type" => self.attributes["#{key}_type"] }.merge(section_params["0"])
|
||||
if section_params && section_params.key?("0")
|
||||
section_params["0"] = { "@type" => self.attributes["#{key}_type"] }.merge(section_params["0"])
|
||||
else
|
||||
section_params = {
|
||||
"0" => { "@type" => self.attributes["#{key}_type"] }
|
||||
}
|
||||
end
|
||||
end
|
||||
next if section_params.blank?
|
||||
section_params.each do |index, _section_params|
|
||||
|
||||
@ -38,19 +38,19 @@ class Fluentd
|
||||
end
|
||||
|
||||
def have_buffer_section?
|
||||
self.class._sections.key?(:buffer)
|
||||
self.class.have_buffer_section?
|
||||
end
|
||||
|
||||
def have_storage_section?
|
||||
self.class._sections.key?(:storage)
|
||||
self.class.have_storage_section?
|
||||
end
|
||||
|
||||
def have_parse_section?
|
||||
self.class._sections.key?(:parse)
|
||||
self.class.have_parse_section?
|
||||
end
|
||||
|
||||
def have_format_section?
|
||||
self.class._sections.key?(:format)
|
||||
self.class.have_format_section?
|
||||
end
|
||||
|
||||
def create_buffer
|
||||
@ -99,12 +99,34 @@ class Fluentd
|
||||
self._list[name]
|
||||
end
|
||||
|
||||
def have_buffer_section?
|
||||
self._sections.key?(:buffer)
|
||||
end
|
||||
|
||||
def have_storage_section?
|
||||
self._sections.key?(:storage)
|
||||
end
|
||||
|
||||
def have_parse_section?
|
||||
self._sections.key?(:parse)
|
||||
end
|
||||
|
||||
def have_format_section?
|
||||
self._sections.key?(:format)
|
||||
end
|
||||
|
||||
def permit_params
|
||||
self.new # init
|
||||
keys = self._types.keys
|
||||
self._sections.each do |key, section|
|
||||
keys << _permit_section(key, section)
|
||||
end
|
||||
|
||||
keys << :buffer_type if have_buffer_section?
|
||||
keys << :storage_type if have_storage_section?
|
||||
keys << :parse_type if have_parse_section?
|
||||
keys << :format_type if have_format_section?
|
||||
|
||||
keys
|
||||
end
|
||||
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
|
||||
#plugin-setting
|
||||
- # NOTE: plugin_setting_form_action_url is defined at SettingConcern
|
||||
= form_with(model: @setting, scope: :setting, url: plugin_setting_form_action_url(@fluentd), class: "ignore-rails-error-div", builder: FluentdFormBuilder) do |form|
|
||||
= form_with(model: @setting, scope: :setting, url: plugin_setting_form_action_url(@fluentd), local: true, class: "ignore-rails-error-div", builder: FluentdFormBuilder) do |form|
|
||||
- @setting.common_options.each do |key|
|
||||
= form.field(key)
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user