From 620cc6dced923c75284b682fd4cc5215d879d107 Mon Sep 17 00:00:00 2001 From: Eric Leijonmarck Date: Wed, 21 Feb 2024 09:26:09 +0000 Subject: [PATCH] Team LBAC: Add epilogue to permissions (#82523) * add epilogue to permissions * gs linting fix * update docs * Revert "update docs" This reverts commit 0902ce2d8a2dc3f402baa63ac0e9515c603231d0. --- public/app/core/actions/index.ts | 1 + .../components/AccessControl/Permissions.tsx | 165 +++++++++--------- 2 files changed, 86 insertions(+), 80 deletions(-) diff --git a/public/app/core/actions/index.ts b/public/app/core/actions/index.ts index 88c6c68ab2e..d73c489b33e 100644 --- a/public/app/core/actions/index.ts +++ b/public/app/core/actions/index.ts @@ -1,3 +1,4 @@ import { hideAppNotification, notifyApp } from '../reducers/appNotification'; import { updateNavIndex, updateConfigurationSubtitle } from '../reducers/navModel'; + export { updateNavIndex, updateConfigurationSubtitle, notifyApp, hideAppNotification }; diff --git a/public/app/core/components/AccessControl/Permissions.tsx b/public/app/core/components/AccessControl/Permissions.tsx index 56180466695..d84e03031e7 100644 --- a/public/app/core/components/AccessControl/Permissions.tsx +++ b/public/app/core/components/AccessControl/Permissions.tsx @@ -37,6 +37,7 @@ export type Props = { resourceId: ResourceId; canSetPermissions: boolean; getWarnings?: (items: ResourcePermission[]) => ResourcePermission[]; + epilogue?: (items: ResourcePermission[]) => React.ReactNode; }; export const Permissions = ({ @@ -48,6 +49,7 @@ export const Permissions = ({ canSetPermissions, addPermissionTitle, getWarnings, + epilogue, }: Props) => { const styles = useStyles2(getStyles); const [isAdding, setIsAdding] = useState(false); @@ -157,87 +159,90 @@ export const Permissions = ({ const titleTeam = t('access-control.permissions.team', 'Team'); return ( -
- {canSetPermissions && resource === 'folders' && ( - <> - - This will change permissions for this folder and all its descendants. In total, this will affect: - - - - - )} - {items.length === 0 && ( - - {emptyLabel} - - )} - - - - - {canSetPermissions && ( - <> - - - setIsAdding(false)} + <> +
+ {canSetPermissions && resource === 'folders' && ( + <> + + This will change permissions for this folder and all its descendants. In total, this will affect: + + - - - )} -
+ + + )} + {items.length === 0 && ( + + {emptyLabel} + + )} + + + + + {canSetPermissions && ( + <> + + + setIsAdding(false)} + /> + + + )} +
+ {epilogue && epilogue(items)} + ); };