From ace800ad55450111fb09d07f49102fe604a55323 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20B=C3=BCchele?= Date: Fri, 31 Aug 2018 10:02:45 -0700 Subject: [PATCH] fix log counter Summary: Log counter had a bug that only allowed the number to go up to 2. To increment the number of the last row is read and increased. However, this failed and always fall back to 1. Reviewed By: passy Differential Revision: D9613056 fbshipit-source-id: dc73990eb26c7a6ecbc70b0fe50687607b8bf0ad --- src/device-plugins/logs/index.js | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/device-plugins/logs/index.js b/src/device-plugins/logs/index.js index 1aeda58f3..c52ec0bf4 100644 --- a/src/device-plugins/logs/index.js +++ b/src/device-plugins/logs/index.js @@ -290,8 +290,7 @@ export default class LogTable extends SonarDevicePlugin { ); this.device.addLogListener((entry: DeviceLogEntry) => { - const {icon, style} = - LOG_TYPES[(entry.type: string)] || LOG_TYPES.verbose; + const {icon, style} = LOG_TYPES[(entry.type: string)] || LOG_TYPES.debug; // clean message const message = entry.message.trim(); @@ -450,9 +449,16 @@ export default class LogTable extends SonarDevicePlugin { entry.tag === previousEntry.tag && previousRow.type != null ) { - const count = (previousRow.columns.time.value.props.count || 1) + 1; + // duplicate log, increase counter + const count = + previousRow.columns.type.value && + previousRow.columns.type.value.props && + typeof previousRow.columns.type.value.props.children === 'number' + ? previousRow.columns.type.value.props.children + 1 + : 2; + const type = LOG_TYPES[previousRow.type] || LOG_TYPES.debug; previousRow.columns.type.value = ( - {count} + {count} ); } else { rows.push(row);