-
Notifications
You must be signed in to change notification settings - Fork 9
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
#353 | Pull request reminder widget (github / bitbucket) #403
base: master
Are you sure you want to change the base?
Conversation
…uests from given repo path
</PullRequestLink> | ||
)) | ||
) : ( | ||
<StyledNoItemsInfo> |
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.
I think this part will never be rendered because of condition in line 14
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.
Github API returns empty array when there is no pull requests in a given repository, so the widget will display "No Pull Requests", but if path to repository is invalid or API limit is reached it will return nothing, so widget will display "API rate limit exceeded!"
import styled from '@emotion/styled/macro'; | ||
import { COLORS } from '../../../../constants/'; | ||
|
||
export const PullRequestContainer = styled('div')` |
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.
export const PullRequestContainer = styled('div')` | |
export const PullRequestContainer = styled.div` |
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.
Fixed in commit 53f7cc8
} | ||
`; | ||
|
||
export const PullRequestLink = styled('a')` |
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.
export const PullRequestLink = styled('a')` | |
export const PullRequestLink = styled.a` |
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.
Fixed in commit 53f7cc8
val apiUrl = url.replace("github.com/", "api.github.com") | ||
httpGet(url = "$apiUrl/repos$path/pulls") | ||
} else { | ||
httpGet(url = "https://api.bitbucket.org/2.0/repositories$path/pullrequests") |
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.
I would like to be able to setup some repos from here:
https://bitbucket.cognifide.com/dashboard
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.
Fixed in f03e91e
override fun updateState() { | ||
if (url.isNotBlank() && path.isNotBlank()) { | ||
if (url.contains("github")) { | ||
val apiUrl = url.replace("github.com/", "api.github.com") |
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.
This will not work for commertial repos i think you should be replacing ://
with ://api.
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.
my project repo as an example: https://github.company.com/
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.
Fixed in commit f03e91e
<PullRequestLink key={id} href={url} target="_blank"> | ||
<PullRequestContainer> | ||
{`${index + 1}. ${formatPullRequestTitle(title)}`} | ||
</PullRequestContainer> | ||
</PullRequestLink> |
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.
Please reuse the existing look & feel from other widgets - look at Random picker, Link List, ToDo list
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.
Fixed in commit fe5980b
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.
Please have a look @ my comments.
Add mocks, and example content for two widgets.
Test solution with our companys bitbucket.
fe5980b
… fixed github api url replace.
{ | ||
"id": "endpoint5", | ||
"label": "Bitbucket Cognifide", | ||
"publicUrl": "https://bitbucket.cognifide.com/", | ||
"url": "https://bitbucket.cognifide.com/", | ||
"credentials": "" |
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.
Remove this and instead add support to our Api Mocks - and mimic a response there. Please make sure you are not providing any sensitiva data.
}, | ||
PullRequestReminderWidget: { | ||
component: PullRequestReminderWidget, | ||
dialogFields: ['EndpointField', 'SchedulePeriod', 'Path'], |
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.
Let's expand dialog with new fields:
1 Project (Group)
2 Repository
in place of Path
3 API Type
dropdown with values: Bitbucket 1.0
, Bitbucket 2.0
, GitHub
- we will expand if needed - GitHub
as a default one
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.
Use SonarQube Version
field as an example
@@ -73,6 +73,8 @@ class CogboardConstants { | |||
const val JQL_QUERY = "jqlQuery" | |||
const val BUCKET_QUERIES = "bucketQueries" | |||
const val BUCKET_NAME = "bucketName" | |||
const val PULL_REQUESTS = "pullRequests" | |||
const val REPOSITORY_HUB = "repositoryHub" |
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.
after the introduction of apiType
dropdown this will not be required.
override fun handleResponse(responseBody: JsonObject) { | ||
var pullRequests = responseBody | ||
|
||
if (url.contains("github")) { |
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.
use switch-case on apiType
instead
pullRequests = | ||
pullRequests | ||
.put(Props.PULL_REQUESTS, responseBody.remove("array")) | ||
.put(Props.REPOSITORY_HUB, "github") |
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.
no need to send this property
if (url.contains("github")) { | ||
var (_, owner, repo) = path.split("/") | ||
var apiUrl = url.replace("://", "://api.").replace("com/", "com") | ||
httpGet("$apiUrl/repos/$owner/$repo/pulls") | ||
} else if (url.contains("bitbucket") && path.contains("dashboard")) { | ||
httpGet("$url/rest/api/1.0/dashboard/pull-requests") | ||
return | ||
} else { | ||
var (_, project, repo) = path.split("/") | ||
httpGet(url = "$url/rest/api/1.0/projects/$project/repos/$repo/pull-requests") | ||
} |
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.
move this logic to a seprate class so we can just:
httpGet(UrlUtil.getApiUrl(apiType, url, project, repository))
You can do this as an extension method on string class also.
httpGet(url.getApiUrl(apiType, project, repository))
https://kotlinlang.org/docs/extensions.html#extension-functions
write Unit tests for supported examples
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.
#353 Pull request reminder widget (github / bitbucket)
Description
Added new widget which will show pull requests of a given repository.
Motivation and Context
User will be able to track all of the open pull request from a repository
Screenshots
Types of changes
Checklist:
I hereby agree to the terms of the Cogboard Contributor License Agreement.