-
-
Notifications
You must be signed in to change notification settings - Fork 4.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
permissionalert: deprecate old permission alert
- Loading branch information
Showing
2 changed files
with
41 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
import Access from 'sentry/components/acl/access'; | ||
import type {AlertProps} from 'sentry/components/alert'; | ||
import {Alert} from 'sentry/components/alert'; | ||
import {t} from 'sentry/locale'; | ||
import type {Scope} from 'sentry/types/core'; | ||
import type {Team} from 'sentry/types/organization'; | ||
import type {Project} from 'sentry/types/project'; | ||
|
||
interface PermissionAlertProps extends Omit<AlertProps, 'type'> { | ||
access?: Scope[]; | ||
project?: Project; | ||
team?: Team; | ||
} | ||
|
||
export const permissionAlertText = t( | ||
'These settings can only be edited by users with the organization-level owner, manager, or team-level admin roles.' | ||
); | ||
|
||
/** | ||
* @deprecated Use `ProjectPermissionAlert` instead. | ||
*/ | ||
function PermissionAlert({ | ||
access = ['project:write'], | ||
project, | ||
team, | ||
...props | ||
}: PermissionAlertProps) { | ||
return ( | ||
<Access access={access} project={project} team={team}> | ||
{({hasAccess}) => | ||
!hasAccess && ( | ||
<Alert data-test-id="project-permission-alert" type="warning" {...props}> | ||
{permissionAlertText} | ||
</Alert> | ||
) | ||
} | ||
</Access> | ||
); | ||
} | ||
|
||
export default PermissionAlert; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -31,5 +31,3 @@ export function ProjectPermissionAlert({ | |
</Access> | ||
); | ||
} | ||
|
||
export default ProjectPermissionAlert; |