mirror of
https://github.com/fluent/fluentd-ui.git
synced 2026-05-05 10:56:11 +02:00
Support filter_record_transformer
Signed-off-by: Kenji Okimoto <okimoto@clear-code.com>
This commit is contained in:
parent
c8063f94dd
commit
b7397133a8
@ -6,4 +6,9 @@ class Fluentd::Settings::FilterRecordTransformerController < ApplicationControll
|
||||
def target_class
|
||||
Fluentd::Setting::FilterRecordTransformer
|
||||
end
|
||||
|
||||
def setting_params
|
||||
permit_params = target_class.permit_params + [:record]
|
||||
params.require(:setting).permit(*permit_params)
|
||||
end
|
||||
end
|
||||
|
||||
@ -74,7 +74,16 @@ class Fluentd
|
||||
section_class.new(_section_params).to_config
|
||||
end.compact
|
||||
end
|
||||
attrs = params.to_h.reject do |key, value|
|
||||
params = params.to_h
|
||||
if plugin_type == "filter" && plugin_name == "record_transformer"
|
||||
record_params = {}
|
||||
params.delete("record").lines.each do |line|
|
||||
k, v = line.split(" ", 2)
|
||||
record_params[k] = v
|
||||
end
|
||||
elements << config_element("record", "", record_params, [])
|
||||
end
|
||||
attrs = params.reject do |key, value|
|
||||
skip?(key.to_sym, value)
|
||||
end
|
||||
return attrs, elements
|
||||
|
||||
@ -5,6 +5,8 @@ class Fluentd
|
||||
|
||||
register_plugin("filter", "record_transformer")
|
||||
|
||||
attribute(:record, :string)
|
||||
|
||||
def self.initial_params
|
||||
{
|
||||
}
|
||||
|
||||
@ -0,0 +1,20 @@
|
||||
= render "shared/setting_errors"
|
||||
|
||||
- # NOTE: plugin_setting_form_action_url is defined at SettingConcern
|
||||
= form_with(model: setting, scope: "setting", url: plugin_setting_form_action_url(fluentd), local: true, class: "ignore-rails-error-div", builder: FluentdFormBuilder) do |f|
|
||||
- setting.common_options.each do |key|
|
||||
= f.field(key)
|
||||
|
||||
.form-group
|
||||
= f.label(:record, nil, data: { toggle: "tooltip", placement: "right"}, title: "considered to be new key-value pairs")
|
||||
= f.text_area(:record, class: "form-control")
|
||||
|
||||
.card.card-body.bg-light
|
||||
%h4{"data-toggle" => "collapse", "href" => "#advanced-setting"}
|
||||
= icon('fa-caret-down')
|
||||
= t('terms.advanced_setting')
|
||||
#advanced-setting.collapse
|
||||
- setting.advanced_options.each do |key|
|
||||
= f.field(key)
|
||||
|
||||
= f.submit t('fluentd.common.finish'), class: "btn btn-lg btn-primary pull-right"
|
||||
Loading…
x
Reference in New Issue
Block a user