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.

Files changed (80) hide show
  1. checksums.yaml +4 -4
  2. data/.eslintrc.js +2 -1
  3. data/ChangeLog.md +8 -0
  4. data/Gemfile.lock +28 -28
  5. data/app/assets/stylesheets/application.css +1 -0
  6. data/app/controllers/misc_controller.rb +8 -0
  7. data/app/controllers/plugins_controller.rb +20 -3
  8. data/app/decorators/plugin_decorator.rb +18 -0
  9. data/app/helpers/application_helper.rb +0 -10
  10. data/app/javascript/packs/application.js +7 -5
  11. data/app/javascript/packs/codemirror.js +2 -1
  12. data/app/javascript/packs/{aws_credential.js → components/aws_credential.js} +0 -0
  13. data/app/javascript/packs/components/config_field.js +110 -0
  14. data/app/javascript/packs/{grep_container.js → components/grep_container.js} +1 -1
  15. data/app/javascript/packs/{grep_pattern.js → components/grep_pattern.js} +4 -2
  16. data/app/javascript/packs/components/owned_plugin_form.js +88 -0
  17. data/app/javascript/packs/{parser_multiline_form.js → components/parser_multiline_form.js} +0 -0
  18. data/app/javascript/packs/{owned_plugin_form.js → components/parser_plugin_form.js} +12 -20
  19. data/app/javascript/packs/{transport_config.js → components/transport_config.js} +0 -0
  20. data/app/javascript/packs/filter_grep_setting.js +2 -2
  21. data/app/javascript/packs/fluent_log.js +1 -1
  22. data/app/javascript/packs/in_tail_parse.js +20 -16
  23. data/app/javascript/packs/{notification.js → navigation.js} +8 -6
  24. data/app/javascript/packs/nested_settings.js +1 -1
  25. data/app/javascript/packs/out_forward_setting.js +3 -3
  26. data/app/javascript/packs/out_s3_setting.js +3 -3
  27. data/app/javascript/packs/plugin_setting.js +4 -2
  28. data/app/javascript/packs/settings.js +2 -2
  29. data/app/javascript/packs/store/index.js +21 -0
  30. data/app/javascript/packs/store/modules/parser_params.js +83 -0
  31. data/app/javascript/packs/transport_section.js +2 -2
  32. data/app/javascript/packs/treeview.js +1 -1
  33. data/app/models/concerns/fluentd/setting/configurable.rb +1 -1
  34. data/app/models/concerns/fluentd/setting/formatter_advanced_options.rb +22 -0
  35. data/app/models/concerns/fluentd/setting/label.rb +1 -1
  36. data/app/models/concerns/fluentd/setting/parser_advanced_options.rb +27 -0
  37. data/app/models/concerns/fluentd/setting/plugin.rb +12 -1
  38. data/app/models/fluentd/setting/buffer_file.rb +4 -0
  39. data/app/models/fluentd/setting/buffer_memory.rb +4 -0
  40. data/app/models/fluentd/setting/parser_ltsv.rb +1 -1
  41. data/app/models/fluentd/setting/parser_regexp.rb +2 -2
  42. data/app/models/fluentd/setting/parser_syslog.rb +2 -8
  43. data/app/models/plugin.rb +4 -4
  44. data/app/views/fluentd/settings/in_tail/_form.html.haml +3 -3
  45. data/app/views/fluentd/settings/in_tail/after_file_choose.html.haml +1 -1
  46. data/app/views/fluentd/settings/source_and_output.html.haml +10 -10
  47. data/app/views/layouts/application.html.erb +2 -28
  48. data/app/views/misc/information.html.haml +48 -44
  49. data/app/views/plugins/installed.html.haml +49 -60
  50. data/app/views/plugins/recommended.html.haml +54 -54
  51. data/app/views/sessions/new.html.haml +10 -4
  52. data/app/views/shared/settings/_form.html.haml +16 -13
  53. data/app/views/shared/vue/_aws_credential.html.haml +2 -4
  54. data/app/views/shared/vue/_config_field.html.haml +16 -30
  55. data/app/views/shared/vue/_grep_container.html.haml +13 -14
  56. data/app/views/shared/vue/_grep_pattern.html.haml +10 -6
  57. data/app/views/shared/vue/_in_tail_parse.html.haml +13 -13
  58. data/app/views/shared/vue/_navigation.html.haml +38 -0
  59. data/app/views/shared/vue/_owned_plugin_form.html.haml +18 -13
  60. data/app/views/shared/vue/_parser_multiline_form.html.haml +5 -3
  61. data/app/views/shared/vue/_parser_plugin_form.html.haml +40 -0
  62. data/app/views/shared/vue/_setting.html.haml +20 -0
  63. data/app/views/shared/vue/_sidemenu.html.haml +40 -0
  64. data/app/views/shared/vue/_transport_section.html.haml +10 -8
  65. data/app/views/shared/vue/_treeview.html.haml +30 -0
  66. data/config/locales/translation_en.yml +1 -0
  67. data/config/locales/translation_ja.yml +1 -0
  68. data/lib/fluentd-ui/version.rb +1 -1
  69. data/lib/regexp_preview/multi_line.rb +4 -3
  70. data/lib/regexp_preview/single_line.rb +4 -3
  71. data/package.json +3 -1
  72. data/test/test_helper.rb +5 -0
  73. data/yarn.lock +111 -5
  74. metadata +62 -78
  75. data/app/javascript/packs/config_field.js +0 -93
  76. data/app/views/shared/_global_nav.html.erb +0 -80
  77. data/app/views/shared/_modal.html.erb +0 -25
  78. data/app/views/shared/vue/_notification.html.erb +0 -27
  79. data/app/views/shared/vue/_setting.html.erb +0 -25
  80. data/app/views/shared/vue/_treeview.html.erb +0 -33
@@ -16,7 +16,7 @@ const GrepContainer = {
16
16
  return {
17
17
  grepType: "regexp",
18
18
  patterns: [true],
19
- }
19
+ };
20
20
  },
21
21
  filters: {
22
22
  humanize: function(value) {
@@ -14,7 +14,7 @@ const GrepPattern = {
14
14
  return {
15
15
  key: null,
16
16
  pattern: null,
17
- }
17
+ };
18
18
  },
19
19
 
20
20
  filters: {
@@ -30,10 +30,12 @@ const GrepPattern = {
30
30
  remove: function(event) {
31
31
  this.$emit("remove-grep-pattern", this.grepType, this.subIndex);
32
32
  },
33
+ labelId: function(name, index, subIndex) {
34
+ return `label_${this.inputId(name, index, subIndex)}`;
35
+ },
33
36
  inputId: function(name, index, subIndex) {
34
37
  return `setting_${this.containerType}_${index}_${this.grepType}_${subIndex}__${name}`;
35
38
  },
36
-
37
39
  inputName: function(name, index, subIndex) {
38
40
  return `setting[${this.containerType}[${index}]][${this.grepType}[${subIndex}]][${name}]`;
39
41
  }
@@ -0,0 +1,88 @@
1
+ /* global _ */
2
+ "use strict";
3
+
4
+ import "lodash/lodash";
5
+ import ConfigField from "./config_field";
6
+
7
+ const OwnedPluginForm = {
8
+ template: "#vue-owned-plugin-form",
9
+ components: {
10
+ "config-field": ConfigField
11
+ },
12
+ props: [
13
+ "id",
14
+ "optionsJson",
15
+ "initialPluginName",
16
+ "initialParamsJson",
17
+ "pluginType",
18
+ "pluginLabel"
19
+ ],
20
+ data: () => {
21
+ return {
22
+ pluginName: "",
23
+ options: [],
24
+ initialParams: {},
25
+ commonOptions: [],
26
+ advancedOptions: [],
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.initialParams = JSON.parse(this.initialParamsJson || "{}");
39
+ this.pluginName = this.initialPluginName;
40
+ this.$once("data-loaded", () => {
41
+ this.updateSection();
42
+ });
43
+ this.$emit("data-loaded");
44
+ },
45
+
46
+ methods: {
47
+ onChange: function() {
48
+ this.updateSection();
49
+ if (this.pluginType === "parse") {
50
+ this.$emit("change-plugin-name", this.pluginName);
51
+ }
52
+ },
53
+
54
+ onChangeFormats: function(data) {
55
+ console.log("ownedPluginForm:onChangeFormats", data);
56
+ this.$emit("change-formats", data);
57
+ },
58
+
59
+ updateSection: function() {
60
+ $.ajax({
61
+ method: "GET",
62
+ url: `${relativeUrlRoot}/api/config_definitions`,
63
+ headers: {
64
+ "X-CSRF-Token": this.token
65
+ },
66
+ data: {
67
+ type: this.pluginType,
68
+ name: this.pluginName
69
+ }
70
+ }).then((data) => {
71
+ this.commonOptions = data.commonOptions;
72
+ this.advancedOptions = data.advancedOptions;
73
+ });
74
+ },
75
+
76
+ selectId: function(pluginType) {
77
+ return `setting_${pluginType}_type`;
78
+ },
79
+ selectClass: function(pluginType) {
80
+ return `${pluginType} form-control`;
81
+ },
82
+ selectName: function(pluginType) {
83
+ return `setting[${pluginType}_type]`;
84
+ }
85
+ }
86
+ };
87
+
88
+ export { OwnedPluginForm as default };
@@ -4,9 +4,10 @@
4
4
  import "lodash/lodash";
5
5
  import ParserMultilineForm from "./parser_multiline_form";
6
6
  import ConfigField from "./config_field";
7
+ import store from "../store";
7
8
 
8
- const OwnedPluginForm = {
9
- template: "#vue-owned-plugin-form",
9
+ const ParserPluginForm = {
10
+ template: "#vue-parser-plugin-form",
10
11
  components: {
11
12
  "parser-multiline-form": ParserMultilineForm,
12
13
  "config-field": ConfigField
@@ -43,38 +44,28 @@ const OwnedPluginForm = {
43
44
  this.options = JSON.parse(this.optionsJson);
44
45
  this.initialParams = JSON.parse(this.initialParamsJson || "{}");
45
46
  this.pluginName = this.initialPluginName;
47
+ store.commit("parserParams/setType", this.initialPluginName);
46
48
  this.$once("data-loaded", () => {
47
49
  this.updateSection();
48
50
  });
49
51
  this.$emit("data-loaded");
50
52
  },
51
53
 
52
- updated: function() {
53
- this.$nextTick(() => {
54
- if ($("[data-toggle=tooltip]").tooltip) {
55
- $("[data-toggle=tooltip]").tooltip("dispose");
56
- $("[data-toggle=tooltip]").tooltip("enable");
57
- }
58
- });
59
- },
60
-
61
54
  methods: {
62
- onChange: function() {
55
+ onChange: function(event) {
56
+ store.dispatch("parserParams/updateType", event);
57
+ this.$emit("change-plugin-name", event.target.value);
63
58
  this.updateSection();
64
- if (this.pluginType === "parse") {
65
- this.$emit("change-plugin-name", this.pluginName);
66
- }
67
59
  },
68
60
 
69
61
  onChangeFormats: function(data) {
70
- console.log("ownedPluginForm:onChangeFormats", data);
62
+ console.log("parserPluginForm:onChangeFormats", data);
71
63
  this.$emit("change-formats", data);
72
64
  },
73
65
 
74
66
  onChangeParseConfig: function(data) {
75
- console.log("ownedPluginForm:onChangeParseConfig", data);
76
- this.expression = data.expression;
77
- this.timeFormat = data.timeFormat;
67
+ console.log("parserPluginForm:onChangeParseConfig");
68
+ this.$emit("change-parse-config", {});
78
69
  },
79
70
 
80
71
  updateSection: function() {
@@ -90,6 +81,7 @@ const OwnedPluginForm = {
90
81
  }
91
82
  }).then((data) => {
92
83
  this.commonOptions = data.commonOptions;
84
+ this.advancedOptions = data.advancedOptions;
93
85
  let foundExpression = false;
94
86
  let foundTimeFormat = false;
95
87
  _.each(this.commonOptions, (option) => {
@@ -143,4 +135,4 @@ const OwnedPluginForm = {
143
135
  }
144
136
  };
145
137
 
146
- export { OwnedPluginForm as default };
138
+ export { ParserPluginForm as default };
@@ -2,9 +2,9 @@
2
2
  "use strict";
3
3
  import "lodash/lodash";
4
4
 
5
- import GrepContainer from "./grep_container";
5
+ import GrepContainer from "./components/grep_container";
6
6
 
7
- $(document).ready(() => {
7
+ window.addEventListener("load", () => {
8
8
  new Vue({
9
9
  el: "#filter-grep-setting",
10
10
  components: {
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
- $(document).ready(()=> {
2
+ window.addEventListener("load", ()=> {
3
3
  new Vue({
4
4
  el: "#fluent-log",
5
5
  data: {
@@ -3,14 +3,21 @@
3
3
  import "lodash/lodash";
4
4
  import "popper.js/dist/popper";
5
5
  import "bootstrap/dist/js/bootstrap";
6
- import OwnedPluginForm from "./owned_plugin_form";
6
+ import ParserPluginForm from "./components/parser_plugin_form";
7
+ import store from "./store";
7
8
 
8
- $(document).ready(() => {
9
+ window.addEventListener("load", () => {
9
10
  new Vue({
10
11
  el: "#in-tail-parse",
12
+ store,
11
13
  components: {
12
- "owned-plugin-form": OwnedPluginForm
14
+ "parser-plugin-form": ParserPluginForm
13
15
  },
16
+ props: [
17
+ "initialPluginName",
18
+ "pluginType",
19
+ "pluginLabel",
20
+ ],
14
21
  data: function() {
15
22
  return {
16
23
  "path": "",
@@ -41,26 +48,23 @@ $(document).ready(() => {
41
48
  },
42
49
  mounted: function() {
43
50
  this.parse = {};
44
- this.$on("hook:updated", () => {
45
- this.$nextTick(() => {
46
- $("[data-toggle=tooltip]").tooltip("dispose");
47
- $("[data-toggle=tooltip]").tooltip("enable");
48
- });
49
- });
51
+ this.parseType = this.initialPluginName;
52
+ this.preview();
50
53
  },
51
54
  methods: {
52
55
  onChangePluginName: function(name) {
53
56
  console.log("#in-tail-parse onChangePluginName", name);
54
- this.parseType = name;
57
+ this.updateHighlightedLines([]);
55
58
  this.parse = {}; // clear parser plugin configuration
59
+ this.onChangeParseConfig();
56
60
  },
57
61
  onChangeParseConfig: function(data) {
58
- console.log("#in-tail-parse onChangeParseConfig", data);
59
- _.merge(this.parse, data);
62
+ console.log("#in-tail-parse onChangeParseConfig", store.getters["parserParams/toParams"]);
63
+ _.merge(this.parse, store.getters["parserParams/toParams"]);
60
64
  this.preview();
61
65
  },
62
66
  onChangeFormats: function(data) {
63
- console.log("in_tail_parse:onChangeFormats", data);
67
+ console.log("#in_tail_parse onChangeFormats", data);
64
68
  _.merge(this.parse, data);
65
69
  this.preview();
66
70
  },
@@ -124,9 +128,9 @@ $(document).ready(() => {
124
128
  preview: function() {
125
129
  console.log("preview!!!!");
126
130
  if (this.previewAjax && this.previewAjax.state() === "pending") {
127
- this.previewAjax.abort();
131
+ this.previewAjax.abort && this.previewAjax.abort();
128
132
  }
129
-
133
+ const parseType = store.getters["parserParams/pluginName"];
130
134
  this.previewAjax = $.ajax({
131
135
  method: "POST",
132
136
  url: `${relativeUrlRoot}/api/regexp_preview`,
@@ -134,7 +138,7 @@ $(document).ready(() => {
134
138
  "X-CSRF-Token": this.token
135
139
  },
136
140
  data: {
137
- parse_type: _.isEmpty(this.parseType) ? "regexp" : this.parseType,
141
+ parse_type: _.isEmpty(parseType) ? "regexp" : parseType,
138
142
  file: this.path,
139
143
  plugin_config: this.parse
140
144
  }
@@ -1,19 +1,21 @@
1
1
  const POLLING_INTERVAL = 3 * 1000;
2
2
  const POLLING_URL = "/polling/alerts";
3
3
 
4
- $(document).ready(()=> {
4
+ window.addEventListener("load", () => {
5
5
  new Vue({
6
- el: "#vue-notification",
7
- data: {
8
- "alerts": []
6
+ el: "#mainNav",
7
+ data: function() {
8
+ return {
9
+ alerts: []
10
+ };
9
11
  },
10
12
 
11
13
  computed: {
12
14
  alertsCount: {
13
- get: function(){ return this.alerts.length; }
15
+ get: function() { return this.alerts.length; }
14
16
  },
15
17
  hasAlerts: {
16
- get: function(){ return this.alertsCount > 0; }
18
+ get: function() { return this.alertsCount > 0; }
17
19
  }
18
20
  },
19
21
 
@@ -1,7 +1,7 @@
1
1
  /* global _ */
2
2
  "use strict";
3
3
  import "lodash/lodash";
4
- $(document).ready(()=> {
4
+ window.addEventListener("load", () => {
5
5
  var $firstSetting = $(".js-nested-column.js-multiple:first");
6
6
 
7
7
  if ($firstSetting.length === 0) {
@@ -1,9 +1,9 @@
1
1
  "use strict";
2
2
 
3
- import TransportConfig from "./transport_config";
4
- import OwnedPluginForm from "./owned_plugin_form";
3
+ import TransportConfig from "./components/transport_config";
4
+ import OwnedPluginForm from "./components/owned_plugin_form";
5
5
 
6
- $(document).ready(() => {
6
+ window.addEventListener("load", () => {
7
7
  new Vue({
8
8
  el: "#out-forward-setting",
9
9
  components: {
@@ -1,9 +1,9 @@
1
1
  "use strict";
2
2
 
3
- import OwnedPluginForm from "./owned_plugin_form";
4
- import AwsCredential from "./aws_credential";
3
+ import OwnedPluginForm from "./components/owned_plugin_form";
4
+ import AwsCredential from "./components/aws_credential";
5
5
 
6
- $(document).ready(() => {
6
+ window.addEventListener("load", () => {
7
7
  new Vue({
8
8
  el: "#out-s3-setting",
9
9
  components: {
@@ -2,13 +2,15 @@
2
2
  import "lodash/lodash";
3
3
  import "popper.js/dist/popper";
4
4
  import "bootstrap/dist/js/bootstrap";
5
- import OwnedPluginForm from "./owned_plugin_form";
5
+ import OwnedPluginForm from "./components/owned_plugin_form";
6
+ import ParserPluginForm from "./components/parser_plugin_form";
6
7
 
7
8
  window.addEventListener("load", () => {
8
9
  new Vue({
9
10
  el: "#plugin-setting",
10
11
  components: {
11
- "owned-plugin-form": OwnedPluginForm
12
+ "owned-plugin-form": OwnedPluginForm,
13
+ "parser-plugin-form": ParserPluginForm
12
14
  },
13
15
  data: () => {
14
16
  return {};
@@ -3,7 +3,7 @@
3
3
 
4
4
  import "lodash/lodash";
5
5
 
6
- $(document).ready(() => {
6
+ window.addEventListener("load", () => {
7
7
  const SettingSection = {
8
8
  template: "#vue-setting-section",
9
9
  props: [
@@ -141,7 +141,7 @@ $(document).ready(() => {
141
141
  if (_.isEmpty(data[label])) {
142
142
  this.$delete(this.sections, label);
143
143
  }
144
- })
144
+ });
145
145
  if (_.isEmpty(data["ROOT"])) {
146
146
  this.$set(this.sections, "ROOT", []);
147
147
  }
@@ -0,0 +1,21 @@
1
+ /* global process:true */
2
+ import Vue from "vue/dist/vue.esm";
3
+ import Vuex from "vuex/dist/vuex.esm";
4
+ import { createNamespaceHelpers } from "vuex/dist/vuex.esm";
5
+ import createLogger from "vuex/dist/logger";
6
+
7
+ Vue.use(Vuex);
8
+
9
+ const debug = process.env.NODE_ENV !== "production";
10
+
11
+ import parserParams from "./modules/parser_params";
12
+
13
+ const store = new Vuex.Store({
14
+ modules: {
15
+ parserParams,
16
+ },
17
+ strict: debug,
18
+ plugins: debug ? [createLogger()] : []
19
+ });
20
+
21
+ export { store as default };
@@ -0,0 +1,83 @@
1
+ "user strict";
2
+
3
+ const state = {
4
+ type: null,
5
+ expression: null,
6
+ timeFormat: null,
7
+ messageFormat: null,
8
+ rfc5424TimeFormat: null,
9
+ withPriority: null,
10
+ };
11
+
12
+ const getters = {
13
+ toParams: (state) => {
14
+ return {
15
+ expression: state.expression,
16
+ time_format: state.timeFormat,
17
+ message_format: state.messageFormat,
18
+ rfc5424_time_format: state.rfc5424TimeFormat,
19
+ with_priority: state.withPriority
20
+ };
21
+ },
22
+ pluginName: (state) => {
23
+ return state.type;
24
+ }
25
+ };
26
+
27
+ const actions = {
28
+ updateType({ commit, state }, event) {
29
+ commit("setType", event.target.value);
30
+ commit("clearParams");
31
+ },
32
+ updateExpression({ commit, state }, event) {
33
+ commit("setExpression", event.target.value);
34
+ },
35
+ updateTimeFormat({ commit, state }, event) {
36
+ commit("setTimeFormat", event.target.value);
37
+ },
38
+ updateMessageFormat({ commit, state }, event) {
39
+ commit("setMessageFormat", event.target.value);
40
+ },
41
+ updateRfc5424TimeFormat({ commit, state }, event) {
42
+ commit("setRfc5424TimeFormat", event.target.value);
43
+ },
44
+ updateWithPriority({ commit, state }, event) {
45
+ commit("setWithPriority", event.target.checked);
46
+ }
47
+ };
48
+
49
+ const mutations = {
50
+ setType(state, value) {
51
+ state.type = value;
52
+ },
53
+ setExpression(state, value) {
54
+ state.expression = value;
55
+ },
56
+ setTimeFormat(state, value) {
57
+ state.timeFormat = value;
58
+ },
59
+ setMessageFormat(state, value) {
60
+ state.messageFormat = value;
61
+ },
62
+ setRfc5424TimeFormat(state, value) {
63
+ state.rfc5424TimeFormat = value;
64
+ },
65
+ setWithPriority(state, value) {
66
+ state.withPriority = value;
67
+ },
68
+ clearParams(state) {
69
+ state.expression = null;
70
+ state.timeFormat = null;
71
+ state.messageFormat = null;
72
+ state.rfc5424TimeFormat = null;
73
+ state.withPriority = null;
74
+ }
75
+ };
76
+
77
+ export default {
78
+ namespaced: true,
79
+ state,
80
+ getters,
81
+ actions,
82
+ mutations
83
+ };