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A6B,EAE/B,KAAK,eAAe,GAEpB,IAAiB,QAAQ,mBAAmBA,CAAiB,2BAA2BC,CAAa,aACnG,4BAA4B,CAElC,CAAC,CACH,CACF,CAAC,CACH,C","sources":["webpack://graylog-web-interface/./src/components/extractors/ImportExtractors.jsx","webpack://graylog-web-interface/./src/pages/ImportExtractorsPage.jsx","webpack://graylog-web-interface/./src/routing/withParams.tsx","webpack://graylog-web-interface/./src/stores/extractors/ExtractorsStore.ts"],"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 PropTypes from 'prop-types';\nimport React from 'react';\n\nimport { Row, Col, Button, Input } from 'components/bootstrap';\nimport UserNotification from 'util/UserNotification';\nimport { ExtractorsActions } from 'stores/extractors/ExtractorsStore';\n\nclass ImportExtractors extends React.Component {\n static propTypes = {\n input: PropTypes.object.isRequired,\n };\n\n _onSubmit = (event) => {\n event.preventDefault();\n\n try {\n const parsedExtractors = JSON.parse(this.extractorsInput.getValue());\n const { extractors } = parsedExtractors;\n\n ExtractorsActions.import(this.props.input.id, extractors);\n } catch (error) {\n UserNotification.error(`There was an error while parsing extractors. Are they in JSON format? ${error}`,\n 'Could not import extractors');\n }\n };\n\n render() {\n return (\n \n \n \n \n Extractors JSON
\n \n
\n \n \n \n \n
\n \n
\n );\n }\n}\n\nexport default ImportExtractors;\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 PropTypes from 'prop-types';\nimport React from 'react';\nimport createReactClass from 'create-react-class';\nimport Reflux from 'reflux';\n\nimport { DocumentTitle, PageHeader, Spinner } from 'components/common';\nimport ImportExtractors from 'components/extractors/ImportExtractors';\nimport withParams from 'routing/withParams';\nimport { InputsActions, InputsStore } from 'stores/inputs/InputsStore';\n\nconst ImportExtractorsPage = createReactClass({\n displayName: 'ImportExtractorsPage',\n\n propTypes: {\n params: PropTypes.object.isRequired,\n },\n\n mixins: [Reflux.connect(InputsStore)],\n\n componentDidMount() {\n const { params } = this.props;\n\n InputsActions.get.triggerPromise(params.inputId).then((input) => this.setState({ input: input }));\n },\n\n _isLoading() {\n return !this.state.input;\n },\n\n render() {\n if (this._isLoading()) {\n return ;\n }\n\n const { input } = this.state;\n\n return (\n \n \n Import extractors to {input.title}}>\n \n Exported extractors can be imported to an input. All you need is the JSON export of extractors from any\n other Graylog setup or from{' '}\n \n the Graylog Marketplace\n .\n \n \n \n \n \n );\n },\n});\n\nexport default withParams(ImportExtractorsPage);\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 { useParams } from 'react-router-dom';\nimport type { Subtract } from 'utility-types';\n\ntype ParamsContext = {\n params: {\n [key: string]: string | null | undefined;\n };\n};\n\nconst withParams = (Component: React.ComponentType): React.ComponentType> => (props) => {\n const params = useParams();\n\n return ;\n};\n\nexport default withParams;\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 Reflux from 'reflux';\n\nimport ApiRoutes from 'routing/ApiRoutes';\nimport fetch from 'logic/rest/FetchProvider';\nimport ExtractorUtils from 'util/ExtractorUtils';\nimport * as URLUtils from 'util/URLUtils';\nimport UserNotification from 'util/UserNotification';\nimport { singletonStore, singletonActions } from 'logic/singleton';\n\nexport type InputSummary = {\n creator_user_id: string;\n node: string;\n name: string;\n created_at: string;\n global: boolean;\n attributes: {\n [_key: string]: Object;\n };\n id: string;\n title: string;\n type: string;\n content_pack: string;\n static_fields: {\n [_key: string]: string;\n };\n};\n\nexport type NodeSummary = {\n cluster_id: string,\n hostname: string,\n is_leader: boolean,\n is_master: boolean,\n last_seen: string,\n node_id: string,\n short_node_id: string,\n transport_address: string,\n type: string,\n};\n\ntype RateMetricsResponse = {\n total: number,\n mean: number,\n five_minute: number,\n fifteen_minute: number,\n one_minute: number,\n};\n\ntype TimerMetricsResponse = {\n min: number,\n max: number,\n std_dev: number,\n mean: number,\n '95th_percentile': number,\n '99th_percentile': number,\n '98th_percentile': number,\n};\n\ntype TimerRateMetricsResponse = {\n rate: RateMetricsResponse,\n rate_unit: string,\n time: TimerMetricsResponse,\n duration_unit: string,\n};\n\nexport type ExtractorMetrics = {\n condition_misses: number,\n execution: TimerRateMetricsResponse,\n total: TimerRateMetricsResponse,\n condition: TimerRateMetricsResponse,\n condition_hits: number,\n converters: TimerRateMetricsResponse,\n};\n\nexport type ExtractorType = {\n creator_user_id: string,\n extractor_type?: string,\n source_field: string,\n condition_type: string,\n converter_exceptions: number,\n title: string,\n type: string,\n cursor_strategy: string,\n exceptions: number,\n target_field: string,\n extractor_config: {\n [_key: string]: Object,\n },\n condition_value: string,\n converters: {\n [_key: string]: Object,\n }[],\n id?: string,\n metrics: ExtractorMetrics,\n order: number,\n};\n\ntype ExtractorsActionsType = {\n list: (inputId: string) => Promise>,\n get: (inputId: string, extractorId: string) => Promise,\n create: (inputId: string, extractor: ExtractorType, calledFromMethod: boolean) => Promise,\n save: (inputId: string, extractor: ExtractorType) => Promise,\n update: (inputId: string, extractor: ExtractorType, calledFromMethod: boolean) => Promise,\n delete: (inputId: string, extractor: ExtractorType) => Promise,\n order: { asyncResult: true },\n import: (inputId: string, orderedExtractors: Array) => Promise,\n};\n\nexport type ExtractorsStoreState = {\n extractors: Array,\n extractor: ExtractorType,\n};\n\nexport const ExtractorsActions = singletonActions(\n 'core.Extractors',\n () => Reflux.createActions({\n list: { asyncResult: true },\n get: { asyncResult: true },\n create: { asyncResult: true },\n save: { asyncResult: true },\n update: { asyncResult: true },\n delete: { asyncResult: true },\n order: { asyncResult: true },\n import: { asyncResult: true },\n }),\n);\n\nfunction getExtractorDTO(extractor: ExtractorType) {\n const conditionValue = extractor.condition_type && extractor.condition_type !== 'none' ? extractor.condition_value : '';\n\n return {\n title: extractor.title,\n cursor_strategy: extractor.cursor_strategy || 'copy',\n source_field: extractor.source_field,\n target_field: extractor.target_field,\n extractor_type: extractor.type || extractor.extractor_type, // \"extractor_type\" needed for imports\n extractor_config: extractor.extractor_config,\n converters: extractor.converters,\n condition_type: extractor.condition_type || 'none',\n condition_value: conditionValue,\n order: extractor.order,\n };\n}\n\nexport const ExtractorsStore = singletonStore(\n 'core.Extractors',\n () => Reflux.createStore({\n listenables: [ExtractorsActions],\n sourceUrl: '/system/inputs/',\n extractors: undefined,\n extractor: undefined,\n\n getInitialState() {\n return this.getState();\n },\n\n init() {\n this.trigger({ extractors: this.extractors, extractor: this.extractor });\n },\n\n getState() {\n return {\n extractors: this.extractors,\n extractor: this.extractor,\n };\n },\n\n propagateState() {\n this.trigger(this.getState());\n },\n\n list(inputId: string) {\n const promise = fetch('GET', URLUtils.qualifyUrl(URLUtils.concatURLPath(this.sourceUrl, inputId, 'extractors')));\n\n promise.then((response) => {\n this.extractors = response.extractors;\n this.propagateState();\n });\n\n ExtractorsActions.list.promise(promise);\n },\n\n // Creates an basic extractor object that we can use to create new extractors.\n new(type: string, field: string) {\n if (ExtractorUtils.EXTRACTOR_TYPES.indexOf(type) === -1) {\n throw new Error(`Invalid extractor type provided: ${type}`);\n }\n\n return {\n type: type,\n source_field: field,\n converters: [],\n extractor_config: {},\n target_field: '',\n };\n },\n\n get(inputId: string, extractorId: string) {\n const promise = fetch('GET', URLUtils.qualifyUrl(URLUtils.concatURLPath(this.sourceUrl, inputId, 'extractors', extractorId)));\n\n promise.then((response) => {\n this.extractor = response;\n this.propagateState();\n });\n\n ExtractorsActions.get.promise(promise);\n },\n\n save(inputId: string, extractor: ExtractorType) {\n let promise;\n\n if (extractor.id) {\n promise = this.update(inputId, extractor, true);\n } else {\n promise = this.create(inputId, extractor, true);\n }\n\n ExtractorsActions.save.promise(promise);\n },\n\n _silentExtractorCreate(inputId: string, extractor: ExtractorType) {\n const url = URLUtils.qualifyUrl(ApiRoutes.ExtractorsController.create(inputId).url);\n\n return fetch('POST', url, getExtractorDTO(extractor));\n },\n\n create(inputId: string, extractor: ExtractorType, calledFromMethod: boolean) {\n const promise = this._silentExtractorCreate(inputId, extractor);\n\n promise\n .then(() => {\n UserNotification.success(`Extractor ${extractor.title} created successfully`);\n\n if (this.extractor) {\n ExtractorsActions.get.triggerPromise(inputId, extractor.id);\n }\n })\n .catch((error) => {\n UserNotification.error(`Creating extractor failed: ${error}`,\n 'Could not create extractor');\n });\n\n if (!calledFromMethod) {\n ExtractorsActions.create.promise(promise);\n }\n\n return promise;\n },\n\n update(inputId: string, extractor: ExtractorType, calledFromMethod: boolean) {\n const url = URLUtils.qualifyUrl(ApiRoutes.ExtractorsController.update(inputId, extractor.id).url);\n\n const promise = fetch('PUT', url, getExtractorDTO(extractor));\n\n promise\n .then(() => {\n UserNotification.success(`Extractor \"${extractor.title}\" updated successfully`);\n\n if (this.extractor) {\n ExtractorsActions.get.triggerPromise(inputId, extractor.id);\n }\n })\n .catch((error) => {\n UserNotification.error(`Updating extractor failed: ${error}`,\n 'Could not update extractor');\n });\n\n if (!calledFromMethod) {\n ExtractorsActions.update.promise(promise);\n }\n\n return promise;\n },\n\n delete(inputId: string, extractor: ExtractorType) {\n const url = URLUtils.qualifyUrl(ApiRoutes.ExtractorsController.delete(inputId, extractor.id).url);\n\n const promise = fetch('DELETE', url);\n\n promise\n .then(() => {\n UserNotification.success(`Extractor \"${extractor.title}\" deleted successfully`);\n\n if (this.extractors) {\n ExtractorsActions.list.triggerPromise(inputId);\n }\n })\n .catch((error) => {\n UserNotification.error(`Deleting extractor failed: ${error}`,\n `Could not delete extractor ${extractor.title}`);\n });\n\n ExtractorsActions.delete.promise(promise);\n },\n\n order(inputId: string, orderedExtractors: Array) {\n const url = URLUtils.qualifyUrl(ApiRoutes.ExtractorsController.order(inputId).url);\n const orderedExtractorsMap = {};\n\n orderedExtractors.forEach((extractor, idx) => {\n orderedExtractorsMap[idx] = extractor.id;\n });\n\n const promise = fetch('POST', url, { order: orderedExtractorsMap });\n\n promise.then(() => {\n UserNotification.success('Extractor positions updated successfully');\n\n if (this.extractors) {\n ExtractorsActions.list.triggerPromise(inputId);\n }\n });\n\n promise.catch((error) => {\n UserNotification.error(`Changing extractor positions failed: ${error}`,\n 'Could not update extractor positions');\n });\n\n ExtractorsActions.order.promise(promise);\n },\n\n import(inputId: string, extractors: Array) {\n let successfulImports = 0;\n let failedImports = 0;\n const promises = [];\n\n extractors.forEach((extractor) => {\n const promise = this._silentExtractorCreate(inputId, extractor);\n\n promise\n .then(() => { successfulImports += 1; })\n .catch(() => { failedImports += 1; });\n\n promises.push(promise);\n });\n\n Promise.allSettled(promises).then(() => {\n if (failedImports === 0) {\n UserNotification.success(`Import results: ${successfulImports} extractor(s) imported.`,\n 'Import operation successful');\n\n this.propagateState();\n } else {\n UserNotification.warning(`Import results: ${successfulImports} extractor(s) imported, ${failedImports} error(s).`,\n 'Import operation completed');\n }\n });\n },\n }),\n);\n"],"names":["ImportExtractors","event","parsedExtractors","extractors","error","UserNotification","extractorsInput","ImportExtractorsPage","InputsStore","params","input","withParams","Component","props","ExtractorsActions","getExtractorDTO","extractor","conditionValue","ExtractorsStore","inputId","promise","response","type","field","extractorId","url","calledFromMethod","orderedExtractors","orderedExtractorsMap","idx","successfulImports","failedImports","promises"],"sourceRoot":""}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy