12 |
- "use strict";(self.webpackChunkgrafana=self.webpackChunkgrafana||[]).push([[8932],{30936:(e,r,a)=>{a.r(r),a.d(r,{NewDashboardsFolder:()=>p,default:()=>v});var n,t,s=a(68404),d=a(18745),l=a(69783),o=a(33801),i=a(8674),c=a(42235),u=a(87413),h=a(45916);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.82841af471ab7e9dd097.js.map
|