Skip to content
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

#254 Jira Cloud Support #378

Open
wants to merge 73 commits into
base: main
Choose a base branch
from
Open

#254 Jira Cloud Support #378

wants to merge 73 commits into from

Conversation

KzuDemEvin
Copy link
Collaborator

Feature #254 - Finally JIRA Cloud support!

What

  • Add JIRA Cloud OAuth1 support
  • Add error message when JIRA cloud application link is not set up correctly
  • Add a new JiraApiClient class, because JIRA cloud and JIRA server can use the same requests
  • Add a new JiraConfig class to store the jiraUrl, accessToken, consumerKey and privateKey for each connection (shared with JIRA cloud and server)
  • Update documentation with a guide on how to set up an application link and how to use Diveni with JIRA cloud

Fix

  • Fix accessToken maps can grow indefinitely by removing an accessToken when it's session is deleted
  • Fix receiving the tokenIdentifier when creating a session
  • Change some endpoints from camelCase to kebab-case
  • Replace accessToken with tokenIdentifier as instance variable for each session
  • Fix typo and remove unused methods for authenticating with JIRA instances
  • Remove unused view JiraCallbackPage

Schoch, Kevin added 30 commits May 30, 2023 14:24
@KzuDemEvin
Copy link
Collaborator Author

Thanks for your feedback, @G1t-Happens!

I have updated this pull request with your suggested fix.
Could you please verify my changes as I currently do not have access to the JIRA server.

@SponsoredByPuma
Copy link
Contributor

SponsoredByPuma commented Sep 20, 2023

Hey @KzuDemEvin,

I've tried your changes but it is not working for me.
For the cloud version I could fix the issue, by replacing

  • fields.put("reporter", Map.of("accountId", getJiraConfigs().get(tokenIdentifier)));

with

  • fields.put("reporter", Map.of("accountId", jiraApiClient.getCurrentUsername(getJiraConfigs().get(tokenIdentifier))));

I did the same for Jira Server, but there i get this error message:
image

@G1t-Happens
Copy link
Contributor

Thanks for your feedback, @G1t-Happens!

I have updated this pull request with your suggested fix. Could you please verify my changes as I currently do not have access to the JIRA server.

Unfortunately, it doesn't work.
Nonetheless, when I configure the reporter attribute as outlined below, both issue trackers operate as expected:

JiraServerService: fields.put("reporter", Map.of("name", getCurrentUsername(tokenIdentifier)));
JiraCloudService: fields.put("reporter", Map.of("accountId", getCurrentUsername(tokenIdentifier)));

Maybe you can verify it too ? @SponsoredByPuma

@KzuDemEvin
Copy link
Collaborator Author

I've tried your changes but it is not working for me. For the cloud version I could fix the issue, by replacing

  • fields.put("reporter", Map.of("accountId", getJiraConfigs().get(tokenIdentifier)));

with

  • fields.put("reporter", Map.of("accountId", jiraApiClient.getCurrentUsername(getJiraConfigs().get(tokenIdentifier))));

Yes, you are right. I forgot to convert the config to the accountId. Thanks for pointing that out.
Should be fixed now.

Can someone check my changes? @SponsoredByPuma or @G1t-Happens?


I did the same for Jira Server, but there i get this error message: image

This seems to be a different bug. Does creating issues with Diveni work on the main branch? And does it now fail on this branch?

@G1t-Happens
Copy link
Contributor

Yes, you are right. I forgot to convert the config to the accountId. Thanks for pointing that out. Should be fixed now.

Can someone check my changes? @SponsoredByPuma or @G1t-Happens?

Both Jira issue trackers are now working for me 👍

@SponsoredByPuma
Copy link
Contributor

@KzuDemEvin
Jira Cloud now works fine for me, but I still have problems trying to create an issue for the server variant.
I've tried it on the main branch and it works fine there.
On this branch I still the get the error message that the component field is missing.

@Dan1elBox
Copy link
Collaborator

@SponsoredByPuma Which Jira Server version are you using?
If your version differs from mine (v9.11.0), I will set up the same server on my computer to attempt to reproduce the error.

@KzuDemEvin
Copy link
Collaborator Author

@Dan1elBox, were you able to reproduce @SponsoredByPuma's issue?

@Dan1elBox
Copy link
Collaborator

Hi @KzuDemEvin
Jira Cloud and the locally installed Jira Server work perfectly for me, but I will try it with the internal Jira Server in the next few days. We believe that could be the issue.

… feature/254-jira-plugin

# Conflicts:
#	backend/src/main/java/io/diveni/backend/controller/RoutesController.java
#	backend/src/main/java/io/diveni/backend/model/Session.java
#	docs/.vitepress/config.js
#	frontend/src/components/SignInWithJiraCloudButtonComponent.vue
#	frontend/src/components/SignInWithJiraServerButtonComponent.vue
#	frontend/src/locales/de.json
#	frontend/src/locales/fr.json
#	frontend/src/locales/pl.json
#	frontend/src/views/PrepareSessionPage.vue
@KzuDemEvin
Copy link
Collaborator Author

@SponsoredByPuma @Dan1elBox,
I have resolved the merge conflicts. Can either of you verify that everything is still working as expected?

@SponsoredByPuma, I think the bug you posted is a local bug. I do not think that my changes caused the error, as there were no code changes made, just refractoring. Can you verify that?

@SponsoredByPuma
Copy link
Contributor

Hey @KzuDemEvin,
The issue still exists, but I guess I know why it is appearing.
So currently on main branch when you create an issue you create an Test Case
image
On your branch you don't create an Test Case, but an actual User Story.
image
As you can see here when I try to create a user story manually in Jira, it tells me that components is necessary field.
image
Important note: Every Project has its own component's in this case it would be "Frontend" and "Service"
image

Now how to fix it:

You need to add "components" to your fields. It has to be an array I just used an ArrayList<Map<String, Object>>.
Now here comes the tricky part. The user has to give information about the component in the frontend, since it is different for every project and for every user story. I guess you could add a drop down where you can select the component. When you got that done, you can just simply add a Map.of("name", YOUR_COMPONENT_NAME) to the ArrayList.
Last but not least just have to add the ArrayList to your fields map and that's it.

Here is an example on how I hard coded it for this specific project.
image
(the component of user story should be Frontend)
image
(add component to the fields)

@stritti
Copy link
Member

stritti commented Oct 25, 2023

Great investigation and analysis, @SponsoredByPuma!

Before we add more and more features of JIRA we should think about fallback on such issues. For example, if something like this company specific field 'component' is required, we show error and redirect to JIRA. Or something similar.

@Dan1elBox
Copy link
Collaborator

Hi @stritti, I wanted to ask you because you are very knowledgeable about Jira, if it is common practice to split Jira projects into components or if it doesn't happen very often ? So that we might keep this in mind for the future, especially if this happens more frequently.

@KzuDemEvin
Copy link
Collaborator Author

Good find @SponsoredByPuma,
would you mind taking over my pull request since you have better access to Jira?

@SponsoredByPuma
Copy link
Contributor

@KzuDemEvin, I can take care of this PR 😄

SponsoredByPuma and others added 8 commits November 7, 2023 11:34
# Conflicts:
#	backend/src/main/java/io/diveni/backend/model/Session.java
#	backend/src/main/java/io/diveni/backend/service/projectmanagementproviders/jiracloud/JiraCloudService.java
#	backend/src/main/java/io/diveni/backend/service/projectmanagementproviders/jiraserver/JiraServerService.java
#	docs/.vitepress/config.js
#	docs/guide/develop.md
#	frontend/src/components/IssueTrackerComponent.vue
#	frontend/src/components/SignInWithJiraButtonComponent.vue
#	frontend/src/components/SignInWithJiraCloudButtonComponent.vue
#	frontend/src/components/SignInWithJiraServerButtonComponent.vue
#	frontend/src/locales/es.json
#	frontend/src/locales/it.json
#	frontend/src/views/PrepareSessionPage.vue
# Conflicts:
#	frontend/src/components/SignInWithJiraButtonComponent.vue
#	frontend/src/components/SignInWithJiraCloudButtonComponent.vue
#	frontend/src/components/SignInWithJiraServerButtonComponent.vue
#	frontend/src/views/JiraCallbackPage.vue
# Conflicts:
#	backend/src/main/java/io/diveni/backend/controller/ConfigController.java
#	backend/src/main/java/io/diveni/backend/controller/ProjectManagementController.java
#	backend/src/test/java/io/diveni/backend/controller/ConfigControllerTest.java
#	frontend/src/components/IssueTrackerComponent.vue
#	frontend/src/components/SignInWithAzureDevOpsButtonComponent.vue
#	frontend/src/components/SignInWithJiraButtonComponent.vue
#	frontend/src/components/SignInWithJiraCloudButtonComponent.vue
#	frontend/src/components/SignInWithJiraServerButtonComponent.vue
#	frontend/src/views/JiraCallbackPage.vue
# Conflicts:
#	backend/src/main/java/io/diveni/backend/controller/ConfigController.java
#	backend/src/main/java/io/diveni/backend/controller/ProjectManagementController.java
#	frontend/src/components/IssueTrackerComponent.vue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backend frontend java Pull requests that update Java code javascript Pull requests that update Javascript code
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Jira Plugin
5 participants