[Kimchi-devel] [PATCH][Wok] Sort user request log output
Ramon Medeiros
ramonn at linux.vnet.ibm.com
Fri Apr 29 18:35:06 UTC 2016
Reviewed-By: Ramon Medeiros <ramonn at br.ibm.com>
On 04/29/2016 02:09 PM, Rodrigo Trujillo wrote:
> There is an issue in user request log output when you have backup files
> in your system. The values from backup logs are included in the return
> list and showed before latest events. Then user has to use UI sort
> buttons in order to see what is happening.
> This patch sorts the output, ensuring that latest events will be
> returned on 'top' of the list and be showed firstly in the UI.
>
> Signed-off-by: Rodrigo Trujillo <rodrigo.trujillo at linux.vnet.ibm.com>
> ---
> src/wok/reqlogger.py | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/src/wok/reqlogger.py b/src/wok/reqlogger.py
> index 1294be1..1145dbd 100644
> --- a/src/wok/reqlogger.py
> +++ b/src/wok/reqlogger.py
> @@ -105,7 +105,9 @@ class RequestParser(object):
> filename = ".".join([self.baseFile, str(count + 1)])
> records.extend(self.getRecordsFromFile(filename))
>
> - return records
> + # Return ordered by latest events first
> + return sorted(records, key=lambda k: k['date'] + k['time'],
> + reverse=True)
>
> def getRecordsFromFile(self, filename):
> """
--
Ramon Nunes Medeiros
Kimchi Developer
Linux Technology Center Brazil
IBM Systems & Technology Group
Phone : +55 19 2132 7878
ramonn at br.ibm.com
More information about the Kimchi-devel
mailing list