fluentd-ui 0.4.5 → 1.0.0.alpha.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 (243) hide show
  1. checksums.yaml +5 -5
  2. data/.babelrc +18 -0
  3. data/.editorconfig +11 -0
  4. data/.gitignore +7 -0
  5. data/.postcssrc.yml +3 -0
  6. data/.travis.yml +20 -4
  7. data/ChangeLog.md +7 -2
  8. data/Gemfile +8 -6
  9. data/Gemfile.lock +177 -178
  10. data/README.md +15 -10
  11. data/app/assets/stylesheets/application.css +6 -5
  12. data/app/controllers/concerns/setting_history_concern.rb +1 -1
  13. data/app/controllers/fluentd/agents_controller.rb +5 -0
  14. data/app/controllers/misc_controller.rb +2 -2
  15. data/app/controllers/plugins_controller.rb +4 -4
  16. data/app/helpers/application_helper.rb +8 -2
  17. data/app/helpers/settings_helper.rb +2 -2
  18. data/app/javascript/packs/application.js +31 -0
  19. data/app/{assets/javascripts/codemirror_fluentd.js → javascript/packs/codemirror.js} +32 -1
  20. data/app/javascript/packs/fluent_log.js +63 -0
  21. data/app/javascript/packs/in_tail_format.js +174 -0
  22. data/app/javascript/packs/nested_settings.js +40 -0
  23. data/app/javascript/packs/notification.js +60 -0
  24. data/app/javascript/packs/settings.js +122 -0
  25. data/app/javascript/packs/treeview.js +99 -0
  26. data/{vendor/assets/javascripts/.keep → app/javascript/stylesheets/application.scss} +0 -0
  27. data/app/jobs/all_plugin_check_update_job.rb +10 -0
  28. data/app/jobs/application_job.rb +2 -0
  29. data/app/{workers/fluentd_ui_restart.rb → jobs/fluentd_ui_restart_job.rb} +4 -4
  30. data/app/jobs/fluentd_ui_update_check_job.rb +11 -0
  31. data/app/{workers/gem_installer.rb → jobs/gem_installer_job.rb} +4 -5
  32. data/app/jobs/gem_uninstaller_job.rb +14 -0
  33. data/app/jobs/gem_update_check_job.rb +9 -0
  34. data/app/models/fluentd/agent.rb +9 -5
  35. data/app/models/fluentd/agent/common.rb +10 -6
  36. data/app/models/fluentd/agent/fluentd_gem.rb +2 -3
  37. data/app/models/fluentd/agent/td_agent/unix.rb +7 -5
  38. data/app/models/fluentd/setting/in_tail.rb +2 -2
  39. data/app/views/fluentd/_form.html.haml +1 -1
  40. data/app/views/fluentd/errors.html.haml +5 -6
  41. data/app/views/fluentd/log.html.haml +4 -5
  42. data/app/views/fluentd/settings/edit.html.haml +2 -1
  43. data/app/views/fluentd/settings/histories/_list.html.haml +1 -1
  44. data/app/views/fluentd/settings/histories/show.html.haml +6 -6
  45. data/app/views/fluentd/settings/in_tail/after_file_choose.html.haml +4 -3
  46. data/app/views/fluentd/settings/in_tail/after_format.html.haml +2 -2
  47. data/app/views/fluentd/settings/in_tail/confirm.html.haml +3 -3
  48. data/app/views/fluentd/settings/running_backup/show.html.haml +5 -5
  49. data/app/views/fluentd/settings/show.html.haml +7 -7
  50. data/app/views/fluentd/settings/source_and_output.html.haml +31 -18
  51. data/app/views/fluentd/show.html.haml +16 -15
  52. data/app/views/layouts/application.html.erb +31 -46
  53. data/app/views/layouts/sign_in.html.erb +9 -16
  54. data/app/views/misc/information.html.haml +13 -13
  55. data/app/views/misc/update_fluentd_ui.html.haml +3 -3
  56. data/app/views/plugins/installed.html.haml +8 -8
  57. data/app/views/plugins/recommended.html.haml +5 -5
  58. data/app/views/plugins/updated.html.haml +5 -5
  59. data/app/views/sessions/new.html.haml +5 -6
  60. data/app/views/shared/_global_nav.html.erb +9 -9
  61. data/app/views/shared/_initial_setup.html.haml +3 -3
  62. data/app/views/shared/_modal.html.erb +1 -1
  63. data/app/views/shared/settings/_form.html.haml +9 -8
  64. data/app/views/shared/settings/show.html.haml +4 -2
  65. data/app/views/shared/vue/_fluent_log.html.erb +6 -6
  66. data/app/views/shared/vue/_in_tail_format.html.erb +31 -29
  67. data/app/views/shared/vue/_notification.html.erb +5 -9
  68. data/app/views/shared/vue/_setting.html.erb +12 -10
  69. data/app/views/shared/vue/_treeview.html.erb +13 -10
  70. data/app/views/tutorials/chapter1.html.erb +3 -4
  71. data/app/views/tutorials/chapter2.html.haml +2 -2
  72. data/app/views/tutorials/chapter3.html.haml +2 -2
  73. data/app/views/tutorials/chapter4.html.haml +2 -2
  74. data/app/views/users/show.html.haml +1 -1
  75. data/bin/bundle +1 -1
  76. data/bin/fluentd-ui +1 -0
  77. data/bin/rails +1 -1
  78. data/bin/setup +16 -17
  79. data/bin/update +28 -0
  80. data/bin/webpack +15 -0
  81. data/bin/webpack-dev-server +15 -0
  82. data/bin/yarn +11 -0
  83. data/config/application.rb +18 -5
  84. data/config/boot.rb +2 -1
  85. data/config/environment.rb +1 -1
  86. data/config/environments/development.rb +27 -5
  87. data/config/environments/production.rb +34 -23
  88. data/config/environments/test.rb +7 -3
  89. data/config/initializers/application_controller_renderer.rb +8 -0
  90. data/config/initializers/assets.rb +14 -0
  91. data/config/initializers/content_security_policy.rb +25 -0
  92. data/config/initializers/cookies_serializer.rb +2 -0
  93. data/config/initializers/fluentd_ui_update_check.rb +2 -1
  94. data/config/initializers/new_framework_defaults_5_2.rb +35 -0
  95. data/config/initializers/prefetch_gem_updates.rb +4 -1
  96. data/config/initializers/wrap_parameters.rb +1 -6
  97. data/config/locales/ja.yml +61 -57
  98. data/config/routes.rb +1 -0
  99. data/config/spring.rb +6 -0
  100. data/config/webpack/development.js +5 -0
  101. data/config/webpack/environment.js +20 -0
  102. data/config/webpack/loaders/vue.js +13 -0
  103. data/config/webpack/production.js +5 -0
  104. data/config/webpack/test.js +5 -0
  105. data/config/webpacker.yml +69 -0
  106. data/fluentd-ui.gemspec +16 -6
  107. data/lib/fluentd-ui/version.rb +1 -1
  108. data/lib/regexp_preview/single_line.rb +5 -5
  109. data/package.json +19 -0
  110. data/spec/controllers/application_controller_spec.rb +2 -6
  111. data/spec/controllers/fluentd/agents_controller_spec.rb +12 -0
  112. data/spec/controllers/polling_controller_spec.rb +1 -1
  113. data/spec/factories/fluentd.rb +1 -1
  114. data/spec/factories/plugins.rb +2 -2
  115. data/spec/factories/user.rb +1 -1
  116. data/spec/features/fluentd/setting/histories_spec.rb +7 -6
  117. data/spec/features/fluentd/setting/running_backup_spec.rb +4 -3
  118. data/spec/features/setting_spec.rb +1 -0
  119. data/spec/features/source_and_output_spec.rb +16 -16
  120. data/spec/lib/regexp_preview/single_line_spec.rb +1 -1
  121. data/spec/models/fluentd_spec.rb +4 -4
  122. data/spec/spec_helper.rb +16 -4
  123. data/yarn.lock +6225 -0
  124. metadata +120 -154
  125. data/.bowerrc +0 -3
  126. data/app/assets/javascripts/application.js +0 -24
  127. data/app/assets/javascripts/codemirror.js +0 -29
  128. data/app/assets/javascripts/enable_bootstrap_tooltip.js +0 -3
  129. data/app/assets/javascripts/nested_setting.js +0 -41
  130. data/app/assets/javascripts/vue/fluent_log.js +0 -64
  131. data/app/assets/javascripts/vue/in_tail_format.js +0 -177
  132. data/app/assets/javascripts/vue/notification.js +0 -65
  133. data/app/assets/javascripts/vue/settings.js +0 -121
  134. data/app/assets/javascripts/vue/treeview.js +0 -97
  135. data/app/assets/javascripts/vue_common.js +0 -4
  136. data/app/workers/all_plugin_check_update.rb +0 -14
  137. data/app/workers/fluentd_ui_update_check.rb +0 -15
  138. data/app/workers/gem_uninstaller.rb +0 -15
  139. data/app/workers/gem_update_check.rb +0 -10
  140. data/bower.json +0 -11
  141. data/vendor/assets/javascripts/bower/.gitignore +0 -10
  142. data/vendor/assets/javascripts/bower/codemirror/.bower.json +0 -29
  143. data/vendor/assets/javascripts/bower/codemirror/bower.json +0 -16
  144. data/vendor/assets/javascripts/bower/codemirror/lib/codemirror.css +0 -309
  145. data/vendor/assets/javascripts/bower/codemirror/lib/codemirror.js +0 -8029
  146. data/vendor/assets/javascripts/bower/codemirror/theme/3024-day.css +0 -38
  147. data/vendor/assets/javascripts/bower/codemirror/theme/3024-night.css +0 -37
  148. data/vendor/assets/javascripts/bower/codemirror/theme/ambiance-mobile.css +0 -5
  149. data/vendor/assets/javascripts/bower/codemirror/theme/ambiance.css +0 -77
  150. data/vendor/assets/javascripts/bower/codemirror/theme/base16-dark.css +0 -36
  151. data/vendor/assets/javascripts/bower/codemirror/theme/base16-light.css +0 -36
  152. data/vendor/assets/javascripts/bower/codemirror/theme/blackboard.css +0 -30
  153. data/vendor/assets/javascripts/bower/codemirror/theme/cobalt.css +0 -23
  154. data/vendor/assets/javascripts/bower/codemirror/theme/eclipse.css +0 -23
  155. data/vendor/assets/javascripts/bower/codemirror/theme/elegant.css +0 -13
  156. data/vendor/assets/javascripts/bower/codemirror/theme/erlang-dark.css +0 -32
  157. data/vendor/assets/javascripts/bower/codemirror/theme/lesser-dark.css +0 -45
  158. data/vendor/assets/javascripts/bower/codemirror/theme/mbo.css +0 -35
  159. data/vendor/assets/javascripts/bower/codemirror/theme/mdn-like.css +0 -44
  160. data/vendor/assets/javascripts/bower/codemirror/theme/midnight.css +0 -45
  161. data/vendor/assets/javascripts/bower/codemirror/theme/monokai.css +0 -31
  162. data/vendor/assets/javascripts/bower/codemirror/theme/neat.css +0 -12
  163. data/vendor/assets/javascripts/bower/codemirror/theme/neo.css +0 -43
  164. data/vendor/assets/javascripts/bower/codemirror/theme/night.css +0 -26
  165. data/vendor/assets/javascripts/bower/codemirror/theme/paraiso-dark.css +0 -36
  166. data/vendor/assets/javascripts/bower/codemirror/theme/paraiso-light.css +0 -36
  167. data/vendor/assets/javascripts/bower/codemirror/theme/pastel-on-dark.css +0 -50
  168. data/vendor/assets/javascripts/bower/codemirror/theme/rubyblue.css +0 -23
  169. data/vendor/assets/javascripts/bower/codemirror/theme/solarized.css +0 -165
  170. data/vendor/assets/javascripts/bower/codemirror/theme/the-matrix.css +0 -28
  171. data/vendor/assets/javascripts/bower/codemirror/theme/tomorrow-night-bright.css +0 -35
  172. data/vendor/assets/javascripts/bower/codemirror/theme/tomorrow-night-eighties.css +0 -36
  173. data/vendor/assets/javascripts/bower/codemirror/theme/twilight.css +0 -30
  174. data/vendor/assets/javascripts/bower/codemirror/theme/vibrant-ink.css +0 -32
  175. data/vendor/assets/javascripts/bower/codemirror/theme/xq-dark.css +0 -51
  176. data/vendor/assets/javascripts/bower/codemirror/theme/xq-light.css +0 -43
  177. data/vendor/assets/javascripts/bower/codemirror/theme/zenburn.css +0 -37
  178. data/vendor/assets/javascripts/bower/es6-promise/.bower.json +0 -15
  179. data/vendor/assets/javascripts/bower/es6-promise/bower.json +0 -5
  180. data/vendor/assets/javascripts/bower/es6-promise/promise.js +0 -684
  181. data/vendor/assets/javascripts/bower/es6-promise/promise.min.js +0 -1
  182. data/vendor/assets/javascripts/bower/lodash/.bower.json +0 -33
  183. data/vendor/assets/javascripts/bower/lodash/LICENSE.txt +0 -22
  184. data/vendor/assets/javascripts/bower/lodash/bower.json +0 -23
  185. data/vendor/assets/javascripts/bower/lodash/dist/lodash.compat.js +0 -7157
  186. data/vendor/assets/javascripts/bower/lodash/dist/lodash.compat.min.js +0 -61
  187. data/vendor/assets/javascripts/bower/lodash/dist/lodash.js +0 -6785
  188. data/vendor/assets/javascripts/bower/lodash/dist/lodash.min.js +0 -56
  189. data/vendor/assets/javascripts/bower/lodash/dist/lodash.underscore.js +0 -4979
  190. data/vendor/assets/javascripts/bower/lodash/dist/lodash.underscore.min.js +0 -39
  191. data/vendor/assets/javascripts/bower/vue/.bower.json +0 -29
  192. data/vendor/assets/javascripts/bower/vue/bower.json +0 -17
  193. data/vendor/assets/javascripts/bower/vue/dist/vue.js +0 -7977
  194. data/vendor/assets/javascripts/bower/vue/dist/vue.min.js +0 -7
  195. data/vendor/assets/javascripts/sb-admin-v2/bootstrap.js +0 -1951
  196. data/vendor/assets/javascripts/sb-admin-v2/bootstrap.min.js +0 -6
  197. data/vendor/assets/javascripts/sb-admin-v2/demo/dashboard-demo.js +0 -117
  198. data/vendor/assets/javascripts/sb-admin-v2/demo/flot-demo.js +0 -1242
  199. data/vendor/assets/javascripts/sb-admin-v2/demo/morris-demo.js +0 -155
  200. data/vendor/assets/javascripts/sb-admin-v2/jquery-1.10.2.js +0 -6
  201. data/vendor/assets/javascripts/sb-admin-v2/plugins/dataTables/dataTables.bootstrap.js +0 -245
  202. data/vendor/assets/javascripts/sb-admin-v2/plugins/dataTables/jquery.dataTables.js +0 -14013
  203. data/vendor/assets/javascripts/sb-admin-v2/plugins/flot/excanvas.min.js +0 -1
  204. data/vendor/assets/javascripts/sb-admin-v2/plugins/flot/jquery.flot.js +0 -2599
  205. data/vendor/assets/javascripts/sb-admin-v2/plugins/flot/jquery.flot.pie.js +0 -750
  206. data/vendor/assets/javascripts/sb-admin-v2/plugins/flot/jquery.flot.resize.js +0 -60
  207. data/vendor/assets/javascripts/sb-admin-v2/plugins/flot/jquery.flot.tooltip.min.js +0 -12
  208. data/vendor/assets/javascripts/sb-admin-v2/plugins/metisMenu/jquery.metisMenu.js +0 -45
  209. data/vendor/assets/javascripts/sb-admin-v2/plugins/morris/morris.js +0 -1888
  210. data/vendor/assets/javascripts/sb-admin-v2/plugins/morris/raphael-2.1.0.min.js +0 -10
  211. data/vendor/assets/javascripts/sb-admin-v2/sb-admin.js +0 -18
  212. data/vendor/assets/stylesheets/.keep +0 -0
  213. data/vendor/assets/stylesheets/sb-admin-v2/bootstrap.css +0 -5830
  214. data/vendor/assets/stylesheets/sb-admin-v2/bootstrap.min.css +0 -7
  215. data/vendor/assets/stylesheets/sb-admin-v2/font-awesome/css/font-awesome.css +0 -1338
  216. data/vendor/assets/stylesheets/sb-admin-v2/font-awesome/css/font-awesome.min.css +0 -4
  217. data/vendor/assets/stylesheets/sb-admin-v2/font-awesome/fonts/FontAwesome.otf +0 -0
  218. data/vendor/assets/stylesheets/sb-admin-v2/font-awesome/fonts/fontawesome-webfont.eot +0 -0
  219. data/vendor/assets/stylesheets/sb-admin-v2/font-awesome/fonts/fontawesome-webfont.svg +0 -414
  220. data/vendor/assets/stylesheets/sb-admin-v2/font-awesome/fonts/fontawesome-webfont.ttf +0 -0
  221. data/vendor/assets/stylesheets/sb-admin-v2/font-awesome/fonts/fontawesome-webfont.woff +0 -0
  222. data/vendor/assets/stylesheets/sb-admin-v2/font-awesome/scss/_bordered-pulled.scss +0 -16
  223. data/vendor/assets/stylesheets/sb-admin-v2/font-awesome/scss/_core.scss +0 -12
  224. data/vendor/assets/stylesheets/sb-admin-v2/font-awesome/scss/_fixed-width.scss +0 -6
  225. data/vendor/assets/stylesheets/sb-admin-v2/font-awesome/scss/_icons.scss +0 -412
  226. data/vendor/assets/stylesheets/sb-admin-v2/font-awesome/scss/_larger.scss +0 -13
  227. data/vendor/assets/stylesheets/sb-admin-v2/font-awesome/scss/_list.scss +0 -19
  228. data/vendor/assets/stylesheets/sb-admin-v2/font-awesome/scss/_mixins.scss +0 -20
  229. data/vendor/assets/stylesheets/sb-admin-v2/font-awesome/scss/_path.scss +0 -14
  230. data/vendor/assets/stylesheets/sb-admin-v2/font-awesome/scss/_rotated-flipped.scss +0 -9
  231. data/vendor/assets/stylesheets/sb-admin-v2/font-awesome/scss/_spinning.scss +0 -30
  232. data/vendor/assets/stylesheets/sb-admin-v2/font-awesome/scss/_stacked.scss +0 -20
  233. data/vendor/assets/stylesheets/sb-admin-v2/font-awesome/scss/_variables.scss +0 -381
  234. data/vendor/assets/stylesheets/sb-admin-v2/font-awesome/scss/font-awesome.scss +0 -17
  235. data/vendor/assets/stylesheets/sb-admin-v2/fonts/glyphicons-halflings-regular.eot +0 -0
  236. data/vendor/assets/stylesheets/sb-admin-v2/fonts/glyphicons-halflings-regular.svg +0 -229
  237. data/vendor/assets/stylesheets/sb-admin-v2/fonts/glyphicons-halflings-regular.ttf +0 -0
  238. data/vendor/assets/stylesheets/sb-admin-v2/fonts/glyphicons-halflings-regular.woff +0 -0
  239. data/vendor/assets/stylesheets/sb-admin-v2/plugins/dataTables/dataTables.bootstrap.css +0 -233
  240. data/vendor/assets/stylesheets/sb-admin-v2/plugins/morris/morris-0.4.3.min.css +0 -2
  241. data/vendor/assets/stylesheets/sb-admin-v2/plugins/social-buttons/social-buttons.css +0 -68
  242. data/vendor/assets/stylesheets/sb-admin-v2/plugins/timeline/timeline.css +0 -144
  243. data/vendor/assets/stylesheets/sb-admin-v2/sb-admin.css +0 -329
data/.bowerrc DELETED
@@ -1,3 +0,0 @@
1
- {
2
- "directory": "vendor/assets/javascripts/bower"
3
- }
@@ -1,24 +0,0 @@
1
- // This is a manifest file that'll be compiled into application.js, which will include all the files
2
- // listed below.
3
- //
4
- // Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
5
- // or vendor/assets/javascripts of plugins, if any, can be referenced here using a relative path.
6
- //
7
- // It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
8
- // compiled file.
9
- //
10
- // Read Sprockets README (https://github.com/sstephenson/sprockets#sprockets-directives) for details
11
- // about supported directives.
12
- //
13
- //= require jquery
14
- //= require jquery_ujs
15
- //= require sb-admin-v2/bootstrap
16
- //= require sb-admin-v2/plugins/dataTables/jquery.dataTables
17
- //= require sb-admin-v2/plugins/dataTables/dataTables.bootstrap
18
- //= require bower/vue/dist/vue
19
- //= require bower/es6-promise/promise
20
- //= require bower/lodash/dist/lodash.compat
21
- //= require bower/codemirror/lib/codemirror
22
- //= require codemirror_fluentd
23
- //= require vue_common
24
- //= require_tree .
@@ -1,29 +0,0 @@
1
- function codemirrorify(el) {
2
- return CodeMirror.fromTextArea(el, {
3
- theme: "neo",
4
- lineNumbers: true,
5
- viewportMargin: Infinity,
6
- mode: "fluentd"
7
- });
8
- }
9
-
10
- $(function(){
11
- $('.js-fluentd-config-editor').each(function(_, el){
12
- codemirrorify(el);
13
- });
14
- });
15
-
16
- Vue.directive('config-editor', {
17
- bind: function(){
18
- var $parent = this.vm;
19
- // NOTE: needed delay for waiting CodeMirror setup
20
- _.delay(function(textarea){
21
- var cm = codemirrorify(textarea);
22
- // textarea.codemirror = cm; // for test, but doesn't work for now (working on Chrome, but Poltergeist not)
23
- cm.on('change', function(code_mirror){
24
- // bridge Vue - CodeMirror world
25
- $parent.editContent = code_mirror.getValue();
26
- });
27
- }, 0, this.el);
28
- }
29
- });
@@ -1,3 +0,0 @@
1
- $(function(){
2
- $('[data-toggle="tooltip"]').tooltip();
3
- });
@@ -1,41 +0,0 @@
1
- (function(){
2
- "use strict";
3
-
4
- $(function(){
5
- var $firstSetting = $('.js-nested-column.js-multiple:first');
6
-
7
- if($firstSetting.length === 0) return;
8
-
9
- var counter = 0;
10
- $('.js-append', $firstSetting).on('click', function(ev){
11
- ev.preventDefault();
12
- var $new = $firstSetting.clone(true);
13
- counter++;
14
-
15
- var fields = $('input,select,textarea', $new);
16
- _.each(fields, function(elm){
17
- elm.name = elm.name.replace("0", counter);
18
- });
19
- $('label', $new).each(function(_, label){
20
- var $label = $(label);
21
- $label.attr('for', $label.attr('for').replace("0", counter));
22
- });
23
-
24
- $('.js-remove', $new).show();
25
- $('.js-append', $new).hide();
26
- $new.appendTo($firstSetting.parent());
27
- });
28
-
29
- $('.js-remove').on('click', function(ev){
30
- ev.preventDefault();
31
- $(this).closest('.js-nested-column').remove();
32
- });
33
-
34
- var $allSettings = $('.js-nested-column.js-multiple');
35
- $('.js-append', $allSettings).hide();
36
- $('.js-remove', $allSettings).show();
37
- $('.js-append', $firstSetting).show();
38
- $('.js-remove', $firstSetting).hide();
39
- });
40
- })();
41
-
@@ -1,64 +0,0 @@
1
- (function(){
2
- "use strict";
3
-
4
- $(function(){
5
- if($('#fluent-log').length === 0) return;
6
-
7
- new Vue({
8
- el: "#fluent-log",
9
- paramAttributes: ["logUrl", "initialAutoReload"],
10
- data: {
11
- "autoFetch": false,
12
- "logs": [],
13
- "limit": 30,
14
- "processing": false
15
- },
16
-
17
- compiled: function(){
18
- this.fetchLogs();
19
-
20
- var self = this;
21
- var timer;
22
- this.$watch("autoFetch", function(newValue){
23
- if(newValue === true) {
24
- timer = setInterval(function(){
25
- self.fetchLogs();
26
- var $log = $(".log", self.$el);
27
- $log.scrollTop($log.innerHeight());
28
- }, 1000);
29
- } else {
30
- clearInterval(timer);
31
- }
32
- });
33
- if(this.initialAutoReload) {
34
- this.autoFetch = true;
35
- }
36
- },
37
-
38
- computed: {
39
- isPresentedLogs: function(){
40
- return this.logs.length > 0;
41
- }
42
- },
43
-
44
- methods: {
45
- fetchLogs: function() {
46
- if(this.processing) return;
47
- this.processing = true;
48
- var self = this;
49
- new Promise(function(resolve, reject) {
50
- $.getJSON(self.logUrl + "?limit=" + self.limit, resolve).fail(reject);
51
- }).then(function(logs){
52
- self.logs = logs;
53
- setTimeout(function(){
54
- self.processing = false;
55
- }, 256); // delay to reduce flicking loading icon
56
- })["catch"](function(error){
57
- self.processing = false;
58
- });
59
- }
60
- }
61
- });
62
- });
63
- })();
64
-
@@ -1,177 +0,0 @@
1
- (function(){
2
- "use strict";
3
- var maxFormatCount = 20;
4
-
5
- $(function(){
6
- if($('#in_tail_format').length === 0) return;
7
-
8
- var FormatBundle = Vue.component('format-bundle', {
9
- inherit: true,
10
- template: "#format-bundle",
11
- computed: {
12
- options: {
13
- get: function(){
14
- return this.formatOptions[this.format];
15
- },
16
- },
17
- selectableFormats: {
18
- get: function() {
19
- return Object.keys(this.formatOptions);
20
- }
21
- }
22
- }
23
- });
24
-
25
- new Vue({
26
- el: "#in_tail_format",
27
- paramAttributes: ["formatOptionsJson", "initialSelected", "targetFile", "paramsJson"],
28
- data: {
29
- previewProcessing: false,
30
- format: "",
31
- highlightedLines: null,
32
- },
33
-
34
- computed: {
35
- useTextArea: function() {
36
- return this.format === "multiline";
37
- }
38
- },
39
-
40
- compiled: function(){
41
- this.$watch('params.setting.formats', function(formats){
42
- _.range(1, maxFormatCount + 1).forEach(function(i) {params.setting["format" + String(i)] = "";});
43
-
44
- _.compact(formats.split("\n")).forEach(function(formatLine, index) {
45
- params.setting["format" + String(index + 1)] = formatLine;
46
- });
47
- }),
48
- this.$watch('params.setting.regexp', function(){
49
- this.preview();
50
- });
51
- this.$watch('format', function(){
52
- this.preview();
53
- });
54
- this.$set("formatOptions", JSON.parse(this.formatOptionsJson));
55
- this.format = this.initialSelected;
56
-
57
- // initialize params
58
- // NOTE: if `params.setting.foo` is undefined, Vue can't binding with v-model="params.setting.foo"
59
- var params = JSON.parse(this.paramsJson);
60
- if(!params.setting) {
61
- params.setting = {};
62
- }
63
-
64
- var formats = _.chain(_.range(1, maxFormatCount + 1)).map(function(i) {return params.setting["format" + String(i)];}).compact().value();
65
- params.setting.formats = formats.join("\n");
66
-
67
- _.each(this.formatOptions, function(options){
68
- _.each(options, function(key){
69
- if(!params.setting.hasOwnProperty(key)){
70
- params.setting[key] = "";
71
- }
72
- });
73
- });
74
- this.$set('params', params);
75
- this.$emit("data-loaded");
76
- },
77
-
78
- methods: {
79
- onKeyup: function(ev){
80
- var el = ev.target;
81
- if(el.name.match(/\[format/)){
82
- this.preview();
83
- }
84
- },
85
- updateHighlightedLines: function() {
86
- if(!this.regexpMatches) {
87
- this.highlightedLines = null;
88
- return;
89
- }
90
-
91
- var $container = jQuery('<div>');
92
- _.each(this.regexpMatches, function(match){
93
- var colors = [
94
- "#ff9", "#cff", "#fcf", "#dfd"
95
- ];
96
- var whole = match.whole;
97
- var html = "";
98
- var matches = [];
99
-
100
- var lastPos = 0;
101
- _.each(match.matches, function(match) {
102
- var matched = match.matched;
103
- if(!matched) return;
104
- if(matched.length === 0) return; // Ignore empty matched with "foobar".match(/foo(.*?)bar/)[1] #=> ""
105
-
106
- // rotated highlight color
107
- var currentColor = colors.shift();
108
- colors.push(currentColor);
109
-
110
- // create highlighted range HTML
111
- var $highlighted = jQuery('<span>').text(matched);
112
- $highlighted.attr({
113
- "class": "regexp-preview",
114
- "data-toggle": "tooltip",
115
- "data-placement": "top",
116
- "title": match.key,
117
- 'style': 'background-color:' + currentColor
118
- });
119
- var highlightedHtml = $highlighted.wrap('<div>').parent().html();
120
-
121
- var pos = {
122
- "start": match.pos[0],
123
- "end": match.pos[1]
124
- };
125
- if(pos.start > 0) {
126
- html += _.escape(whole.substring(lastPos, pos.start));
127
- }
128
- html += highlightedHtml;
129
- lastPos = pos.end;
130
- });
131
- html += whole.substring(lastPos);
132
-
133
- $container.append(html);
134
- $container.append("<br />");
135
- });
136
-
137
- this.highlightedLines = $container.html();
138
- setTimeout(function(){
139
- $('#in_tail_format').tooltip({
140
- selector: "[data-toggle=tooltip]",
141
- container: "body"
142
- })
143
- },0);
144
- },
145
-
146
- preview: function(){
147
- if(this.previewAjax) {
148
- this.previewAjax.abort();
149
- }
150
- var self = this;
151
- new Promise(function(resolve, reject) {
152
- self.previewAjax = $.ajax({
153
- method: "POST",
154
- url: "/api/regexp_preview",
155
- data: {
156
- regexp: self.params.setting.regexp,
157
- time_format: self.params.setting.time_format,
158
- format: _.isEmpty(self.format) ? "regexp" : self.format,
159
- params: self.params.setting,
160
- file: self.targetFile
161
- }
162
- }).done(resolve).fail(reject);
163
- }).then(function(result){
164
- self.params = _.merge(self.params, result.params);
165
- self.regexpMatches = result.matches;
166
- self.updateHighlightedLines();
167
- })["catch"](function(error){
168
- if(error.stack) {
169
- console.error(error.stack);
170
- }
171
- });
172
- },
173
- }
174
- });
175
- });
176
- })();
177
-
@@ -1,65 +0,0 @@
1
- (function(){
2
- "use strict";
3
- var POLLING_INTERVAL = 3 * 1000;
4
- var POLLING_URL = "/polling/alerts";
5
-
6
- $(function(){
7
- if($('#vue-notification').length === 0) return;
8
-
9
- var alert = new Vue({
10
- el: "#vue-notification",
11
- data: {
12
- "alerts": []
13
- },
14
-
15
- created: function(){
16
- var timer;
17
- var self = this;
18
- var currentInterval = POLLING_INTERVAL;
19
- var fetch = function(){
20
- self.fetchAlertsData().then(function(alerts){
21
- if(self.alerts.toString() == alerts.toString()) {
22
- currentInterval *= 1.1;
23
- } else {
24
- currentInterval = POLLING_INTERVAL;
25
- }
26
- self.alerts = alerts;
27
- timer = setTimeout(fetch, currentInterval);
28
- })["catch"](function(xhr){
29
- if(xhr.status === 401) {
30
- // signed out
31
- }
32
- if(xhr.status === 0) {
33
- // server unreachable (maybe down)
34
- }
35
- });
36
- };
37
- window.addEventListener('focus', function(ev){
38
- currentInterval = POLLING_INTERVAL;
39
- timer = setTimeout(fetch, currentInterval);
40
- }, false);
41
- window.addEventListener('blur', function(ev){
42
- clearTimeout(timer);
43
- }, false);
44
- fetch();
45
- },
46
-
47
- computed: {
48
- alertsCount: {
49
- get: function(){ return this.alerts.length; }
50
- },
51
- hasAlerts: {
52
- get: function(){ return this.alertsCount > 0; }
53
- }
54
- },
55
-
56
- methods: {
57
- fetchAlertsData: function() {
58
- return new Promise(function(resolve, reject) {
59
- $.getJSON(POLLING_URL, resolve).fail(reject);
60
- });
61
- }
62
- }
63
- });
64
- });
65
- })();
@@ -1,121 +0,0 @@
1
- ;(function(){
2
- "use strict";
3
-
4
- $(function(){
5
- var el = document.querySelector("#vue-setting");
6
- if(!el) return;
7
-
8
- new Vue({
9
- el: el,
10
- data: function(){
11
- return {
12
- loaded: false,
13
- loading: false,
14
- sections: {
15
- sources: [],
16
- matches: []
17
- }
18
- };
19
- },
20
- ready: function() {
21
- this.update();
22
- },
23
- components: {
24
- section: {
25
- inherit: true,
26
- template: "#vue-setting-section",
27
- data: function(){
28
- return {
29
- mode: "default",
30
- processing: false,
31
- editContent: null
32
- };
33
- },
34
- created: function(){
35
- this.initialState();
36
- },
37
- computed: {
38
- endpoint: function(){
39
- return "/api/settings/" + this.id;
40
- }
41
- },
42
- methods: {
43
- onCancel: function(ev) {
44
- this.initialState();
45
- },
46
- onEdit: function(ev) {
47
- this.mode = "edit";
48
- },
49
- onDelete: function(ev) {
50
- if(!confirm("really?")) return;
51
- this.destroy();
52
- },
53
- onSubmit: function(ev) {
54
- this.processing = true;
55
- var self = this;
56
- $.ajax({
57
- url: this.endpoint,
58
- method: "POST",
59
- data: {
60
- _method: "PATCH",
61
- id: this.id,
62
- content: this.editContent
63
- }
64
- }).then(function(data){
65
- // NOTE: self.$data = data doesn't work as well, so using _.each
66
- // whole $data swapping breaks mode switching..
67
- _.each(data, function(v,k){
68
- self[k] = v;
69
- });
70
- self.initialState();
71
- }).always(function(){
72
- self.processing = false;
73
- });
74
- },
75
- initialState: function(){
76
- this.$set('processing', false);
77
- this.$set('mode', 'default');
78
- this.$set('editContent', this.content);
79
- },
80
- destroy: function(){
81
- var self = this;
82
- $.ajax({
83
- url: this.endpoint,
84
- method: "POST",
85
- data: {
86
- _method: "DELETE",
87
- id: this.id
88
- }
89
- }).then(function(){
90
- self.$parent.update();
91
- });
92
- }
93
- }
94
- }
95
- },
96
- methods: {
97
- update: function() {
98
- this.loading = true;
99
- var self = this;
100
- $.getJSON("/api/settings", function(data){
101
- var sources = [];
102
- var matches = [];
103
- data.forEach(function(v){
104
- if(v.name === "source"){
105
- sources.push(v);
106
- }else{
107
- matches.push(v);
108
- }
109
- });
110
- self.sections.sources = sources;
111
- self.sections.matches = matches;
112
- self.loaded = true;
113
- setTimeout(function(){
114
- self.loading = false;
115
- }, 500);
116
- });
117
- }
118
- }
119
- });
120
- });
121
- })();