"use strict";(self.webpackChunkgrafana=self.webpackChunkgrafana||[]).push([[8431],{42524:(T,_,s)=>{s.r(_),s.d(_,{AccessControlFolderPermissions:()=>P,default:()=>h});var e=s(68404),E=s(36635),c=s(73546),m=s(79396),p=s(77582),D=s(86245),r=s(81168),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._)(1))}}const A={getFolderByUid:M.Pb},o=(0,E.connect)(v,A),P=({uid:t,getFolderByUid:i,pageNav:a})=>{(0,e.useEffect)(()=>{i(t)},[i,t]);const C=p.Vt.hasPermission(r.AccessControlAction.FoldersPermissionsWrite);return e.createElement(m.T,{navId:"dashboards/browse",pageNav:a.main},e.createElement(m.T.Contents,null,e.createElement(c.P,{resource:"folders",resourceId:t,canSetPermissions:C})))},h=o(P)},45663:(T,_,s)=>{s.r(_),s.d(_,{FolderPermissions:()=>a,default:()=>C});var e=s(68404),E=s(36635),c=s(61860),m=s(39904),p=s(31403),D=s(1108),r=s(79396),M=s(6645),O=s(92103),v=s(54630),A=s(86245),o=s(61986),P=s(60492);const h=(g,d)=>{const n=d.match.params.uid;return{pageNav:(0,A.ht)(g.navIndex,`folder-permissions-${n}`,(0,P._)(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)(h,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,l)=>{this.props.updateFolderPermission(n,l)},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:l}=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:"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(m.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:l},"Add Permission")),e.createElement(D.s,{in:l},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.a29cb67ada579765b380.js.map