mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
* Change all parsed fields and functions to detected fields * Update * Sneak in UI improvement, add tooltip * Update docs/sources/whatsnew/whats-new-in-v6-5.md Co-authored-by: Diana Payton <52059945+oddlittlebird@users.noreply.github.com> * Update docs/sources/whatsnew/whats-new-in-v6-5.md Co-authored-by: Diana Payton <52059945+oddlittlebird@users.noreply.github.com> * Remove changes from old Whats new * Rename LogMessageParsed Co-authored-by: Diana Payton <52059945+oddlittlebird@users.noreply.github.com>
42 lines
1.2 KiB
TypeScript
42 lines
1.2 KiB
TypeScript
import React, { PureComponent } from 'react';
|
|
import { LogRowModel, Field, LinkModel } from '@grafana/data';
|
|
|
|
import { Themeable } from '../../types/theme';
|
|
import { withTheme } from '../../themes/index';
|
|
|
|
import { getAllFields } from './logParser';
|
|
|
|
export interface Props extends Themeable {
|
|
row: LogRowModel;
|
|
showDetectedFields: string[];
|
|
getFieldLinks?: (field: Field, rowIndex: number) => Array<LinkModel<Field>>;
|
|
}
|
|
|
|
class UnThemedLogRowMessageDetectedFields extends PureComponent<Props> {
|
|
render() {
|
|
const { row, showDetectedFields, getFieldLinks } = this.props;
|
|
const fields = getAllFields(row, getFieldLinks);
|
|
|
|
const line = showDetectedFields
|
|
.map(parsedKey => {
|
|
const field = fields.find(field => {
|
|
const { key } = field;
|
|
return key === parsedKey;
|
|
});
|
|
|
|
if (field) {
|
|
return `${parsedKey}=${field.value}`;
|
|
}
|
|
|
|
return null;
|
|
})
|
|
.filter(s => s !== null)
|
|
.join(' ');
|
|
|
|
return <td>{line}</td>;
|
|
}
|
|
}
|
|
|
|
export const LogRowMessageDetectedFields = withTheme(UnThemedLogRowMessageDetectedFields);
|
|
LogRowMessageDetectedFields.displayName = 'LogRowMessageDetectedFields';
|