forked from Graylog2/graylog2-server
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Link decorator fixes (Graylog2#4742)
* Fix check when fieldValue is not an object The `in` operator is not available for all types, and can make the condition throw an error. * Move renderForDisplay method Fixing a linting error * Small styling changes Preparing for the changes to come * Introduce DecorationStats This will help us to check if a field was decorated without passing around functions. * Ensure LinkFieldDecorator is applied in message table Move logic decorating message to MessageTableEntry, and apply the same logic to the message details.
- Loading branch information
Showing
4 changed files
with
58 additions
and
54 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
17 changes: 17 additions & 0 deletions
17
graylog2-web-interface/src/logic/message/DecorationStats.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
const DecorationStats = { | ||
isFieldAddedByDecorator(message, fieldName) { | ||
const decorationStats = message.decoration_stats; | ||
return decorationStats && decorationStats.added_fields && decorationStats.added_fields[fieldName] !== undefined; | ||
}, | ||
|
||
isFieldChangedByDecorator(message, fieldName) { | ||
const decorationStats = message.decoration_stats; | ||
return decorationStats && decorationStats.changed_fields && decorationStats.changed_fields[fieldName] !== undefined; | ||
}, | ||
|
||
isFieldDecorated(message, fieldName) { | ||
return this.isFieldAddedByDecorator(message, fieldName) || this.isFieldChangedByDecorator(message, fieldName); | ||
}, | ||
}; | ||
|
||
export default DecorationStats; |