"use strict";(self.webpackChunkgrafana=self.webpackChunkgrafana||[]).push([[8431],{52090:(T,_,s)=>{s.r(_),s.d(_,{AccessControlFolderPermissions:()=>P,default:()=>A});var e=s(65237),E=s(37149),c=s(60336),m=s(38992),p=s(63969),D=s(85938),r=s(3315),M=s(4036),O=s(18149);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 h={getFolderByUid:M.Pb},o=(0,E.connect)(v,h),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})))},A=o(P)},98571:(T,_,s)=>{s.r(_),s.d(_,{FolderPermissions:()=>a,default:()=>C});var e=s(65237),E=s(37149),c=s(89050),m=s(6335),p=s(48389),D=s(85208),r=s(38992),M=s(60802),O=s(60496),v=s(63198),h=s(85938),o=s(4036),P=s(18149);const A=(g,d)=>{const n=d.match.params.uid;return{pageNav:(0,h.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)(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,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:"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(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.536862c302b290d9ca67.js.map