"use strict";(self.webpackChunkgrafana=self.webpackChunkgrafana||[]).push([[4827],{75718:(e,t,s)=>{s.r(t),s.d(t,{FolderSettingsPage:()=>j,default:()=>F});var a,n,o=s(76687),i=s(46958),r=s(70534),l=s(33225),d=s(36131),h=s(3276),c=s(80410),p=s(89348),u=s(92114),f=s(82919),g=s(52010);function m(e,t,s){return t in e?Object.defineProperty(e,t,{value:s,enumerable:!0,configurable:!0,writable:!0}):e[t]=s,e}const{Input:v}=r.LegacyForms,b={getFolderByUid:p.Pb,saveFolder:p.OD,setFolderTitle:f.Ss,deleteFolder:p.Go},x=(0,i.connect)(((e,t)=>{const s=t.match.params.uid;return{navModel:(0,h.h)(e.navIndex,`folder-settings-${s}`,(0,u._)(2)),folderUid:s,folder:e.folder}}),b);class j extends o.PureComponent{constructor(e){super(e),m(this,"onTitleChange",(e=>{this.props.setFolderTitle(e.target.value)})),m(this,"onSave",(async e=>{e.preventDefault(),e.stopPropagation(),this.setState({isLoading:!0}),await this.props.saveFolder(this.props.folder),this.setState({isLoading:!1})})),m(this,"onDelete",(e=>{e.stopPropagation(),e.preventDefault();l.Z.publish(new c.VJ({title:"Delete",text:"Do you want to delete this folder and all its dashboards and alerts?",icon:"trash-alt",yesText:"Delete",onConfirm:()=>{this.props.deleteFolder(this.props.folder.uid)}}))})),this.state={isLoading:!1}}componentDidMount(){this.props.getFolderByUid(this.props.folderUid)}render(){const{navModel:e,folder:t}=this.props;return(0,g.jsx)(d.Z,{navModel:e,children:(0,g.jsxs)(d.Z.Contents,{isLoading:this.state.isLoading,children:[a||(a=(0,g.jsx)("h3",{className:"page-sub-heading",children:"Folder settings"})),(0,g.jsx)("div",{className:"section gf-form-group",children:(0,g.jsxs)("form",{name:"folderSettingsForm",onSubmit:this.onSave,children:[(0,g.jsxs)("div",{className:"gf-form",children:[n||(n=(0,g.jsx)("label",{className:"gf-form-label width-7",children:"Name"})),(0,g.jsx)(v,{type:"text",className:"gf-form-input width-30",value:t.title,onChange:this.onTitleChange})]}),(0,g.jsxs)("div",{className:"gf-form-button-row",children:[(0,g.jsx)(r.Button,{type:"submit",disabled:!t.canSave||!t.hasChanged,children:"Save"}),(0,g.jsx)(r.Button,{variant:"destructive",onClick:this.onDelete,disabled:!t.canDelete,children:"Delete"})]})]})})]})})}}const F=x(j)}}]);
//# sourceMappingURL=FolderSettingsPage.7d5e04f5e17969a02a9b.js.map