web-interface.assets.628bc5f1-19.8082683cbeb94d06c5f9.js.map Maven / Gradle / Ivy
{"version":3,"sources":["webpack:///./src/components/messageloaders/RecentMessageLoader.tsx","webpack:///./src/components/messageloaders/LoaderTabs.jsx","webpack:///./src/components/inputs/InputDropdown.tsx","webpack:///./src/components/extractors/MessageLoader.tsx"],"names":["UniversalSearchStore","StoreProvider","getStore","LoaderContainer","styled","div","Description","p","StyledSelect","Input","ServerInputSelect","selectedInputId","inputs","onChange","isLoading","InputDropdown","preselectedInputId","onLoadMessage","title","disabled","ForwarderInputSelect","ForwarderInputDropdown","useForwarderMessageLoaders","md","loadButtonDisabled","RecentMessageLoader","onMessageLoaded","useState","loading","setLoading","undefined","selectedInputType","setSelectedInputType","isCloud","AppConfig","useEffect","get","onClick","inputId","input","promise","search","range","then","response","total_results","messages","UserNotification","error","id","aria-label","type","value","e","target","propTypes","PropTypes","object","func","isRequired","string","defaultProps","InputsStore","StreamsStore","InputsActions","ActionsProvider","getActions","LoaderTabs","props","recent","messageId","raw","message","setState","list","listStreams","streams","forEach","stream","Immutable","tabKey","tabs","indexOf","activeTab","state","index","_isTabVisible","TAB_KEYS","selectedTab","messageLoaders","push","key","eventKey","style","marginBottom","marginTop","MessageLoader","hidden","hideText","RawMessageLoader","this","loadData","customFieldActions","displayMessage","MessageShow","activeKey","_getActiveTab","onSelect","_changeActiveTab","animation","_formatMessageLoaders","React","oneOfType","oneOf","arrayOf","node","connect","inputsAsMap","StyledInputDropdown","PLACEHOLDER","_formatInput","_sortByTitle","input1","input2","localeCompare","StaticInput","selectedInput","setSelectedInput","onSelectedInputChange","useCallback","event","_onLoadMessage","preselectedInput","useMemo","bsStyle","inputOptions","sort","map","placeholder","toArray","MessagesActions","LoadMessageForm","loadMessage","children","className","onSubmit","defaultMessageId","defaultIndex","isHidden","setIsHidden","setMessageId","onChangeMessageId","messageIdRef","useRef","setIndex","onChangeIndex","data","useMessageLoader","_loadMessage","preventDefault","toggleMessageForm","current","focus","bsSize","ref","required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AUxGkH,EAVwG,KAYlHgB,EAAe7B,uBAAY,SAAC5E,GAC5BA,WAAG0G,gBACL1G,EAAE0G,iBAGJjB,EAAYxE,EAAWe,KACtB,CAACA,EAAOyD,EAAaxE,IAElB0F,EAAoB/B,uBAAY,WACpCoB,GAAaD,KACZ,CAACA,IAQJ,OANAjH,qBAAU,YACHiH,GAAYI,EAAaS,SAC5BT,EAAaS,QAAQC,UAEtB,CAACd,IAGF,uBAAKJ,UAAU,kBACZ9C,GACC,2CACiB,gBAAC,IAAD,CAAQiE,OAAO,KAAK9H,QAAS2H,GAA7B,yBAGlBZ,GACC,gBAACP,EAAD,CAAiBjH,QAASA,EAASkH,YAAagB,GAC9C,yBAAOM,IAAKZ,EAAcrG,KAAK,OAAO6F,UAAU,gCAAgCN,YAAY,aAAa2B,UAAQ,EAACjH,MAAOkB,EAAWzD,SAAU0I,IAC9I,yBAAOpG,KAAK,OAAO6F,UAAU,eAAeN,YAAY,QAAQ2B,UAAQ,EAACjH,MAAOiC,EAAOxE,SAAU8I,OAO3G3D,EAAczC,UAAY,CACxB0C,OAAQzC,IAAU8G,KAClBpE,SAAU1C,IAAU8G,KACpB5I,gBAAiB8B,IAAUE,KAAKC,WAChCW,UAAWd,IAAUI,OACrByB,MAAO7B,IAAUI,QAGnBoC,EAAcnC,aAAe,CAC3BoC,QAAQ,EACRC,UAAU,EACV5B,UAAW,GACXe,MAAO,IAGMW","file":"628bc5f1-19.8082683cbeb94d06c5f9.js","sourcesContent":["/*\n * Copyright (C) 2020 Graylog, Inc.\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the Server Side Public License, version 1,\n * as published by MongoDB, Inc.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * Server Side Public License for more details.\n *\n * You should have received a copy of the Server Side Public License\n * along with this program. If not, see\n * .\n */\nimport React, { useEffect, useState } from 'react';\nimport PropTypes from 'prop-types';\nimport * as Immutable from 'immutable';\nimport styled from 'styled-components';\n\nimport { Row, Col } from 'components/graylog';\nimport AppConfig from 'util/AppConfig';\nimport InputDropdown from 'components/inputs/InputDropdown';\nimport UserNotification from 'util/UserNotification';\nimport StoreProvider from 'injection/StoreProvider';\nimport type { Message } from 'views/components/messagelist/Types';\nimport { Input } from 'components/bootstrap';\nimport useForwarderMessageLoaders from 'components/messageloaders/useForwarderMessageLoaders';\n\nimport type { Input as InputType } from './Types';\n\nconst UniversalSearchStore = StoreProvider.getStore('UniversalSearch');\n\nconst LoaderContainer = styled.div`\n margin-top: 5px;\n`;\n\nconst Description = styled.p`\n margin-bottom: 0.5em;\n`;\n\nconst StyledSelect = styled(Input)`\n width: 200px;\n`;\n\ntype ServerInputSelectProps = {\n inputs: Immutable.Map,\n onChange: (inputId: string) => void,\n selectedInputId: string | undefined,\n isLoading: boolean,\n};\n\nconst ServerInputSelect = ({ selectedInputId, inputs, onChange, isLoading }: ServerInputSelectProps) => {\n return (\n \n );\n};\n\ntype ForwaderInputSelectProps = {\n onChange: (inputId: string) => void,\n selectedInputId: string | undefined,\n isLoading: boolean,\n};\n\nconst ForwarderInputSelect = ({ selectedInputId, onChange, isLoading }: ForwaderInputSelectProps) => {\n const { ForwarderInputDropdown } = useForwarderMessageLoaders();\n\n return (\n \n );\n};\n\ntype Props = {\n inputs?: Immutable.Map,\n onMessageLoaded: (message?: Message) => void,\n selectedInputId?: string,\n};\n\nconst RecentMessageLoader = ({ inputs, onMessageLoaded, selectedInputId }: Props) => {\n const [loading, setLoading] = useState(false);\n const { ForwarderInputDropdown } = useForwarderMessageLoaders();\n\n const [selectedInputType, setSelectedInputType] = useState<'forwarder' | 'server'>(ForwarderInputDropdown ? undefined : 'server');\n const isCloud = AppConfig.isCloud();\n\n useEffect(() => {\n if (selectedInputId && inputs) {\n setSelectedInputType(inputs?.get(selectedInputId) ? 'server' : 'forwarder');\n }\n }, [inputs, selectedInputId]);\n\n const onClick = (inputId: string) => {\n const input = inputs && inputs.get(inputId);\n\n if (selectedInputType === 'server' && !input) {\n UserNotification.error(`Invalid input selected: ${inputId}`,\n `Could not load message from invalid Input ${inputId}`);\n\n return;\n }\n\n setLoading(true);\n const promise = UniversalSearchStore.search('relative', `gl2_source_input:${inputId} OR gl2_source_radio_input:${inputId}`,\n { range: 3600 }, undefined, 1, undefined, undefined, undefined, false);\n\n promise.then((response) => {\n if (response.total_results > 0) {\n onMessageLoaded(response.messages[0]);\n } else {\n UserNotification.error('Input did not return a recent message.');\n onMessageLoaded(undefined);\n }\n });\n\n promise.finally(() => setLoading(false));\n };\n\n if (isCloud) {\n return (\n \n \n \n );\n }\n\n return (\n \n {ForwarderInputDropdown\n ? (\n <>\n \n\n {selectedInputType === 'server' && (\n \n )}\n {selectedInputType === 'forwarder' && (\n \n )}\n >\n ) : (\n \n )}\n \n );\n};\n\nRecentMessageLoader.propTypes = {\n inputs: PropTypes.object,\n onMessageLoaded: PropTypes.func.isRequired,\n selectedInputId: PropTypes.string,\n};\n\nRecentMessageLoader.defaultProps = {\n inputs: undefined,\n selectedInputId: undefined,\n};\n\nexport default RecentMessageLoader;\n","/*\n * Copyright (C) 2020 Graylog, Inc.\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the Server Side Public License, version 1,\n * as published by MongoDB, Inc.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * Server Side Public License for more details.\n *\n * You should have received a copy of the Server Side Public License\n * along with this program. If not, see\n * .\n */\nimport * as React from 'react';\nimport PropTypes from 'prop-types';\nimport * as Immutable from 'immutable';\n\nimport { Col, Tab, Tabs } from 'components/graylog';\nimport connect from 'stores/connect';\nimport StoreProvider from 'injection/StoreProvider';\nimport ActionsProvider from 'injection/ActionsProvider';\nimport MessageShow from 'components/search/MessageShow';\nimport MessageLoader from 'components/extractors/MessageLoader';\n\nimport RawMessageLoader from './RawMessageLoader';\nimport RecentMessageLoader from './RecentMessageLoader';\n\nconst InputsStore = StoreProvider.getStore('Inputs');\nconst StreamsStore = StoreProvider.getStore('Streams');\nconst InputsActions = ActionsProvider.getActions('Inputs');\n\nclass LoaderTabs extends React.Component {\n TAB_KEYS = {\n recent: 1,\n messageId: 2,\n raw: 3,\n };\n\n constructor(props) {\n super(props);\n\n this.state = {\n activeTab: undefined,\n message: undefined,\n };\n }\n\n componentDidMount() {\n this.loadData();\n }\n\n onMessageLoaded = (message) => {\n this.setState({ message });\n const { onMessageLoaded } = this.props;\n\n if (onMessageLoaded) {\n onMessageLoaded(message);\n }\n };\n\n loadData = () => {\n InputsActions.list();\n\n StreamsStore.listStreams().then((response) => {\n const streams = {};\n\n response.forEach((stream) => {\n streams[stream.id] = stream;\n });\n\n this.setState({ streams: Immutable.Map(streams) });\n });\n };\n\n _isTabVisible = (tabKey) => {\n const { tabs } = this.props;\n\n return tabs === tabKey || tabs.indexOf(tabKey) !== -1;\n };\n\n _getActiveTab = () => {\n const { activeTab } = this.state;\n\n if (activeTab) {\n return activeTab;\n }\n\n const { messageId, index } = this.props;\n\n if (this._isTabVisible('messageId') && messageId && index) {\n return this.TAB_KEYS.messageId;\n }\n\n if (this._isTabVisible('recent')) {\n return this.TAB_KEYS.recent;\n }\n\n if (this._isTabVisible('messageId')) {\n return this.TAB_KEYS.messageId;\n }\n\n return this.TAB_KEYS.raw;\n };\n\n _changeActiveTab = (selectedTab) => {\n const { activeTab } = this.state;\n\n if (activeTab !== selectedTab) {\n this.setState({ activeTab: selectedTab, message: undefined });\n }\n };\n\n _formatMessageLoaders = () => {\n const messageLoaders = [];\n\n if (this._isTabVisible('recent')) {\n const { inputs, selectedInputId } = this.props;\n\n messageLoaders.push(\n \n \n ,\n );\n }\n\n if (this._isTabVisible('messageId')) {\n const { messageId, index } = this.props;\n\n messageLoaders.push(\n \n \n Please provide the id and index of the message that you want to load in this form:\n \n \n ,\n );\n }\n\n if (this._isTabVisible('raw')) {\n messageLoaders.push(\n \n \n Load a message from text, as if it was sent by a log source.\n \n\n \n ,\n );\n }\n\n return messageLoaders;\n };\n\n render() {\n const { streams, message } = this.state;\n const { customFieldActions, inputs } = this.props;\n const displayMessage = message && inputs\n ? (\n \n \n \n )\n : null;\n\n return (\n \n \n {this._formatMessageLoaders()}\n \n {displayMessage}\n \n );\n }\n}\n\nLoaderTabs.propTypes = {\n tabs: PropTypes.oneOfType([\n PropTypes.oneOf(['recent', 'messageId', 'raw']),\n PropTypes.arrayOf(PropTypes.oneOf(['recent', 'messageId', 'raw'])),\n ]),\n messageId: PropTypes.string,\n index: PropTypes.string,\n onMessageLoaded: PropTypes.func,\n selectedInputId: PropTypes.string,\n customFieldActions: PropTypes.node,\n inputs: PropTypes.object,\n};\n\nLoaderTabs.defaultProps = {\n tabs: ['recent', 'messageId'],\n index: undefined,\n messageId: undefined,\n onMessageLoaded: undefined,\n selectedInputId: undefined,\n customFieldActions: undefined,\n inputs: undefined,\n};\n\nexport default connect(\n LoaderTabs,\n { inputs: InputsStore },\n ({ inputs: { inputs } }) => ({ inputs: inputs ? Immutable.Map(InputsStore.inputsAsMap(inputs)) : undefined }),\n);\n","/*\n * Copyright (C) 2020 Graylog, Inc.\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the Server Side Public License, version 1,\n * as published by MongoDB, Inc.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * Server Side Public License for more details.\n *\n * You should have received a copy of the Server Side Public License\n * along with this program. If not, see\n * .\n */\nimport * as React from 'react';\nimport { useCallback, useMemo, useState } from 'react';\nimport * as PropTypes from 'prop-types';\nimport styled from 'styled-components';\nimport * as Immutable from 'immutable';\n\nimport { Button } from 'components/graylog';\nimport { Input } from 'components/bootstrap';\nimport Spinner from 'components/common/Spinner';\n\nconst LoaderContainer = styled.div`\n display: flex;\n flex-wrap: wrap;\n\n .form-group {\n margin: 0 15px 0 0;\n }\n`;\n\nconst StyledInputDropdown = styled(Input)`\n min-width: 400px;\n`;\n\nconst PLACEHOLDER = 'placeholder';\n\ntype InputType = {\n id: string,\n title: string,\n type: string,\n};\n\nconst _formatInput = ({ id, title, type }: InputType) => {\n return ;\n};\n\nconst _sortByTitle = (input1: InputType, input2: InputType) => input1.title.localeCompare(input2.title);\n\nconst StaticInput = ({ input: { type, title } }: { input: InputType }) => (\n \n \n \n);\n\ntype Props = {\n disabled?: boolean,\n inputs: Immutable.Map,\n preselectedInputId?: string,\n onLoadMessage: (inputId: string) => any,\n title: string,\n};\n\nconst InputDropdown = ({ disabled, inputs, onLoadMessage, preselectedInputId, title }: Props) => {\n const [selectedInput, setSelectedInput] = useState(preselectedInputId || PLACEHOLDER);\n const onSelectedInputChange = useCallback((event) => setSelectedInput(event.target.value), []);\n const _onLoadMessage = useCallback(() => onLoadMessage(selectedInput), [onLoadMessage, selectedInput]);\n const preselectedInput = useMemo(() => inputs?.get(preselectedInputId), [inputs, preselectedInputId]);\n\n // When an input is pre-selected, show a static dropdown\n if (preselectedInput) {\n return (\n \n \n\n \n \n );\n }\n\n if (inputs) {\n const inputOptions = inputs.sort(_sortByTitle).map(_formatInput);\n\n return (\n \n \n \n {inputOptions.toArray()}\n \n\n \n \n );\n }\n\n return ;\n};\n\nInputDropdown.propTypes = {\n inputs: PropTypes.object,\n title: PropTypes.string.isRequired,\n preselectedInputId: PropTypes.string,\n onLoadMessage: PropTypes.func,\n disabled: PropTypes.bool,\n};\n\nInputDropdown.defaultProps = {\n inputs: Immutable.Map(),\n onLoadMessage: () => {},\n preselectedInputId: undefined,\n disabled: false,\n};\n\nexport default InputDropdown;\n","/*\n * Copyright (C) 2020 Graylog, Inc.\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the Server Side Public License, version 1,\n * as published by MongoDB, Inc.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * Server Side Public License for more details.\n *\n * You should have received a copy of the Server Side Public License\n * along with this program. If not, see\n * .\n */\nimport * as React from 'react';\nimport { useCallback, useEffect, useRef, useState } from 'react';\nimport PropTypes from 'prop-types';\n\nimport ActionsProvider from 'injection/ActionsProvider';\n\nimport { Button } from '../graylog';\n\nconst MessagesActions = ActionsProvider.getActions('Messages');\n\ntype LoadMessageFormProps = {\n loadMessage: (e: React.FormEvent) => void,\n children: React.ReactNode,\n loading: boolean,\n};\nconst LoadMessageForm = ({ loadMessage, children, loading }: LoadMessageFormProps) => (\n \n \n \n);\n\ntype Props = {\n hidden: boolean,\n hideText: string,\n onMessageLoaded: (data: any) => void,\n messageId?: string,\n index?: string,\n};\n\nconst useMessageLoader = (defaultMessageId: string, defaultIndex: string, onMessageLoaded: (data: any) => void): [boolean, (messageId: string, index: string) => void] => {\n const [loading, setLoading] = useState(false);\n const loadMessage = useCallback((messageId: string, index: string) => {\n if (messageId === '' || index === '') {\n return;\n }\n\n setLoading(true);\n const promise = MessagesActions.loadMessage(index, messageId);\n\n promise.then((data) => onMessageLoaded(data));\n promise.finally(() => setLoading(false));\n }, [onMessageLoaded]);\n\n useEffect(() => {\n if (defaultMessageId && defaultIndex) {\n loadMessage(defaultMessageId, defaultIndex);\n }\n }, [defaultMessageId, defaultIndex, loadMessage]);\n\n return [loading, loadMessage];\n};\n\nconst MessageLoader = ({ hidden, hideText, onMessageLoaded, messageId: defaultMessageId, index: defaultIndex }: Props) => {\n const [isHidden, setIsHidden] = useState(hidden);\n\n const [messageId, setMessageId] = useState(defaultMessageId);\n const onChangeMessageId = useCallback((e) => setMessageId(e.target.value), []);\n const messageIdRef = useRef();\n\n const [index, setIndex] = useState(defaultIndex);\n const onChangeIndex = useCallback((e) => setIndex(e.target.value), []);\n\n const [loading, loadMessage] = useMessageLoader(defaultMessageId, defaultIndex, onMessageLoaded);\n\n const _loadMessage = useCallback((e?: React.FormEvent) => {\n if (e?.preventDefault) {\n e.preventDefault();\n }\n\n loadMessage(messageId, index);\n }, [index, loadMessage, messageId]);\n\n const toggleMessageForm = useCallback(() => {\n setIsHidden(!isHidden);\n }, [isHidden]);\n\n useEffect(() => {\n if (!isHidden && messageIdRef.current) {\n messageIdRef.current.focus();\n }\n }, [isHidden]);\n\n return (\n \n {hideText || (\n \n Wrong example? \n
\n )}\n {isHidden || (\n \n \n \n \n )}\n \n );\n};\n\nMessageLoader.propTypes = {\n hidden: PropTypes.bool,\n hideText: PropTypes.bool,\n onMessageLoaded: PropTypes.func.isRequired,\n messageId: PropTypes.string,\n index: PropTypes.string,\n};\n\nMessageLoader.defaultProps = {\n hidden: true,\n hideText: false,\n messageId: '',\n index: '',\n};\n\nexport default MessageLoader;\n"],"sourceRoot":""}