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,IAAC,EAA1C,gBAAC,EAAW,CAAC,QAASxC,CAAA,CAAM,CAC7C,CACF,CACF,CAEJ,C,qBC9DA,IAAI6C,EAAkB,EAAQ,UAAoB,EAC9CC,EAAmB,EAAQ,UAAqB,EAGhDC,EAAc,OAAO,UAGrBC,EAAiBD,EAAY,eAwB7BE,EAAUH,EAAiB,SAASI,EAAQ5D,EAAO6D,EAAK,CACtDH,EAAe,KAAKE,EAAQC,CAAG,EACjC,EAAED,EAAOC,CAAG,EAEZN,EAAgBK,EAAQC,EAAK,CAAC,CAElC,CAAC,EAEDC,EAAO,QAAUH,C","sources":["webpack://graylog-web-interface/./src/components/indices/IndexSetFieldTypeProfiles/ProfileForm.tsx","webpack://graylog-web-interface/./src/components/indices/IndexSetFieldTypeProfiles/hooks/useProfileMutations.ts","webpack://graylog-web-interface/./src/components/indices/IndexSetFieldTypeProfiles/EditProfile.tsx","webpack://graylog-web-interface/./src/pages/IndexSetFieldTypeProfileEditPage.tsx","webpack://graylog-web-interface/./node_modules/lodash/countBy.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 */\n\nimport { styled } from 'styled-components';\nimport React, { useMemo } from 'react';\nimport { Formik, Form, FieldArray, Field } from 'formik';\nimport countBy from 'lodash/countBy';\n\nimport type { IndexSetFieldTypeProfileForm } from 'components/indices/IndexSetFieldTypeProfiles/types';\nimport { FormikInput, IconButton, Select, FormSubmit, Spinner, InputOptionalInfo } from 'components/common';\nimport { Button, Col, HelpBlock, Input } from 'components/bootstrap';\nimport useFieldTypes from 'views/logic/fieldtypes/useFieldTypes';\nimport useFieldTypesForMapping from 'views/logic/fieldactions/ChangeFieldType/hooks/useFieldTypesForMappings';\nimport { defaultCompare } from 'logic/DefaultCompare';\nimport isReservedField from 'views/logic/IsReservedField';\n\nconst SelectContainer = styled.div`\n flex-basis: 100%;\n`;\n\nconst SelectGroup = styled.div`\n flex-grow: 1;\n display: flex;\n gap: 5px;\n`;\nconst List = styled.div`\n display: flex;\n flex-direction: column;\n`;\nconst StyledLabel = styled.h5`\n font-weight: bold;\n margin-bottom: 5px;\n`;\n\nconst Item = styled.div`\n display: flex;\n gap: 5px;\n`;\n\nconst StyledFormSubmit = styled(FormSubmit)`\n margin-top: 30px;\n`;\ntype Props = {\n initialValues?: IndexSetFieldTypeProfileForm,\n submitButtonText: string,\n submitLoadingText: string,\n onCancel: () => void,\n onSubmit: (profile: IndexSetFieldTypeProfileForm) => void\n}\n\nconst getFieldError = (field: string, occurrences: number) => {\n if (!field) return 'Field is required';\n if (isReservedField(field)) return 'Field is reserved';\n if (occurrences > 1) return 'This field occurs several times';\n\n return undefined;\n};\n\nconst validate = (formValues: IndexSetFieldTypeProfileForm) => {\n const errors: { name?: string, customFieldMappings?: Array<{ field?: string, type?: string }>} = {};\n\n if (!formValues.name) {\n errors.name = 'Profile name is required';\n }\n\n const fieldsOccurrences = countBy(formValues.customFieldMappings, 'field');\n\n const customFieldMappings: Array<{ field: string, type: string }> = formValues\n .customFieldMappings\n .map(({ field, type }) => {\n if (field && type && (fieldsOccurrences[field] === 1)) return undefined;\n\n return ({\n field: getFieldError(field, fieldsOccurrences[field]),\n type: !type ? 'Type is required' : undefined,\n });\n });\n\n if (customFieldMappings.filter((item) => item).length > 0) {\n errors.customFieldMappings = customFieldMappings;\n }\n\n return errors;\n};\n\ntype ProfileFormSelectProps = {\n onChange: (param: { target: { value: string, name: string } }) => void,\n options: Array<{ value: string, label: string, disabled?: boolean }>,\n error: string,\n name: string,\n value: string | undefined | null,\n placeholder: string,\n allowCreate: boolean,\n}\n\nconst ProfileFormSelect = ({ onChange, options, error, name, value, placeholder, allowCreate }: ProfileFormSelectProps) => (\n \n \n \n);\n\nconst ProfileForm = ({ initialValues, submitButtonText, submitLoadingText, onCancel, onSubmit }: Props) => {\n const { data, isLoading } = useFieldTypes(undefined, undefined);\n const { data: { fieldTypes }, isLoading: isLoadingFieldTypes } = useFieldTypesForMapping();\n const fieldTypeOptions = useMemo(() => Object.entries(fieldTypes)\n .sort(([, label1], [, label2]) => defaultCompare(label1, label2))\n .map(([value, label]) => ({\n value,\n label,\n })), [fieldTypes]);\n const fields = useMemo(() => (isLoading ? [] : data.map(({ value: { name } }) => ({ value: name, label: name, disabled: isReservedField(name) }))), [data, isLoading]);\n\n const _onSubmit = (profile: IndexSetFieldTypeProfileForm) => {\n onSubmit(profile);\n };\n\n return (\n \n initialValues={initialValues}\n onSubmit={_onSubmit}\n validate={validate}\n validateOnChange>\n {({ isSubmitting, isValid, isValidating, values: { customFieldMappings } }) => (\n \n )}\n \n \n );\n};\n\nProfileForm.defaultProps = {\n initialValues: { name: '', description: '', customFieldMappings: [{ type: '', field: '' }] },\n};\n\nexport default ProfileForm;\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 { useMutation, useQueryClient } from '@tanstack/react-query';\n\nimport { qualifyUrl } from 'util/URLUtils';\nimport fetch from 'logic/rest/FetchProvider';\nimport UserNotification from 'util/UserNotification';\nimport type {\n IndexSetFieldTypeProfileForm,\n IndexSetFieldTypeProfileRequestJson,\n} from 'components/indices/IndexSetFieldTypeProfiles/types';\n\nexport const urlPrefix = '/system/indices/index_sets/profiles';\n\nconst putProfile = async ({ profile, id }: { profile: IndexSetFieldTypeProfileForm, id: string }) => {\n const url = qualifyUrl(urlPrefix);\n const body: IndexSetFieldTypeProfileRequestJson = {\n id,\n name: profile.name,\n description: profile.description,\n custom_field_mappings: profile.customFieldMappings,\n };\n\n return fetch('PUT', url, body);\n};\n\nconst postProfile = async (profile: IndexSetFieldTypeProfileForm) => {\n const url = qualifyUrl(urlPrefix);\n const body: IndexSetFieldTypeProfileRequestJson = {\n name: profile.name,\n description: profile.description,\n custom_field_mappings: profile.customFieldMappings,\n };\n\n return fetch('POST', url, body);\n};\n\nconst deleteProfile = async (id: string) => {\n const url = qualifyUrl(`${urlPrefix}/${id}`);\n\n return fetch('DELETE', url);\n};\n\nconst useProfileMutation = () => {\n const queryClient = useQueryClient();\n\n const post = useMutation(postProfile, {\n onError: (errorThrown) => {\n UserNotification.error(`Creating index set field type profile failed with status: ${errorThrown}`,\n 'Could not create index set field type profile');\n },\n onSuccess: () => {\n UserNotification.success('Index set field type profile has been successfully created.', 'Success!');\n\n return queryClient.refetchQueries({ queryKey: ['indexSetFieldTypeProfiles'], type: 'active' });\n },\n });\n const put = useMutation(putProfile, {\n onError: (errorThrown) => {\n UserNotification.error(`Updating index set field type profile failed with status: ${errorThrown}`,\n 'Could not update index set field type profile');\n },\n onSuccess: () => {\n UserNotification.success('Index set field type profile has been successfully updated.', 'Success!');\n\n return queryClient.refetchQueries({ queryKey: ['indexSetFieldTypeProfiles'], type: 'active' });\n },\n });\n const remove = useMutation(deleteProfile, {\n onError: (errorThrown) => {\n UserNotification.error(`Deleting index set field type profile failed with status: ${errorThrown}`,\n 'Could not delete index set field type profile');\n },\n onSuccess: () => {\n UserNotification.success('Index set field type profile has been successfully deleted.', 'Success!');\n\n return queryClient.refetchQueries({ queryKey: ['indexSetFieldTypeProfiles'], type: 'active' });\n },\n });\n\n return ({\n editProfile: put.mutateAsync,\n isEditLoading: put.isLoading,\n createProfile: post.mutateAsync,\n isCreateLoading: post.isLoading,\n isLoading: post.mutateAsync || post.isLoading || remove.isLoading,\n deleteProfile: remove.mutateAsync,\n });\n};\n\nexport default useProfileMutation;\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, { useMemo, useCallback, useEffect } from 'react';\nimport { useNavigate } from 'react-router-dom';\nimport omit from 'lodash/omit';\n\nimport useSendTelemetry from 'logic/telemetry/useSendTelemetry';\nimport { TELEMETRY_EVENT_TYPE } from 'logic/telemetry/Constants';\nimport { getPathnameWithoutId } from 'util/URLUtils';\nimport useLocation from 'routing/useLocation';\nimport ProfileForm from 'components/indices/IndexSetFieldTypeProfiles/ProfileForm';\nimport type {\n IndexSetFieldTypeProfile,\n IndexSetFieldTypeProfileForm,\n} from 'components/indices/IndexSetFieldTypeProfiles/types';\nimport useProfileMutations from 'components/indices/IndexSetFieldTypeProfiles/hooks/useProfileMutations';\nimport Routes from 'routing/Routes';\n\ntype Props = {\n profile: IndexSetFieldTypeProfile,\n}\n\nconst EditProfile = ({\n profile,\n}: Props) => {\n const sendTelemetry = useSendTelemetry();\n const navigate = useNavigate();\n const { pathname } = useLocation();\n const { editProfile } = useProfileMutations();\n const telemetryPathName = useMemo(() => getPathnameWithoutId(pathname), [pathname]);\n\n const onSubmit = useCallback((newProfile: IndexSetFieldTypeProfileForm) => {\n editProfile({ profile: newProfile, id: profile.id }).then(() => {\n sendTelemetry(TELEMETRY_EVENT_TYPE.INDEX_SET_FIELD_TYPE_PROFILE.EDIT, {\n app_pathname: telemetryPathName,\n app_action_value: { mappingsQuantity: newProfile?.customFieldMappings?.length },\n });\n\n navigate(Routes.SYSTEM.INDICES.FIELD_TYPE_PROFILES.OVERVIEW);\n });\n }, [editProfile, navigate, profile.id, sendTelemetry, telemetryPathName]);\n\n useEffect(() => {\n sendTelemetry(TELEMETRY_EVENT_TYPE.INDEX_SET_FIELD_TYPE_PROFILE.EDIT_OPENED, { app_pathname: telemetryPathName, app_action_value: 'create-new-index-set-field-type-profile-opened' });\n }, [sendTelemetry, telemetryPathName]);\n\n const onCancel = useCallback(() => {\n sendTelemetry(TELEMETRY_EVENT_TYPE.INDEX_SET_FIELD_TYPE_PROFILE.EDIT_CANCELED, { app_pathname: telemetryPathName, app_action_value: 'create-new-index-set-field-type-profile-canceled' });\n navigate(Routes.SYSTEM.INDICES.FIELD_TYPE_PROFILES.OVERVIEW);\n }, [navigate, sendTelemetry, telemetryPathName]);\n\n const initialValues = useMemo(() => omit(profile, ['id', 'indexSetIds']), [profile]);\n\n return (\n \n );\n};\n\nexport default EditProfile;\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, { useEffect } from 'react';\nimport { useNavigate } from 'react-router-dom';\n\nimport { DocumentTitle, PageHeader, Spinner } from 'components/common';\nimport DocsHelper from 'util/DocsHelper';\nimport Routes from 'routing/Routes';\nimport { Col, Row } from 'components/bootstrap';\nimport useProfile from 'components/indices/IndexSetFieldTypeProfiles/hooks/useProfile';\nimport useParams from 'routing/useParams';\nimport EditProfile from 'components/indices/IndexSetFieldTypeProfiles/EditProfile';\nimport useHasTypeMappingPermission from 'hooks/useHasTypeMappingPermission';\nimport { IndicesPageNavigation } from 'components/indices';\n\nconst IndexSetFieldTypeProfileEditPage = () => {\n const { profileId } = useParams();\n const { data, isFetching } = useProfile(profileId);\n const navigate = useNavigate();\n const hasMappingPermission = useHasTypeMappingPermission();\n\n useEffect(() => {\n if (!hasMappingPermission) {\n navigate(Routes.NOTFOUND);\n }\n }, [hasMappingPermission, navigate]);\n\n return (\n \n \n \n \n With index set field type profiles you can bundle up custom field types into profiles.\n Then you can assign this profile to any index set.\n On this page you can modify the "{data?.name}" field type profile configuration.\n \n \n \n \n {!isFetching ? : }\n \n
\n \n );\n};\n\nexport default IndexSetFieldTypeProfileEditPage;\n","var baseAssignValue = require('./_baseAssignValue'),\n createAggregator = require('./_createAggregator');\n\n/** Used for built-in method references. */\nvar objectProto = Object.prototype;\n\n/** Used to check objects for own properties. */\nvar hasOwnProperty = objectProto.hasOwnProperty;\n\n/**\n * Creates an object composed of keys generated from the results of running\n * each element of `collection` thru `iteratee`. The corresponding value of\n * each key is the number of times the key was returned by `iteratee`. The\n * iteratee is invoked with one argument: (value).\n *\n * @static\n * @memberOf _\n * @since 0.5.0\n * @category Collection\n * @param {Array|Object} collection The collection to iterate over.\n * @param {Function} [iteratee=_.identity] The iteratee to transform keys.\n * @returns {Object} Returns the composed aggregate object.\n * @example\n *\n * _.countBy([6.1, 4.2, 6.3], Math.floor);\n * // => { '4': 1, '6': 2 }\n *\n * // The `_.property` iteratee shorthand.\n * _.countBy(['one', 'two', 'three'], 'length');\n * // => { '3': 2, '5': 1 }\n */\nvar countBy = createAggregator(function(result, value, key) {\n if (hasOwnProperty.call(result, key)) {\n ++result[key];\n } else {\n baseAssignValue(result, key, 1);\n }\n});\n\nmodule.exports = countBy;\n"],"names":["SelectContainer","SelectGroup","List","StyledLabel","Item","StyledFormSubmit","getFieldError","field","occurrences","validate","formValues","errors","fieldsOccurrences","customFieldMappings","type","item","ProfileFormSelect","onChange","options","error","name","value","placeholder","allowCreate","newVal","ProfileForm","initialValues","submitButtonText","submitLoadingText","onCancel","onSubmit","data","isLoading","fieldTypes","isLoadingFieldTypes","fieldTypeOptions","label1","label2","label","fields","_onSubmit","profile","isSubmitting","isValid","isValidating","remove","push","index","urlPrefix","putProfile","id","url","body","postProfile","deleteProfile","queryClient","post","errorThrown","put","sendTelemetry","useSendTelemetry","navigate","pathname","useLocation","editProfile","useProfileMutations","telemetryPathName","newProfile","Routes","profileId","useParams","isFetching","useProfile","hasMappingPermission","useHasTypeMappingPermission","DocsHelper","baseAssignValue","createAggregator","objectProto","hasOwnProperty","countBy","result","key","module"],"sourceRoot":""}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy