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x","webpack://grafana/./public/app/features/folders/FolderPermissions.tsx"],"sourcesContent":["import React, { useEffect } from 'react';\nimport { connect, ConnectedProps } from 'react-redux';\n\nimport { Permissions } from 'app/core/components/AccessControl';\nimport Page from 'app/core/components/Page/Page';\nimport { contextSrv } from 'app/core/core';\nimport { GrafanaRouteComponentProps } from 'app/core/navigation/types';\nimport { getNavModel } from 'app/core/selectors/navModel';\nimport { AccessControlAction, StoreState } from 'app/types';\n\nimport { getFolderByUid } from './state/actions';\nimport { getLoadingNav } from './state/navModel';\n\ninterface RouteProps extends GrafanaRouteComponentProps<{ uid: string }> {}\n\nfunction mapStateToProps(state: StoreState, props: RouteProps) {\n const uid = props.match.params.uid;\n return {\n uid: uid,\n navModel: getNavModel(state.navIndex, `folder-permissions-${uid}`, getLoadingNav(1)),\n };\n}\n\nconst mapDispatchToProps = {\n getFolderByUid,\n};\n\nconst connector = connect(mapStateToProps, mapDispatchToProps);\nexport type Props = ConnectedProps;\n\nexport const AccessControlFolderPermissions = ({ uid, getFolderByUid, navModel }: Props) => {\n useEffect(() => {\n getFolderByUid(uid);\n }, [getFolderByUid, uid]);\n\n const canSetPermissions = contextSrv.hasPermission(AccessControlAction.FoldersPermissionsWrite);\n\n return (\n \n \n \n \n \n );\n};\n\nexport default connector(AccessControlFolderPermissions);\n","import React, { PureComponent } from 'react';\nimport { connect, ConnectedProps } from 'react-redux';\n\nimport { Tooltip, Icon, Button } from '@grafana/ui';\nimport { SlideDown } from 'app/core/components/Animations/SlideDown';\nimport Page from 'app/core/components/Page/Page';\nimport AddPermission from 'app/core/components/PermissionList/AddPermission';\nimport PermissionList from 'app/core/components/PermissionList/PermissionList';\nimport PermissionsInfo from 'app/core/components/PermissionList/PermissionsInfo';\nimport { GrafanaRouteComponentProps } from 'app/core/navigation/types';\nimport { getNavModel } from 'app/core/selectors/navModel';\nimport { StoreState } from 'app/types';\nimport { DashboardAcl, PermissionLevel, NewDashboardAclItem } from 'app/types/acl';\n\nimport {\n getFolderByUid,\n getFolderPermissions,\n updateFolderPermission,\n removeFolderPermission,\n addFolderPermission,\n} from './state/actions';\nimport { getLoadingNav } from './state/navModel';\n\nexport interface OwnProps extends GrafanaRouteComponentProps<{ uid: string }> {}\n\nconst mapStateToProps = (state: StoreState, props: OwnProps) => {\n const uid = props.match.params.uid;\n return {\n navModel: getNavModel(state.navIndex, `folder-permissions-${uid}`, getLoadingNav(1)),\n folderUid: uid,\n folder: state.folder,\n };\n};\n\nconst mapDispatchToProps = {\n getFolderByUid,\n getFolderPermissions,\n updateFolderPermission,\n removeFolderPermission,\n addFolderPermission,\n};\n\nconst connector = connect(mapStateToProps, mapDispatchToProps);\n\nexport type Props = OwnProps & ConnectedProps;\n\nexport interface State {\n isAdding: boolean;\n}\n\nexport class FolderPermissions extends PureComponent {\n constructor(props: Props) {\n super(props);\n\n this.state = {\n isAdding: false,\n };\n }\n\n componentDidMount() {\n this.props.getFolderByUid(this.props.folderUid);\n this.props.getFolderPermissions(this.props.folderUid);\n }\n\n onOpenAddPermissions = () => {\n this.setState({ isAdding: true });\n };\n\n onRemoveItem = (item: DashboardAcl) => {\n this.props.removeFolderPermission(item);\n };\n\n onPermissionChanged = (item: DashboardAcl, level: PermissionLevel) => {\n this.props.updateFolderPermission(item, level);\n };\n\n onAddPermission = (newItem: NewDashboardAclItem) => {\n return this.props.addFolderPermission(newItem);\n };\n\n onCancelAddPermission = () => {\n this.setState({ isAdding: false });\n };\n\n render() {\n const { navModel, folder } = this.props;\n const { isAdding } = this.state;\n\n if (folder.id === 0) {\n return (\n \n \n \n \n \n );\n }\n\n const folderInfo = { title: folder.title, url: folder.url, id: folder.id };\n\n return (\n \n \n
\n

Folder Permissions

\n }>\n \n \n
\n \n
\n \n \n \n \n \n \n );\n }\n}\n\nexport default connector(FolderPermissions);\n"],"names":["mapDispatchToProps","getFolderByUid","connector","connect","state","props","uid","match","params","navModel","getNavModel","navIndex","getLoadingNav","AccessControlFolderPermissions","useEffect","canSetPermissions","contextSrv","AccessControlAction","P","resource","resourceId","getFolderPermissions","updateFolderPermission","removeFolderPermission","addFolderPermission","folderUid","folder","FolderPermissions","PureComponent","constructor","super","this","setState","isAdding","item","level","newItem","componentDidMount","render","id","isLoading","folderInfo","title","url","className","Tooltip","placement","content","Icon","name","Button","onClick","onOpenAddPermissions","disabled","in","onAddPermission","onCancel","onCancelAddPermission","items","permissions","onRemoveItem","onPermissionChanged","isFetching"],"sourceRoot":""}