fluentd-ui 1.0.0.alpha.3 → 1.0.0.beta.1

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of fluentd-ui might be problematic. Click here for more details.

Files changed (84) hide show
  1. checksums.yaml +4 -4
  2. data/.eslintrc.js +45 -0
  3. data/.travis.yml +17 -3
  4. data/Gemfile +2 -2
  5. data/Gemfile.lock +62 -63
  6. data/README.md +11 -0
  7. data/app/controllers/api/config_definitions_controller.rb +41 -17
  8. data/app/controllers/concerns/setting_concern.rb +0 -4
  9. data/app/controllers/fluentd/settings/in_tail_controller.rb +1 -1
  10. data/app/form_builders/fluentd_form_builder.rb +18 -6
  11. data/app/javascript/packs/application.js +20 -20
  12. data/app/javascript/packs/aws_credential.js +61 -0
  13. data/app/javascript/packs/codemirror.js +33 -37
  14. data/app/javascript/packs/config_field.js +93 -0
  15. data/app/javascript/packs/fluent_log.js +10 -9
  16. data/app/javascript/packs/in_tail_parse.js +77 -76
  17. data/app/javascript/packs/nested_settings.js +17 -16
  18. data/app/javascript/packs/notification.js +14 -14
  19. data/app/javascript/packs/out_forward_setting.js +14 -0
  20. data/app/javascript/packs/out_s3_setting.js +14 -0
  21. data/app/javascript/packs/owned_plugin_form.js +60 -57
  22. data/app/javascript/packs/parser_multiline_form.js +15 -14
  23. data/app/javascript/packs/plugin_setting.js +13 -13
  24. data/app/javascript/packs/settings.js +23 -18
  25. data/app/javascript/packs/transport_config.js +62 -0
  26. data/app/javascript/packs/transport_section.js +72 -0
  27. data/app/javascript/packs/treeview.js +11 -10
  28. data/app/models/concerns/fluentd/setting/configurable.rb +1 -3
  29. data/app/models/concerns/fluentd/setting/plugin.rb +29 -1
  30. data/app/models/concerns/fluentd/setting/plugin_config.rb +32 -8
  31. data/app/models/concerns/fluentd/setting/plugin_parameter.rb +74 -21
  32. data/app/models/concerns/fluentd/setting/registry_loader.rb +38 -0
  33. data/app/models/concerns/fluentd/setting/section_config.rb +52 -0
  34. data/app/models/concerns/fluentd/setting/section_parser.rb +25 -18
  35. data/app/models/fluentd/setting/in_forward.rb +29 -10
  36. data/app/models/fluentd/setting/in_syslog.rb +6 -6
  37. data/app/models/fluentd/setting/out_forward.rb +15 -3
  38. data/app/models/fluentd/setting/out_mongo.rb +0 -11
  39. data/app/models/fluentd/setting/out_s3.rb +17 -3
  40. data/app/models/fluentd/setting/out_tdlog.rb +3 -2
  41. data/app/models/fluentd/setting/section.rb +4 -0
  42. data/app/models/fluentd/setting/type/object.rb +17 -0
  43. data/app/views/fluentd/settings/in_forward/_form.html.haml +5 -3
  44. data/app/views/fluentd/settings/out_forward/_form.html.haml +18 -0
  45. data/app/views/fluentd/settings/out_s3/_form.html.haml +18 -0
  46. data/app/views/shared/settings/_form.html.haml +14 -10
  47. data/app/views/shared/settings/show.html.haml +2 -2
  48. data/app/views/shared/vue/_aws_credential.html.haml +22 -0
  49. data/app/views/shared/vue/_config_field.html.haml +49 -0
  50. data/app/views/shared/vue/_out_forward_setting.html.haml +13 -0
  51. data/app/views/shared/vue/_out_s3_setting.html.haml +19 -0
  52. data/app/views/shared/vue/_owned_plugin_form.html.haml +8 -48
  53. data/app/views/shared/vue/_transport_config.html.haml +20 -0
  54. data/app/views/shared/vue/_transport_section.html.haml +30 -0
  55. data/config/initializers/dig.rb +8 -0
  56. data/config/initializers/dummy_logger.rb +1 -0
  57. data/config/initializers/types.rb +2 -1
  58. data/config/locales/translation_ja.yml +2 -2
  59. data/fluentd-ui.gemspec +1 -0
  60. data/gemfiles/ruby2.2.gemfile +28 -0
  61. data/lib/dummy_logger.rb +13 -0
  62. data/lib/fluentd-ui/version.rb +1 -1
  63. data/package.json +5 -0
  64. data/spec/features/fluentd/setting/in_forward_spec.rb +1 -2
  65. data/spec/features/fluentd/setting/in_http_spec.rb +1 -2
  66. data/spec/features/fluentd/setting/in_monitor_agent_spec.rb +1 -2
  67. data/spec/features/fluentd/setting/out_forward_spec.rb +3 -5
  68. data/spec/features/fluentd/setting/out_stdout_spec.rb +1 -2
  69. data/spec/features/out_elasticsearch_spec.rb +3 -3
  70. data/spec/features/out_forward_spec.rb +6 -5
  71. data/spec/features/out_tdlog_spec.rb +3 -2
  72. data/spec/features/shared_examples/configurable_daemon_settings.rb +2 -2
  73. data/spec/features/source_and_output_spec.rb +2 -0
  74. data/spec/models/fluentd/setting/in_forward_spec.rb +65 -9
  75. data/spec/models/fluentd/setting/in_syslog_spec.rb +12 -7
  76. data/spec/models/fluentd/setting/in_tail_spec.rb +6 -0
  77. data/spec/models/fluentd/setting/out_mongo_spec.rb +2 -3
  78. data/spec/models/fluentd/setting/out_tdlog_spec.rb +1 -2
  79. data/spec/spec_helper.rb +5 -0
  80. data/yarn.lock +466 -12
  81. metadata +90 -39
  82. data/app/helpers/settings_helper.rb +0 -144
  83. data/app/models/concerns/fluentd/setting/section_validator.rb +0 -21
  84. data/app/views/fluentd/settings/_form.html.haml +0 -43
@@ -0,0 +1,38 @@
1
+ class Fluentd
2
+ module Setting
3
+ module RegistryLoader
4
+ extend ActiveSupport::Concern
5
+
6
+ module ClassMethods
7
+ def define_all_attributes(section_name)
8
+ registry = case section_name
9
+ when :buffer
10
+ Fluent::Plugin::BUFFER_REGISTRY
11
+ when :storage
12
+ Fluent::Plugin::STORAGE_REGISTRY
13
+ when :parse
14
+ Fluent::Plugin::PARSER_REGISTRY
15
+ when :format
16
+ Fluent::Plugin::FORMATTER_REGISTRY
17
+ end
18
+ registry.map.each do |key, plugin_class|
19
+ plugin_class.ancestors.reverse_each do |klass|
20
+ next unless klass.respond_to?(:dump_config_definition)
21
+ begin
22
+ dumped_config_definition = klass.dump_config_definition
23
+ self._dumped_config[klass.name] = dumped_config_definition unless dumped_config_definition.empty?
24
+ rescue NoMethodError
25
+ end
26
+ end
27
+ end
28
+ attribute(:type, :string)
29
+ self._types[:type] = :string
30
+ self._dumped_config.values.map(&:keys).flatten.uniq.each do |name|
31
+ attribute(name, :object)
32
+ self._types[name] = :object
33
+ end
34
+ end
35
+ end
36
+ end
37
+ end
38
+ end
@@ -0,0 +1,52 @@
1
+ class Fluentd
2
+ module Setting
3
+ module SectionConfig
4
+ extend ActiveSupport::Concern
5
+
6
+ def to_config
7
+ _attributes = attributes.dup
8
+ if %i(parse format buffer storage).include?(section_name)
9
+ _attributes["@type"] = _attributes.delete("type")
10
+ _attributes["@log_level"] = _attributes.delete("log_level")
11
+ end
12
+ argument = _attributes.delete(self._argument_name.to_s) || ""
13
+ attrs, elements = parse_attributes(_attributes)
14
+ if attrs.present? || elements.present?
15
+ config_element(section_name, argument, attrs.sort.to_h, elements)
16
+ end
17
+ end
18
+
19
+ def parse_attributes(attributes)
20
+ sections, params = attributes.partition do |key, _|
21
+ self._sections.key?(key.to_sym)
22
+ end
23
+ elements = sections.map do |key, section_params|
24
+ if section_params.present?
25
+ self._sections[key.to_sym].new(section_params).to_config
26
+ end
27
+ end.compact
28
+ attrs = params.to_h.reject do |key, value|
29
+ skip?(key.to_sym, value)
30
+ end
31
+ unless attrs.blank?
32
+ attrs["@type"] = params.to_h["@type"] if params.to_h.key?("@type")
33
+ end
34
+ return attrs, elements
35
+ end
36
+
37
+ # copy from Fluent::Test::Helpers#config_element
38
+ def config_element(name = 'test', argument = '', params = {}, elements = [])
39
+ Fluent::Config::Element.new(name, argument, params, elements)
40
+ end
41
+
42
+ def skip?(key, value)
43
+ return true if value.blank?
44
+ if self._defaults.key?(key)
45
+ self.class.reformat_value(key, self._defaults[key]) == self.class.reformat_value(key, value)
46
+ else
47
+ false
48
+ end
49
+ end
50
+ end
51
+ end
52
+ end
@@ -6,25 +6,32 @@ class Fluentd
6
6
  module ClassMethods
7
7
  def parse_section(name, definition)
8
8
  config_section(name, **definition.slice(:required, :multi, :alias)) do
9
- definition.except(:section, :argument, :required, :multi, :alias).each do |_param_name, _definition|
10
- if _definition[:section]
11
- parse_section(_param_name, _definition)
12
- else
13
- if self._types.key?(_param_name)
14
- if _definition.key?(:default)
15
- self._defaults[_param_name] = _definition[:default]
16
- self._required[_param_name] = false
17
- self.clear_validators! # We register PresenceValidator only
18
- end
19
- self._secrets[_param_name] = _definition[:secret] if _definition.key?(:secret)
20
- self._aliases[name] = _definition[:alias] if _definition.key?(:alias)
21
- self._deprecated_params[name] = _definition[:deprecated] if _definition.key?(:deprecated)
22
- self._obsoleted_params[name] = _definition[:obsoleted] if _definition.key?(:obsoleted)
23
- self._list[name] = _definition[:list] if _definition.key?(:list)
24
- self._value_types[name] = _definition[:value_types] if _definition.key?(:value_types)
25
- self._symbolize_keys = _definition[:symbolize_keys] if _definition.key?(:symbolize_keys)
9
+ if %i(buffer storage parse format).include?(name)
10
+ define_all_attributes(name)
11
+ else
12
+ definition.except(:section, :argument, :required, :multi, :alias).each do |_param_name, _definition|
13
+ if _definition[:section]
14
+ parse_section(_param_name, _definition)
26
15
  else
27
- config_param(_param_name, _definition[:type], **_definition.except(:type))
16
+ if self._types.key?(_param_name)
17
+ if _definition.key?(:default) && self._required[_param_name] && _definition[:default].present?
18
+ self._defaults[_param_name] = _definition[:default]
19
+ self._required[_param_name] = false
20
+ end
21
+ self._secrets[_param_name] = _definition[:secret] if _definition.key?(:secret)
22
+ self._aliases[name] = _definition[:alias] if _definition.key?(:alias)
23
+ self._deprecated_params[name] = _definition[:deprecated] if _definition.key?(:deprecated)
24
+ self._obsoleted_params[name] = _definition[:obsoleted] if _definition.key?(:obsoleted)
25
+ self._list[name] = _definition[:list] if _definition.key?(:list)
26
+ self._value_types[name] = _definition[:value_types] if _definition.key?(:value_types)
27
+ self._symbolize_keys = _definition[:symbolize_keys] if _definition.key?(:symbolize_keys)
28
+ else
29
+ if _definition[:argument]
30
+ config_argument(_param_name, _definition[:type], **_definition.except(:type))
31
+ else
32
+ config_param(_param_name, _definition[:type], **_definition.except(:type))
33
+ end
34
+ end
28
35
  end
29
36
  end
30
37
  end
@@ -5,16 +5,6 @@ class Fluentd
5
5
 
6
6
  register_plugin("input", "forward")
7
7
 
8
- def self.initial_params
9
- {
10
- bind: "0.0.0.0",
11
- port: 24224,
12
- linger_timeout: 0,
13
- chunk_size_limit: nil,
14
- chunk_size_warn_limit: nil,
15
- }
16
- end
17
-
18
8
  def common_options
19
9
  [
20
10
  :bind, :port
@@ -29,6 +19,35 @@ class Fluentd
29
19
  :blocking_timeout,
30
20
  ]
31
21
  end
22
+
23
+ def transport_common_options
24
+ [
25
+ :ca_path,
26
+ :cert_path,
27
+ :private_key_path,
28
+ :private_key_passphrase
29
+ ]
30
+ end
31
+
32
+ def transport_advanced_options
33
+ [
34
+ :version,
35
+ :ciphers,
36
+ :insecure,
37
+ :client_cert_auth,
38
+ :ca_cert_path,
39
+ :ca_private_key_path,
40
+ :ca_private_key_passphrase,
41
+ :generate_private_key_length,
42
+ :generate_cert_country,
43
+ :generate_cert_state,
44
+ :generate_cert_locality,
45
+ :generate_cert_common_name,
46
+ :generate_cert_common_name,
47
+ :generate_cert_expiration,
48
+ :generate_cert_digest
49
+ ]
50
+ end
32
51
  end
33
52
  end
34
53
  end
@@ -6,17 +6,15 @@ class Fluentd
6
6
  register_plugin("input", "syslog")
7
7
 
8
8
  def self.initial_params
9
- {
10
- bind: "0.0.0.0",
11
- port: 5140,
9
+ params = {
12
10
  parse_type: "syslog",
13
11
  parse: {
14
12
  "0" => {
15
13
  "type" => "syslog"
16
14
  }
17
- },
18
- protocol_type: :udp,
15
+ }
19
16
  }
17
+ super.compact.deep_merge(params)
20
18
  end
21
19
 
22
20
  def common_options
@@ -27,7 +25,9 @@ class Fluentd
27
25
 
28
26
  def hidden_options
29
27
  [
30
- :parse
28
+ :parse,
29
+ :transport,
30
+ :blocking_timeout
31
31
  ]
32
32
  end
33
33
  end
@@ -10,7 +10,7 @@ class Fluentd
10
10
  end
11
11
 
12
12
  def self.initial_params
13
- {
13
+ params = {
14
14
  buffer_type: "memory",
15
15
  buffer: {
16
16
  "0" => {
@@ -23,6 +23,7 @@ class Fluentd
23
23
  }
24
24
  }
25
25
  }
26
+ super.except(:transport).compact.deep_merge(params)
26
27
  end
27
28
 
28
29
  # TODO overwrite this method to support transport parameter and transport section
@@ -39,9 +40,20 @@ class Fluentd
39
40
  def hidden_options
40
41
  [
41
42
  :inject, :buffer,
43
+ # Deprecated options
42
44
  :host, :port,
43
- # We don't support TLS configuration via fluentd-ui for now.
44
- :transport, :tls_version, :tls_ciphers, :tls_insecure_mode, :tls_verify_hostname, :tls_cert_path
45
+ :transport
46
+ ].concat(tls_options) # Hide TLS related options to customize view
47
+ end
48
+
49
+ def tls_options
50
+ [
51
+ :tls_version,
52
+ :tls_ciphers,
53
+ :tls_insecure_mode,
54
+ :tls_allow_self_signed_cert,
55
+ :tls_verify_hostname,
56
+ :tls_cert_path
45
57
  ]
46
58
  end
47
59
  end
@@ -7,17 +7,6 @@ class Fluentd
7
7
  config_param(:capped, :bool, default: false)
8
8
  config_param(:capped_size, :size, default: nil)
9
9
 
10
- # NOTE: fluent-plugin-mongo defines database parameter as required parameter
11
- # But Fluentd tells us that the database parameter is not required.
12
- validates :database, presence: true
13
- validate :validate_collection
14
-
15
- def validate_collection
16
- if tag_mapped.blank? && collection.blank?
17
- errors.add(:collection, :blank)
18
- end
19
- end
20
-
21
10
  def self.initial_params
22
11
  {
23
12
  host: "127.0.0.1",
@@ -26,14 +26,28 @@ class Fluentd
26
26
 
27
27
  def common_options
28
28
  [
29
- :pattern, :aws_key_id, :aws_sec_key,
29
+ :pattern,
30
30
  :s3_region, :s3_bucket, :use_ssl, :path,
31
31
  ]
32
32
  end
33
33
 
34
- def hidden
34
+ def hidden_options
35
35
  [
36
- :secondary, :inject, :buffer
36
+ :secondary, :inject, :buffer, :format,
37
+ ] + aws_credential_options + aws_credential_sections
38
+ end
39
+
40
+ def aws_credential_options
41
+ [
42
+ :aws_key_id, :aws_sec_key,
43
+ ]
44
+ end
45
+
46
+ def aws_credential_sections
47
+ [
48
+ :assume_role_credentials,
49
+ :instance_profile_credentials,
50
+ :shared_credentials
37
51
  ]
38
52
  end
39
53
  end
@@ -6,17 +6,18 @@ class Fluentd
6
6
  register_plugin("output", "tdlog")
7
7
 
8
8
  def self.initial_params
9
- {
9
+ params = {
10
10
  pattern: "td.*.*",
11
11
  buffer_type: "file",
12
12
  buffer: {
13
13
  "0" => {
14
- "@type" => "file",
14
+ "type" => "file",
15
15
  "path" => "/var/log/td-agent/buffer/td",
16
16
  }
17
17
  },
18
18
  auto_create_table: true,
19
19
  }
20
+ super.compact.deep_merge(params)
20
21
  end
21
22
 
22
23
  def common_options
@@ -9,11 +9,15 @@ class Fluentd
9
9
  include Fluentd::Setting::Configurable
10
10
  include Fluentd::Setting::SectionParser
11
11
  include Fluentd::Setting::PluginParameter
12
+ include Fluentd::Setting::SectionConfig
13
+ include Fluentd::Setting::RegistryLoader
12
14
 
13
15
  class_attribute :_klass, :_block, :_blocks
14
16
  class_attribute :section_name, :required, :multi, :alias
17
+ class_attribute :_dumped_config
15
18
  self._klass = klass
16
19
  self._blocks = []
20
+ self._dumped_config = {}
17
21
  end
18
22
  end
19
23
 
@@ -0,0 +1,17 @@
1
+ class Fluentd
2
+ module Setting
3
+ module Type
4
+ class Object < ActiveModel::Type::Value
5
+ def type
6
+ :object
7
+ end
8
+
9
+ private
10
+
11
+ def cast_value(value)
12
+ value
13
+ end
14
+ end
15
+ end
16
+ end
17
+ end
@@ -1,16 +1,18 @@
1
1
  = render "shared/setting_errors"
2
2
 
3
3
  - # NOTE: plugin_setting_form_action_url is defined at SettingConcern
4
- = form_with(model: @setting, scope: "setting", url: plugin_setting_form_action_url(@fluentd), local: true, class: "ignore-rails-error-div", builder: FluentdFormBuilder) do |f|
5
- - @setting.common_options.each do |key|
4
+ = form_with(model: setting, scope: "setting", url: plugin_setting_form_action_url(fluentd), local: true, class: "ignore-rails-error-div", builder: FluentdFormBuilder) do |f|
5
+ - setting.common_options.each do |key|
6
6
  = f.field(key)
7
7
 
8
+ = render "shared/vue/transport_section", setting: setting, form: f
9
+
8
10
  .card.card-body.bg-light
9
11
  %h4{"data-toggle" => "collapse", "href" => "#advanced-setting"}
10
12
  = icon('fa-caret-down')
11
13
  = t('terms.advanced_setting')
12
14
  #advanced-setting.collapse
13
- - @setting.advanced_options.each do |key|
15
+ - setting.advanced_options.each do |key|
14
16
  = f.field(key)
15
17
 
16
18
  = f.submit t('fluentd.common.finish'), class: "btn btn-lg btn-primary pull-right"
@@ -0,0 +1,18 @@
1
+ = render "shared/setting_errors"
2
+
3
+ - # NOTE: plugin_setting_form_action_url is defined at SettingConcern
4
+ = form_with(model: setting, scope: "setting", url: plugin_setting_form_action_url(fluentd), local: true, class: "ignore-rails-error-div", builder: FluentdFormBuilder) do |f|
5
+ - setting.common_options.each do |key|
6
+ = f.field(key)
7
+
8
+ = render "shared/vue/out_forward_setting", setting: setting
9
+
10
+ .card.card-body.bg-light
11
+ %h4{"data-toggle" => "collapse", "href" => "#advanced-setting"}
12
+ = icon('fa-caret-down')
13
+ = t('terms.advanced_setting')
14
+ #advanced-setting.collapse
15
+ - setting.advanced_options.each do |key|
16
+ = f.field(key)
17
+
18
+ = f.submit t('fluentd.common.finish'), class: "btn btn-lg btn-primary pull-right"
@@ -0,0 +1,18 @@
1
+ = render "shared/setting_errors"
2
+
3
+ - # NOTE: plugin_setting_form_action_url is defined at SettingConcern
4
+ = form_with(model: setting, scope: "setting", url: plugin_setting_form_action_url(fluentd), local: true, class: "ignore-rails-error-div", builder: FluentdFormBuilder) do |f|
5
+ - setting.common_options.each do |key|
6
+ = f.field(key)
7
+
8
+ = render "shared/vue/out_s3_setting", setting: setting
9
+
10
+ .card.card-body.bg-light
11
+ %h4{"data-toggle" => "collapse", "href" => "#advanced-setting"}
12
+ = icon('fa-caret-down')
13
+ = t('terms.advanced_setting')
14
+ #advanced-setting.collapse
15
+ - setting.advanced_options.each do |key|
16
+ = f.field(key)
17
+
18
+ = f.submit t('fluentd.common.finish'), class: "btn btn-lg btn-primary pull-right"
@@ -5,45 +5,49 @@
5
5
 
6
6
  #plugin-setting
7
7
  - # NOTE: plugin_setting_form_action_url is defined at SettingConcern
8
- = form_with(model: @setting, scope: :setting, url: plugin_setting_form_action_url(@fluentd), class: "ignore-rails-error-div", builder: FluentdFormBuilder) do |form|
8
+ = form_with(model: setting, scope: :setting, url: plugin_setting_form_action_url(fluentd), local: true, class: "ignore-rails-error-div", builder: FluentdFormBuilder) do |form|
9
9
  - @setting.common_options.each do |key|
10
10
  = form.field(key)
11
11
 
12
12
  - if @setting.have_buffer_section?
13
13
  %owned-plugin-form{"v-bind:id" => "'buffer-section'",
14
14
  "v-bind:options-json" => "'#{Fluent::Plugin::BUFFER_REGISTRY.map.keys.to_json}'",
15
- "v-bind:initial-plugin-name" => "'#{@setting.buffer_type}'",
15
+ "v-bind:initial-plugin-name" => "'#{setting.buffer_type}'",
16
+ "v-bind:initial-params-json" => "'#{setting.class.initial_params[:buffer]["0"].to_json}'",
16
17
  "v-bind:plugin-type" => "'buffer'",
17
18
  "v-bind:plugin-label" => "'Buffer'"}
18
19
 
19
- - if @setting.have_storage_section?
20
+ - if setting.have_storage_section?
20
21
  %owned-plugin-form{"v-bind:id" => "'storage-section'",
21
22
  "v-bind:options-json" => "'#{Fluent::Plugin::STORAGE_REGISTRY.map.keys.to_json}'",
22
- "v-bind:initial-plugin-name" => "'#{@setting.storage_type}'",
23
+ "v-bind:initial-plugin-name" => "'#{setting.storage_type}'",
24
+ "v-bind:initial-params-json" => "'#{setting.class.initial_params[:storage]["0"].to_json}'",
23
25
  "v-bind:plugin-type" => "'storage'",
24
26
  "v-bind:plugin-label" => "'Storage'"}
25
27
 
26
- - if @setting.have_parse_section?
28
+ - if setting.have_parse_section?
27
29
  %owned-plugin-form{"v-bind:id" => "'parse-section'",
28
30
  "v-bind:options-json" => "'#{Fluent::Plugin::PARSER_REGISTRY.map.keys.to_json}'",
29
- "v-bind:initial-plugin-name" => "'#{@setting.parse_type}'",
31
+ "v-bind:initial-plugin-name" => "'#{setting.parse_type}'",
32
+ "v-bind:initial-params-json" => "'#{setting.class.initial_params[:parse]["0"].to_json}'",
30
33
  "v-bind:plugin-type" => "'parse'",
31
34
  "v-bind:plugin-label" => "'Parse'"}
32
35
 
33
- - if @setting.have_format_section?
36
+ - if setting.have_format_section?
34
37
  %owned-plugin-form{"v-bind:id" => "'format-section'",
35
38
  "v-bind:options-json" => "'#{Fluent::Plugin::FORMATTER_REGISTRY.map.keys.to_json}'",
36
- "v-bind:initial-plugin-name" => "'#{@setting.format_type}'",
39
+ "v-bind:initial-plugin-name" => "'#{setting.format_type}'",
40
+ "v-bind:initial-params-json" => "'#{setting.class.initial_params[:format]["0"].to_json}'",
37
41
  "v-bind:plugin-type" => "'format'",
38
42
  "v-bind:plugin-label" => "'Format'"}
39
43
 
40
- - if @setting.advanced_options.present?
44
+ - if setting.advanced_options.present?
41
45
  .card.card-body.bg-light
42
46
  %h4{"data-toggle" => "collapse", "href" => "#advanced-setting"}
43
47
  = icon('fa-caret-down')
44
48
  = t('terms.advanced_setting')
45
49
  #advanced-setting.collapse
46
- - @setting.advanced_options.each do |key|
50
+ - setting.advanced_options.each do |key|
47
51
  = form.field(key)
48
52
 
49
53
  = form.submit t('fluentd.common.finish'), class: "btn btn-lg btn-primary float-right mt-3"