"use strict";(self.webpackChunkgrafana=self.webpackChunkgrafana||[]).push([[4827],{96225:(e,t,s)=>{s.r(t),s.d(t,{FolderSettingsPage:()=>w,default:()=>D});var a,n,i=s(68404),o=s(1485),r=s(59912),l=s(40920),d=s(5831),h=s(90894),c=s(8674),p=s(21169),g=s(87413),f=s(49545),u=s(11304),m=s(45916);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.5a6e7c9cc438ca300e6a.js.map