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 problems rendering object field values #3106

Merged
merged 1 commit into from Nov 21, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -28,7 +28,7 @@ const MessageShow = React.createClass({

possiblyHighlight(fieldName) {
// No highlighting for the message details view.
return String(this.props.message.fields[fieldName]);
return JSON.stringify(this.props.message.fields[fieldName]) || '';
},
render() {
return (
Expand Down
Expand Up @@ -30,7 +30,7 @@ const MessageTableEntry = React.createClass({
if (fullOrigValue === undefined) {
return '';
}
const fullStringOrigValue = String(fullOrigValue); // Ensure the field is a string for later processing
const fullStringOrigValue = JSON.stringify(fullOrigValue); // Ensure the field is a string for later processing

// Truncate the field to 2048 characters if requested. This is for performance reasons to avoid hogging the CPU.
// It's not optimal, more like a workaround to at least being able to show the page...
Expand Down
2 changes: 1 addition & 1 deletion graylog2-web-interface/src/pages/CreateExtractorsPage.jsx
Expand Up @@ -78,7 +78,7 @@ const CreateExtractorsPage = React.createClass({
<EditExtractor action="create"
extractor={this.state.extractor}
inputId={this.state.input.id}
exampleMessage={this.state.exampleMessage.fields[this.state.field]}
exampleMessage={JSON.stringify(this.state.exampleMessage.fields[this.state.field]) || ''}
onSave={this._extractorSaved}/>
</div>
);
Expand Down
Expand Up @@ -31,7 +31,7 @@ const MessagesStore = Reflux.createStore({
},

fieldTerms(index, string) {
const url = ApiRoutes.MessagesController.analyze(index, string).url;
const url = ApiRoutes.MessagesController.analyze(index, JSON.stringify(string)).url;
const promise = fetch('GET', URLUtils.qualifyUrl(url))
.then(
response => response.tokens,
Expand Down