"use strict";(self.webpackChunkgrafana=self.webpackChunkgrafana||[]).push([[8431],{42524:(T,_,s)=>{s.r(_),s.d(_,{AccessControlFolderPermissions:()=>m,default:()=>A});var e=s(66111),E=s(67948),c=s(73546),l=s(8412),p=s(77582),D=s(86245),r=s(27876),M=s(61986),O=s(60492);function v(t,i){const a=i.match.params.uid;return{uid:a,pageNav:(0,D.ht)(t.navIndex,`folder-permissions-${a}`,(0,O._l)(1))}}const h={getFolderByUid:M.Pb},o=(0,E.connect)(v,h),m=({uid:t,getFolderByUid:i,pageNav:a})=>{(0,e.useEffect)(()=>{i(t)},[i,t]);const C=p.Vt.hasPermission(r.AccessControlAction.FoldersPermissionsWrite);return e.createElement(l.T,{navId:"dashboards/browse",pageNav:a.main},e.createElement(l.T.Contents,null,e.createElement(c.P,{resource:"folders",resourceId:t,canSetPermissions:C})))},A=o(m)},45663:(T,_,s)=>{s.r(_),s.d(_,{FolderPermissions:()=>a,default:()=>C});var e=s(66111),E=s(67948),c=s(61860),l=s(39904),p=s(31403),D=s(1108),r=s(8412),M=s(6645),O=s(92158),v=s(54630),h=s(86245),o=s(61986),m=s(60492);const A=(g,d)=>{const n=d.match.params.uid;return{pageNav:(0,h.ht)(g.navIndex,`folder-permissions-${n}`,(0,m._l)(1)),folderUid:n,folder:g.folder}},t={getFolderByUid:o.Pb,getFolderPermissions:o.a,updateFolderPermission:o.v7,removeFolderPermission:o.Uk,addFolderPermission:o.pz},i=(0,E.connect)(A,t);class a extends e.PureComponent{constructor(d){super(d),this.onOpenAddPermissions=()=>{this.setState({isAdding:!0})},this.onRemoveItem=n=>{this.props.removeFolderPermission(n)},this.onPermissionChanged=(n,P)=>{this.props.updateFolderPermission(n,P)},this.onAddPermission=n=>this.props.addFolderPermission(n),this.onCancelAddPermission=()=>{this.setState({isAdding:!1})},this.state={isAdding:!1}}componentDidMount(){this.props.getFolderByUid(this.props.folderUid),this.props.getFolderPermissions(this.props.folderUid)}render(){const{pageNav:d,folder:n}=this.props,{isAdding:P}=this.state;if(n.id===0)return e.createElement(r.T,{navId:"dashboards/browse",pageNav:d.main},e.createElement(r.T.Contents,{isLoading:!0},e.createElement("span",null)));const I={title:n.title,url:n.url,id:n.id};return e.createElement(r.T,{navId:"dashboards/browse",pageNav:d.main},e.createElement(r.T.Contents,null,e.createElement("div",{className:"page-action-bar"},e.createElement("h3",{className:"page-sub-heading"},"Folder Permissions"),e.createElement(c.u,{placement:"auto",content:e.createElement(v.Z,null)},e.createElement(l.J,{className:"icon--has-hover page-sub-heading-icon",name:"question-circle"})),e.createElement("div",{className:"page-action-bar__spacer"}),e.createElement(p.zx,{className:"pull-right",onClick:this.onOpenAddPermissions,disabled:P},"Add Permission")),e.createElement(D.s,{in:P},e.createElement(M.Z,{onAddPermission:this.onAddPermission,onCancel:this.onCancelAddPermission})),e.createElement(O.Z,{items:n.permissions,onRemoveItem:this.onRemoveItem,onPermissionChanged:this.onPermissionChanged,isFetching:!1,folderInfo:I})))}}const C=i(a)}}]);

//# sourceMappingURL=FolderPermissions.16b68e8fc8cd24e99f58.js.map