1
0
mirror of https://github.com/lensapp/lens.git synced 2025-05-20 05:10:56 +00:00

Fixing log row renderer

Signed-off-by: Alex Andreev <alex.andreev.email@gmail.com>
This commit is contained in:
Alex Andreev 2020-11-27 15:53:10 +03:00
parent ae4dc3023c
commit 3cbc0d142c
2 changed files with 4 additions and 5 deletions

View File

@ -184,9 +184,8 @@ export class PodLogs extends React.Component<Props> {
* @param rowIndex {Number} index of the log element in logs array
* @returns A react element with a row itself
*/
getLogRow = (rowIndex: number) => {
getLogRow = (item: string, rowIndex: number) => {
const { searchQuery, isActiveOverlay } = searchStore;
const item = this.logs[rowIndex];
const contents: React.ReactElement[] = [];
const ansiToHtml = (ansi: string) => DOMPurify.sanitize(this.colorConverter.ansi_to_html(ansi));
if (searchQuery) { // If search is enabled, replace keyword with backgrounded <span>

View File

@ -18,7 +18,7 @@ interface Props {
initialOffset?: number;
readyOffset?: number;
selectedItemId?: string;
getRow: (item: any) => React.ReactElement<any>;
getRow: (item: any, index: number) => React.ReactElement<any>;
onScroll?: (props: ListOnScrollProps) => void;
outerRef?: React.Ref<any>
}
@ -105,7 +105,7 @@ export class VirtualList extends Component<Props, State> {
interface RowData {
items: any[];
getRow?: (item: any) => React.ReactElement;
getRow?: (item: any, index: number) => React.ReactElement;
}
interface RowProps extends ListChildComponentProps {
@ -116,7 +116,7 @@ const Row = observer((props: RowProps) => {
const { index, style, data } = props;
const { items, getRow } = data;
const item = items[index];
const row = getRow(item);
const row = getRow(item, index);
if (!row) return null;
return React.cloneElement(row, {
style: Object.assign({}, row.props.style, style)