mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
[gig/github] simplify PR details component
GitOrigin-RevId: e63000b465ebb331702b8cb86e6a98675521e322
This commit is contained in:
committed by
intellij-monorepo-bot
parent
caa37e0116
commit
d3529498ab
+3
-1
@@ -22,6 +22,7 @@ import com.intellij.ui.components.panels.Wrapper
|
||||
import kotlinx.coroutines.*
|
||||
import kotlinx.coroutines.flow.Flow
|
||||
import kotlinx.coroutines.flow.map
|
||||
import org.jetbrains.annotations.ApiStatus
|
||||
import org.jetbrains.plugins.github.i18n.GithubBundle
|
||||
import org.jetbrains.plugins.github.pullrequest.ui.details.action.*
|
||||
import org.jetbrains.plugins.github.pullrequest.ui.details.model.GHPRReviewFlowViewModel
|
||||
@@ -29,7 +30,8 @@ import org.jetbrains.plugins.github.pullrequest.ui.review.GHPRSubmitReviewPopup
|
||||
import javax.swing.JButton
|
||||
import javax.swing.JComponent
|
||||
|
||||
internal object GHPRDetailsActionsComponentFactory {
|
||||
@ApiStatus.Internal
|
||||
object GHPRDetailsActionsComponentFactory {
|
||||
private const val BUTTONS_GAP = 10
|
||||
|
||||
fun create(
|
||||
|
||||
+17
-7
@@ -48,12 +48,20 @@ object GHPRDetailsComponentFactory {
|
||||
scope: CoroutineScope,
|
||||
project: Project,
|
||||
detailsVm: GHPRDetailsViewModel,
|
||||
withTitle: Boolean = true,
|
||||
): JComponent {
|
||||
val actionGroup = ActionManager.getInstance().getAction("Github.PullRequest.Details.Popup") as ActionGroup
|
||||
val title = CodeReviewDetailsTitleComponentFactory.create(scope, detailsVm, GithubBundle.message("open.on.github.action"), actionGroup,
|
||||
htmlPaneFactory = { SimpleHtmlPane() })
|
||||
val timelineLink = ActionLink(CollaborationToolsBundle.message("review.details.view.timeline.action")) {
|
||||
showTimelineAction(it.source as JComponent)
|
||||
|
||||
val titlePanel = if (withTitle) {
|
||||
val title = CodeReviewDetailsTitleComponentFactory.create(scope, detailsVm, GithubBundle.message("open.on.github.action"), actionGroup,
|
||||
htmlPaneFactory = { SimpleHtmlPane() })
|
||||
val timelineLink = ActionLink(CollaborationToolsBundle.message("review.details.view.timeline.action")) {
|
||||
showTimelineAction(it.source as JComponent)
|
||||
}
|
||||
ReviewDetailsUIUtil.createTitlePanel(title, timelineLink)
|
||||
}
|
||||
else {
|
||||
null
|
||||
}
|
||||
|
||||
val commitsAndBranches = createCommitsAndBranchesComponent(project, scope, detailsVm)
|
||||
@@ -70,7 +78,9 @@ object GHPRDetailsComponentFactory {
|
||||
)).apply {
|
||||
isOpaque = false
|
||||
|
||||
add(ReviewDetailsUIUtil.createTitlePanel(title, timelineLink), CC().growX().gap(ReviewDetailsUIUtil.TITLE_GAPS))
|
||||
if (titlePanel != null) {
|
||||
add(titlePanel, CC().growX().gap(ReviewDetailsUIUtil.TITLE_GAPS))
|
||||
}
|
||||
add(commitsAndBranches, CC().growX().gap(ReviewDetailsUIUtil.COMMIT_POPUP_BRANCHES_GAPS))
|
||||
add(createCommitsInfoComponent(project, scope, detailsVm), CC().growX().gap(ReviewDetailsUIUtil.COMMIT_INFO_GAPS))
|
||||
add(createCommitFilesBrowserComponent(scope, detailsVm.changesVm), CC().grow().shrinkPrioY(200))
|
||||
@@ -94,7 +104,7 @@ object GHPRDetailsComponentFactory {
|
||||
})
|
||||
}
|
||||
|
||||
fun createCommitsAndBranchesComponent(project: Project, cs: CoroutineScope, detailsVm: GHPRDetailsViewModel): JComponent {
|
||||
private fun createCommitsAndBranchesComponent(project: Project, cs: CoroutineScope, detailsVm: GHPRDetailsViewModel): JComponent {
|
||||
return JPanel(MigLayout(LC().emptyBorders().fill(), AC().gap("push"))).apply {
|
||||
isOpaque = false
|
||||
add(CodeReviewDetailsCommitsComponentFactory.create(cs, detailsVm.changesVm) { commit: GHCommit ->
|
||||
@@ -121,7 +131,7 @@ object GHPRDetailsComponentFactory {
|
||||
)
|
||||
|
||||
|
||||
fun createCommitFilesBrowserComponent(cs: CoroutineScope, changesVm: GHPRChangesViewModel): JComponent {
|
||||
private fun createCommitFilesBrowserComponent(cs: CoroutineScope, changesVm: GHPRChangesViewModel): JComponent {
|
||||
return Wrapper(LoadingLabel()).apply {
|
||||
bindContentIn(cs, changesVm.changeListVm) { res ->
|
||||
res.result?.let {
|
||||
|
||||
+3
-1
@@ -24,6 +24,7 @@ import kotlinx.coroutines.CoroutineScope
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.flow.map
|
||||
import kotlinx.coroutines.withContext
|
||||
import org.jetbrains.annotations.ApiStatus
|
||||
import org.jetbrains.plugins.github.ai.GHPRAIReviewExtension
|
||||
import org.jetbrains.plugins.github.api.data.GHRepositoryPermissionLevel
|
||||
import org.jetbrains.plugins.github.i18n.GithubBundle
|
||||
@@ -37,7 +38,8 @@ import java.awt.event.ActionListener
|
||||
import javax.swing.JComponent
|
||||
import javax.swing.JScrollPane
|
||||
|
||||
internal object GHPRStatusChecksComponentFactory {
|
||||
@ApiStatus.Internal
|
||||
object GHPRStatusChecksComponentFactory {
|
||||
fun create(
|
||||
parentScope: CoroutineScope,
|
||||
project: Project,
|
||||
|
||||
+1
-1
@@ -10,7 +10,7 @@ import org.jetbrains.plugins.github.pullrequest.data.service.GHPRSecurityService
|
||||
import org.jetbrains.plugins.github.pullrequest.ui.review.GHPRReviewViewModel
|
||||
import javax.swing.JComponent
|
||||
|
||||
internal interface GHPRReviewFlowViewModel : CodeReviewFlowViewModel<GHPullRequestRequestedReviewer>, GHPRReviewViewModel {
|
||||
interface GHPRReviewFlowViewModel : CodeReviewFlowViewModel<GHPullRequestRequestedReviewer>, GHPRReviewViewModel {
|
||||
val isBusy: Flow<Boolean>
|
||||
val requestedReviewers: Flow<List<GHPullRequestRequestedReviewer>>
|
||||
val reviewState: Flow<ReviewState>
|
||||
|
||||
Reference in New Issue
Block a user