- Add copy button to the build logs

- Add support for timestamps in the build logs
- Other small UI improvements to the build view
This commit is contained in:
Joseph Schorr 2015-02-27 16:00:32 -05:00
parent e227d7e526
commit ed46d37ea7
12 changed files with 189 additions and 18 deletions

View file

@ -1,4 +1,5 @@
import logging
import datetime
from random import SystemRandom
from functools import wraps, partial
@ -108,7 +109,13 @@ class TestBuildLogs(RedisBuildLogs):
return script
def _generate_phase(self, start_weight, phase_name):
return (start_weight, {'message': phase_name, 'type': self.PHASE},
message = {
'message': phase_name,
'type': self.PHASE,
'datetime': str(datetime.datetime.now())
}
return (start_weight, message,
(phase_name, deepcopy(self.STATUS_TEMPLATE)))
def _generate_command(self, command_num, total_commands, command_weight):
@ -123,6 +130,7 @@ class TestBuildLogs(RedisBuildLogs):
msg = {
'message': 'Step %s: %s %s' % (command_num, command, sentence),
'type': self.COMMAND,
'datetime': str(datetime.datetime.now())
}
status = deepcopy(self.STATUS_TEMPLATE)
status['total_commands'] = total_commands
@ -133,10 +141,26 @@ class TestBuildLogs(RedisBuildLogs):
def _generate_logs(count):
others = []
if random.randint(0, 10) <= 8:
count = count - 2
others = [(1, {'message': '\x1b[91m' + get_sentence()}, None), (1, {'message': '\x1b[0m'}, None)]
premessage = {
'message': '\x1b[91m' + get_sentence(),
'datetime': str(datetime.datetime.now())
}
return others + [(1, {'message': get_sentence()}, None) for _ in range(count)]
postmessage = {
'message': '\x1b[0m',
'datetime': str(datetime.datetime.now())
}
count = count - 2
others = [(1, premessage, None), (1, postmessage, None)]
def get_message():
return {
'message': get_sentence(),
'datetime': str(datetime.datetime.now())
}
return others + [(1, get_message(), None) for _ in range(count)]
@staticmethod
def _compute_total_completion(statuses, total_images):