Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: improve log formatting #167

Merged
merged 1 commit into from
Oct 10, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 13 additions & 5 deletions web/src/components/Logs/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@ type LogsProps = {
lease: Beta2Lease | Beta3Lease;
}

function trimPodName(name: string) {
return name.split('-')[0];
}

export const Logs: React.FC<LogsProps> = ({ lease }) => {
const { networkType } = getRpcNode();
const { data: provider } = useQuery(
Expand Down Expand Up @@ -111,9 +115,9 @@ export const Logs: React.FC<LogsProps> = ({ lease }) => {
<ul>
{logs.map((log: any, i: number) => (
<LogList key={`log-line-${i}`}>
<span className="mr-3 text-white mw-3">{i}</span>
<span className="mr-3 mw-10 text-red-1">{log.name}</span>
<span className="text-white">{log.message}</span>
<div className="flex-shrink-0 w-4 text-white">{i}</div>
<div className="text-red-1">{trimPodName(log.name)}</div>
<div className="text-white"><pre>{log.message}</pre></div>
</LogList>
))}
<span ref={bottomRef} />
Expand Down Expand Up @@ -144,9 +148,13 @@ const LogsWrapper = styled.div`
overflow-y: scroll;
`;

const LogList = styled(List)`
const LogList = styled.div`
font-family: monospace;
& span {
display: flex;
gap: 1rem;

& div {
white-space: nowrap;
white-space-collapse: keep-all;
}
`;
Loading