From 85786b1a11108ba4e38fa24cb1080afb07971bc9 Mon Sep 17 00:00:00 2001 From: Dmitry Gozman Date: Thu, 3 Jun 2021 21:52:29 -0700 Subject: [PATCH] feat(trace viewer): fix UI issues (#6890) --- src/web/traceViewer/ui/actionList.css | 1 + src/web/traceViewer/ui/filmStrip.tsx | 1 - src/web/traceViewer/ui/logsTab.css | 12 +++++++ src/web/traceViewer/ui/logsTab.tsx | 12 +++---- src/web/traceViewer/ui/timeline.css | 10 ++---- src/web/traceViewer/ui/timeline.tsx | 52 +++++++++++++++++++-------- 6 files changed, 58 insertions(+), 30 deletions(-) diff --git a/src/web/traceViewer/ui/actionList.css b/src/web/traceViewer/ui/actionList.css index d6c9f3c7c3..34f0231a12 100644 --- a/src/web/traceViewer/ui/actionList.css +++ b/src/web/traceViewer/ui/actionList.css @@ -69,6 +69,7 @@ color: red; position: relative; margin-right: 2px; + flex: none; } .action-selector { diff --git a/src/web/traceViewer/ui/filmStrip.tsx b/src/web/traceViewer/ui/filmStrip.tsx index 7725375544..3af5e4fd77 100644 --- a/src/web/traceViewer/ui/filmStrip.tsx +++ b/src/web/traceViewer/ui/filmStrip.tsx @@ -37,7 +37,6 @@ export const FilmStrip: React.FunctionComponent<{ } const screencastFrames = context.pages[pageIndex]?.screencastFrames; - // TODO: pick file from the Y position. let previewImage = undefined; if (previewPoint !== undefined && screencastFrames) { const previewTime = boundaries.minimum + (boundaries.maximum - boundaries.minimum) * previewPoint.x / measure.width; diff --git a/src/web/traceViewer/ui/logsTab.css b/src/web/traceViewer/ui/logsTab.css index 01b3c9dc37..67bf64f505 100644 --- a/src/web/traceViewer/ui/logsTab.css +++ b/src/web/traceViewer/ui/logsTab.css @@ -23,6 +23,18 @@ user-select: text; } +.logs-error { + border-bottom: 1px solid var(--background); + padding: 3px 0 3px 12px; +} + +.logs-error .codicon { + color: red; + position: relative; + top: 2px; + margin-right: 2px; +} + .log-line { flex: none; padding: 3px 0 3px 12px; diff --git a/src/web/traceViewer/ui/logsTab.tsx b/src/web/traceViewer/ui/logsTab.tsx index 596f43bcfb..91b13464c3 100644 --- a/src/web/traceViewer/ui/logsTab.tsx +++ b/src/web/traceViewer/ui/logsTab.tsx @@ -21,13 +21,13 @@ import { ActionTraceEvent } from '../../../server/trace/common/traceEvents'; export const LogsTab: React.FunctionComponent<{ action: ActionTraceEvent | undefined, }> = ({ action }) => { - let logs: string[] = []; - if (action) { - logs = action.metadata.log || []; - if (action.metadata.error) - logs = [action.metadata.error, ...logs]; - } + const logs = action?.metadata.log || []; + const error = action?.metadata.error; return
{ + -
{ +
{ bars.map((bar, index) => { return
; }) @@ -222,3 +235,12 @@ function timeToPosition(clientWidth: number, boundaries: Boundaries, time: numbe function positionToTime(clientWidth: number, boundaries: Boundaries, x: number): number { return x / clientWidth * (boundaries.maximum - boundaries.minimum) + boundaries.minimum; } + +function trimRight(s: string, maxLength: number): string { + return s.length <= maxLength ? s : s.substring(0, maxLength - 1) + '\u2026'; +} + +const kBarHeight = 11; +function barTop(bar: TimelineBar): number { + return bar.event ? 22 : (bar.action?.metadata.method === 'waitForEventInfo' ? 0 : 11); +}