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,CAAQD,KAAK,SAAb","sources":["webpack://grafana/./public/app/features/admin/UserCreatePage.tsx"],"sourcesContent":["import React, { useCallback } from 'react';\nimport { connect } from 'react-redux';\nimport { useHistory } from 'react-router-dom';\n\nimport { NavModel } from '@grafana/data';\nimport { getBackendSrv } from '@grafana/runtime';\nimport { Form, Button, Input, Field } from '@grafana/ui';\nimport Page from 'app/core/components/Page/Page';\n\nimport { getNavModel } from '../../core/selectors/navModel';\nimport { StoreState } from '../../types';\n\ninterface UserCreatePageProps {\n navModel: NavModel;\n}\ninterface UserDTO {\n name: string;\n password: string;\n email?: string;\n login?: string;\n}\n\nconst createUser = async (user: UserDTO) => getBackendSrv().post('/api/admin/users', user);\n\nconst UserCreatePage: React.FC = ({ navModel }) => {\n const history = useHistory();\n\n const onSubmit = useCallback(\n async (data: UserDTO) => {\n await createUser(data);\n history.push('/admin/users');\n },\n [history]\n );\n\n return (\n \n \n

Add new user

\n
\n {({ register, errors }) => {\n return (\n <>\n \n \n \n\n \n \n \n\n \n \n \n \n value.trim() !== '' && value.length >= 4,\n })}\n type=\"password\"\n />\n \n \n \n );\n }}\n \n
\n
\n );\n};\n\nconst mapStateToProps = (state: StoreState) => ({\n navModel: getNavModel(state.navIndex, 'global-users'),\n});\n\nexport default connect(mapStateToProps)(UserCreatePage);\n"],"names":["connect","state","navModel","getNavModel","navIndex","history","useHistory","onSubmit","useCallback","async","getBackendSrv","post","user","createUser","data","push","Form","validateOn","register","errors","Field","label","required","invalid","name","error","undefined","Input","id","password","validate","value","trim","length","type","Button"],"sourceRoot":""}