Browse Source

Log cleanup

pull/5287/head
Ruud 10 years ago
parent
commit
5314fc7112
  1. 5
      couchpotato/core/plugins/log/main.py
  2. 24
      couchpotato/core/plugins/log/static/log.js
  3. 12
      couchpotato/core/plugins/log/static/log.scss
  4. 21
      couchpotato/static/scripts/combined.plugins.min.js
  5. 2
      couchpotato/static/style/combined.min.css

5
couchpotato/core/plugins/log/main.py

@ -131,11 +131,12 @@ class Logging(Plugin):
def toList(self, log_content = ''):
logs_raw = toUnicode(log_content).split('[0m\n')
logs_raw = re.split(r'\[0m\n', toUnicode(log_content))
logs = []
re_split = r'\x1b'
for log_line in logs_raw:
split = splitString(log_line, '\x1b')
split = re.split(re_split, log_line)
if split:
try:
date, time, log_type = splitString(split[0], ' ')

24
couchpotato/core/plugins/log/static/log.js

@ -7,6 +7,7 @@ Page.Log = new Class({
title: 'Show recent logs.',
has_tab: false,
navigation: null,
log_items: [],
report_text: '### Steps to reproduce:\n'+
'1. ..\n'+
@ -43,7 +44,15 @@ Page.Log = new Class({
}
}).inject(self.content);
Api.request('logging.get', {
if(self.navigation){
var nav = self.navigation.getElement('.nav');
nav.getElements('.active').removeClass('active');
self.navigation.getElements('li')[nr+1].addClass('active');
}
if(self.request && self.request.running) self.request.cancel();
self.request = Api.request('logging.get', {
'data': {
'nr': nr
},
@ -52,8 +61,10 @@ Page.Log = new Class({
self.log_items = self.createLogElements(json.log);
self.log.adopt(self.log_items);
self.log.removeClass('loading');
self.scrollToBottom();
var navigation = new Element('div.navigation').adopt(
if(!self.navigation){
self.navigation = new Element('div.navigation').adopt(
new Element('h2[text=Logs]'),
new Element('div.hint', {
'text': 'Select multiple lines & report an issue'
@ -66,7 +77,7 @@ Page.Log = new Class({
self.getLogs(parseInt(el.get('text')) - 1);
}
}
}).inject(navigation);
}).inject(self.navigation);
// Type selection
new Element('li.filter').grab(
@ -110,9 +121,8 @@ Page.Log = new Class({
}).inject(nav);
// Add to page
navigation.inject(self.content, 'top');
self.scrollToBottom();
self.navigation.inject(self.content, 'top');
}
}
});
@ -142,7 +152,7 @@ Page.Log = new Class({
},
scrollToBottom: function () {
new Fx.Scroll(this.el, {'duration': 0}).toBottom();
new Fx.Scroll(this.content, {'duration': 0}).toBottom();
},
showSelectionButton: function(e){

12
couchpotato/core/plugins/log/static/log.scss

@ -34,17 +34,17 @@
margin-top: 3px;
}
.loading {
text-align: center;
font-size: 20px;
padding: 50px;
}
.container {
padding: $padding;
overflow: hidden;
line-height: 150%;
&.loading {
text-align: center;
font-size: 20px;
padding: 100px 50px;
}
select {
vertical-align: top;
}

21
couchpotato/static/scripts/combined.plugins.min.js

@ -2952,6 +2952,7 @@ Page.Log = new Class({
name: "log",
title: "Show recent logs.",
has_tab: false,
navigation: null,
log_items: [],
report_text: "### Steps to reproduce:\n" + "1. ..\n" + "2. ..\n" + "\n" + "### Information:\n" + "Movie(s) I have this with: ...\n" + "Quality of the movie being searched: ...\n" + "Providers I use: ...\n" + "Version of CouchPotato: {version}\n" + "Running on: ...\n" + "\n" + "### Logs:\n" + "```\n{issue}```",
indexAction: function() {
@ -2969,7 +2970,13 @@ Page.Log = new Class({
}
}
}).inject(self.content);
Api.request("logging.get", {
if (self.navigation) {
var nav = self.navigation.getElement(".nav");
nav.getElements(".active").removeClass("active");
self.navigation.getElements("li")[nr + 1].addClass("active");
}
if (self.request && self.request.running) self.request.cancel();
self.request = Api.request("logging.get", {
data: {
nr: nr
},
@ -2978,7 +2985,9 @@ Page.Log = new Class({
self.log_items = self.createLogElements(json.log);
self.log.adopt(self.log_items);
self.log.removeClass("loading");
var navigation = new Element("div.navigation").adopt(new Element("h2[text=Logs]"), new Element("div.hint", {
self.scrollToBottom();
if (!self.navigation) {
self.navigation = new Element("div.navigation").adopt(new Element("h2[text=Logs]"), new Element("div.hint", {
text: "Select multiple lines & report an issue"
}));
var nav = new Element("ul.nav", {
@ -2987,7 +2996,7 @@ Page.Log = new Class({
self.getLogs(parseInt(el.get("text")) - 1);
}
}
}).inject(navigation);
}).inject(self.navigation);
new Element("li.filter").grab(new Element("select", {
events: {
change: function() {
@ -3027,8 +3036,8 @@ Page.Log = new Class({
}
}
}).inject(nav);
navigation.inject(self.content, "top");
self.scrollToBottom();
self.navigation.inject(self.content, "top");
}
}
});
},
@ -3048,7 +3057,7 @@ Page.Log = new Class({
return elements;
},
scrollToBottom: function() {
new Fx.Scroll(this.el, {
new Fx.Scroll(this.content, {
duration: 0
}).toBottom();
},

2
couchpotato/static/style/combined.min.css

@ -402,8 +402,8 @@
.page.log .nav li.clear,.page.log .nav li.select{cursor:pointer}
.page.log .nav li.active{font-weight:700;cursor:default}
.page.log .hint{font-style:italic;opacity:.5;margin-top:3px}
.page.log .loading{text-align:center;font-size:20px;padding:50px}
.page.log .container{padding:20px;overflow:hidden;line-height:150%}
.page.log .container.loading{text-align:center;font-size:20px;padding:100px 50px}
.page.log .container select{vertical-align:top}
.page.log .container .time{clear:both;font-size:11px;border-top:1px solid rgba(255,255,255,.1);position:relative;overflow:hidden;padding:0 3px;font-family:Lucida Console,Monaco,Nimbus Mono L,monospace,serif}
.page.log .container .time.highlight{background:#eaeaea}

Loading…
Cancel
Save