mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
Add wrapper switch
Signed-off-by: Alex Andreev <alex.andreev.email@gmail.com>
This commit is contained in:
parent
f90ede1026
commit
c4ae074abd
@ -25,13 +25,17 @@ export const LogControls = observer(({ model }: LogControlsProps) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const logs = model.timestampSplitLogs.get();
|
const logs = model.timestampSplitLogs.get();
|
||||||
const { showTimestamps, showPrevious: previous } = tabData;
|
const { showTimestamps, showPrevious: previous, wrap } = tabData;
|
||||||
const since = logs.length ? logs[0][0] : null;
|
const since = logs.length ? logs[0][0] : null;
|
||||||
|
|
||||||
const toggleTimestamps = () => {
|
const toggleTimestamps = () => {
|
||||||
model.updateLogTabData({ showTimestamps: !showTimestamps });
|
model.updateLogTabData({ showTimestamps: !showTimestamps });
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const toggleWrap = () => {
|
||||||
|
model.updateLogTabData({ wrap: !wrap });
|
||||||
|
};
|
||||||
|
|
||||||
const togglePrevious = () => {
|
const togglePrevious = () => {
|
||||||
model.updateLogTabData({ showPrevious: !previous });
|
model.updateLogTabData({ showPrevious: !previous });
|
||||||
model.reloadLogs();
|
model.reloadLogs();
|
||||||
@ -49,6 +53,12 @@ export const LogControls = observer(({ model }: LogControlsProps) => {
|
|||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
<div className="flex gaps align-center">
|
<div className="flex gaps align-center">
|
||||||
|
<Checkbox
|
||||||
|
label="Wrap logs"
|
||||||
|
value={wrap}
|
||||||
|
onChange={toggleWrap}
|
||||||
|
className="wrap-logs"
|
||||||
|
/>
|
||||||
<Checkbox
|
<Checkbox
|
||||||
label="Show timestamps"
|
label="Show timestamps"
|
||||||
value={showTimestamps}
|
value={showTimestamps}
|
||||||
|
|||||||
@ -18,11 +18,16 @@
|
|||||||
font-family: var(--font-monospace);
|
font-family: var(--font-monospace);
|
||||||
font-size: smaller;
|
font-size: smaller;
|
||||||
line-height: 120%;
|
line-height: 120%;
|
||||||
|
white-space: nowrap;
|
||||||
|
|
||||||
> * {
|
> * {
|
||||||
-webkit-font-smoothing: auto; // Better readability on non-retina screens
|
-webkit-font-smoothing: auto; // Better readability on non-retina screens
|
||||||
padding: 2px 16px;
|
padding: 2px 16px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
&.wrap {
|
||||||
|
white-space: normal;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.lastLine {
|
.lastLine {
|
||||||
|
|||||||
@ -5,6 +5,7 @@ import { observer } from 'mobx-react';
|
|||||||
import React, { useEffect, useRef } from 'react';
|
import React, { useEffect, useRef } from 'react';
|
||||||
import type { LogTabViewModel } from './logs-view-model';
|
import type { LogTabViewModel } from './logs-view-model';
|
||||||
import { LogRow } from "./log-row";
|
import { LogRow } from "./log-row";
|
||||||
|
import { cssNames } from "../../../utils";
|
||||||
|
|
||||||
export interface LogListProps {
|
export interface LogListProps {
|
||||||
model: LogTabViewModel;
|
model: LogTabViewModel;
|
||||||
@ -106,7 +107,7 @@ export const LogList = observer(({ model }: LogListProps) => {
|
|||||||
style={{
|
style={{
|
||||||
transform: `translateY(${virtualRow.start}px)`,
|
transform: `translateY(${virtualRow.start}px)`,
|
||||||
}}
|
}}
|
||||||
className={styles.rowWrapper}
|
className={cssNames(styles.rowWrapper, { [styles.wrap]: model.logTabData.get()?.wrap })}
|
||||||
>
|
>
|
||||||
<div>
|
<div>
|
||||||
<LogRow rowIndex={virtualRow.index} model={model} />
|
<LogRow rowIndex={virtualRow.index} model={model} />
|
||||||
|
|||||||
@ -54,6 +54,11 @@ export interface LogTabData {
|
|||||||
* Whether to show the logs of the previous container instance
|
* Whether to show the logs of the previous container instance
|
||||||
*/
|
*/
|
||||||
showPrevious: boolean;
|
showPrevious: boolean;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Whether to wrap logs lines to avoid horizontal scrolling.
|
||||||
|
*/
|
||||||
|
wrap: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
interface Dependencies {
|
interface Dependencies {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user