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,EAEA,OAAIH,EAAe,OAAS,EACnB,gBAAC,IAAyB,CAAC,MAAO,KAAM,iBAAkBA,CAAA,CAAgB,EAG9EV,EAaH,gBAAC,KAAa,CAAC,MAAO,SAASA,EAAgB,KAAK,sBAClD,gBAAC,IAAoB,IAAC,EACtB,gBAAC,MAAW,MAAO,SAASA,EAAgB,KAAK,qBACrC,kBAAmB,CACjB,MAAO,uBACP,KAAM,IAAW,MAAM,MACzB,GACV,gBAAC,YAAK,2FAEN,CACF,EACA,gBAAC,MAAG,CAAC,UAAU,WACb,gBAAC,MAAG,CAAC,GAAI,IACP,gBAAC,KAA6B,OAAO,OACP,YAAaF,EACb,aAAca,EACd,gBAAAX,EACA,SAAUI,EACV,SAAUA,CAAA,CAAc,CACxD,CACF,CACF,EAhCE,gBAAC,KAAa,CAAC,MAAM,yBACnB,gBAAC,YACC,gBAAC,KAAU,CAAC,MAAM,yBAChB,gBAAC,KAAO,CAAC,KAAK,6BAA8B,EAC9C,CACF,CACF,CA4BN,C","sources":["webpack://graylog-web-interface/./src/pages/EditEventDefinitionPage.tsx"],"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, { useCallback } from 'react';\nimport { useParams, useNavigate } from 'react-router-dom';\nimport URI from 'urijs';\n\nimport EventsPageNavigation from 'components/events/EventsPageNavigation';\nimport { Col, Row } from 'components/bootstrap';\nimport { DocumentTitle, PageHeader, Spinner } from 'components/common';\nimport EventDefinitionFormContainer from 'components/event-definitions/event-definition-form/EventDefinitionFormContainer';\nimport Routes from 'routing/Routes';\nimport DocsHelper from 'util/DocsHelper';\nimport { isPermitted } from 'util/PermissionsMixin';\nimport useCurrentUser from 'hooks/useCurrentUser';\nimport { EventDefinitionsActions } from 'stores/event-definitions/EventDefinitionsStore';\nimport type { EventDefinition } from 'components/event-definitions/event-definitions-types';\nimport useHistory from 'routing/useHistory';\nimport useQuery from 'routing/useQuery';\n\nimport StreamPermissionErrorPage from './StreamPermissionErrorPage';\n\nconst EditEventDefinitionPage = () => {\n const params = useParams<{definitionId?: string}>();\n const { step } = useQuery();\n const currentUser = useCurrentUser();\n const [eventDefinition, setEventDefinition] = React.useState(undefined);\n const history = useHistory();\n const navigate = useNavigate();\n\n const goToOverview = useCallback(() => {\n navigate(Routes.ALERTS.DEFINITIONS.LIST);\n }, [navigate]);\n\n React.useEffect(() => {\n if (isPermitted(currentUser.permissions, `eventdefinitions:edit:${params.definitionId}`)) {\n EventDefinitionsActions.get(params.definitionId)\n .then(\n (response) => {\n const eventDefinitionResponse = response.event_definition;\n\n // Inject an internal \"_is_scheduled\" field to indicate if the event definition should be scheduled in the\n // backend. This field will be removed in the event definitions store before sending an event definition\n // back to the server.\n eventDefinitionResponse.config._is_scheduled = response.context.scheduler.is_scheduled;\n setEventDefinition(eventDefinitionResponse);\n },\n (error) => {\n if (error.status === 404) {\n history.push(Routes.ALERTS.DEFINITIONS.LIST);\n }\n },\n );\n }\n }, [params, currentUser, history]);\n\n const streamsWithMissingPermissions = () => {\n const streams = eventDefinition?.config?.streams || [];\n\n return streams.filter((streamId) => !isPermitted(currentUser.permissions, `streams:read:${streamId}`));\n };\n\n if (!isPermitted(currentUser.permissions, `eventdefinitions:edit:${params.definitionId}`)) {\n history.push(Routes.NOTFOUND);\n }\n\n const missingStreams = streamsWithMissingPermissions();\n\n const updateURLStepQueryParam = (newStep: string) => {\n const newUrl = new URI(window.location.href).removeSearch('step').addQuery('step', newStep);\n history.replace(newUrl.resource());\n };\n\n if (missingStreams.length > 0) {\n return ;\n }\n\n if (!eventDefinition) {\n return (\n \n \n \n \n \n \n \n );\n }\n\n return (\n \n \n \n \n Event Definitions allow you to create Events from different Conditions and alert on them.\n \n \n \n \n \n \n
\n \n );\n};\n\nexport default EditEventDefinitionPage;\n"],"names":["params","step","currentUser","eventDefinition","setEventDefinition","history","navigate","goToOverview","response","eventDefinitionResponse","error","streamsWithMissingPermissions","streamId","missingStreams","updateURLStepQueryParam","newStep","newUrl"],"sourceRoot":""}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy