Giter Site home page Giter Site logo

backstage-plugin-jira's Introduction

backstage-plugin-jira's People

Contributors

adamdmharvey avatar athal7 avatar ayshiff avatar bobalong79 avatar dependabot[bot] avatar dtuite avatar irma12 avatar kuangp avatar lewtakm avatar martina-if avatar mcalus3 avatar o5ten avatar padraigobrien avatar snyk-bot avatar xantier avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

backstage-plugin-jira's Issues

Jira Card breaks if activity stream contains content with < or > that is not an HTML element

Expected Behavior

The activity stream displays.

Current Behavior

For one of my projects, I discovered the Jira Card was broken. I tried to troubleshoot it, and best I can tell, it breaks anytime someone adds a comment to a Jira story where the CONTENT of their comment contains the < or > character.

In particular, I have a few people who have pasted in e-mail forwards and the output of a single entry.content looks roughly like so:

<blockquote>    <p><b>From:</b> Last, First <[email protected]> <br>  <b>Sent:</b> Wednesday, February 17, 2021 11:09 PM<br>  <b>To:</b> Last, First <[email protected]>; Last, First <[email protected]><br>  <b>Subject:</b> RE: Title of E-mail - <a class="issue-link" href="https://jiraurl.com/browse/PROJECTKEY-123" title="Jira Story Title">PROJECTKEY-123</a> - more of a sentence</p>
</blockquote>

This seems to break the entire card.

Possible Solution

Parse function may need to handle the output in a different way? I don't know if it's coming that way from an HTMl scrape or what, but it seems to be getting confused thinking <[email protected]> is an HTML field and bombing out.

Steps to Reproduce

  1. Step 1
  2. Step 2
  3. ...

Context

Specifically seems to break on this line, which if I comment it out, the rest of the card displays:

<Box>
{parse(entry.summary || entry.content || '', options)}
</Box>

Unable to display this entity's Jira project, seemingly at all. (This team seems to frequently paste e-mails into comments!)

Your Environment

  • Plugin Version (version of this software e.g. v0.4.3):
  • Backstage version (e.g. 0.1.1-alpha23):
  • NodeJS Version (e.g. v12):
  • Operating System and Version (e.g. Ubuntu 14.04):
  • Browser Information (e.g. chrome 85):

Include Bearer authentication

Hi, i think it would be nice to include Basic and Bearer authentication for jira. This way people with api token could use this plugin too :)

Issues when upgrade to Backstage release-2021-05-27

Expected Behavior

When upgrade to latest Backstage release no issues should occur.

  • Upgrade done via yarn backstage-cli versions:bump
  • Plugin version: @roadiehq/backstage-plugin-jira": "^1.0.6

Current Behavior

<EntitySwitch.Case if={isJiraAvailable}> results in following error:

Type '(entity: import("/node_modules/@roadiehq/backstage-plugin-jira/node_modules/@backstage/catalog-model/dist/index").Entity) => boolean' is not assignable to type '(entity: import("/node_modules/@backstage/catalog-model/dist/index").Entity) => boolean'.
  Types of parameters 'entity' and 'entity' are incompatible.
    Type 'import("/node_modules/@backstage/catalog-model/dist/index").Entity' is not assignable to type 'import("/node_modules/@roadiehq/backstage-plugin-jira/node_modules/@backstage/catalog-model/dist/index").Entity'.

This snippet

<Grid item md={6}>
  <EntityJiraOverviewCard/>
</Grid>

results in following runtime error:

Uncaught TypeError: Cannot read property 'metadata' of undefined
    at useProjectEntity (index.esm.js?b6ad:285)
    at JiraCard (index.esm.js?b6ad:530)

The above error occurred in the <JiraCard> component:
    in JiraCard (created by Extension(Component))

Possible Solution

I assume it can be fixed by update dependencies in package.json

$ yarn backstage-cli versions:check --fix
The following packages must be deduplicated by updating dependencies in package.json

  @backstage/plugin-catalog-react @ ^0.1.6 should be changed to ^0.2.0

The following packages can be deduplicated by updating dependencies in package.json

  @backstage/catalog-model @ ^0.7.10 should be changed to ^0.8.0
  @backstage/catalog-model @ ^0.7.9 should be changed to ^0.8.0

Steps to Reproduce

see above

Context

upgrade Backstage

Your Environment

  • Plugin Version (version of this software e.g. v0.4.3): 1.0.6
  • Backstage version (e.g. 0.1.1-alpha23): release-2021-05-20
  • NodeJS Version (e.g. v12): v12.19.0
  • Operating System and Version (e.g. Ubuntu 14.04): Pop!_OS 20.10
  • Browser Information (e.g. chrome 85): Opera 76.0.4017.123

Problem setting up plugin

Hi, i was setting up the plugin in my test environment and sadly it does not work.
I see the request being sent to jira but i get the following error:

Log's referral number: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
Cause
Referer URL: Unknown
java.lang.ArrayIndexOutOfBoundsException: 1
java.lang.ArrayIndexOutOfBoundsException: 1 ... 

Project avatars not reachable to Jira Data Center Instance

My project avatar us issuing an HTTP 403 unauthorized and not displaying in the widget:

image

image

It's funny because if I grab the URL and fire it in my browser, I'm already authenticated to the instance and it shows me immediately. So doesn't seem to be a CORS/Backstage proxy issue, but not sure why.

Jira plugin send api didn't have an authorization

when I use jira plugin to get the jira data. I set my authorization in app-config.yaml like this:

'/jira/api':
target: https://jira.huami.com
allowedHeaders: ['Authorization']
headers:
Authorization: 'Basic {api_token}'
Accept: 'application/json'
Content-Type: 'application/json'
X-Atlassian-Token: 'nocheck'
User-Agent: "MY-UA-STRING"

But when I check the api,there is no authorization .

curl 'http://localhost:7000/api/proxy/jira/api/rest/api/latest/search'
-H 'Connection: keep-alive'
-H 'sec-ch-ua: " Not;A Brand";v="99", "Google Chrome";v="91", "Chromium";v="91"'
-H 'sec-ch-ua-mobile: ?0'
-H 'User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.114 Safari/537.36'
-H 'content-type: application/json'
-H 'Accept: /'
-H 'Origin: http://localhost:3000'
-H 'Sec-Fetch-Site: same-site'
-H 'Sec-Fetch-Mode: cors'
-H 'Sec-Fetch-Dest: empty'
-H 'Referer: http://localhost:3000/'
-H 'Accept-Language: en,zh-CN;q=0.9,zh;q=0.8'
--data-raw '{"jql":"project = "CLOUD"\n AND issuetype = "新功能"\n \n \n AND statuscategory not in ("Done")\n ","maxResults":0}'
--compressed

Update README to support new composability setup

Expected Behavior

README reflects current setup instructions.

Current Behavior

The current README uses isPluginApplicableToEntity which in alignment with the new composability work is now deprecated via #47.

Possible Solution

Minor README updates.

Steps to Reproduce

  1. Step 1
  2. Step 2
  3. ...

Context

Your Environment

  • Plugin Version (version of this software e.g. v0.4.3):
  • Backstage version (e.g. 0.1.1-alpha23):
  • NodeJS Version (e.g. v12):
  • Operating System and Version (e.g. Ubuntu 14.04):
  • Browser Information (e.g. chrome 85):

Suggestion: Don't show the empty issue categories

As you can see it doesn't look great when having multiple issue categories, which isn't uncommon.
Either make it look better or hide the categories that lack issues entirely. Perhaps even make it configurable which ones to show.

image

Validate the JIRA_TOKEN

Based on #15 we could validate the JIRA_TOKEN and give a (better) hint when it's in an incorrect format.

Plugin unable to authenticate to Jira Server

A user in Discord reported that the plugin isn't working for him with Jira Server.

we are not using Jira cloud, we use Jira Server which i think the api url may be different (similar to the differences between Bitbucket Server and Bitbucket Cloud) we use an id to login, not email but i tried base 64 encoding both (user name and email) and my API token isnt even being hit, it does allow me to register the API with the jira project key annotation but i dont see anything in the about card...

i got it hitting jira now using my username vs email but getting an error 'Request failed with status code 403' here are the logs, any ideas?

'/jira/api':
    target: https://jiraserver.com
    headers:
      Authorization: Basic MYTOKENUSINGUSERNAME
      Accept: application/json
      Content-Type: application/json
      X-Atlassian-Token: no-check
[12:53 AM]
"GET /api/proxy/jira/api/rest/api/latest/project/PIL1 HTTP/1.1" 200 - "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.61 Safari/537.36" type=incomingRequest
"POST /api/proxy/jira/api/rest/api/latest/search HTTP/1.1" 403 - "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.61 Safari/537.36" type=incomingRequest
"POST /api/proxy/jira/api/rest/api/latest/search HTTP/1.1" 403 - "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.61 Safari/537.36" type=incomingRequest
"POST /api/proxy/jira/api/rest/api/latest/search HTTP/1.1" 403 - "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.61 

Activity Stream should be for a project and not an entire instance

The activity stream currently displayed seems to be from the entire Jira instance. My instance has over 1.4 million issues and over 6000 projects, and I personally have read access to hundreds of projects with my user I used a token for. Thus when displaying the card, the activity stream I see is not really relevant to the component I'm viewing.

Suggest replacing it with the activity stream of the given project as defined in the annotation (e.g., jira/project-key).

Cannot read property 'length' of undefined

Trying out the new plugin, but not able to get it to work yet. Various permutations, I keep getting this:

image

Also the resulting link for "Project ->" ends up just being the URL for my component with a suffix of my annotation project-ley (so it's reading that), i.e. http://localhost:3000/catalog/default/component/adams-component/undefined/browse/PROJKEY.

I've tried a few different permutations of settings, restarting Backstage each time to confirm I'm picking up my app-config.local.yaml changes, including:

  • target being https://mycustomJiraUrl.company.com
  • target being https://mycustomJiraUrl.company.com/api/2 (the REST API end point)
  • Confirmed/tweaked the Authorization base64 encoded user string

Would be valuable maybe to...

  • get some either debugging context (I'm not sure if plugins can extend winston-style logging object if say I add LOG_LEVEL=debug to the env vars, could this plugin pick them up?)
  • print out more specific error, such as unable to get to link, or bad authentication, something like that

Any help appreciated, and/or happy to try bug fixes/tweaks?

Thanks!

Display component in card if defined

When the Jira card uses both a project and a defined component, it would be great to SHOW the component in some way.

For example, I setup a new component entity in Backstage and gave it my same Jira project key and defined a Jira component for only it. (actually our work for standing up a Backstage PoC 😃 which is represented by only one epic ) But I actually can't tell that that is all that is being shown.

image

So maybe something along the subtitle, next to the "Project Description | software type", maybe right aligned saying like "Component: Foo" ? Open to other ideas.

Type 'Promise<void>' is not assignable to type 'never'.

I get this error when I add this plugin to the plugins directory of a Backstage app and run yarn install && yarn tsc && yarn build.

plugins/backstage-plugin-jira/src/components/JiraCard/JiraCard.test.tsx:104:7 - error TS2322: Type 'Promise<void>' is not assignable to type 'never'.

104       expect(
          ~~~~~~~
105         await rendered.findByText(/status 403: Forbidden/)
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
106       ).toBeInTheDocument()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~

  node_modules/@testing-library/dom/types/wait-for.d.ts:10:13
    10   callback: () => T extends Promise<any> ? never : T,
                   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    The expected type comes from the return type of this signature.


Found 1 error.

error Command failed with exit code 2.

Returned statuses should be project specific and not instance wide

When I first clicked on the status filter button, it delayed a good 4-5 seconds before painting. Looking into it, it seems it's the REST API endpoint for all statuses on a given Jira instance:

const request = await axios.get(`${apiUrl}status`);

My instance has hundreds of customized statuses, where some teams do agile, some issue tracking, some basic Kanban, etc, and each project uses a set of customized statues based on predefined patterns. So my given project does not uses most of the returned list of statuses.

Since this widget displays data specific for a project, I think the status collection should be only those valid for the project. The project status call on large instances is also faster.

I tried a PR to fix this, but I'll admit to getting a bit lost into the mechanics of React's useState calls firing the hooks.

But the simple API change is as so:

const request = await axios.get(`${apiUrl}project/${projectKey}/statuses`);

It returns in the same format as the root instance /status API call. Essentially, need to call the statuses call per project like so:

https://docs.atlassian.com/software/jira/docs/api/REST/8.14.0/#api/2/project-getAllStatuses

And this necessitates passing the projectKey into the status hook.

Remove Sub-tasks

Sub-tasks are a fine-grained measure of work in JIRA and don't really make sense in the context of an overview widget where you are trying to get an at-a-glance view of the project.

User-Agent: "MY-UA-STRING"

Is the User-Agent string required for Jira Server? If so, is there any documentation on how to obtain the string?

Expected Behavior

Current Behavior

Possible Solution

Steps to Reproduce

  1. Step 1
  2. Step 2
  3. ...

Context

Your Environment

  • Plugin Version (version of this software e.g. v0.4.3):
  • Backstage version (e.g. 0.1.1-alpha23):
  • NodeJS Version (e.g. v12):
  • Operating System and Version (e.g. Ubuntu 14.04):
  • Browser Information (e.g. chrome 85):

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.