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.
- checksums.yaml +5 -5
- data/.babelrc +18 -0
- data/.editorconfig +11 -0
- data/.gitignore +7 -0
- data/.postcssrc.yml +3 -0
- data/.travis.yml +20 -4
- data/ChangeLog.md +7 -2
- data/Gemfile +8 -6
- data/Gemfile.lock +177 -178
- data/README.md +15 -10
- data/app/assets/stylesheets/application.css +6 -5
- data/app/controllers/concerns/setting_history_concern.rb +1 -1
- data/app/controllers/fluentd/agents_controller.rb +5 -0
- data/app/controllers/misc_controller.rb +2 -2
- data/app/controllers/plugins_controller.rb +4 -4
- data/app/helpers/application_helper.rb +8 -2
- data/app/helpers/settings_helper.rb +2 -2
- data/app/javascript/packs/application.js +31 -0
- data/app/{assets/javascripts/codemirror_fluentd.js → javascript/packs/codemirror.js} +32 -1
- data/app/javascript/packs/fluent_log.js +63 -0
- data/app/javascript/packs/in_tail_format.js +174 -0
- data/app/javascript/packs/nested_settings.js +40 -0
- data/app/javascript/packs/notification.js +60 -0
- data/app/javascript/packs/settings.js +122 -0
- data/app/javascript/packs/treeview.js +99 -0
- data/{vendor/assets/javascripts/.keep → app/javascript/stylesheets/application.scss} +0 -0
- data/app/jobs/all_plugin_check_update_job.rb +10 -0
- data/app/jobs/application_job.rb +2 -0
- data/app/{workers/fluentd_ui_restart.rb → jobs/fluentd_ui_restart_job.rb} +4 -4
- data/app/jobs/fluentd_ui_update_check_job.rb +11 -0
- data/app/{workers/gem_installer.rb → jobs/gem_installer_job.rb} +4 -5
- data/app/jobs/gem_uninstaller_job.rb +14 -0
- data/app/jobs/gem_update_check_job.rb +9 -0
- data/app/models/fluentd/agent.rb +9 -5
- data/app/models/fluentd/agent/common.rb +10 -6
- data/app/models/fluentd/agent/fluentd_gem.rb +2 -3
- data/app/models/fluentd/agent/td_agent/unix.rb +7 -5
- data/app/models/fluentd/setting/in_tail.rb +2 -2
- data/app/views/fluentd/_form.html.haml +1 -1
- data/app/views/fluentd/errors.html.haml +5 -6
- data/app/views/fluentd/log.html.haml +4 -5
- data/app/views/fluentd/settings/edit.html.haml +2 -1
- data/app/views/fluentd/settings/histories/_list.html.haml +1 -1
- data/app/views/fluentd/settings/histories/show.html.haml +6 -6
- data/app/views/fluentd/settings/in_tail/after_file_choose.html.haml +4 -3
- data/app/views/fluentd/settings/in_tail/after_format.html.haml +2 -2
- data/app/views/fluentd/settings/in_tail/confirm.html.haml +3 -3
- data/app/views/fluentd/settings/running_backup/show.html.haml +5 -5
- data/app/views/fluentd/settings/show.html.haml +7 -7
- data/app/views/fluentd/settings/source_and_output.html.haml +31 -18
- data/app/views/fluentd/show.html.haml +16 -15
- data/app/views/layouts/application.html.erb +31 -46
- data/app/views/layouts/sign_in.html.erb +9 -16
- data/app/views/misc/information.html.haml +13 -13
- data/app/views/misc/update_fluentd_ui.html.haml +3 -3
- data/app/views/plugins/installed.html.haml +8 -8
- data/app/views/plugins/recommended.html.haml +5 -5
- data/app/views/plugins/updated.html.haml +5 -5
- data/app/views/sessions/new.html.haml +5 -6
- data/app/views/shared/_global_nav.html.erb +9 -9
- data/app/views/shared/_initial_setup.html.haml +3 -3
- data/app/views/shared/_modal.html.erb +1 -1
- data/app/views/shared/settings/_form.html.haml +9 -8
- data/app/views/shared/settings/show.html.haml +4 -2
- data/app/views/shared/vue/_fluent_log.html.erb +6 -6
- data/app/views/shared/vue/_in_tail_format.html.erb +31 -29
- data/app/views/shared/vue/_notification.html.erb +5 -9
- data/app/views/shared/vue/_setting.html.erb +12 -10
- data/app/views/shared/vue/_treeview.html.erb +13 -10
- data/app/views/tutorials/chapter1.html.erb +3 -4
- data/app/views/tutorials/chapter2.html.haml +2 -2
- data/app/views/tutorials/chapter3.html.haml +2 -2
- data/app/views/tutorials/chapter4.html.haml +2 -2
- data/app/views/users/show.html.haml +1 -1
- data/bin/bundle +1 -1
- data/bin/fluentd-ui +1 -0
- data/bin/rails +1 -1
- data/bin/setup +16 -17
- data/bin/update +28 -0
- data/bin/webpack +15 -0
- data/bin/webpack-dev-server +15 -0
- data/bin/yarn +11 -0
- data/config/application.rb +18 -5
- data/config/boot.rb +2 -1
- data/config/environment.rb +1 -1
- data/config/environments/development.rb +27 -5
- data/config/environments/production.rb +34 -23
- data/config/environments/test.rb +7 -3
- data/config/initializers/application_controller_renderer.rb +8 -0
- data/config/initializers/assets.rb +14 -0
- data/config/initializers/content_security_policy.rb +25 -0
- data/config/initializers/cookies_serializer.rb +2 -0
- data/config/initializers/fluentd_ui_update_check.rb +2 -1
- data/config/initializers/new_framework_defaults_5_2.rb +35 -0
- data/config/initializers/prefetch_gem_updates.rb +4 -1
- data/config/initializers/wrap_parameters.rb +1 -6
- data/config/locales/ja.yml +61 -57
- data/config/routes.rb +1 -0
- data/config/spring.rb +6 -0
- data/config/webpack/development.js +5 -0
- data/config/webpack/environment.js +20 -0
- data/config/webpack/loaders/vue.js +13 -0
- data/config/webpack/production.js +5 -0
- data/config/webpack/test.js +5 -0
- data/config/webpacker.yml +69 -0
- data/fluentd-ui.gemspec +16 -6
- data/lib/fluentd-ui/version.rb +1 -1
- data/lib/regexp_preview/single_line.rb +5 -5
- data/package.json +19 -0
- data/spec/controllers/application_controller_spec.rb +2 -6
- data/spec/controllers/fluentd/agents_controller_spec.rb +12 -0
- data/spec/controllers/polling_controller_spec.rb +1 -1
- data/spec/factories/fluentd.rb +1 -1
- data/spec/factories/plugins.rb +2 -2
- data/spec/factories/user.rb +1 -1
- data/spec/features/fluentd/setting/histories_spec.rb +7 -6
- data/spec/features/fluentd/setting/running_backup_spec.rb +4 -3
- data/spec/features/setting_spec.rb +1 -0
- data/spec/features/source_and_output_spec.rb +16 -16
- data/spec/lib/regexp_preview/single_line_spec.rb +1 -1
- data/spec/models/fluentd_spec.rb +4 -4
- data/spec/spec_helper.rb +16 -4
- data/yarn.lock +6225 -0
- metadata +120 -154
- data/.bowerrc +0 -3
- data/app/assets/javascripts/application.js +0 -24
- data/app/assets/javascripts/codemirror.js +0 -29
- data/app/assets/javascripts/enable_bootstrap_tooltip.js +0 -3
- data/app/assets/javascripts/nested_setting.js +0 -41
- data/app/assets/javascripts/vue/fluent_log.js +0 -64
- data/app/assets/javascripts/vue/in_tail_format.js +0 -177
- data/app/assets/javascripts/vue/notification.js +0 -65
- data/app/assets/javascripts/vue/settings.js +0 -121
- data/app/assets/javascripts/vue/treeview.js +0 -97
- data/app/assets/javascripts/vue_common.js +0 -4
- data/app/workers/all_plugin_check_update.rb +0 -14
- data/app/workers/fluentd_ui_update_check.rb +0 -15
- data/app/workers/gem_uninstaller.rb +0 -15
- data/app/workers/gem_update_check.rb +0 -10
- data/bower.json +0 -11
- data/vendor/assets/javascripts/bower/.gitignore +0 -10
- data/vendor/assets/javascripts/bower/codemirror/.bower.json +0 -29
- data/vendor/assets/javascripts/bower/codemirror/bower.json +0 -16
- data/vendor/assets/javascripts/bower/codemirror/lib/codemirror.css +0 -309
- data/vendor/assets/javascripts/bower/codemirror/lib/codemirror.js +0 -8029
- data/vendor/assets/javascripts/bower/codemirror/theme/3024-day.css +0 -38
- data/vendor/assets/javascripts/bower/codemirror/theme/3024-night.css +0 -37
- data/vendor/assets/javascripts/bower/codemirror/theme/ambiance-mobile.css +0 -5
- data/vendor/assets/javascripts/bower/codemirror/theme/ambiance.css +0 -77
- data/vendor/assets/javascripts/bower/codemirror/theme/base16-dark.css +0 -36
- data/vendor/assets/javascripts/bower/codemirror/theme/base16-light.css +0 -36
- data/vendor/assets/javascripts/bower/codemirror/theme/blackboard.css +0 -30
- data/vendor/assets/javascripts/bower/codemirror/theme/cobalt.css +0 -23
- data/vendor/assets/javascripts/bower/codemirror/theme/eclipse.css +0 -23
- data/vendor/assets/javascripts/bower/codemirror/theme/elegant.css +0 -13
- data/vendor/assets/javascripts/bower/codemirror/theme/erlang-dark.css +0 -32
- data/vendor/assets/javascripts/bower/codemirror/theme/lesser-dark.css +0 -45
- data/vendor/assets/javascripts/bower/codemirror/theme/mbo.css +0 -35
- data/vendor/assets/javascripts/bower/codemirror/theme/mdn-like.css +0 -44
- data/vendor/assets/javascripts/bower/codemirror/theme/midnight.css +0 -45
- data/vendor/assets/javascripts/bower/codemirror/theme/monokai.css +0 -31
- data/vendor/assets/javascripts/bower/codemirror/theme/neat.css +0 -12
- data/vendor/assets/javascripts/bower/codemirror/theme/neo.css +0 -43
- data/vendor/assets/javascripts/bower/codemirror/theme/night.css +0 -26
- data/vendor/assets/javascripts/bower/codemirror/theme/paraiso-dark.css +0 -36
- data/vendor/assets/javascripts/bower/codemirror/theme/paraiso-light.css +0 -36
- data/vendor/assets/javascripts/bower/codemirror/theme/pastel-on-dark.css +0 -50
- data/vendor/assets/javascripts/bower/codemirror/theme/rubyblue.css +0 -23
- data/vendor/assets/javascripts/bower/codemirror/theme/solarized.css +0 -165
- data/vendor/assets/javascripts/bower/codemirror/theme/the-matrix.css +0 -28
- data/vendor/assets/javascripts/bower/codemirror/theme/tomorrow-night-bright.css +0 -35
- data/vendor/assets/javascripts/bower/codemirror/theme/tomorrow-night-eighties.css +0 -36
- data/vendor/assets/javascripts/bower/codemirror/theme/twilight.css +0 -30
- data/vendor/assets/javascripts/bower/codemirror/theme/vibrant-ink.css +0 -32
- data/vendor/assets/javascripts/bower/codemirror/theme/xq-dark.css +0 -51
- data/vendor/assets/javascripts/bower/codemirror/theme/xq-light.css +0 -43
- data/vendor/assets/javascripts/bower/codemirror/theme/zenburn.css +0 -37
- data/vendor/assets/javascripts/bower/es6-promise/.bower.json +0 -15
- data/vendor/assets/javascripts/bower/es6-promise/bower.json +0 -5
- data/vendor/assets/javascripts/bower/es6-promise/promise.js +0 -684
- data/vendor/assets/javascripts/bower/es6-promise/promise.min.js +0 -1
- data/vendor/assets/javascripts/bower/lodash/.bower.json +0 -33
- data/vendor/assets/javascripts/bower/lodash/LICENSE.txt +0 -22
- data/vendor/assets/javascripts/bower/lodash/bower.json +0 -23
- data/vendor/assets/javascripts/bower/lodash/dist/lodash.compat.js +0 -7157
- data/vendor/assets/javascripts/bower/lodash/dist/lodash.compat.min.js +0 -61
- data/vendor/assets/javascripts/bower/lodash/dist/lodash.js +0 -6785
- data/vendor/assets/javascripts/bower/lodash/dist/lodash.min.js +0 -56
- data/vendor/assets/javascripts/bower/lodash/dist/lodash.underscore.js +0 -4979
- data/vendor/assets/javascripts/bower/lodash/dist/lodash.underscore.min.js +0 -39
- data/vendor/assets/javascripts/bower/vue/.bower.json +0 -29
- data/vendor/assets/javascripts/bower/vue/bower.json +0 -17
- data/vendor/assets/javascripts/bower/vue/dist/vue.js +0 -7977
- data/vendor/assets/javascripts/bower/vue/dist/vue.min.js +0 -7
- data/vendor/assets/javascripts/sb-admin-v2/bootstrap.js +0 -1951
- data/vendor/assets/javascripts/sb-admin-v2/bootstrap.min.js +0 -6
- data/vendor/assets/javascripts/sb-admin-v2/demo/dashboard-demo.js +0 -117
- data/vendor/assets/javascripts/sb-admin-v2/demo/flot-demo.js +0 -1242
- data/vendor/assets/javascripts/sb-admin-v2/demo/morris-demo.js +0 -155
- data/vendor/assets/javascripts/sb-admin-v2/jquery-1.10.2.js +0 -6
- data/vendor/assets/javascripts/sb-admin-v2/plugins/dataTables/dataTables.bootstrap.js +0 -245
- data/vendor/assets/javascripts/sb-admin-v2/plugins/dataTables/jquery.dataTables.js +0 -14013
- data/vendor/assets/javascripts/sb-admin-v2/plugins/flot/excanvas.min.js +0 -1
- data/vendor/assets/javascripts/sb-admin-v2/plugins/flot/jquery.flot.js +0 -2599
- data/vendor/assets/javascripts/sb-admin-v2/plugins/flot/jquery.flot.pie.js +0 -750
- data/vendor/assets/javascripts/sb-admin-v2/plugins/flot/jquery.flot.resize.js +0 -60
- data/vendor/assets/javascripts/sb-admin-v2/plugins/flot/jquery.flot.tooltip.min.js +0 -12
- data/vendor/assets/javascripts/sb-admin-v2/plugins/metisMenu/jquery.metisMenu.js +0 -45
- data/vendor/assets/javascripts/sb-admin-v2/plugins/morris/morris.js +0 -1888
- data/vendor/assets/javascripts/sb-admin-v2/plugins/morris/raphael-2.1.0.min.js +0 -10
- data/vendor/assets/javascripts/sb-admin-v2/sb-admin.js +0 -18
- data/vendor/assets/stylesheets/.keep +0 -0
- data/vendor/assets/stylesheets/sb-admin-v2/bootstrap.css +0 -5830
- data/vendor/assets/stylesheets/sb-admin-v2/bootstrap.min.css +0 -7
- data/vendor/assets/stylesheets/sb-admin-v2/font-awesome/css/font-awesome.css +0 -1338
- data/vendor/assets/stylesheets/sb-admin-v2/font-awesome/css/font-awesome.min.css +0 -4
- data/vendor/assets/stylesheets/sb-admin-v2/font-awesome/fonts/FontAwesome.otf +0 -0
- data/vendor/assets/stylesheets/sb-admin-v2/font-awesome/fonts/fontawesome-webfont.eot +0 -0
- data/vendor/assets/stylesheets/sb-admin-v2/font-awesome/fonts/fontawesome-webfont.svg +0 -414
- data/vendor/assets/stylesheets/sb-admin-v2/font-awesome/fonts/fontawesome-webfont.ttf +0 -0
- data/vendor/assets/stylesheets/sb-admin-v2/font-awesome/fonts/fontawesome-webfont.woff +0 -0
- data/vendor/assets/stylesheets/sb-admin-v2/font-awesome/scss/_bordered-pulled.scss +0 -16
- data/vendor/assets/stylesheets/sb-admin-v2/font-awesome/scss/_core.scss +0 -12
- data/vendor/assets/stylesheets/sb-admin-v2/font-awesome/scss/_fixed-width.scss +0 -6
- data/vendor/assets/stylesheets/sb-admin-v2/font-awesome/scss/_icons.scss +0 -412
- data/vendor/assets/stylesheets/sb-admin-v2/font-awesome/scss/_larger.scss +0 -13
- data/vendor/assets/stylesheets/sb-admin-v2/font-awesome/scss/_list.scss +0 -19
- data/vendor/assets/stylesheets/sb-admin-v2/font-awesome/scss/_mixins.scss +0 -20
- data/vendor/assets/stylesheets/sb-admin-v2/font-awesome/scss/_path.scss +0 -14
- data/vendor/assets/stylesheets/sb-admin-v2/font-awesome/scss/_rotated-flipped.scss +0 -9
- data/vendor/assets/stylesheets/sb-admin-v2/font-awesome/scss/_spinning.scss +0 -30
- data/vendor/assets/stylesheets/sb-admin-v2/font-awesome/scss/_stacked.scss +0 -20
- data/vendor/assets/stylesheets/sb-admin-v2/font-awesome/scss/_variables.scss +0 -381
- data/vendor/assets/stylesheets/sb-admin-v2/font-awesome/scss/font-awesome.scss +0 -17
- data/vendor/assets/stylesheets/sb-admin-v2/fonts/glyphicons-halflings-regular.eot +0 -0
- data/vendor/assets/stylesheets/sb-admin-v2/fonts/glyphicons-halflings-regular.svg +0 -229
- data/vendor/assets/stylesheets/sb-admin-v2/fonts/glyphicons-halflings-regular.ttf +0 -0
- data/vendor/assets/stylesheets/sb-admin-v2/fonts/glyphicons-halflings-regular.woff +0 -0
- data/vendor/assets/stylesheets/sb-admin-v2/plugins/dataTables/dataTables.bootstrap.css +0 -233
- data/vendor/assets/stylesheets/sb-admin-v2/plugins/morris/morris-0.4.3.min.css +0 -2
- data/vendor/assets/stylesheets/sb-admin-v2/plugins/social-buttons/social-buttons.css +0 -68
- data/vendor/assets/stylesheets/sb-admin-v2/plugins/timeline/timeline.css +0 -144
- data/vendor/assets/stylesheets/sb-admin-v2/sb-admin.css +0 -329
data/.bowerrc
DELETED
@@ -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,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
|
-
})();
|