mirror of
https://github.com/fluent/fluentd-ui.git
synced 2026-05-05 10:56:11 +02:00
Add auto-reload for log tail
This commit is contained in:
parent
08d3d4aa0d
commit
b99132d67b
@ -8,12 +8,27 @@
|
||||
el: "#fluent-log",
|
||||
paramAttributes: ["logUrl"],
|
||||
data: {
|
||||
"autoFetch": false,
|
||||
"logs": [],
|
||||
"limit": 30
|
||||
},
|
||||
|
||||
created: function(){
|
||||
this.fetchLogs();
|
||||
|
||||
var self = this;
|
||||
var timer;
|
||||
this.$watch("autoFetch", function(newValue){
|
||||
if(newValue === true) {
|
||||
timer = setInterval(function(){
|
||||
self.fetchLogs();
|
||||
var $log = $(".log", self.$el);
|
||||
$log.scrollTop($log[0].scrollHeight);
|
||||
}, 1000);
|
||||
} else {
|
||||
clearInterval(timer);
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
methods: {
|
||||
|
||||
@ -2,6 +2,7 @@
|
||||
<div id="fluent-log" logUrl="<%= log_tail_fluentd_agent_path(fluentd) %>">
|
||||
<pre>
|
||||
<button class="btn btn-primary" v-on="click: fetchLogs"><%= t "terms.reload_log" %></button> <input type="text" v-model="limit" size="4" v-on="keyup: fetchLogs | key enter" />
|
||||
<input type="checkbox" v-model="autoFetch" /> 自動更新
|
||||
|
||||
<div class="log"><span v-repeat="logs">{{ $value }}
|
||||
</span></div></pre>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user