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
@@ -0,0 +1,40 @@
|
|
1
|
+
'use strict';
|
2
|
+
import 'lodash/lodash';
|
3
|
+
$(document).ready(()=> {
|
4
|
+
var $firstSetting = $('.js-nested-column.js-multiple:first');
|
5
|
+
|
6
|
+
if ($firstSetting.length === 0) {
|
7
|
+
return;
|
8
|
+
}
|
9
|
+
|
10
|
+
var counter = 0;
|
11
|
+
$('.js-append', $firstSetting).on('click', function(ev){
|
12
|
+
ev.preventDefault();
|
13
|
+
var $new = $firstSetting.clone(true);
|
14
|
+
counter++;
|
15
|
+
|
16
|
+
var fields = $('input,select,textarea', $new);
|
17
|
+
_.each(fields, function(elm){
|
18
|
+
elm.name = elm.name.replace("0", counter);
|
19
|
+
});
|
20
|
+
$('label', $new).each(function(_, label){
|
21
|
+
var $label = $(label);
|
22
|
+
$label.attr('for', $label.attr('for').replace("0", counter));
|
23
|
+
});
|
24
|
+
|
25
|
+
$('.js-remove', $new).show();
|
26
|
+
$('.js-append', $new).hide();
|
27
|
+
$new.appendTo($firstSetting.parent());
|
28
|
+
});
|
29
|
+
|
30
|
+
$('.js-remove').on('click', function(ev){
|
31
|
+
ev.preventDefault();
|
32
|
+
$(this).closest('.js-nested-column').remove();
|
33
|
+
});
|
34
|
+
|
35
|
+
var $allSettings = $('.js-nested-column.js-multiple');
|
36
|
+
$('.js-append', $allSettings).hide();
|
37
|
+
$('.js-remove', $allSettings).show();
|
38
|
+
$('.js-append', $firstSetting).show();
|
39
|
+
$('.js-remove', $firstSetting).hide();
|
40
|
+
});
|
@@ -0,0 +1,60 @@
|
|
1
|
+
const POLLING_INTERVAL = 3 * 1000
|
2
|
+
const POLLING_URL = "/polling/alerts"
|
3
|
+
|
4
|
+
$(document).ready(()=> {
|
5
|
+
let alert = new Vue({
|
6
|
+
el: "#vue-notification",
|
7
|
+
data: {
|
8
|
+
"alerts": []
|
9
|
+
},
|
10
|
+
|
11
|
+
created: function(){
|
12
|
+
let timer;
|
13
|
+
let self = this;
|
14
|
+
let currentInterval = POLLING_INTERVAL;
|
15
|
+
let fetch = function(){
|
16
|
+
self.fetchAlertsData().then(function(alerts){
|
17
|
+
if(self.alerts.toString() == alerts.toString()) {
|
18
|
+
currentInterval *= 1.1;
|
19
|
+
} else {
|
20
|
+
currentInterval = POLLING_INTERVAL;
|
21
|
+
}
|
22
|
+
self.alerts = alerts;
|
23
|
+
timer = setTimeout(fetch, currentInterval);
|
24
|
+
})["catch"](function(xhr){
|
25
|
+
if(xhr.status === 401) {
|
26
|
+
// signed out
|
27
|
+
}
|
28
|
+
if(xhr.status === 0) {
|
29
|
+
// server unreachable (maybe down)
|
30
|
+
}
|
31
|
+
});
|
32
|
+
};
|
33
|
+
window.addEventListener('focus', function(ev){
|
34
|
+
currentInterval = POLLING_INTERVAL;
|
35
|
+
timer = setTimeout(fetch, currentInterval);
|
36
|
+
}, false);
|
37
|
+
window.addEventListener('blur', function(ev){
|
38
|
+
clearTimeout(timer);
|
39
|
+
}, false);
|
40
|
+
fetch();
|
41
|
+
},
|
42
|
+
|
43
|
+
computed: {
|
44
|
+
alertsCount: {
|
45
|
+
get: function(){ return this.alerts.length; }
|
46
|
+
},
|
47
|
+
hasAlerts: {
|
48
|
+
get: function(){ return this.alertsCount > 0; }
|
49
|
+
}
|
50
|
+
},
|
51
|
+
|
52
|
+
methods: {
|
53
|
+
fetchAlertsData: function() {
|
54
|
+
return new Promise(function(resolve, reject) {
|
55
|
+
$.getJSON(POLLING_URL, resolve).fail(reject);
|
56
|
+
});
|
57
|
+
}
|
58
|
+
}
|
59
|
+
});
|
60
|
+
});
|
@@ -0,0 +1,122 @@
|
|
1
|
+
$(document).ready(() => {
|
2
|
+
const SettingSection = {
|
3
|
+
template: '#vue-setting-section',
|
4
|
+
props: ['id', 'content', 'type', 'name', 'arg'],
|
5
|
+
data: function() {
|
6
|
+
return {
|
7
|
+
mode: 'default',
|
8
|
+
processing: false
|
9
|
+
};
|
10
|
+
},
|
11
|
+
created: function() {
|
12
|
+
this.initialState();
|
13
|
+
},
|
14
|
+
computed: {
|
15
|
+
endpoint: function() {
|
16
|
+
return '/api/settings/' + this.id;
|
17
|
+
}
|
18
|
+
},
|
19
|
+
methods: {
|
20
|
+
onCancel: function(event) {
|
21
|
+
this.initialState();
|
22
|
+
},
|
23
|
+
onEdit: function(ev) {
|
24
|
+
this.mode = "edit";
|
25
|
+
},
|
26
|
+
onDelete: function(ev) {
|
27
|
+
if (!confirm("really?")) {
|
28
|
+
return;
|
29
|
+
}
|
30
|
+
this.destroy();
|
31
|
+
},
|
32
|
+
onSubmit: function(ev) {
|
33
|
+
const token = document.getElementsByName("csrf-token")[0].getAttribute('content');
|
34
|
+
this.processing = true;
|
35
|
+
this.content = $(`#${this.id} textarea.form-control`)[0].dataset.content;
|
36
|
+
$.ajax({
|
37
|
+
url: this.endpoint,
|
38
|
+
method: "POST",
|
39
|
+
data: {
|
40
|
+
_method: "PATCH",
|
41
|
+
id: this.id,
|
42
|
+
content: this.content
|
43
|
+
},
|
44
|
+
headers: {
|
45
|
+
'X-CSRF-Token': token
|
46
|
+
}
|
47
|
+
}).then((data)=> {
|
48
|
+
_.each(data, function(v,k){
|
49
|
+
this[k] = v;
|
50
|
+
});
|
51
|
+
this.initialState();
|
52
|
+
}).always(()=> {
|
53
|
+
this.processing = false;
|
54
|
+
});
|
55
|
+
},
|
56
|
+
initialState: function(){
|
57
|
+
this.processing = false;
|
58
|
+
this.mode = 'default';
|
59
|
+
},
|
60
|
+
destroy: function(){
|
61
|
+
const token = document.getElementsByName("csrf-token")[0].getAttribute('content');
|
62
|
+
$.ajax({
|
63
|
+
url: this.endpoint,
|
64
|
+
method: "POST",
|
65
|
+
data: {
|
66
|
+
_method: "DELETE",
|
67
|
+
id: this.id
|
68
|
+
},
|
69
|
+
headers: {
|
70
|
+
'X-CSRF-Token': token
|
71
|
+
}
|
72
|
+
}).then(()=> {
|
73
|
+
this.$parent.update();
|
74
|
+
});
|
75
|
+
}
|
76
|
+
}
|
77
|
+
};
|
78
|
+
|
79
|
+
new Vue({
|
80
|
+
el: "#vue-setting",
|
81
|
+
data: function(){
|
82
|
+
return {
|
83
|
+
loaded: false,
|
84
|
+
loading: false,
|
85
|
+
sections: {
|
86
|
+
sources: [],
|
87
|
+
matches: []
|
88
|
+
}
|
89
|
+
};
|
90
|
+
},
|
91
|
+
mounted: function() {
|
92
|
+
this.$nextTick(() => {
|
93
|
+
this.update();
|
94
|
+
})
|
95
|
+
},
|
96
|
+
components: {
|
97
|
+
'setting-section': SettingSection
|
98
|
+
},
|
99
|
+
methods: {
|
100
|
+
update: function() {
|
101
|
+
this.loading = true;
|
102
|
+
$.getJSON("/api/settings", (data)=> {
|
103
|
+
var sources = [];
|
104
|
+
var matches = [];
|
105
|
+
data.forEach((v)=> {
|
106
|
+
if(v.name === "source"){
|
107
|
+
sources.push(v);
|
108
|
+
}else{
|
109
|
+
matches.push(v);
|
110
|
+
}
|
111
|
+
});
|
112
|
+
this.sections.sources = sources;
|
113
|
+
this.sections.matches = matches;
|
114
|
+
this.loaded = true;
|
115
|
+
setTimeout(()=> {
|
116
|
+
this.loading = false;
|
117
|
+
}, 500);
|
118
|
+
});
|
119
|
+
}
|
120
|
+
}
|
121
|
+
});
|
122
|
+
})
|
@@ -0,0 +1,99 @@
|
|
1
|
+
'use strict';
|
2
|
+
import 'lodash/lodash';
|
3
|
+
$(document).ready(() => {
|
4
|
+
new Vue({
|
5
|
+
el: "#treeview",
|
6
|
+
props: {
|
7
|
+
initialPath: {
|
8
|
+
default: "/var/log",
|
9
|
+
type: String
|
10
|
+
}
|
11
|
+
},
|
12
|
+
data: {
|
13
|
+
preview: "",
|
14
|
+
path: "",
|
15
|
+
paths: []
|
16
|
+
},
|
17
|
+
|
18
|
+
mounted: function(){
|
19
|
+
console.log(this.initialPath);
|
20
|
+
this.path = this.initialPath;
|
21
|
+
this.fetchTree();
|
22
|
+
this.$watch("path", this.fetchTree);
|
23
|
+
this.$watch("path", this.fetchPreview);
|
24
|
+
},
|
25
|
+
|
26
|
+
computed: {
|
27
|
+
selected: function(){
|
28
|
+
var self = this;
|
29
|
+
return _.find(this.paths, function(path){
|
30
|
+
return self.path == path.path;
|
31
|
+
});
|
32
|
+
},
|
33
|
+
selectedIsDir: function() {
|
34
|
+
if(!this.selected) return true;
|
35
|
+
return this.selected.is_dir;
|
36
|
+
},
|
37
|
+
currentDirs: function() {
|
38
|
+
if(this.path === "/") {
|
39
|
+
return ["/"];
|
40
|
+
}
|
41
|
+
|
42
|
+
var path = this.path;
|
43
|
+
if(this.selected && !this.selected.is_dir) {
|
44
|
+
path = path.replace(/\/[^/]+$/, "");
|
45
|
+
}
|
46
|
+
var root = "/";
|
47
|
+
var dirs = [];
|
48
|
+
path.split("/").forEach(function(dir) {
|
49
|
+
dirs.push(root + dir);
|
50
|
+
if(dir) {
|
51
|
+
root = root + dir + "/";
|
52
|
+
}
|
53
|
+
});
|
54
|
+
return dirs;
|
55
|
+
}
|
56
|
+
},
|
57
|
+
|
58
|
+
methods: {
|
59
|
+
isAncestor: function(target) {
|
60
|
+
return this.path.indexOf(target) === 0;
|
61
|
+
},
|
62
|
+
basename: function(path) {
|
63
|
+
if (path === "/") return "/";
|
64
|
+
return path.match(/[^/]+$/)[0];
|
65
|
+
},
|
66
|
+
fetchTree: function() {
|
67
|
+
var self = this;
|
68
|
+
return new Promise(function(resolve, reject) {
|
69
|
+
$.getJSON("/api/tree?path=" + self.path, resolve).fail(reject);
|
70
|
+
}).then(function(paths){
|
71
|
+
console.log(paths);
|
72
|
+
self.paths = paths;
|
73
|
+
});
|
74
|
+
},
|
75
|
+
fetchPreview: function(){
|
76
|
+
if(!this.selected) return ;
|
77
|
+
var self = this;
|
78
|
+
this.preview = "";
|
79
|
+
new Promise(function(resolve, reject) {
|
80
|
+
$.getJSON("/api/file_preview?file=" + self.selected.path, resolve).fail(reject);
|
81
|
+
}).catch(function(e){
|
82
|
+
console.error(e);
|
83
|
+
}).then(function(lines){
|
84
|
+
self.preview = lines.join("\n");
|
85
|
+
});
|
86
|
+
},
|
87
|
+
|
88
|
+
selectPath: function(path){
|
89
|
+
this.path = path;
|
90
|
+
},
|
91
|
+
isSuffixRequired: function(data){
|
92
|
+
return data.is_dir && data.path != "/";
|
93
|
+
},
|
94
|
+
isSelected: function(path){
|
95
|
+
return this.path == path;
|
96
|
+
}
|
97
|
+
}
|
98
|
+
});
|
99
|
+
});
|
File without changes
|
@@ -0,0 +1,10 @@
|
|
1
|
+
class AllPluginCheckUpdateJob < ApplicationJob
|
2
|
+
queue_as :default
|
3
|
+
|
4
|
+
def perform(*args)
|
5
|
+
Plugin.installed.each do |pl|
|
6
|
+
GemUpdateCheckJob.perform_later(pl.gem_name)
|
7
|
+
end
|
8
|
+
AllPluginCheckUpdateJob.set(wait: 1.hour).perform_later # will be checked every hour
|
9
|
+
end
|
10
|
+
end
|
@@ -1,5 +1,5 @@
|
|
1
|
-
class
|
2
|
-
|
1
|
+
class FluentdUiRestartJob < ApplicationJob
|
2
|
+
queue_as :default
|
3
3
|
|
4
4
|
LOCK = []
|
5
5
|
|
@@ -20,7 +20,7 @@ class FluentdUiRestart
|
|
20
20
|
lock!
|
21
21
|
|
22
22
|
# NOTE: install will be failed before released fluentd-ui gem
|
23
|
-
|
23
|
+
logger.info "[restart] install new fluentd-ui"
|
24
24
|
Plugin.new(gem_name: "fluentd-ui").install!
|
25
25
|
|
26
26
|
if Rails.env.production?
|
@@ -29,7 +29,7 @@ class FluentdUiRestart
|
|
29
29
|
cmd = %W(bundle exec rails s)
|
30
30
|
end
|
31
31
|
|
32
|
-
|
32
|
+
logger.info "[restart] will restart"
|
33
33
|
Bundler.with_clean_env do
|
34
34
|
restarter = "#{Rails.root}/bin/fluentd-ui-restart"
|
35
35
|
Process.spawn(*[restarter, $$.to_s, *cmd, *ARGV]) && Process.kill(:TERM, $$)
|
@@ -0,0 +1,11 @@
|
|
1
|
+
class FluentdUiUpdateCheckJob < ApplicationJob
|
2
|
+
queue_as :default
|
3
|
+
|
4
|
+
def perform
|
5
|
+
pl = Plugin.new(gem_name: "fluentd-ui")
|
6
|
+
if pl.gem_versions
|
7
|
+
FluentdUI.latest_version = pl.latest_version
|
8
|
+
end
|
9
|
+
FluentdUiUpdateCheckJob.set(wait: 1.hour).perform_later # will be checked every hour
|
10
|
+
end
|
11
|
+
end
|
@@ -1,6 +1,5 @@
|
|
1
|
-
class
|
2
|
-
|
3
|
-
workers 16
|
1
|
+
class GemInstallerJob < ApplicationJob
|
2
|
+
queue_as :default
|
4
3
|
|
5
4
|
def perform(gem_name, version = nil)
|
6
5
|
SuckerPunch.logger.info "install #{gem_name} #{version}"
|
@@ -9,9 +8,9 @@ class GemInstaller
|
|
9
8
|
# NOTE: uninstall all versions of `gem_name` then install it for upgrade/downgrade
|
10
9
|
pl.uninstall! if pl.installed?
|
11
10
|
pl.install!
|
12
|
-
|
11
|
+
logger.info "installed #{gem_name} #{version}"
|
13
12
|
rescue Plugin::GemError
|
14
|
-
|
13
|
+
logger.warn "installing #{gem_name} #{version} is failed"
|
15
14
|
end
|
16
15
|
end
|
17
16
|
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
class GemUninstallerJob < ApplicationJob
|
2
|
+
queue_as :default
|
3
|
+
|
4
|
+
def perform(gem_name)
|
5
|
+
logger.info "uninstall #{gem_name}"
|
6
|
+
pl = Plugin.new(gem_name: gem_name)
|
7
|
+
begin
|
8
|
+
pl.uninstall!
|
9
|
+
logger.info "uninstalled #{gem_name}"
|
10
|
+
rescue Plugin::GemError
|
11
|
+
logger.warn "uninstalling #{gem_name} is failed"
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
data/app/models/fluentd/agent.rb
CHANGED
@@ -10,19 +10,23 @@ class Fluentd
|
|
10
10
|
class Agent
|
11
11
|
# pidfile
|
12
12
|
# td-agent: /var/run/td-agent/td-agent.pid
|
13
|
-
# - https://github.com/treasure-data/td-agent/blob/master/td-agent.
|
14
|
-
# - https://github.com/treasure-data/td-agent/blob/master/
|
13
|
+
# - https://github.com/treasure-data/omnibus-td-agent/blob/master/templates/etc/systemd/td-agent.service.erb#L18
|
14
|
+
# - https://github.com/treasure-data/omnibus-td-agent/blob/master/templates/etc/init.d/deb/td-agent#L24
|
15
|
+
# - https://github.com/treasure-data/omnibus-td-agent/blob/master/templates/etc/init.d/rpm/td-agent#L24
|
16
|
+
# - https://github.com/treasure-data/omnibus-td-agent/blob/master/templates/etc/td-agent/logrotate.d/td-agent.logrotate#L10
|
15
17
|
# fluentd: nothing (or --daemon PIDFILE)
|
16
18
|
#
|
17
19
|
# logfile
|
18
20
|
# td-agent: /var/log/td-agent/td-agent.log
|
19
|
-
# - https://github.com/treasure-data/td-agent/blob/master/
|
21
|
+
# - https://github.com/treasure-data/omnibus-td-agent/blob/master/templates/etc/systemd/td-agent.service.erb#L21
|
22
|
+
# - https://github.com/treasure-data/omnibus-td-agent/blob/master/templates/etc/init.d/deb/td-agent#L23
|
23
|
+
# - https://github.com/treasure-data/omnibus-td-agent/blob/master/templates/etc/init.d/rpm/td-agent#L23
|
20
24
|
# fluentd: stdout (or --log LOGFILE)
|
21
25
|
#
|
22
26
|
# config file
|
23
27
|
# td-agent: /etc/td-agent/td-agent.conf
|
24
|
-
# - https://github.com/treasure-data/td-agent/blob/master/
|
25
|
-
# fluentd: /etc/fluent/fluent.conf (by fluentd -s)
|
28
|
+
# - https://github.com/treasure-data/omnibus-td-agent/blob/master/templates/etc/systemd/td-agent.service.erb#L14
|
29
|
+
# fluentd: /etc/fluent/fluent.conf (created by fluentd -s)
|
26
30
|
class ConfigError < StandardError; end
|
27
31
|
end
|
28
32
|
end
|