fluentd-ui 1.1.0 → 1.2.0
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.
- checksums.yaml +4 -4
- data/.eslintrc.js +2 -1
- data/ChangeLog.md +8 -0
- data/Gemfile.lock +28 -28
- data/app/assets/stylesheets/application.css +1 -0
- data/app/controllers/misc_controller.rb +8 -0
- data/app/controllers/plugins_controller.rb +20 -3
- data/app/decorators/plugin_decorator.rb +18 -0
- data/app/helpers/application_helper.rb +0 -10
- data/app/javascript/packs/application.js +7 -5
- data/app/javascript/packs/codemirror.js +2 -1
- data/app/javascript/packs/{aws_credential.js → components/aws_credential.js} +0 -0
- data/app/javascript/packs/components/config_field.js +110 -0
- data/app/javascript/packs/{grep_container.js → components/grep_container.js} +1 -1
- data/app/javascript/packs/{grep_pattern.js → components/grep_pattern.js} +4 -2
- data/app/javascript/packs/components/owned_plugin_form.js +88 -0
- data/app/javascript/packs/{parser_multiline_form.js → components/parser_multiline_form.js} +0 -0
- data/app/javascript/packs/{owned_plugin_form.js → components/parser_plugin_form.js} +12 -20
- data/app/javascript/packs/{transport_config.js → components/transport_config.js} +0 -0
- data/app/javascript/packs/filter_grep_setting.js +2 -2
- data/app/javascript/packs/fluent_log.js +1 -1
- data/app/javascript/packs/in_tail_parse.js +20 -16
- data/app/javascript/packs/{notification.js → navigation.js} +8 -6
- data/app/javascript/packs/nested_settings.js +1 -1
- data/app/javascript/packs/out_forward_setting.js +3 -3
- data/app/javascript/packs/out_s3_setting.js +3 -3
- data/app/javascript/packs/plugin_setting.js +4 -2
- data/app/javascript/packs/settings.js +2 -2
- data/app/javascript/packs/store/index.js +21 -0
- data/app/javascript/packs/store/modules/parser_params.js +83 -0
- data/app/javascript/packs/transport_section.js +2 -2
- data/app/javascript/packs/treeview.js +1 -1
- data/app/models/concerns/fluentd/setting/configurable.rb +1 -1
- data/app/models/concerns/fluentd/setting/formatter_advanced_options.rb +22 -0
- data/app/models/concerns/fluentd/setting/label.rb +1 -1
- data/app/models/concerns/fluentd/setting/parser_advanced_options.rb +27 -0
- data/app/models/concerns/fluentd/setting/plugin.rb +12 -1
- data/app/models/fluentd/setting/buffer_file.rb +4 -0
- data/app/models/fluentd/setting/buffer_memory.rb +4 -0
- data/app/models/fluentd/setting/parser_ltsv.rb +1 -1
- data/app/models/fluentd/setting/parser_regexp.rb +2 -2
- data/app/models/fluentd/setting/parser_syslog.rb +2 -8
- data/app/models/plugin.rb +4 -4
- data/app/views/fluentd/settings/in_tail/_form.html.haml +3 -3
- data/app/views/fluentd/settings/in_tail/after_file_choose.html.haml +1 -1
- data/app/views/fluentd/settings/source_and_output.html.haml +10 -10
- data/app/views/layouts/application.html.erb +2 -28
- data/app/views/misc/information.html.haml +48 -44
- data/app/views/plugins/installed.html.haml +49 -60
- data/app/views/plugins/recommended.html.haml +54 -54
- data/app/views/sessions/new.html.haml +10 -4
- data/app/views/shared/settings/_form.html.haml +16 -13
- data/app/views/shared/vue/_aws_credential.html.haml +2 -4
- data/app/views/shared/vue/_config_field.html.haml +16 -30
- data/app/views/shared/vue/_grep_container.html.haml +13 -14
- data/app/views/shared/vue/_grep_pattern.html.haml +10 -6
- data/app/views/shared/vue/_in_tail_parse.html.haml +13 -13
- data/app/views/shared/vue/_navigation.html.haml +38 -0
- data/app/views/shared/vue/_owned_plugin_form.html.haml +18 -13
- data/app/views/shared/vue/_parser_multiline_form.html.haml +5 -3
- data/app/views/shared/vue/_parser_plugin_form.html.haml +40 -0
- data/app/views/shared/vue/_setting.html.haml +20 -0
- data/app/views/shared/vue/_sidemenu.html.haml +40 -0
- data/app/views/shared/vue/_transport_section.html.haml +10 -8
- data/app/views/shared/vue/_treeview.html.haml +30 -0
- data/config/locales/translation_en.yml +1 -0
- data/config/locales/translation_ja.yml +1 -0
- data/lib/fluentd-ui/version.rb +1 -1
- data/lib/regexp_preview/multi_line.rb +4 -3
- data/lib/regexp_preview/single_line.rb +4 -3
- data/package.json +3 -1
- data/test/test_helper.rb +5 -0
- data/yarn.lock +111 -5
- metadata +62 -78
- data/app/javascript/packs/config_field.js +0 -93
- data/app/views/shared/_global_nav.html.erb +0 -80
- data/app/views/shared/_modal.html.erb +0 -25
- data/app/views/shared/vue/_notification.html.erb +0 -27
- data/app/views/shared/vue/_setting.html.erb +0 -25
- data/app/views/shared/vue/_treeview.html.erb +0 -33
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: be7de017082475652832bd83534a77e2e537ef4edafb79332a76bb4e2c364f88
|
4
|
+
data.tar.gz: 5cbf21ac7f5aed68aeb319af32515a5abc00d76183d63fcbc716c3d3da39908e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 11dbeaaa1f4c2ce5a07d7e66719f308ec64fa12fb48824cfbc05ab472e7a6f9b2b7ed601a466eaf266c8bf1d791f4862d43949d06d1adc33ff83b7aa41d00ec7
|
7
|
+
data.tar.gz: 874ea532e955403d02fe332cba270f2788b67be71f4eb5a19ab8646807dfeaddba5013ad994321325f345df70b30f023539a8fa253e1357e03fb9a1bc1d262f1
|
data/.eslintrc.js
CHANGED
data/ChangeLog.md
CHANGED
@@ -1,3 +1,11 @@
|
|
1
|
+
## Release 1.2.0 - 2018/11/05
|
2
|
+
|
3
|
+
* [maintenance] Add app/javascript/packs/components [#275](https://github.com/fluent/fluentd-ui/pull/275)
|
4
|
+
* [maintenance] Fix eslint errors [#274](https://github.com/fluent/fluentd-ui/pull/274)
|
5
|
+
* [fixed] Set label properly [#270](https://github.com/fluent/fluentd-ui/pull/270)
|
6
|
+
* [maintenance] Use bootstrap-vue [#269](https://github.com/fluent/fluentd-ui/pull/269) [#273](https://github.com/fluent/fluentd-ui/pull/273)
|
7
|
+
* [fixed] Fix preview functionality in in_tail wizard [#267](https://github.com/fluent/fluentd-ui/pull/267)
|
8
|
+
|
1
9
|
## Release 1.1.0 - 2018/09/25
|
2
10
|
|
3
11
|
* [maintenance] Suppress JavaScript warnings [#265](https://github.com/fluent/fluentd-ui/pull/265)
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
fluentd-ui (1.
|
4
|
+
fluentd-ui (1.2.0)
|
5
5
|
addressable
|
6
6
|
bootsnap (>= 1.1.0)
|
7
7
|
bundler
|
@@ -82,31 +82,31 @@ GEM
|
|
82
82
|
io-like (~> 0.3.0)
|
83
83
|
arel (9.0.0)
|
84
84
|
aws-eventstream (1.0.1)
|
85
|
-
aws-partitions (1.
|
86
|
-
aws-sdk-core (3.
|
85
|
+
aws-partitions (1.105.0)
|
86
|
+
aws-sdk-core (3.30.0)
|
87
87
|
aws-eventstream (~> 1.0)
|
88
88
|
aws-partitions (~> 1.0)
|
89
89
|
aws-sigv4 (~> 1.0)
|
90
90
|
jmespath (~> 1.0)
|
91
|
-
aws-sdk-kms (1.
|
92
|
-
aws-sdk-core (~> 3)
|
91
|
+
aws-sdk-kms (1.9.0)
|
92
|
+
aws-sdk-core (~> 3, >= 3.26.0)
|
93
93
|
aws-sigv4 (~> 1.0)
|
94
|
-
aws-sdk-s3 (1.
|
95
|
-
aws-sdk-core (~> 3, >= 3.
|
94
|
+
aws-sdk-s3 (1.21.0)
|
95
|
+
aws-sdk-core (~> 3, >= 3.26.0)
|
96
96
|
aws-sdk-kms (~> 1)
|
97
97
|
aws-sigv4 (~> 1.0)
|
98
|
-
aws-sdk-sqs (1.
|
99
|
-
aws-sdk-core (~> 3)
|
98
|
+
aws-sdk-sqs (1.7.0)
|
99
|
+
aws-sdk-core (~> 3, >= 3.26.0)
|
100
100
|
aws-sigv4 (~> 1.0)
|
101
101
|
aws-sigv4 (1.0.3)
|
102
|
-
better_errors (2.
|
102
|
+
better_errors (2.5.0)
|
103
103
|
coderay (>= 1.0.0)
|
104
104
|
erubi (>= 1.0.0)
|
105
105
|
rack (>= 0.9.0)
|
106
106
|
bindex (0.5.0)
|
107
107
|
binding_of_caller (0.8.0)
|
108
108
|
debug_inspector (>= 0.0.1)
|
109
|
-
bootsnap (1.3.
|
109
|
+
bootsnap (1.3.2)
|
110
110
|
msgpack (~> 1.0)
|
111
111
|
bson (4.3.0)
|
112
112
|
builder (3.2.3)
|
@@ -122,7 +122,7 @@ GEM
|
|
122
122
|
launchy
|
123
123
|
childprocess (0.9.0)
|
124
124
|
ffi (~> 1.0, >= 1.0.11)
|
125
|
-
chromedriver-helper (1.
|
125
|
+
chromedriver-helper (2.1.0)
|
126
126
|
archive-zip (~> 0.10)
|
127
127
|
nokogiri (~> 1.8)
|
128
128
|
coderay (1.1.2)
|
@@ -152,29 +152,29 @@ GEM
|
|
152
152
|
erubi (1.7.1)
|
153
153
|
erubis (2.7.0)
|
154
154
|
excon (0.62.0)
|
155
|
-
factory_bot (4.11.
|
155
|
+
factory_bot (4.11.1)
|
156
156
|
activesupport (>= 3.0.0)
|
157
|
-
factory_bot_rails (4.11.
|
158
|
-
factory_bot (~> 4.11.
|
157
|
+
factory_bot_rails (4.11.1)
|
158
|
+
factory_bot (~> 4.11.1)
|
159
159
|
railties (>= 3.0.0)
|
160
|
-
faraday (0.15.
|
160
|
+
faraday (0.15.3)
|
161
161
|
multipart-post (>= 1.2, < 3)
|
162
162
|
ffi (1.9.25)
|
163
|
-
fluent-plugin-elasticsearch (2.
|
163
|
+
fluent-plugin-elasticsearch (2.12.0)
|
164
164
|
elasticsearch
|
165
165
|
excon
|
166
166
|
fluentd (>= 0.14.20)
|
167
167
|
fluent-plugin-mongo (1.1.2)
|
168
168
|
fluentd (>= 0.14.12, < 2)
|
169
169
|
mongo (~> 2.6.0)
|
170
|
-
fluent-plugin-s3 (1.1.
|
170
|
+
fluent-plugin-s3 (1.1.6)
|
171
171
|
aws-sdk-s3 (~> 1.0)
|
172
172
|
aws-sdk-sqs (~> 1.0)
|
173
173
|
fluentd (>= 0.14.2, < 2)
|
174
174
|
fluent-plugin-td (1.0.0)
|
175
175
|
fluentd (>= 0.14.13, < 2)
|
176
176
|
td-client (~> 1.0)
|
177
|
-
fluentd (1.2.
|
177
|
+
fluentd (1.2.6)
|
178
178
|
cool.io (>= 1.4.5, < 2.0.0)
|
179
179
|
dig_rb (~> 1.0.0)
|
180
180
|
http_parser.rb (>= 0.5.1, < 0.7.0)
|
@@ -230,7 +230,7 @@ GEM
|
|
230
230
|
nokogiri (>= 1.5.9)
|
231
231
|
mail (2.7.0)
|
232
232
|
mini_mime (>= 0.1.1)
|
233
|
-
marcel (0.3.
|
233
|
+
marcel (0.3.3)
|
234
234
|
mimemagic (~> 0.3.2)
|
235
235
|
method_source (0.9.0)
|
236
236
|
mimemagic (0.3.2)
|
@@ -243,7 +243,7 @@ GEM
|
|
243
243
|
multi_json (1.13.1)
|
244
244
|
multipart-post (2.0.0)
|
245
245
|
nio4r (2.3.1)
|
246
|
-
nokogiri (1.8.
|
246
|
+
nokogiri (1.8.5)
|
247
247
|
mini_portile2 (~> 2.3.0)
|
248
248
|
power_assert (1.1.3)
|
249
249
|
pry (0.11.3)
|
@@ -254,7 +254,7 @@ GEM
|
|
254
254
|
public_suffix (3.0.3)
|
255
255
|
puma (3.12.0)
|
256
256
|
rack (2.0.5)
|
257
|
-
rack-proxy (0.6.
|
257
|
+
rack-proxy (0.6.5)
|
258
258
|
rack
|
259
259
|
rack-test (1.1.0)
|
260
260
|
rack (>= 1.0, < 3)
|
@@ -294,7 +294,7 @@ GEM
|
|
294
294
|
sexp_processor (~> 4.9)
|
295
295
|
rubyzip (1.2.2)
|
296
296
|
safe_yaml (1.0.4)
|
297
|
-
sass (3.
|
297
|
+
sass (3.6.0)
|
298
298
|
sass-listen (~> 4.0.0)
|
299
299
|
sass-listen (4.0.0)
|
300
300
|
rb-fsevent (~> 0.9, >= 0.9.4)
|
@@ -337,13 +337,13 @@ GEM
|
|
337
337
|
test-unit-activesupport (1.0.9)
|
338
338
|
activesupport
|
339
339
|
test-unit
|
340
|
-
test-unit-capybara (1.0.
|
340
|
+
test-unit-capybara (1.0.7)
|
341
341
|
capybara (>= 2.1.0)
|
342
342
|
json
|
343
343
|
test-unit (>= 2.5.3)
|
344
344
|
test-unit-notify (1.0.4)
|
345
345
|
test-unit (>= 2.4.9)
|
346
|
-
test-unit-rails (5.2.
|
346
|
+
test-unit-rails (5.2.2)
|
347
347
|
rails (>= 5.1.2)
|
348
348
|
test-unit (>= 3.1.7)
|
349
349
|
test-unit-activesupport (>= 1.0.8)
|
@@ -358,9 +358,9 @@ GEM
|
|
358
358
|
timecop (0.9.1)
|
359
359
|
tzinfo (1.2.5)
|
360
360
|
thread_safe (~> 0.1)
|
361
|
-
tzinfo-data (1.2018.
|
361
|
+
tzinfo-data (1.2018.7)
|
362
362
|
tzinfo (>= 1.0.0)
|
363
|
-
web-console (3.
|
363
|
+
web-console (3.7.0)
|
364
364
|
actionview (>= 5.0)
|
365
365
|
activemodel (>= 5.0)
|
366
366
|
bindex (>= 0.4.0)
|
@@ -405,4 +405,4 @@ DEPENDENCIES
|
|
405
405
|
webmock (~> 3.3.0)
|
406
406
|
|
407
407
|
BUNDLED WITH
|
408
|
-
1.16.
|
408
|
+
1.16.6
|
@@ -12,6 +12,7 @@
|
|
12
12
|
*
|
13
13
|
*= require font-awesome
|
14
14
|
*= require bootstrap/dist/css/bootstrap
|
15
|
+
*= require bootstrap-vue/dist/bootstrap-vue
|
15
16
|
*= require startbootstrap-sb-admin/css/sb-admin.css
|
16
17
|
*= require datatables.net-bs4/css/dataTables.bootstrap4.css
|
17
18
|
*= require codemirror/lib/codemirror
|
@@ -4,6 +4,8 @@ require "zip"
|
|
4
4
|
class MiscController < ApplicationController
|
5
5
|
after_action :update!, only: [:update_fluentd_ui]
|
6
6
|
|
7
|
+
helper_method :env_items
|
8
|
+
|
7
9
|
def show
|
8
10
|
redirect_to misc_information_path
|
9
11
|
end
|
@@ -75,4 +77,10 @@ class MiscController < ApplicationController
|
|
75
77
|
def update!
|
76
78
|
FluentdUiRestart.perform_later
|
77
79
|
end
|
80
|
+
|
81
|
+
def env_items
|
82
|
+
@env.map do |key, value|
|
83
|
+
{ key: key, value: value }
|
84
|
+
end
|
85
|
+
end
|
78
86
|
end
|
@@ -1,10 +1,12 @@
|
|
1
1
|
class PluginsController < ApplicationController
|
2
|
+
helper_method :plugins_json
|
3
|
+
|
2
4
|
def index
|
3
5
|
redirect_to installed_plugins_path
|
4
6
|
end
|
5
7
|
|
6
8
|
def installed
|
7
|
-
@plugins = Plugin.installed.reject{|plugin| plugin.processing? }
|
9
|
+
@plugins = PluginDecorator.decorate_collection(Plugin.installed.reject{|plugin| plugin.processing? })
|
8
10
|
end
|
9
11
|
|
10
12
|
def recommended
|
@@ -12,14 +14,23 @@ class PluginsController < ApplicationController
|
|
12
14
|
end
|
13
15
|
|
14
16
|
def updated
|
15
|
-
@plugins = Plugin.installed.reject{|plugin| plugin.latest_version? }
|
17
|
+
@plugins = PluginDecorator.decorate_collection(Plugin.installed.reject{|plugin| plugin.latest_version? })
|
16
18
|
end
|
17
19
|
|
18
20
|
def install
|
19
21
|
params[:plugins].each do |gem_name|
|
20
22
|
GemInstallerJob.perform_later(gem_name)
|
21
23
|
end
|
22
|
-
|
24
|
+
respond_to do |format|
|
25
|
+
format.html do
|
26
|
+
redirect_to plugins_path
|
27
|
+
end
|
28
|
+
format.json do
|
29
|
+
plugins = PluginDecorator.decorate_collection(Plugin.recommended.select {|item| params[:plugins].include?(item.gem_name)})
|
30
|
+
render json: plugins.map(&:to_hash).to_json
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
23
34
|
end
|
24
35
|
|
25
36
|
def uninstall
|
@@ -41,4 +52,10 @@ class PluginsController < ApplicationController
|
|
41
52
|
end
|
42
53
|
redirect_to plugins_path
|
43
54
|
end
|
55
|
+
|
56
|
+
private
|
57
|
+
|
58
|
+
def plugins_json
|
59
|
+
JSON.pretty_generate(@plugins.map(&:to_hash))
|
60
|
+
end
|
44
61
|
end
|
@@ -10,4 +10,22 @@ class PluginDecorator < Draper::Decorator
|
|
10
10
|
I18n.t("terms.not_installed")
|
11
11
|
end
|
12
12
|
end
|
13
|
+
|
14
|
+
def to_hash
|
15
|
+
{
|
16
|
+
is_installed: installed?,
|
17
|
+
is_processing: processing?,
|
18
|
+
uninstall_button: "plugin-modal-#{gem_name}",
|
19
|
+
name: gem_name,
|
20
|
+
authors: authors,
|
21
|
+
summary: summary,
|
22
|
+
api_version: api_version,
|
23
|
+
category: category,
|
24
|
+
status: status,
|
25
|
+
installed_version: installed_version,
|
26
|
+
latest_version: latest_version,
|
27
|
+
is_latest_version: latest_version?,
|
28
|
+
rubygems_org_page: rubygems_org_page
|
29
|
+
}
|
30
|
+
end
|
13
31
|
end
|
@@ -27,16 +27,6 @@ module ApplicationHelper
|
|
27
27
|
}[locale] || locale
|
28
28
|
end
|
29
29
|
|
30
|
-
def language_menu
|
31
|
-
html = ""
|
32
|
-
I18n.available_locales.each do |locale|
|
33
|
-
text = (locale == current_locale ? icon("fa-check") : "")
|
34
|
-
text << language_name(locale)
|
35
|
-
html << %Q|<li>#{link_to text , "?lang=#{locale}"}</li>|
|
36
|
-
end
|
37
|
-
raw html
|
38
|
-
end
|
39
|
-
|
40
30
|
def link_to_other(text, path, **options)
|
41
31
|
if current_page?(path)
|
42
32
|
# NOTE: sb-admin set style for element name instead of class name, such as ".nav a". So use "a" element even if it isn't a link.
|
@@ -7,8 +7,6 @@
|
|
7
7
|
// To reference this file, add <%= javascript_pack_tag 'application' %> to the appropriate
|
8
8
|
// layout file, like app/views/layouts/application.html.erb
|
9
9
|
|
10
|
-
console.log("Hello World from Webpacker");
|
11
|
-
|
12
10
|
import jQuery from "jquery/dist/jquery";
|
13
11
|
|
14
12
|
window.$ = jQuery;
|
@@ -21,20 +19,24 @@ Rails.start();
|
|
21
19
|
|
22
20
|
import "popper.js/dist/popper";
|
23
21
|
import "bootstrap/dist/js/bootstrap";
|
24
|
-
import "datatables.net/js/jquery.dataTables";
|
25
22
|
import "startbootstrap-sb-admin/js/sb-admin";
|
26
|
-
import "startbootstrap-sb-admin/js/sb-admin-datatables";
|
27
23
|
|
28
24
|
import Vue from "vue/dist/vue.esm";
|
25
|
+
import Vuex from "vuex/dist/vuex.esm";
|
26
|
+
import BootstrapVue from "bootstrap-vue/dist/bootstrap-vue.esm";
|
27
|
+
|
28
|
+
Vue.use(Vuex);
|
29
|
+
Vue.use(BootstrapVue);
|
29
30
|
|
30
31
|
Vue.filter("to_json", function (value) {
|
31
32
|
return JSON.stringify(value);
|
32
33
|
});
|
33
34
|
|
34
35
|
window.Vue = Vue;
|
36
|
+
window.Vuex = Vuex;
|
35
37
|
|
36
38
|
import "../stylesheets/application.scss";
|
37
39
|
|
38
|
-
|
40
|
+
window.addEventListener("load", () => {
|
39
41
|
$("[data-toggle=tooltip]").tooltip();
|
40
42
|
});
|
@@ -43,7 +43,7 @@ CodeMirror.defineMode("fluentd", function() {
|
|
43
43
|
stream.eatWhile(/[^ \t#]/);
|
44
44
|
state.context = "inner-definition-keyword-appeared";
|
45
45
|
return "variable";
|
46
|
-
case "inner-definition-keyword-appeared":
|
46
|
+
case "inner-definition-keyword-appeared": {
|
47
47
|
let eatBuiltin = function(stream, state) {
|
48
48
|
stream.eatWhile(/[^#]/);
|
49
49
|
if (stream.current().match(/\\$/)) {
|
@@ -55,6 +55,7 @@ CodeMirror.defineMode("fluentd", function() {
|
|
55
55
|
eatBuiltin(stream, state);
|
56
56
|
state.context = "inner-definition";
|
57
57
|
return "builtin";
|
58
|
+
}
|
58
59
|
default:
|
59
60
|
stream.eat(/[^<>#]+/);
|
60
61
|
return "string";
|
File without changes
|
@@ -0,0 +1,110 @@
|
|
1
|
+
/* global _ */
|
2
|
+
"use strict";
|
3
|
+
import "lodash/lodash";
|
4
|
+
import store from "../store";
|
5
|
+
|
6
|
+
const ConfigField = {
|
7
|
+
template: "#vue-config-field",
|
8
|
+
props: [
|
9
|
+
"pluginType",
|
10
|
+
"option",
|
11
|
+
"initialTextValue",
|
12
|
+
],
|
13
|
+
|
14
|
+
data: function() {
|
15
|
+
return {
|
16
|
+
selectedValue: null,
|
17
|
+
checkboxValue: null,
|
18
|
+
textValue: null,
|
19
|
+
};
|
20
|
+
},
|
21
|
+
|
22
|
+
filters: {
|
23
|
+
humanize: function(value) {
|
24
|
+
return _.capitalize(value.replace(/_/g, " "));
|
25
|
+
}
|
26
|
+
},
|
27
|
+
|
28
|
+
mounted: function() {
|
29
|
+
if (this.option.type === "enum") {
|
30
|
+
this.selectedValue = this.option.default;
|
31
|
+
} else if (this.option.type === "bool") {
|
32
|
+
this.checkboxValue = this.option.default;
|
33
|
+
} else {
|
34
|
+
this.textValue = this.initialTextValue || this.option.default;
|
35
|
+
}
|
36
|
+
|
37
|
+
if (this.option.name === "message_format") {
|
38
|
+
store.commit("parserParams/setMessageFormat", this.selectedValue);
|
39
|
+
}
|
40
|
+
if (this.option.name === "rfc5424_time_format") {
|
41
|
+
store.commit("parserParams/setRfc5424TimeFormat", this.textValue);
|
42
|
+
}
|
43
|
+
if (this.option.name === "with_priority") {
|
44
|
+
store.commit("parserParams/setWithPriority", this.checkboxValue);
|
45
|
+
}
|
46
|
+
if (this.option.name === "expression") {
|
47
|
+
store.commit("parserParams/Expression", this.textValue);
|
48
|
+
}
|
49
|
+
if (this.option.name === "timeFormat") {
|
50
|
+
store.commit("parserParams/timeFormat", this.textValue);
|
51
|
+
}
|
52
|
+
},
|
53
|
+
|
54
|
+
updated: function() {
|
55
|
+
if (this.option.name === "expression") {
|
56
|
+
this.expression = this.initialExpression;
|
57
|
+
}
|
58
|
+
if (this.option.name === "time_format") {
|
59
|
+
this.timeFormat = this.initialTimeFormat;
|
60
|
+
}
|
61
|
+
},
|
62
|
+
|
63
|
+
methods: {
|
64
|
+
onChange: function(event) {
|
65
|
+
console.log("onChange", this.option.name, event.target.value);
|
66
|
+
if (this.option.name === "message_format") {
|
67
|
+
store.dispatch("parserParams/updateMessageFormat", event);
|
68
|
+
}
|
69
|
+
if (this.option.name === "rfc5424_time_format") {
|
70
|
+
store.dispatch("parserParams/updateRfc5424TimeFormat", event);
|
71
|
+
}
|
72
|
+
if (this.option.name === "with_priority") {
|
73
|
+
store.dispatch("parserParams/updateWithPriority", event);
|
74
|
+
}
|
75
|
+
if (this.option.name === "expression") {
|
76
|
+
store.dispatch("parserParams/updateExpression", event);
|
77
|
+
}
|
78
|
+
if (this.option.name === "timeFormat") {
|
79
|
+
store.dispatch("parserParams/updateTimeFormat", event);
|
80
|
+
}
|
81
|
+
this.$emit("change-parse-config", {});
|
82
|
+
},
|
83
|
+
labelId: function(pluginType, option) {
|
84
|
+
return `label_${this.inputId(pluginType, option)}`;
|
85
|
+
},
|
86
|
+
inputId: function(pluginType, option) {
|
87
|
+
if (pluginType === "output") {
|
88
|
+
return `setting_${option.name}`;
|
89
|
+
} else {
|
90
|
+
return `setting_${_.snakeCase(pluginType)}_0__${option.name}`;
|
91
|
+
}
|
92
|
+
},
|
93
|
+
inputName: function(pluginType, option) {
|
94
|
+
if (pluginType === "output") {
|
95
|
+
return `setting[${option.name}]`;
|
96
|
+
} else {
|
97
|
+
return `setting[${_.snakeCase(pluginType)}[0]][${option.name}]`;
|
98
|
+
}
|
99
|
+
},
|
100
|
+
checked: function(checked) {
|
101
|
+
if (checked === true || checked === "true") {
|
102
|
+
return "checked";
|
103
|
+
} else {
|
104
|
+
return "";
|
105
|
+
}
|
106
|
+
}
|
107
|
+
}
|
108
|
+
};
|
109
|
+
|
110
|
+
export { ConfigField as default };
|