-
-
Notifications
You must be signed in to change notification settings - Fork 4.5k
feat(aci): Disable error monitor create button #103544
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -16,6 +16,7 @@ import { | |
| makeMonitorBasePathname, | ||
| makeMonitorDetailsPathname, | ||
| } from 'sentry/views/detectors/pathnames'; | ||
| import {detectorTypeIsUserCreateable} from 'sentry/views/detectors/utils/detectorTypeConfig'; | ||
| import {useCanEditDetector} from 'sentry/views/detectors/utils/useCanEditDetector'; | ||
|
|
||
| export function DisableDetectorAction({detector}: {detector: Detector}) { | ||
|
|
@@ -59,19 +60,23 @@ export function EditDetectorAction({detector}: {detector: Detector}) { | |
| projectId: detector.projectId, | ||
| }); | ||
|
|
||
| const permissionTooltipText = tct( | ||
| 'You do not have permission to edit this monitor. Ask your organization owner or manager to [settingsLink:enable monitor access] for you.', | ||
| { | ||
| settingsLink: ( | ||
| <Link | ||
| to={{ | ||
| pathname: `/settings/${organization.slug}/`, | ||
| hash: 'alertsMemberWrite', | ||
| }} | ||
| /> | ||
| ), | ||
| } | ||
| ); | ||
| const permissionTooltipText = detectorTypeIsUserCreateable(detector.type) | ||
| ? tct( | ||
| 'You do not have permission to edit this monitor. Ask your organization owner or manager to [settingsLink:enable monitor access] for you.', | ||
| { | ||
| settingsLink: ( | ||
| <Link | ||
| to={{ | ||
| pathname: `/settings/${organization.slug}/`, | ||
| hash: 'alertsMemberWrite', | ||
| }} | ||
| /> | ||
| ), | ||
| } | ||
| ) | ||
| : t( | ||
| 'This monitor is managed by Sentry. Only organization owners and managers can edit it.' | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. wait, is this right?
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. For now yeah, only org owners/managers can access the edit screen for error monitors |
||
| ); | ||
|
|
||
| return ( | ||
| <LinkButton | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| import {hasEveryAccess} from 'sentry/components/acl/access'; | ||
| import type {DetectorType} from 'sentry/types/workflowEngine/detectors'; | ||
| import useOrganization from 'sentry/utils/useOrganization'; | ||
|
|
||
| import {detectorTypeIsUserCreateable} from './detectorTypeConfig'; | ||
|
|
||
| export function useCanCreateDetector(detectorType: DetectorType | null) { | ||
| const organization = useOrganization(); | ||
|
|
||
| if (!detectorType) { | ||
| return hasEveryAccess(['alerts:write'], {organization}); | ||
| } | ||
|
|
||
| return detectorTypeIsUserCreateable(detectorType); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Bug: Inconsistent authorization allows monitor creation.When |
||
| } | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Won't this only show if you're unable to edit the monitor?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oh canEdit inherited behavior huh
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nvm I see I think