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AAU,WACb,gBAAC,MAAG,CAAC,GAAI,IACP,gBAAC,IAA8B,CAAC,OAAO,QAAS,EAClD,CACF,CACF,CAEJ,C,uFCzBA,QANkDU,GAAiGxC,GAAU,CAC3J,MAAM8B,KAAU,KAAW,EAE3B,OAAO,gBAACU,EAAA,CAAW,GAAGxC,EAAgB,QAAA8B,CAAA,CAAkB,CAC1D,C,qBC9BA,IAAIW,EAAY,EAAQ,UAAc,EAGlCC,EAAqB,EA4BzB,SAASC,EAAMf,EAAO,CACpB,OAAOa,EAAUb,EAAOc,CAAkB,CAC5C,CAEAE,EAAO,QAAUD,C","sources":["webpack://graylog-web-interface/./src/components/event-notifications/event-notification-form/EventNotificationForm.jsx","webpack://graylog-web-interface/./src/components/event-notifications/event-notification-form/EventNotificationFormContainer.jsx","webpack://graylog-web-interface/./src/pages/CreateEventNotificationPage.tsx","webpack://graylog-web-interface/./src/routing/withHistory.tsx","webpack://graylog-web-interface/./node_modules/lodash/clone.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 from 'react';\nimport PropTypes from 'prop-types';\nimport get from 'lodash/get';\nimport { PluginStore } from 'graylog-web-plugin/plugin';\n\nimport { FormSubmit, Select, Spinner } from 'components/common';\nimport { Alert, Button, Col, ControlLabel, FormControl, FormGroup, HelpBlock, Row, Input } from 'components/bootstrap';\nimport { getValueFromInput } from 'util/FormsUtils';\nimport withTelemetry from 'logic/telemetry/withTelemetry';\nimport { getPathnameWithoutId } from 'util/URLUtils';\nimport { TELEMETRY_EVENT_TYPE } from 'logic/telemetry/Constants';\nimport withLocation from 'routing/withLocation';\n\nconst getNotificationPlugin = (type) => {\n if (type === undefined) {\n return {};\n }\n\n return PluginStore.exports('eventNotificationTypes').find((n) => n.type === type) || {};\n};\n\nconst formattedEventNotificationTypes = () => PluginStore.exports('eventNotificationTypes')\n .map((type) => ({ label: type.displayName, value: type.type }));\n\nclass EventNotificationForm extends React.Component {\n static propTypes = {\n action: PropTypes.oneOf(['create', 'edit']),\n notification: PropTypes.object.isRequired,\n validation: PropTypes.object.isRequired,\n testResult: PropTypes.shape({\n isLoading: PropTypes.bool,\n error: PropTypes.bool,\n message: PropTypes.string,\n }).isRequired,\n formId: PropTypes.string,\n embedded: PropTypes.bool.isRequired,\n onChange: PropTypes.func.isRequired,\n onCancel: PropTypes.func.isRequired,\n onSubmit: PropTypes.func.isRequired,\n onTest: PropTypes.func.isRequired,\n sendTelemetry: PropTypes.func.isRequired,\n location: PropTypes.object.isRequired,\n };\n\n static defaultProps = {\n action: 'edit',\n formId: undefined,\n };\n\n constructor(props) {\n super(props);\n\n this.state = {\n isSubmitEnabled: true,\n };\n }\n\n setIsSubmitEnabled = (enabled) => {\n this.setState({ isSubmitEnabled: enabled });\n };\n\n handleSubmit = (event) => {\n const { notification, onSubmit, sendTelemetry, action, location } = this.props;\n\n sendTelemetry(\n action === 'create'\n ? TELEMETRY_EVENT_TYPE.NOTIFICATIONS.CREATE_CLICKED\n : TELEMETRY_EVENT_TYPE.NOTIFICATIONS.EDIT_CLICKED, {\n app_pathname: getPathnameWithoutId(location.pathname),\n app_section: 'event-notification',\n app_action_value: `${action}-button`,\n });\n\n event.preventDefault();\n\n onSubmit(notification);\n };\n\n handleChange = (event) => {\n const { name } = event.target;\n const { onChange } = this.props;\n\n onChange(name, getValueFromInput(event.target));\n };\n\n handleConfigChange = (nextConfig) => {\n const { onChange } = this.props;\n\n onChange('config', nextConfig);\n };\n\n handleTypeChange = (nextType) => {\n const { sendTelemetry, location } = this.props;\n\n sendTelemetry(TELEMETRY_EVENT_TYPE.EVENTDEFINITION_NOTIFICATIONS.NOTIFICATION_TYPE_SELECTED, {\n app_pathname: getPathnameWithoutId(location.pathname),\n app_section: 'event-definition-notifications',\n app_action_value: 'notification-type-select',\n notification_type: nextType,\n });\n\n const notificationPlugin = getNotificationPlugin(nextType);\n const defaultConfig = notificationPlugin.defaultConfig || {};\n\n this.handleConfigChange({ ...defaultConfig, type: nextType });\n };\n\n handleTestTrigger = () => {\n const { notification, onTest, sendTelemetry, location } = this.props;\n\n sendTelemetry(TELEMETRY_EVENT_TYPE.NOTIFICATIONS.EXECUTE_TEST_CLICKED, {\n app_pathname: getPathnameWithoutId(location.pathname),\n app_section: 'event-notification',\n app_action_value: 'execute-test-button',\n });\n\n onTest(notification);\n };\n\n render() {\n const { action, embedded, formId, notification, onCancel, validation, testResult } = this.props;\n const { isSubmitEnabled } = this.state;\n\n const notificationPlugin = getNotificationPlugin(notification.config.type);\n const notificationFormComponent = notificationPlugin.formComponent\n ? React.createElement(notificationPlugin.formComponent, {\n config: notification.config,\n onChange: this.handleConfigChange,\n validation: validation,\n setIsSubmitEnabled: this.setIsSubmitEnabled,\n })\n : null;\n\n const testButtonText = testResult.isLoading ? : 'Execute Test Notification';\n\n return (\n \n \n \n \n
\n );\n }\n}\n\nexport default withLocation(withTelemetry(EventNotificationForm));\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 React from 'react';\nimport PropTypes from 'prop-types';\nimport clone from 'lodash/clone';\nimport cloneDeep from 'lodash/cloneDeep';\n\nimport { ConfirmLeaveDialog } from 'components/common';\nimport Routes from 'routing/Routes';\nimport { EventNotificationsActions } from 'stores/event-notifications/EventNotificationsStore';\nimport withHistory from 'routing/withHistory';\n\nimport EventNotificationForm from './EventNotificationForm';\n\n// Import built-in Event Notification Types\n\nimport '../event-notification-types';\n\nconst initialValidation = {\n errors: {},\n};\n\nconst initialTestResult = {\n isLoading: false,\n};\n\nclass EventNotificationFormContainer extends React.Component {\n static propTypes = {\n action: PropTypes.oneOf(['create', 'edit']),\n notification: PropTypes.object,\n /** Controls whether the form should be embedded into another one, and submitted/cancel externally */\n embedded: PropTypes.bool,\n /** Controls the ID of the form, so it can be controlled externally */\n formId: PropTypes.string,\n onSubmit: PropTypes.func,\n history: PropTypes.object.isRequired,\n };\n\n static defaultProps = {\n action: 'edit',\n notification: {\n title: '',\n description: '',\n config: {},\n },\n embedded: false,\n formId: undefined,\n onSubmit: () => {},\n };\n\n static scrollToFirstError() {\n if (document.getElementsByClassName('has-error')[0] !== undefined) {\n document.getElementsByClassName('has-error')[0].scrollIntoView(true);\n }\n }\n\n constructor(props) {\n super(props);\n\n this.state = {\n notification: props.notification,\n validation: initialValidation,\n testResult: initialTestResult,\n isDirty: false,\n };\n }\n\n componentWillUnmount() {\n // Test request may take a while to return a result, cancel the promise before leaving the page.\n if (this.testPromise) {\n this.testPromise.cancel();\n }\n }\n\n handleChange = (key, value) => {\n const { notification } = this.state;\n const nextNotification = cloneDeep(notification);\n\n nextNotification[key] = value;\n this.setState({ notification: nextNotification, isDirty: true, testResult: initialTestResult });\n };\n\n handleCancel = () => {\n const { history } = this.props;\n history.push(Routes.ALERTS.NOTIFICATIONS.LIST);\n };\n\n handleSubmit = () => {\n const { action, embedded, onSubmit, history } = this.props;\n const { notification } = this.state;\n\n let promise;\n\n if (action === 'create') {\n promise = EventNotificationsActions.create(notification);\n\n promise.then(\n () => {\n this.setState({ isDirty: false }, () => {\n if (!embedded) {\n history.push(Routes.ALERTS.NOTIFICATIONS.LIST);\n }\n });\n },\n (errorResponse) => {\n const { body } = errorResponse.additional;\n\n if (errorResponse.status === 400 && body && body.failed) {\n this.setState({ validation: body });\n EventNotificationFormContainer.scrollToFirstError();\n }\n },\n );\n } else {\n promise = EventNotificationsActions.update(notification.id, notification);\n\n promise.then(\n () => {\n this.setState({ isDirty: false }, () => {\n if (!embedded) {\n history.push(Routes.ALERTS.NOTIFICATIONS.LIST);\n }\n });\n },\n (errorResponse) => {\n const { body } = errorResponse.additional;\n\n if (errorResponse.status === 400 && body && body.failed) {\n this.setState({ validation: body });\n EventNotificationFormContainer.scrollToFirstError();\n }\n },\n );\n }\n\n onSubmit(promise);\n };\n\n handleTest = () => {\n const { notification } = this.state;\n\n this.setState({ testResult: { isLoading: true }, validation: initialValidation });\n const testResult = clone(initialTestResult);\n\n this.testPromise = EventNotificationsActions.test(notification);\n\n this.testPromise\n .then(\n (response) => {\n testResult.error = false;\n testResult.message = 'Notification was executed successfully.';\n\n return response;\n },\n (errorResponse) => {\n testResult.error = true;\n const { body } = errorResponse.additional;\n\n if (errorResponse.status === 400 && body && body.failed) {\n testResult.message = 'Validation failed, please correct any errors in the form before continuing.';\n this.setState({ validation: body });\n } else {\n testResult.message = errorResponse.responseMessage || 'Unknown error, please check your Graylog server logs.';\n }\n },\n )\n .finally(() => {\n this.setState({ testResult: testResult });\n this.testPromise = undefined;\n });\n };\n\n render() {\n const { action, embedded, formId } = this.props;\n const { notification, validation, testResult, isDirty } = this.state;\n\n return (\n <>\n {!embedded && isDirty && (\n \n )}\n \n >\n );\n }\n}\n\nexport default withHistory(EventNotificationFormContainer);\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 React from 'react';\n\nimport { Col, Row } from 'components/bootstrap';\nimport { DocumentTitle, PageHeader } from 'components/common';\nimport Routes from 'routing/Routes';\nimport DocsHelper from 'util/DocsHelper';\nimport { isPermitted } from 'util/PermissionsMixin';\nimport EventNotificationFormContainer from 'components/event-notifications/event-notification-form/EventNotificationFormContainer';\nimport EventsPageNavigation from 'components/events/EventsPageNavigation';\nimport useCurrentUser from 'hooks/useCurrentUser';\nimport useHistory from 'routing/useHistory';\n\nconst CreateEventDefinitionPage = () => {\n const currentUser = useCurrentUser();\n const history = useHistory();\n\n if (!isPermitted(currentUser.permissions, 'eventnotifications:create')) {\n history.push(Routes.NOTFOUND);\n }\n\n return (\n \n \n \n \n Notifications alert you of any configured Event when they occur. Graylog can send Notifications directly\n to you or to other systems you use for that purpose.\n \n \n\n \n \n \n \n
\n \n );\n};\n\nexport default CreateEventDefinitionPage;\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 type { Subtract } from 'utility-types';\n\nimport type { HistoryFunction } from './useHistory';\nimport useHistory from './useHistory';\n\ntype HistoryContext = {\n history: HistoryFunction;\n};\n\nconst withParams = (Component: React.ComponentType): React.ComponentType> => (props) => {\n const history = useHistory();\n\n return ;\n};\n\nexport default withParams;\n","var baseClone = require('./_baseClone');\n\n/** Used to compose bitmasks for cloning. */\nvar CLONE_SYMBOLS_FLAG = 4;\n\n/**\n * Creates a shallow clone of `value`.\n *\n * **Note:** This method is loosely based on the\n * [structured clone algorithm](https://mdn.io/Structured_clone_algorithm)\n * and supports cloning arrays, array buffers, booleans, date objects, maps,\n * numbers, `Object` objects, regexes, sets, strings, symbols, and typed\n * arrays. The own enumerable properties of `arguments` objects are cloned\n * as plain objects. An empty object is returned for uncloneable values such\n * as error objects, functions, DOM nodes, and WeakMaps.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Lang\n * @param {*} value The value to clone.\n * @returns {*} Returns the cloned value.\n * @see _.cloneDeep\n * @example\n *\n * var objects = [{ 'a': 1 }, { 'b': 2 }];\n *\n * var shallow = _.clone(objects);\n * console.log(shallow[0] === objects[0]);\n * // => true\n */\nfunction clone(value) {\n return baseClone(value, CLONE_SYMBOLS_FLAG);\n}\n\nmodule.exports = clone;\n"],"names":["getNotificationPlugin","type","n","formattedEventNotificationTypes","EventNotificationForm","props","enabled","event","notification","onSubmit","sendTelemetry","action","location","name","onChange","nextConfig","nextType","defaultConfig","onTest","embedded","formId","onCancel","validation","testResult","isSubmitEnabled","notificationPlugin","notificationFormComponent","testButtonText","withLocation","withTelemetry","initialValidation","initialTestResult","key","value","nextNotification","history","Routes","promise","errorResponse","body","response","isDirty","EventNotificationFormContainer","withHistory","currentUser","Component","baseClone","CLONE_SYMBOLS_FLAG","clone","module"],"sourceRoot":""}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy