[github] Load less commit details for timeline

GitOrigin-RevId: 3528e7a11395a17668d1271e8c43f519f2cf999a
This commit is contained in:
Ivan Semenov
2020-06-16 22:26:04 +03:00
committed by intellij-monorepo-bot
parent c6f96799c0
commit 7bf02a75ca
11 changed files with 43 additions and 32 deletions
@@ -1,15 +1,5 @@
fragment commit on Commit {
...commitHash
url
author {
name
email
avatarUrl
date
user {
url
}
}
...commitShort
committer {
name
email
@@ -20,7 +10,6 @@ fragment commit on Commit {
}
}
messageHeadline
messageHeadlineHTML
messageBodyHTML
parents(first: 100) {
nodes {
@@ -0,0 +1,13 @@
fragment commitShort on Commit {
...commitHash
messageHeadlineHTML
author {
name
email
avatarUrl
date
user {
url
}
}
}
@@ -10,6 +10,7 @@ query($repoOwner: String!, $repoName: String!, $number: Int!, $pageSize: Int = 1
commit {
...commit
}
url
}
}
}
@@ -6,7 +6,7 @@ fragment issueCommentInfo on IssueComment {
fragment prCommitInfo on PullRequestCommit {
...nodeInfo
commit {
...commit
...commitShort
}
url
}
@@ -103,7 +103,7 @@ object GHGQLRequests {
: GHConnection<GHPullRequestReviewThread>(pageInfo, nodes)
fun commits(repository: GHRepositoryCoordinates, number: Long,
pagination: GHGQLRequestPagination? = null): GQLQuery<GHGQLPagedRequestResponse<GHPullRequestCommitShort>> {
pagination: GHGQLRequestPagination? = null): GQLQuery<GHGQLPagedRequestResponse<GHPullRequestCommit>> {
return GQLQuery.TraversedParsed(repository.serverPath.toGraphQLUrl(), GHGQLQueries.pullRequestCommits,
mapOf("repoOwner" to repository.repositoryPath.owner,
"repoName" to repository.repositoryPath.repository,
@@ -114,8 +114,8 @@ object GHGQLRequests {
"repository", "pullRequest", "commits")
}
private class CommitsConnection(pageInfo: GHGQLPageInfo, nodes: List<GHPullRequestCommitShort>)
: GHConnection<GHPullRequestCommitShort>(pageInfo, nodes)
private class CommitsConnection(pageInfo: GHGQLPageInfo, nodes: List<GHPullRequestCommit>)
: GHConnection<GHPullRequestCommit>(pageInfo, nodes)
object Timeline {
fun items(server: GithubServerPath, repoOwner: String, repoName: String, number: Long,
@@ -6,14 +6,13 @@ import com.fasterxml.jackson.annotation.JsonProperty
class GHCommit(id: String,
oid: String,
abbreviatedOid: String,
val url: String,
val messageHeadline: String,
val messageHeadlineHTML: String,
messageHeadlineHTML: String,
val messageBodyHTML: String,
val author: GHGitActor?,
author: GHGitActor?,
val committer: GHGitActor?,
@JsonProperty("parents") parents: GHNodes<GHCommitHash>)
: GHCommitHash(id, oid, abbreviatedOid) {
: GHCommitShort(id, oid, abbreviatedOid, messageHeadlineHTML, author) {
val parents = parents.nodes
}
@@ -0,0 +1,9 @@
// Copyright 2000-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package org.jetbrains.plugins.github.api.data
open class GHCommitShort(id: String,
oid: String,
abbreviatedOid: String,
val messageHeadlineHTML: String,
val author: GHGitActor?)
: GHCommitHash(id, oid, abbreviatedOid)
@@ -1,11 +1,10 @@
// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
// Copyright 2000-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package org.jetbrains.plugins.github.api.data.pullrequest
import org.jetbrains.plugins.github.api.data.GHCommit
import org.jetbrains.plugins.github.api.data.GHNode
import org.jetbrains.plugins.github.api.data.pullrequest.timeline.GHPRTimelineItem
class GHPullRequestCommit(id: String,
val commit: GHCommit,
val url: String)
: GHNode(id), GHPRTimelineItem
: GHNode(id)
@@ -1,7 +1,8 @@
// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
// Copyright 2000-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package org.jetbrains.plugins.github.api.data.pullrequest
import org.jetbrains.plugins.github.api.data.GHCommit
import org.jetbrains.plugins.github.api.data.GHCommitShort
import org.jetbrains.plugins.github.api.data.GHNode
import org.jetbrains.plugins.github.api.data.pullrequest.timeline.GHPRTimelineItem
class GHPullRequestCommitShort(id: String, val commit: GHCommit) : GHNode(id)
class GHPullRequestCommitShort(id: String, val commit: GHCommitShort, val url: String) : GHNode(id), GHPRTimelineItem
@@ -4,7 +4,7 @@ package org.jetbrains.plugins.github.api.data.pullrequest.timeline
import com.fasterxml.jackson.annotation.JsonSubTypes
import com.fasterxml.jackson.annotation.JsonTypeInfo
import org.jetbrains.plugins.github.api.data.GHIssueComment
import org.jetbrains.plugins.github.api.data.pullrequest.GHPullRequestCommit
import org.jetbrains.plugins.github.api.data.pullrequest.GHPullRequestCommitShort
import org.jetbrains.plugins.github.api.data.pullrequest.GHPullRequestReview
import org.jetbrains.plugins.github.api.data.pullrequest.timeline.GHPRTimelineItem.Unknown
@@ -60,7 +60,7 @@ AutomaticBaseChangeSucceededEvent | AutomaticBaseChangeFailedEvent
defaultImpl = Unknown::class)
@JsonSubTypes(
JsonSubTypes.Type(name = "IssueComment", value = GHIssueComment::class),
JsonSubTypes.Type(name = "PullRequestCommit", value = GHPullRequestCommit::class),
JsonSubTypes.Type(name = "PullRequestCommit", value = GHPullRequestCommitShort::class),
JsonSubTypes.Type(name = "PullRequestReview", value = GHPullRequestReview::class),
JsonSubTypes.Type(name = "ReviewDismissedEvent", value = GHPRReviewDismissedEvent::class),
@@ -17,7 +17,7 @@ import net.miginfocom.layout.LC
import net.miginfocom.swing.MigLayout
import org.intellij.lang.annotations.Language
import org.jetbrains.plugins.github.api.data.*
import org.jetbrains.plugins.github.api.data.pullrequest.GHPullRequestCommit
import org.jetbrains.plugins.github.api.data.pullrequest.GHPullRequestCommitShort
import org.jetbrains.plugins.github.api.data.pullrequest.GHPullRequestReview
import org.jetbrains.plugins.github.api.data.pullrequest.GHPullRequestReviewState.*
import org.jetbrains.plugins.github.api.data.pullrequest.timeline.GHPRTimelineEvent
@@ -43,7 +43,7 @@ class GHPRTimelineItemComponentFactory(private val reviewDataProvider: GHPRRevie
fun createComponent(item: GHPRTimelineItem): Item {
try {
return when (item) {
is GHPullRequestCommit -> Item(AllIcons.Vcs.CommitNode, commitTitle(item.commit))
is GHPullRequestCommitShort -> Item(AllIcons.Vcs.CommitNode, commitTitle(item.commit, item.url))
is GHIssueComment -> createComponent(item)
is GHPullRequestReview -> createComponent(item)
@@ -105,9 +105,9 @@ class GHPRTimelineItemComponentFactory(private val reviewDataProvider: GHPRRevie
})
}
private fun commitTitle(commit: GHCommit): JComponent {
private fun commitTitle(commit: GHCommitShort, commitUrl: String): JComponent {
//language=HTML
val text = """${commit.messageHeadlineHTML} <a href='${commit.url}'>${commit.abbreviatedOid}</a>"""
val text = """${commit.messageHeadlineHTML} <a href='${commitUrl}'>${commit.abbreviatedOid}</a>"""
return HorizontalBox().apply {
add(userAvatar(commit.author))