12 |
- "use strict";(self.webpackChunkgrafana=self.webpackChunkgrafana||[]).push([[8431],{65229:(e,s,i)=>{i.r(s),i.d(s,{AccessControlFolderPermissions:()=>P,default:()=>g});var n=i(68404),o=i(18745),r=i(83654),d=i(33801),t=i(98163),a=i(8674),l=i(58170),c=i(87413),h=i(49545),m=i(45916);const p={getFolderByUid:c.Pb},u=(0,o.connect)((function(e,s){const i=s.match.params.uid;return{uid:i,navModel:(0,a.h)(e.navIndex,`folder-permissions-${i}`,(0,h._)(1))}}),p),P=e=>{let{uid:s,getFolderByUid:i,navModel:o}=e;(0,n.useEffect)((()=>{i(s)}),[i,s]);const a=t.Vt.hasPermission(l.bW.FoldersPermissionsWrite);return(0,m.jsx)(d.Z,{navModel:o,children:(0,m.jsx)(d.Z.Contents,{children:(0,m.jsx)(r.P,{resource:"folders",resourceId:s,canSetPermissions:a})})})},g=u(P)},29577:(e,s,i)=>{i.r(s),i.d(s,{FolderPermissions:()=>b,default:()=>C});var n,o,r,d,t=i(68404),a=i(18745),l=i(69783),c=i(72779),h=i(33801),m=i(93319),p=i(18778),u=i(25130),P=i(8674),g=i(87413),f=i(49545),v=i(45916);function x(e,s,i){return s in e?Object.defineProperty(e,s,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[s]=i,e}const j={getFolderByUid:g.Pb,getFolderPermissions:g.a,updateFolderPermission:g.v7,removeFolderPermission:g.Uk,addFolderPermission:g.pz},F=(0,a.connect)(((e,s)=>{const i=s.match.params.uid;return{navModel:(0,P.h)(e.navIndex,`folder-permissions-${i}`,(0,f._)(1)),folderUid:i,folder:e.folder}}),j);class b extends t.PureComponent{constructor(e){super(e),x(this,"onOpenAddPermissions",(()=>{this.setState({isAdding:!0})})),x(this,"onRemoveItem",(e=>{this.props.removeFolderPermission(e)})),x(this,"onPermissionChanged",((e,s)=>{this.props.updateFolderPermission(e,s)})),x(this,"onAddPermission",(e=>this.props.addFolderPermission(e))),x(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{navModel:e,folder:s}=this.props,{isAdding:i}=this.state;if(0===s.id)return(0,v.jsx)(h.Z,{navModel:e,children:n||(n=(0,v.jsx)(h.Z.Contents,{isLoading:!0,children:(0,v.jsx)("span",{})}))});const t={title:s.title,url:s.url,id:s.id};return(0,v.jsx)(h.Z,{navModel:e,children:(0,v.jsxs)(h.Z.Contents,{children:[(0,v.jsxs)("div",{className:"page-action-bar",children:[o||(o=(0,v.jsx)("h3",{className:"page-sub-heading",children:"Folder Permissions"})),r||(r=(0,v.jsx)(l.Tooltip,{placement:"auto",content:(0,v.jsx)(u.Z,{}),children:(0,v.jsx)(l.Icon,{className:"icon--has-hover page-sub-heading-icon",name:"question-circle"})})),d||(d=(0,v.jsx)("div",{className:"page-action-bar__spacer"})),(0,v.jsx)(l.Button,{className:"pull-right",onClick:this.onOpenAddPermissions,disabled:i,children:"Add Permission"})]}),(0,v.jsx)(c.s,{in:i,children:(0,v.jsx)(m.Z,{onAddPermission:this.onAddPermission,onCancel:this.onCancelAddPermission})}),(0,v.jsx)(p.Z,{items:s.permissions,onRemoveItem:this.onRemoveItem,onPermissionChanged:this.onPermissionChanged,isFetching:!1,folderInfo:t})]})})}}const C=F(b)}}]);
- //# sourceMappingURL=FolderPermissions.b539271cbfc4e5ba83dc.js.map
|