-
-
Notifications
You must be signed in to change notification settings - Fork 4.4k
impr(jira): switch to paginated project endpoint for jira issue config #89707
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 7 commits
ea16738
84d46be
870c677
51f8318
06f43c4
d45b090
398ec93
be86d5b
8ef4856
08e5d1a
720019d
6a0143a
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 |
---|---|---|
|
@@ -789,7 +789,13 @@ def get_create_issue_config(self, group: Group | None, user: RpcUser, **kwargs): | |
project_id = params.get("project", defaults.get("project")) | ||
client = self.get_client() | ||
try: | ||
jira_projects = client.get_projects_list() | ||
jira_projects = ( | ||
client.get_projects_paginated({"maxResults": MAX_PER_PROJECT_QUERIES})["values"] | ||
if features.has( | ||
"organizations:jira-paginated-projects", group.organization, actor=user | ||
) | ||
else client.get_projects_list() | ||
) | ||
except ApiError as e: | ||
logger.info( | ||
"jira.get-create-issue-config.no-projects", | ||
|
@@ -822,15 +828,23 @@ def get_create_issue_config(self, group: Group | None, user: RpcUser, **kwargs): | |
if not any(c for c in issue_type_choices if c[0] == issue_type): | ||
issue_type = issue_type_meta["id"] | ||
|
||
projects_form_field = { | ||
"name": "project", | ||
"label": "Jira Project", | ||
"choices": [(p["id"], f"{p["key"]} - {p["name"]}") for p in jira_projects], | ||
"default": meta["id"], | ||
"type": "select", | ||
"updatesForm": True, | ||
"required": True, | ||
} | ||
Comment on lines
+831
to
+839
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. Part of the "leaving code better than we found it" mantra, it'd be nice if we could create a typeddict or dataclass for this in the future. 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. do you mind if I pull out the FormField typing to another PR ? It's going to add a lot of changes unrelated to the original PRs goal. 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. moving formfield typing to another PR |
||
if features.has("organizations:jira-paginated-projects", group.organization, actor=user): | ||
paginated_projects_url = reverse( | ||
"sentry-extensions-jira-search", args=[self.organization.slug, self.model.id] | ||
) | ||
Christinarlong marked this conversation as resolved.
Show resolved
Hide resolved
|
||
projects_form_field["url"] = paginated_projects_url | ||
|
||
fields = [ | ||
{ | ||
"name": "project", | ||
"label": "Jira Project", | ||
"choices": [(p["id"], p["key"]) for p in jira_projects], | ||
"default": meta["id"], | ||
"type": "select", | ||
"updatesForm": True, | ||
}, | ||
projects_form_field, | ||
*fields, | ||
{ | ||
"name": "issuetype", | ||
|
Uh oh!
There was an error while loading. Please reload this page.