fluentd-ui 1.0.0.alpha.2 → 1.0.0.alpha.3

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 (119) hide show
  1. checksums.yaml +4 -4
  2. data/ChangeLog.md +5 -0
  3. data/Gemfile.lock +56 -1
  4. data/README.md +2 -2
  5. data/app/controllers/api/config_definitions_controller.rb +55 -0
  6. data/app/controllers/api_controller.rb +20 -3
  7. data/app/controllers/concerns/setting_concern.rb +18 -2
  8. data/app/controllers/fluentd/settings/in_tail_controller.rb +13 -5
  9. data/app/controllers/fluentd/settings/out_forward_controller.rb +0 -9
  10. data/app/controllers/fluentd/settings/out_s3_controller.rb +0 -5
  11. data/app/controllers/fluentd/settings/out_tdlog_controller.rb +9 -0
  12. data/app/form_builders/fluentd_form_builder.rb +83 -0
  13. data/app/helpers/settings_helper.rb +81 -18
  14. data/app/javascript/packs/application.js +4 -0
  15. data/app/javascript/packs/in_tail_parse.js +159 -0
  16. data/app/javascript/packs/owned_plugin_form.js +141 -0
  17. data/app/javascript/packs/parser_multiline_form.js +51 -0
  18. data/app/javascript/packs/plugin_setting.js +19 -0
  19. data/app/models/concerns/fluentd/setting/configurable.rb +113 -0
  20. data/app/models/concerns/fluentd/setting/pattern.rb +11 -0
  21. data/app/models/concerns/fluentd/setting/plugin.rb +78 -0
  22. data/app/models/concerns/fluentd/setting/plugin_config.rb +74 -0
  23. data/app/models/concerns/fluentd/setting/plugin_parameter.rb +121 -0
  24. data/app/models/concerns/fluentd/setting/section_parser.rb +36 -0
  25. data/app/models/concerns/fluentd/setting/section_validator.rb +21 -0
  26. data/app/models/fluentd.rb +5 -5
  27. data/app/models/fluentd/setting/buffer_file.rb +23 -0
  28. data/app/models/fluentd/setting/buffer_memory.rb +17 -0
  29. data/app/models/fluentd/setting/formatter_csv.rb +21 -0
  30. data/app/models/fluentd/setting/formatter_hash.rb +19 -0
  31. data/app/models/fluentd/setting/formatter_json.rb +25 -0
  32. data/app/models/fluentd/setting/formatter_ltsv.rb +21 -0
  33. data/app/models/fluentd/setting/formatter_msgpack.rb +13 -0
  34. data/app/models/fluentd/setting/formatter_out_file.rb +21 -0
  35. data/app/models/fluentd/setting/formatter_single_value.rb +20 -0
  36. data/app/models/fluentd/setting/formatter_stdout.rb +19 -0
  37. data/app/models/fluentd/setting/formatter_tsv.rb +21 -0
  38. data/app/models/fluentd/setting/in_forward.rb +7 -17
  39. data/app/models/fluentd/setting/in_http.rb +13 -19
  40. data/app/models/fluentd/setting/in_monitor_agent.rb +6 -19
  41. data/app/models/fluentd/setting/in_syslog.rb +14 -12
  42. data/app/models/fluentd/setting/in_tail.rb +7 -84
  43. data/app/models/fluentd/setting/out_elasticsearch.rb +12 -21
  44. data/app/models/fluentd/setting/out_forward.rb +22 -66
  45. data/app/models/fluentd/setting/out_mongo.rb +20 -26
  46. data/app/models/fluentd/setting/out_s3.rb +18 -30
  47. data/app/models/fluentd/setting/out_stdout.rb +21 -18
  48. data/app/models/fluentd/setting/out_tdlog.rb +35 -0
  49. data/app/models/fluentd/setting/parser_apache.rb +13 -0
  50. data/app/models/fluentd/setting/parser_apache2.rb +13 -0
  51. data/app/models/fluentd/setting/parser_apache_error.rb +13 -0
  52. data/app/models/fluentd/setting/parser_csv.rb +22 -0
  53. data/app/models/fluentd/setting/parser_in_http.rb +13 -0
  54. data/app/models/fluentd/setting/parser_json.rb +25 -0
  55. data/app/models/fluentd/setting/parser_ltsv.rb +30 -0
  56. data/app/models/fluentd/setting/parser_msgpack.rb +13 -0
  57. data/app/models/fluentd/setting/parser_multiline.rb +24 -0
  58. data/app/models/fluentd/setting/parser_nginx.rb +13 -0
  59. data/app/models/fluentd/setting/parser_none.rb +19 -0
  60. data/app/models/fluentd/setting/parser_regexp.rb +26 -0
  61. data/app/models/fluentd/setting/parser_syslog.rb +29 -0
  62. data/app/models/fluentd/setting/parser_tsv.rb +19 -0
  63. data/app/models/fluentd/setting/section.rb +38 -0
  64. data/app/models/fluentd/setting/storage_local.rb +22 -0
  65. data/app/models/fluentd/setting/type/array.rb +17 -0
  66. data/app/models/fluentd/setting/type/bool.rb +18 -0
  67. data/app/models/fluentd/setting/type/enum.rb +17 -0
  68. data/app/models/fluentd/setting/type/hash.rb +17 -0
  69. data/app/models/fluentd/setting/type/regexp.rb +17 -0
  70. data/app/models/fluentd/setting/type/section.rb +17 -0
  71. data/app/models/fluentd/setting/type/size.rb +17 -0
  72. data/app/models/fluentd/setting/type/time.rb +17 -0
  73. data/app/views/api/settings/_element.json.jbuilder +1 -1
  74. data/app/views/fluentd/settings/in_forward/_form.html.haml +16 -0
  75. data/app/views/fluentd/settings/in_tail/_form.html.haml +22 -29
  76. data/app/views/fluentd/settings/in_tail/after_file_choose.html.haml +1 -1
  77. data/app/views/fluentd/settings/in_tail/after_format.html.haml +4 -4
  78. data/app/views/fluentd/settings/in_tail/confirm.html.haml +5 -5
  79. data/app/views/fluentd/settings/source_and_output.html.haml +1 -1
  80. data/app/views/shared/_global_nav.html.erb +8 -8
  81. data/app/views/shared/settings/_form.html.haml +40 -9
  82. data/app/views/shared/settings/show.html.haml +4 -1
  83. data/app/views/shared/vue/_in_tail_parse.html.haml +20 -0
  84. data/app/views/shared/vue/_owned_plugin_form.html.haml +68 -0
  85. data/app/views/shared/vue/_parser_multiline_form.html.haml +19 -0
  86. data/app/views/shared/vue/_setting.html.erb +1 -1
  87. data/config/application.rb +1 -1
  88. data/config/environment.rb +3 -0
  89. data/config/initializers/types.rb +7 -0
  90. data/config/routes.rb +2 -1
  91. data/fluentd-ui.gemspec +5 -0
  92. data/lib/fluentd-ui/version.rb +1 -1
  93. data/lib/regexp_preview.rb +2 -2
  94. data/lib/regexp_preview/multi_line.rb +53 -63
  95. data/lib/regexp_preview/single_line.rb +40 -46
  96. data/spec/features/fluentd/setting/out_forward_spec.rb +1 -1
  97. data/spec/features/fluentd/setting/out_stdout_spec.rb +1 -1
  98. data/spec/features/{out_td_spec.rb → out_tdlog_spec.rb} +3 -3
  99. data/spec/lib/regexp_preview/multi_line_spec.rb +29 -34
  100. data/spec/lib/regexp_preview/single_line_spec.rb +89 -87
  101. data/spec/models/fluentd/setting/in_forward_spec.rb +75 -0
  102. data/spec/models/fluentd/setting/in_http_spec.rb +31 -0
  103. data/spec/models/fluentd/setting/in_monitor_agent_spec.rb +31 -0
  104. data/spec/models/fluentd/setting/in_syslog_spec.rb +65 -7
  105. data/spec/models/fluentd/setting/in_tail_spec.rb +47 -0
  106. data/spec/models/fluentd/setting/out_elasticsearch_spec.rb +31 -0
  107. data/spec/models/fluentd/setting/out_mongo_spec.rb +35 -12
  108. data/spec/models/fluentd/setting/out_s3_spec.rb +128 -0
  109. data/spec/models/fluentd/setting/out_stdout_spec.rb +31 -0
  110. data/spec/models/fluentd/setting/out_tdlog_spec.rb +47 -0
  111. metadata +164 -38
  112. data/app/controllers/fluentd/settings/out_td_controller.rb +0 -18
  113. data/app/helpers/fluentd/settings_helper.rb +0 -2
  114. data/app/javascript/packs/in_tail_format.js +0 -174
  115. data/app/models/fluentd/setting/common.rb +0 -185
  116. data/app/models/fluentd/setting/out_td.rb +0 -48
  117. data/app/views/shared/vue/_in_tail_format.html.erb +0 -43
  118. data/spec/models/fluentd/setting/common_spec.rb +0 -178
  119. data/spec/models/fluentd/setting/out_td_spec.rb +0 -38
@@ -2,28 +2,74 @@ module SettingsHelper
2
2
  def field(form, key, opts = {})
3
3
  html = '<div class="form-group">'
4
4
 
5
- field_resolver(form.object.column_type(key), html, form, key, opts)
5
+ field_resolver(html, form, key, opts)
6
6
 
7
7
  html << "</div>"
8
8
  html.html_safe
9
9
  end
10
10
 
11
11
  private
12
- def field_resolver(type, html, form, key, opts)
13
- case type
14
- when :hidden
15
- html << form.hidden_field(key)
16
- when :boolean, :flag
17
- boolean_field(html, form, key, opts)
18
- when :choice
19
- choice_field(html, form, key, opts)
20
- when :nested
21
- nested_field(html, form, key, opts)
22
- else
23
- other_field(html, form, key, opts)
12
+
13
+ def field_resolver(html, form, key, opts)
14
+ plugin_class = form.object.class
15
+ type = plugin_class.column_type(key)
16
+ if type && !@_used_param.key?(key)
17
+ case type
18
+ when :enum
19
+ enum_field(html, form, key, opts)
20
+ when :bool
21
+ bool_field(html, form, key, opts)
22
+ else
23
+ other_field(html, form, key, opts)
24
+ end
25
+ @_used_param[key] = true
26
+ end
27
+ if plugin_class._sections[key] && !@_used_section.key?(key)
28
+ section_field(html, form, key, opts)
29
+ @_used_section[key] = true
30
+ end
31
+ end
32
+
33
+ def section_field(html, form, key, opts = {})
34
+ klass = form.object.class._sections[key]
35
+ children = form.object.__send__(key) || { "0" => {} }
36
+ # <parse>/<format> section is not multiple in most cases
37
+ multi = if [:parse, :format].include?(key)
38
+ false
39
+ else
40
+ klass.multi
41
+ end
42
+
43
+ children.each do |index, child|
44
+ open_section_div(html, multi) do |_html|
45
+ _html << append_and_remove_links if multi
46
+ _html << h(form.label(key))
47
+ _html << section_fields(form, key, index, klass, child)
48
+ end
24
49
  end
25
50
  end
26
51
 
52
+ def open_section_div(html, multi)
53
+ html << %Q!<div class="js-nested-column #{ multi ? "js-multiple" : "" } well well-sm">!
54
+ yield html
55
+ html << "</div>"
56
+ end
57
+
58
+ def section_fields(form, key, index, klass, child)
59
+ html = ""
60
+ object = klass.new(child)
61
+ form.fields_for("#{key}[#{index}]", object) do |ff|
62
+ klass._types.keys.each do |kk|
63
+ if kk == :type
64
+ html << owned_plugin_type_field(ff, kk, key)
65
+ else
66
+ html << field(ff, kk)
67
+ end
68
+ end
69
+ end
70
+ html
71
+ end
72
+
27
73
  def nested_field(html, form, key, opts = {})
28
74
  klass = child_data(form, key)[:class]
29
75
  options = child_data(form, key)[:options]
@@ -54,28 +100,45 @@ module SettingsHelper
54
100
  end
55
101
 
56
102
  def append_and_remove_links
57
- %Q!<a class="btn btn-sm btn-outline-secondary js-append">#{icon('fa-plus')}</a> ! +
58
- %Q!<a class="btn btn-sm btn-outline-secondary js-remove" style="display:none">#{icon('fa-minus')}</a> !
103
+ %Q!<a class="btn btn-xs btn-default js-append">#{icon('fa-plus')}</a> ! +
104
+ %Q!<a class="btn btn-xs btn-default js-remove" style="display:none">#{icon('fa-minus')}</a> !
59
105
  end
60
106
 
61
107
  def child_data(form, key)
62
108
  form.object.class.children[key]
63
109
  end
64
110
 
65
- def choice_field(html, form, key, opts = {})
111
+ def enum_field(html, form, key, opts = {})
66
112
  html << h(form.label(key))
67
113
  html << " " # NOTE: Adding space for padding
68
- html << form.select(key, form.object.values_of(key), opts)
114
+ html << form.select(key, form.object.list_of(key), opts, { class: "enum" })
69
115
  end
70
116
 
71
- def boolean_field(html, form, key, opts = {})
117
+ def bool_field(html, form, key, opts = {})
72
118
  html << form.check_box(key, {}, "true", "false")
73
119
  html << " " # NOTE: Adding space for padding
74
120
  html << h(form.label(key))
75
121
  end
76
122
 
77
123
  def other_field(html, form, key, opts = {})
124
+ return unless form.object.respond_to?(key)
78
125
  html << h(form.label(key))
79
126
  html << form.text_field(key, class: "form-control")
80
127
  end
128
+
129
+ def owned_plugin_type_field(form, key, plugin_type)
130
+ registry_type = case plugin_type
131
+ when :parse
132
+ "PARSER_REGISTRY"
133
+ when :format
134
+ "FORMATTER_REGISTRY"
135
+ end
136
+ plugin_registry = Fluent::Plugin.const_get("#{registry_type}")
137
+ html = '<div class="form-group">'
138
+ html << form.label(key)
139
+ html << " " # NOTE: Adding space for padding
140
+ html << form.select(key, plugin_registry.map.keys, {}, { class: "owned" })
141
+ html << '</div>'
142
+ html
143
+ end
81
144
  end
@@ -34,3 +34,7 @@ Vue.filter('to_json', function (value) {
34
34
  window.Vue = Vue
35
35
 
36
36
  import '../stylesheets/application.scss'
37
+
38
+ $(document).ready(() => {
39
+ $("[data-toggle=tooltip]").tooltip()
40
+ })
@@ -0,0 +1,159 @@
1
+ 'use strict'
2
+ import 'lodash/lodash'
3
+ import 'popper.js/dist/popper'
4
+ import 'bootstrap/dist/js/bootstrap'
5
+ import OwnedPluginForm from './owned_plugin_form'
6
+
7
+ $(document).ready(() => {
8
+ new Vue({
9
+ el: '#in-tail-parse',
10
+ props: [
11
+ "path",
12
+ "parseType"
13
+ ],
14
+ data: function() {
15
+ return {
16
+ highlightedLines: null
17
+ }
18
+ },
19
+ computed: {
20
+ token: function() {
21
+ return Rails.csrfToken()
22
+ }
23
+ },
24
+ components: {
25
+ 'owned-plugin-form': OwnedPluginForm
26
+ },
27
+ watch: {
28
+ 'parse.expression': function() {
29
+ console.log(`parse.expression: ${this.parse.expression}`)
30
+ this.preview()
31
+ },
32
+ 'parse.time_format': function() {
33
+ console.log(`parse.time_format: ${this.parse.time_format}`)
34
+ this.preview()
35
+ },
36
+ 'parseType': function() {
37
+ this.preview()
38
+ },
39
+ },
40
+ beforeMount: function() {
41
+ this.path = this.$el.attributes.path.nodeValue;
42
+ },
43
+ mounted: function() {
44
+ this.parse = {}
45
+ this.$on("hook:updated", () => {
46
+ $("[data-toggle=tooltip]").tooltip("dispose")
47
+ $("[data-toggle=tooltip]").tooltip("enable")
48
+ })
49
+ },
50
+ methods: {
51
+ onChangePluginName: function(name) {
52
+ console.log("onChangePluginName")
53
+ this.parseType = name
54
+ this.parse = {} // clear parser plugin configuration
55
+ },
56
+ onChangeParseConfig: function(data) {
57
+ console.log("onChangeParseConfig", data)
58
+ _.merge(this.parse, data)
59
+ this.preview()
60
+ },
61
+ onChangeFormats: function(data) {
62
+ console.log("in_tail_parse:onChangeFormats", data)
63
+ _.merge(this.parse, data)
64
+ this.preview()
65
+ },
66
+ updateHighlightedLines: function(matches) {
67
+ if (!matches) {
68
+ this.highlightedLines = null
69
+ return
70
+ }
71
+
72
+ let $container = $('<div>')
73
+ _.each(matches, (match) => {
74
+ const colors = ["#ff9", "#cff", "#fcf", "#dfd"]
75
+ const whole = match.whole
76
+ let html = ""
77
+ let _matches = []
78
+ let lastPos = 0
79
+
80
+ _.each(match.matches, (m) => {
81
+ let matched = m.matched
82
+ if (!matched) {
83
+ return
84
+ }
85
+ // Ignore empty matched with "foobar".match(/foo(.*?)bar/)[1] #=> ""
86
+ if (matched.length === 0) {
87
+ return
88
+ }
89
+ // rotate color
90
+ let currentColor = colors.shift()
91
+ colors.push(currentColor)
92
+
93
+ // create highlighted range HTML
94
+ let $highlighted = $("<span>").text(matched)
95
+ $highlighted.attr({
96
+ "class": "regexp-preview",
97
+ "data-toggle": "tooltip",
98
+ "data-placement": "top",
99
+ "title": m.key,
100
+ 'style': 'background-color:' + currentColor
101
+ })
102
+ let highlightedHtml = $highlighted.wrap("<div>").parent().html()
103
+ let pos = {
104
+ start: m.pos[0],
105
+ end: m.pos[1]
106
+ }
107
+ if (pos.start > 0) {
108
+ html += _.escape(whole.substring(lastPos, pos.start))
109
+ }
110
+ html += highlightedHtml
111
+ lastPos = pos.end
112
+ })
113
+ html += whole.substring(lastPos)
114
+
115
+ $container.append(html)
116
+ $container.append("<br>")
117
+ })
118
+
119
+ this.highlightedLines = $container.html()
120
+ this.$emit("hook:updated")
121
+ },
122
+
123
+ preview: function() {
124
+ console.log("preview!!!!")
125
+ if (this.previewAjax && this.previewAjax.state() === "pending") {
126
+ this.previewAjax.abort()
127
+ }
128
+
129
+ this.previewAjax = $.ajax({
130
+ method: "POST",
131
+ url: "/api/regexp_preview",
132
+ headers: {
133
+ 'X-CSRF-Token': this.token
134
+ },
135
+ data: {
136
+ parse_type: _.isEmpty(this.parseType) ? "regexp" : this.parseType,
137
+ file: this.path,
138
+ plugin_config: this.parse
139
+ }
140
+ }).then(
141
+ (result) => {
142
+ if (result.matches) {
143
+ this.updateHighlightedLines(result.matches)
144
+ } else {
145
+ console.error(result.error)
146
+ this.previewError = result.error
147
+ }
148
+ },
149
+ (error) => {
150
+ this.highlightedLines = null
151
+ // console.error(error.responseText)
152
+ if (error.stack) {
153
+ console.error(error.stack)
154
+ }
155
+ })
156
+ }
157
+ }
158
+ })
159
+ })
@@ -0,0 +1,141 @@
1
+ 'use strict'
2
+
3
+ import ParserMultilineForm from './parser_multiline_form'
4
+
5
+ const OwnedPluginForm = {
6
+ template: "#vue-owned-plugin-form",
7
+ components: {
8
+ "parser-multiline-form": ParserMultilineForm,
9
+ },
10
+ props: [
11
+ "id",
12
+ "optionsJson",
13
+ "initialPluginName",
14
+ "pluginType",
15
+ "pluginLabel"
16
+ ],
17
+ data: () => {
18
+ return {
19
+ pluginName: "",
20
+ options: [],
21
+ commonOptions: [],
22
+ advancedOptions: [],
23
+ expression: null,
24
+ timeFormat: null,
25
+ unwatchExpression: null,
26
+ unwatchTimeFormat: null
27
+ }
28
+ },
29
+
30
+ computed: {
31
+ token: function() {
32
+ return Rails.csrfToken()
33
+ }
34
+ },
35
+
36
+ mounted: function() {
37
+ this.options = JSON.parse(this.optionsJson)
38
+ this.pluginName = this.initialPluginName
39
+ this.$on("hook:updated", () => {
40
+ console.log("hook:updated")
41
+ $("[data-toggle=tooltip]").tooltip("dispose")
42
+ $("[data-toggle=tooltip]").tooltip("enable")
43
+ })
44
+ this.$once("data-loaded", () => {
45
+ this.updateSection()
46
+ })
47
+ this.$emit("data-loaded")
48
+ },
49
+
50
+ methods: {
51
+ onChange: function() {
52
+ this.updateSection()
53
+ if (this.pluginType === "parse") {
54
+ this.$emit("change-plugin-name", this.pluginName)
55
+ }
56
+ },
57
+
58
+ onChangeFormats: function(data) {
59
+ console.log("ownedPluginForm:onChangeFormats", data)
60
+ this.$emit("change-formats", data)
61
+ },
62
+
63
+ updateSection: function() {
64
+ $.ajax({
65
+ method: "GET",
66
+ url: "/api/config_definitions",
67
+ headers: {
68
+ 'X-CSRF-Token': this.token
69
+ },
70
+ data: {
71
+ type: this.pluginType,
72
+ name: this.pluginName
73
+ }
74
+ }).then((data) => {
75
+ this.commonOptions = data.commonOptions
76
+ let foundExpression = false
77
+ let foundTimeFormat = false
78
+ _.each(this.commonOptions, (option) => {
79
+ if (option.name === "expression") {
80
+ foundExpression = true
81
+ this.expression = option.default
82
+ this.unwatchExpression = this.$watch("expression", (newValue, oldValue) => {
83
+ console.log(newValue)
84
+ this.$emit("change-parse-config", {
85
+ "expression": this.expression,
86
+ "time_format": this.timeFormat
87
+ })
88
+ })
89
+ }
90
+ if (option.name === "time_format") {
91
+ foundTimeFormat = true
92
+ this.timeFormat = option.default
93
+ this.unwatchTimeFormat = this.$watch("timeFormat", (newValue, oldValue) => {
94
+ console.log({"watch time_format": newValue})
95
+ this.$emit("change-parse-config", {
96
+ "expression": this.expression,
97
+ "time_format": this.timeFormat
98
+ })
99
+ })
100
+ }
101
+
102
+ if (!foundExpression && this.unwatchExpression) {
103
+ this.expression = null
104
+ this.unwatchExpression()
105
+ this.unwatchExpression = null
106
+ }
107
+ if (!foundTimeFormat && this.unwatchTimeFormat) {
108
+ this.timeFormat = null
109
+ this.unwatchTimeFormat()
110
+ this.unwatchTimeFormat = null
111
+ }
112
+ })
113
+ })
114
+ },
115
+
116
+ selectId: function(pluginType) {
117
+ return `setting_${pluginType}_type`
118
+ },
119
+ selectClass: function(pluginType) {
120
+ return `${pluginType} form-control`
121
+ },
122
+ selectName: function(pluginType) {
123
+ return `setting[${pluginType}_type]`
124
+ },
125
+ inputId: function(pluginType, option) {
126
+ return `setting_${pluginType}_0__${option.name}`
127
+ },
128
+ inputName: function(pluginType, option) {
129
+ return `setting[${pluginType}[0]][${option.name}]`
130
+ },
131
+ checked: function(checked) {
132
+ if (checked === true || checked === "true") {
133
+ return "checked"
134
+ } else {
135
+ return ""
136
+ }
137
+ }
138
+ }
139
+ }
140
+
141
+ export { OwnedPluginForm as default }
@@ -0,0 +1,51 @@
1
+ 'use strict'
2
+ import 'lodash/lodash'
3
+ const ParserMultilineForm = {
4
+ template: "#vue-parser-multiline-form",
5
+ props: [
6
+ "pluginType",
7
+ "commonOptions"
8
+ ],
9
+
10
+ data: function() {
11
+ return {
12
+ formatFirstline: "",
13
+ formats: "",
14
+ formatFirstlineDesc: ""
15
+ }
16
+ },
17
+
18
+ watch: {
19
+ "formatFirstLine": function(newValue, oldValue) {
20
+ console.log(`watch formatFirstLine: ${newValue}`)
21
+ this.$emit("change-formats", {
22
+ "format_firstline": this.formatFirstline,
23
+ "formats": this.formats
24
+ })
25
+ },
26
+ "formats": function(newValue, oldValue) {
27
+ console.log(`watch formats: ${newValue}`)
28
+ this.$emit("change-formats", {
29
+ "format_firstline": this.formatFirstline,
30
+ "formats": this.formats
31
+ })
32
+ },
33
+ "commonOptions": function(newValue, oldValue) {
34
+ const option = _.find(newValue, (o) => {
35
+ return o.name === "format_firstline"
36
+ })
37
+ this.formatFirstlineDesc = option.desc
38
+ }
39
+ },
40
+
41
+ methods: {
42
+ textareaId: function(pluginType) {
43
+ return `setting_${pluginType}_0__formats`
44
+ },
45
+ textareaName: function(pluginType) {
46
+ return `setting[${pluginType}[0]][formats]`
47
+ }
48
+ }
49
+ }
50
+
51
+ export { ParserMultilineForm as default }