"use strict";(self.webpackChunkgrafana=self.webpackChunkgrafana||[]).push([[8932],{9244:(e,r,a)=>{a.r(r),a.d(r,{NewDashboardsFolder:()=>p,default:()=>v});var n,t,s=a(76687),d=a(46958),l=a(70534),o=a(36131),i=a(3276),c=a(50631),u=a(89348),h=a(52010);function m(e,r,a){return r in e?Object.defineProperty(e,r,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[r]=a,e}const f={createNewFolder:u.W7},b=(0,d.connect)((e=>({navModel:(0,i.h)(e.navIndex,"manage-dashboards")})),f),N={folderName:""};class p extends s.PureComponent{constructor(){super(...arguments),m(this,"onSubmit",(e=>{this.props.createNewFolder(e.folderName)})),m(this,"validateFolderName",(e=>c.t.validateNewFolderName(e).then((()=>!0)).catch((e=>e.message))))}render(){return(0,h.jsx)(o.Z,{navModel:this.props.navModel,children:(0,h.jsxs)(o.Z.Contents,{children:[n||(n=(0,h.jsx)("h3",{children:"New dashboard folder"})),(0,h.jsx)(l.Form,{defaultValues:N,onSubmit:this.onSubmit,children:e=>{let{register:r,errors:a}=e;return(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(l.Field,{label:"Folder name",invalid:!!a.folderName,error:a.folderName&&a.folderName.message,children:(0,h.jsx)(l.Input,Object.assign({id:"folder-name-input"},r("folderName",{required:"Folder name is required.",validate:async e=>await this.validateFolderName(e)})))}),t||(t=(0,h.jsx)(l.Button,{type:"submit",children:"Create"}))]})}})]})})}}const v=b(p)}}]);
//# sourceMappingURL=NewDashboardsFolder.5371383ee442f550a6c4.js.map