Skip to content

Commit

Permalink
fix: make log list marker adjusted to number of log items, closes #537
Browse files Browse the repository at this point in the history
  • Loading branch information
felixmosh committed Feb 16, 2023
1 parent 298b461 commit a8ba664
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@
word-break: break-all;
}

.preWrapper ol li {
padding-inline-start: 1rem;
}

.preWrapper ol li::marker {
color: #a0aec0;
content: attr(data-line-number);
Expand Down Expand Up @@ -71,7 +75,7 @@

.jobLogs:fullscreen .preWrapper {
height: 100%;
padding: 40px 1rem 1rem;
padding: 60px 1rem 1rem;
}

.toolbar .searchBar {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,8 @@ export const JobLogs = ({ actions, job }: JobLogsProps) => {
event.preventDefault();
};

const logsToShow = logs.filter((log) => shouldShow(log, keyword));

return (
<div className={s.jobLogs} ref={logsContainer}>
<ul className={s.toolbar}>
Expand Down Expand Up @@ -115,18 +117,16 @@ export const JobLogs = ({ actions, job }: JobLogsProps) => {
</ul>
<div className={s.preWrapper}>
<pre>
<ol>
{logs
.filter((log) => shouldShow(log, keyword))
.map((log) => (
<li
key={log.lineNumber}
className={getLogType(log)}
data-line-number={`${log.lineNumber}. `}
>
{log.message}
</li>
))}
<ol style={{ paddingInlineStart: `${`${logsToShow.length}`.length + 1}ch` }}>
{logsToShow.map((log) => (
<li
key={log.lineNumber}
className={getLogType(log)}
data-line-number={`${log.lineNumber}.`}
>
{log.message}
</li>
))}
</ol>
</pre>
</div>
Expand Down

0 comments on commit a8ba664

Please sign in to comment.