1 |
- {"version":3,"file":"CreateTeam.73c8a6ba12c99f27c0a9.js","mappings":"+OAoBO,MAAMA,UAAmBC,EAAAA,cAAqB,c,UAAA,oB,EAC1CC,MAAAA,IACP,MAAMC,QAAeC,EAAAA,EAAAA,iBAAgBC,KAAK,aAAcC,GACpDH,EAAOI,eACHC,EAAAA,GAAAA,uBACNC,EAAAA,gBAAAA,KAAsB,mBAAkBN,EAAOI,a,EALA,Y,EAAA,M,sFAQnDG,SACE,MAAM,SAAEC,GAAaC,KAAKC,MAE1B,OACE,SAAC,IAAD,CAAMF,SAAUA,EAAhB,UACE,SAAC,aAAD,WACE,SAAC,EAAAG,KAAD,CAAMC,SAAUH,KAAKI,OAArB,SACG,QAAC,SAAEC,EAAF,OAAYC,GAAb,SACC,UAAC,EAAAC,SAAD,CAAUC,MAAM,WAAhB,WACE,SAAC,EAAAC,MAAD,CAAOD,MAAM,OAAOE,UAAQ,EAACC,UAAWL,EAAOM,KAAMC,MAAM,wBAA3D,UACE,SAAC,EAAAC,MAAD,iBAAWT,EAAS,OAAQ,CAAEK,UAAU,IAAxC,CAAiDK,GAAG,YAAYC,MAAO,SAEzE,SAAC,EAAAP,MAAD,CACED,MAAO,QACPS,YAAa,2EAFf,UAIE,SAAC,EAAAH,MAAD,iBAAWT,EAAS,SAApB,CAA8Ba,KAAK,QAAQH,GAAG,aAAaI,YAAY,iBAAiBH,MAAO,QARnG,OAUE,gBAAKI,UAAU,qBAAf,UACE,SAAC,EAAAC,OAAD,CAAQH,KAAK,SAASI,QAAQ,UAA9B,kCAmBlB,SAAeC,EAAAA,EAAAA,UANf,SAAyBC,GACvB,MAAO,CACLzB,UAAU0B,EAAAA,EAAAA,GAAYD,EAAME,SAAU,YAI1C,CAAwCtC","sources":["webpack://grafana/./public/app/features/teams/CreateTeam.tsx"],"sourcesContent":["import React, { PureComponent } from 'react';\nimport { connect } from 'react-redux';\n\nimport { NavModel } from '@grafana/data';\nimport { getBackendSrv, locationService } from '@grafana/runtime';\nimport { Button, Form, Field, Input, FieldSet } from '@grafana/ui';\nimport Page from 'app/core/components/Page/Page';\nimport { contextSrv } from 'app/core/core';\nimport { getNavModel } from 'app/core/selectors/navModel';\nimport { StoreState } from 'app/types';\n\nexport interface Props {\n navModel: NavModel;\n}\n\ninterface TeamDTO {\n name: string;\n email: string;\n}\n\nexport class CreateTeam extends PureComponent<Props> {\n create = async (formModel: TeamDTO) => {\n const result = await getBackendSrv().post('/api/teams', formModel);\n if (result.teamId) {\n await contextSrv.fetchUserPermissions();\n locationService.push(`/org/teams/edit/${result.teamId}`);\n }\n };\n render() {\n const { navModel } = this.props;\n\n return (\n <Page navModel={navModel}>\n <Page.Contents>\n <Form onSubmit={this.create}>\n {({ register, errors }) => (\n <FieldSet label=\"New Team\">\n <Field label=\"Name\" required invalid={!!errors.name} error=\"Team name is required\">\n <Input {...register('name', { required: true })} id=\"team-name\" width={60} />\n </Field>\n <Field\n label={'Email'}\n description={'This is optional and is primarily used for allowing custom team avatars.'}\n >\n <Input {...register('email')} type=\"email\" id=\"team-email\" placeholder=\"email@test.com\" width={60} />\n </Field>\n <div className=\"gf-form-button-row\">\n <Button type=\"submit\" variant=\"primary\">\n Create\n </Button>\n </div>\n </FieldSet>\n )}\n </Form>\n </Page.Contents>\n </Page>\n );\n }\n}\n\nfunction mapStateToProps(state: StoreState) {\n return {\n navModel: getNavModel(state.navIndex, 'teams'),\n };\n}\n\nexport default connect(mapStateToProps)(CreateTeam);\n"],"names":["CreateTeam","PureComponent","async","result","getBackendSrv","post","formModel","teamId","contextSrv","locationService","render","navModel","this","props","Form","onSubmit","create","register","errors","FieldSet","label","Field","required","invalid","name","error","Input","id","width","description","type","placeholder","className","Button","variant","connect","state","getNavModel","navIndex"],"sourceRoot":""}
|