-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Creating advanced field type for event definition ids.
- Loading branch information
1 parent
d2d2e11
commit 5f4d71e
Showing
4 changed files
with
27 additions
and
3 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
18 changes: 18 additions & 0 deletions
18
graylog2-web-interface/src/views/components/fieldtypes/EventDefinition.tsx
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,18 @@ | ||
import * as React from 'react'; | ||
|
||
import useEventDefinition from 'hooks/useEventDefinition'; | ||
import Spinner from 'components/common/Spinner'; | ||
|
||
const EventDefinition = ({ value }: { value: string }) => { | ||
const { data, isLoading } = useEventDefinition(value); | ||
|
||
if (isLoading) { | ||
return <Spinner />; | ||
} | ||
|
||
const { eventDefinition } = data; | ||
|
||
return <span>{eventDefinition?.title ?? value}</span>; | ||
}; | ||
|
||
export default EventDefinition; |
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