Skip to content

Commit

Permalink
chore: rename project name to project key (#731)
Browse files Browse the repository at this point in the history
  • Loading branch information
pablohashescobar authored Apr 6, 2023
1 parent 6be7754 commit c0b732f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
6 changes: 3 additions & 3 deletions apiserver/plane/api/views/importer.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,12 +65,12 @@ def get(self, request, slug, service):
)

if service == "jira":
project_name = request.data.get("project_name", "")
project_key = request.data.get("project_key", "")
api_token = request.data.get("api_token", "")
email = request.data.get("email", "")
cloud_hostname = request.data.get("cloud_hostname", "")
if (
not bool(project_name)
not bool(project_key)
or not bool(api_token)
or not bool(email)
or not bool(cloud_hostname)
Expand All @@ -84,7 +84,7 @@ def get(self, request, slug, service):

return Response(
jira_project_issue_summary(
email, api_token, project_name, cloud_hostname
email, api_token, project_key, cloud_hostname
),
status=status.HTTP_200_OK,
)
Expand Down
12 changes: 6 additions & 6 deletions apiserver/plane/utils/importers/jira.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,33 +3,33 @@
from sentry_sdk import capture_exception


def jira_project_issue_summary(email, api_token, project_name, hostname):
def jira_project_issue_summary(email, api_token, project_key, hostname):
try:
auth = HTTPBasicAuth(email, api_token)
headers = {"Accept": "application/json"}

issue_url = f"https://{hostname}/rest/api/3/search?jql=project={project_name} AND issuetype=Story"
issue_url = f"https://{hostname}/rest/api/3/search?jql=project={project_key} AND issuetype=Story"
issue_response = requests.request(
"GET", issue_url, headers=headers, auth=auth
).json()["total"]

module_url = f"https://{hostname}/rest/api/3/search?jql=project={project_name} AND issuetype=Epic"
module_url = f"https://{hostname}/rest/api/3/search?jql=project={project_key} AND issuetype=Epic"
module_response = requests.request(
"GET", module_url, headers=headers, auth=auth
).json()["total"]

status_url = f"https://{hostname}/rest/api/3/status/?jql=project={project_name}"
status_url = f"https://{hostname}/rest/api/3/status/?jql=project={project_key}"
status_response = requests.request(
"GET", status_url, headers=headers, auth=auth
).json()

labels_url = f"https://{hostname}/rest/api/3/label/?jql=project={project_name}"
labels_url = f"https://{hostname}/rest/api/3/label/?jql=project={project_key}"
labels_response = requests.request(
"GET", labels_url, headers=headers, auth=auth
).json()["total"]

users_url = (
f"https://{hostname}/rest/api/3/users/search?jql=project={project_name}"
f"https://{hostname}/rest/api/3/users/search?jql=project={project_key}"
)
users_response = requests.request(
"GET", users_url, headers=headers, auth=auth
Expand Down

0 comments on commit c0b732f

Please sign in to comment.