"use strict";(self.webpackChunkgrafana=self.webpackChunkgrafana||[]).push([[4827],{75718:(e,t,s)=>{s.r(t),s.d(t,{FolderSettingsPage:()=>w,default:()=>D});var a,n,i=s(76687),o=s(30415),r=s(64536),l=s(55312),d=s(33225),h=s(28781),c=s(3276),p=s(80410),g=s(89348),f=s(92114),u=s(18087),m=s(52010);function v(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:b}=r.vw6,x={getFolderByUid:g.Pb,saveFolder:g.OD,setFolderTitle:u.Ss,deleteFolder:g.Go},j=(0,o.connect)(((e,t)=>{const s=t.match.params.uid;return{pageNav:(0,c.h)(e.navIndex,`folder-settings-${s}`,(0,f._)(2)),folderUid:s,folder:e.folder}}),x);class w extends i.PureComponent{constructor(e){super(e),v(this,"onTitleChange",(e=>{this.props.setFolderTitle(e.target.value)})),v(this,"onSave",(async e=>{e.preventDefault(),e.stopPropagation(),this.setState({isLoading:!0}),await this.props.saveFolder(this.props.folder),this.setState({isLoading:!1})})),v(this,"onDelete",(e=>{e.stopPropagation(),e.preventDefault();d.Z.publish(new p.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{pageNav:e,folder:t}=this.props;return(0,m.jsx)(h.T,{navId:"dashboards/browse",pageNav:e.main,children:(0,m.jsxs)(h.T.Contents,{isLoading:this.state.isLoading,children:[a||(a=(0,m.jsx)("h3",{className:"page-sub-heading",children:"Folder settings"})),(0,m.jsx)("div",{className:"section gf-form-group",children:(0,m.jsxs)("form",{name:"folderSettingsForm",onSubmit:this.onSave,children:[(0,m.jsxs)("div",{className:"gf-form",children:[n||(n=(0,m.jsx)("label",{className:"gf-form-label width-7",children:"Name"})),(0,m.jsx)(b,{type:"text",className:"gf-form-input width-30",value:t.title,onChange:this.onTitleChange})]}),(0,m.jsxs)("div",{className:"gf-form-button-row",children:[(0,m.jsx)(l.zx,{type:"submit",disabled:!t.canSave||!t.hasChanged,children:"Save"}),(0,m.jsx)(l.zx,{variant:"destructive",onClick:this.onDelete,disabled:!t.canDelete,children:"Delete"})]})]})})]})})}}const D=j(w)}}]);
//# sourceMappingURL=FolderSettingsPage.af660e7853c4ecacaf83.js.map