"use strict";(self.webpackChunkgrafana=self.webpackChunkgrafana||[]).push([[8431],{47895:(T,_,s)=>{s.r(_),s.d(_,{AccessControlFolderPermissions:()=>m,default:()=>A});var e=s(27702),E=s(27173),c=s(1541),l=s(44644),p=s(66574),D=s(86809),r=s(18771),M=s(35381),O=s(40127);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)},30902:(T,_,s)=>{s.r(_),s.d(_,{FolderPermissions:()=>a,default:()=>C});var e=s(27702),E=s(27173),c=s(80011),l=s(73453),p=s(66670),D=s(88203),r=s(44644),M=s(71313),O=s(50683),v=s(22698),h=s(86809),o=s(35381),m=s(40127);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.6dc761483b6a459db1ef.js.map