mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-01-08 15:09:39 +07:00
[github] update PR statistics collector
add project where possible rename fields to snake case GitOrigin-RevId: b3691cb09d4cf31cab06ce8e351c7cfcf8452823
This commit is contained in:
committed by
intellij-monorepo-bot
parent
c488cb995b
commit
109938cb8a
@@ -25,7 +25,7 @@ import org.jetbrains.plugins.github.util.GHEnterpriseServerMetadataLoader
|
||||
import java.util.*
|
||||
|
||||
internal object GHPRStatisticsCollector {
|
||||
private val COUNTERS_GROUP = EventLogGroup("vcs.github.pullrequest.counters", 4)
|
||||
private val COUNTERS_GROUP = EventLogGroup("vcs.github.pullrequest.counters", 5)
|
||||
|
||||
class Counters : CounterUsagesCollector() {
|
||||
override fun getGroup() = COUNTERS_GROUP
|
||||
@@ -34,12 +34,12 @@ internal object GHPRStatisticsCollector {
|
||||
private val SELECTORS_OPENED_EVENT = COUNTERS_GROUP.registerEvent("selectors.opened")
|
||||
private val LIST_OPENED_EVENT = COUNTERS_GROUP.registerEvent("list.opened")
|
||||
|
||||
private val FILTER_SEARCH_PRESENT = EventFields.Boolean("hasSearch")
|
||||
private val FILTER_STATE_PRESENT = EventFields.Boolean("hasState")
|
||||
private val FILTER_AUTHOR_PRESENT = EventFields.Boolean("hasAuthor")
|
||||
private val FILTER_ASSIGNEE_PRESENT = EventFields.Boolean("hasAssignee")
|
||||
private val FILTER_REVIEW_PRESENT = EventFields.Boolean("hasReviewState")
|
||||
private val FILTER_LABEL_PRESENT = EventFields.Boolean("hasLabel")
|
||||
private val FILTER_SEARCH_PRESENT = EventFields.Boolean("has_search")
|
||||
private val FILTER_STATE_PRESENT = EventFields.Boolean("has_state")
|
||||
private val FILTER_AUTHOR_PRESENT = EventFields.Boolean("has_author")
|
||||
private val FILTER_ASSIGNEE_PRESENT = EventFields.Boolean("has_assignee")
|
||||
private val FILTER_REVIEW_PRESENT = EventFields.Boolean("has_review_state")
|
||||
private val FILTER_LABEL_PRESENT = EventFields.Boolean("has_label")
|
||||
|
||||
private val FILTERS_APPLIED_EVENT = COUNTERS_GROUP.registerVarargEvent("list.filters.applied",
|
||||
FILTER_SEARCH_PRESENT,
|
||||
@@ -80,19 +80,20 @@ internal object GHPRStatisticsCollector {
|
||||
|
||||
|
||||
private val DETAILS_ACTION_EVENT = COUNTERS_GROUP.registerEvent("details.additional.actions.invoked",
|
||||
EventFields.Enum("action", GHPRAction::class.java),
|
||||
EventFields.Boolean("isDefault"))
|
||||
EventFields.Enum<GHPRAction>("action"),
|
||||
EventFields.Boolean("is_default"))
|
||||
|
||||
fun logSelectorsOpened() {
|
||||
SELECTORS_OPENED_EVENT.log()
|
||||
fun logSelectorsOpened(project: Project) {
|
||||
SELECTORS_OPENED_EVENT.log(project)
|
||||
}
|
||||
|
||||
fun logListOpened() {
|
||||
LIST_OPENED_EVENT.log()
|
||||
fun logListOpened(project: Project) {
|
||||
LIST_OPENED_EVENT.log(project)
|
||||
}
|
||||
|
||||
fun logListFiltersApplied(filters: GHPRListSearchValue): Unit =
|
||||
fun logListFiltersApplied(project: Project, filters: GHPRListSearchValue): Unit =
|
||||
FILTERS_APPLIED_EVENT.log(
|
||||
project,
|
||||
EventPair(FILTER_SEARCH_PRESENT, filters.searchQuery != null),
|
||||
EventPair(FILTER_STATE_PRESENT, filters.state != null),
|
||||
EventPair(FILTER_AUTHOR_PRESENT, filters.author != null),
|
||||
@@ -101,12 +102,12 @@ internal object GHPRStatisticsCollector {
|
||||
EventPair(FILTER_LABEL_PRESENT, filters.label != null)
|
||||
)
|
||||
|
||||
fun logDetailsOpened() {
|
||||
DETAILS_OPENED_EVENT.log()
|
||||
fun logDetailsOpened(project: Project) {
|
||||
DETAILS_OPENED_EVENT.log(project)
|
||||
}
|
||||
|
||||
fun logNewPRViewOpened() {
|
||||
NEW_OPENED_EVENT.log()
|
||||
fun logNewPRViewOpened(project: Project) {
|
||||
NEW_OPENED_EVENT.log(project)
|
||||
}
|
||||
|
||||
fun logTimelineOpened(project: Project) {
|
||||
@@ -122,40 +123,40 @@ internal object GHPRStatisticsCollector {
|
||||
DIFF_OPENED_EVENT.log(project, count)
|
||||
}
|
||||
|
||||
fun logDetailsBranchesOpened() {
|
||||
DETAILS_BRANCHES_EVENT.log()
|
||||
fun logDetailsBranchesOpened(project: Project) {
|
||||
DETAILS_BRANCHES_EVENT.log(project)
|
||||
}
|
||||
|
||||
fun logDetailsBranchCheckedOut() {
|
||||
DETAILS_BRANCH_CHECKED_OUT_EVENT.log()
|
||||
fun logDetailsBranchCheckedOut(project: Project) {
|
||||
DETAILS_BRANCH_CHECKED_OUT_EVENT.log(project)
|
||||
}
|
||||
|
||||
fun logDetailsCommitChosen() {
|
||||
DETAILS_COMMIT_CHOSEN_EVENT.log()
|
||||
fun logDetailsCommitChosen(project: Project) {
|
||||
DETAILS_COMMIT_CHOSEN_EVENT.log(project)
|
||||
}
|
||||
|
||||
fun logDetailsNextCommitChosen() {
|
||||
DETAILS_NEXT_COMMIT_EVENT.log()
|
||||
fun logDetailsNextCommitChosen(project: Project) {
|
||||
DETAILS_NEXT_COMMIT_EVENT.log(project)
|
||||
}
|
||||
|
||||
fun logDetailsPrevCommitChosen() {
|
||||
DETAILS_PREV_COMMIT_EVENT.log()
|
||||
fun logDetailsPrevCommitChosen(project: Project) {
|
||||
DETAILS_PREV_COMMIT_EVENT.log(project)
|
||||
}
|
||||
|
||||
fun logDetailsChecksOpened() {
|
||||
DETAILS_CHECKS_EVENT.log()
|
||||
fun logDetailsChecksOpened(project: Project) {
|
||||
DETAILS_CHECKS_EVENT.log(project)
|
||||
}
|
||||
|
||||
fun logDetailsActionInvoked(action: GHPRAction, isDefault: Boolean) {
|
||||
DETAILS_ACTION_EVENT.log(action, isDefault)
|
||||
fun logDetailsActionInvoked(project: Project, action: GHPRAction, isDefault: Boolean) {
|
||||
DETAILS_ACTION_EVENT.log(project, action, isDefault)
|
||||
}
|
||||
|
||||
fun logChangeSelected() {
|
||||
DETAILS_CHANGE_EVENT.log()
|
||||
fun logChangeSelected(project: Project) {
|
||||
DETAILS_CHANGE_EVENT.log(project)
|
||||
}
|
||||
|
||||
fun logMergedEvent(method: GithubPullRequestMergeMethod) {
|
||||
MERGED_EVENT.log(method)
|
||||
fun logMergedEvent(project: Project, method: GithubPullRequestMergeMethod) {
|
||||
MERGED_EVENT.log(project, method)
|
||||
}
|
||||
|
||||
fun logEnterpriseServerMeta(project: Project, server: GithubServerPath, meta: GHEnterpriseServerMeta) {
|
||||
|
||||
@@ -126,7 +126,7 @@ internal class GHPRDataContextRepository(private val project: Project) : Disposa
|
||||
account, currentUser, currentUserTeams,
|
||||
repositoryInfo)
|
||||
val detailsService = GHPRDetailsServiceImpl(ProgressManager.getInstance(), requestExecutor, apiRepositoryCoordinates)
|
||||
val stateService = GHPRStateServiceImpl(ProgressManager.getInstance(), securityService,
|
||||
val stateService = GHPRStateServiceImpl(ProgressManager.getInstance(), project, securityService,
|
||||
requestExecutor, account.server, apiRepositoryPath)
|
||||
val commentService = GHPRCommentServiceImpl(ProgressManager.getInstance(), requestExecutor, apiRepositoryCoordinates)
|
||||
val changesService = GHPRChangesServiceImpl(ProgressManager.getInstance(), project, requestExecutor,
|
||||
|
||||
@@ -6,6 +6,7 @@ import com.intellij.openapi.diagnostic.logger
|
||||
import com.intellij.openapi.progress.ProcessCanceledException
|
||||
import com.intellij.openapi.progress.ProgressIndicator
|
||||
import com.intellij.openapi.progress.ProgressManager
|
||||
import com.intellij.openapi.project.Project
|
||||
import org.jetbrains.plugins.github.api.*
|
||||
import org.jetbrains.plugins.github.api.data.GHBranchProtectionRules
|
||||
import org.jetbrains.plugins.github.api.data.GHRepositoryPermissionLevel
|
||||
@@ -18,6 +19,7 @@ import org.jetbrains.plugins.github.pullrequest.data.service.GHServiceUtil.logEr
|
||||
import java.util.concurrent.CompletableFuture
|
||||
|
||||
class GHPRStateServiceImpl internal constructor(private val progressManager: ProgressManager,
|
||||
private val project: Project,
|
||||
private val securityService: GHPRSecurityService,
|
||||
private val requestExecutor: GithubApiRequestExecutor,
|
||||
private val serverPath: GithubServerPath,
|
||||
@@ -91,7 +93,7 @@ class GHPRStateServiceImpl internal constructor(private val progressManager: Pro
|
||||
requestExecutor.execute(it, GithubApiRequests.Repos.PullRequests.merge(serverPath, repoPath, pullRequestId.number,
|
||||
commitMessage.first, commitMessage.second,
|
||||
currentHeadRef))
|
||||
GHPRStatisticsCollector.logMergedEvent(GithubPullRequestMergeMethod.merge)
|
||||
GHPRStatisticsCollector.logMergedEvent(project, GithubPullRequestMergeMethod.merge)
|
||||
return@submitIOTask
|
||||
}.logError(LOG, "Error occurred while merging PR ${pullRequestId.number}")
|
||||
|
||||
@@ -102,7 +104,7 @@ class GHPRStateServiceImpl internal constructor(private val progressManager: Pro
|
||||
requestExecutor.execute(it,
|
||||
GithubApiRequests.Repos.PullRequests.rebaseMerge(serverPath, repoPath, pullRequestId.number,
|
||||
currentHeadRef))
|
||||
GHPRStatisticsCollector.logMergedEvent(GithubPullRequestMergeMethod.rebase)
|
||||
GHPRStatisticsCollector.logMergedEvent(project, GithubPullRequestMergeMethod.rebase)
|
||||
return@submitIOTask
|
||||
}.logError(LOG, "Error occurred while rebasing PR ${pullRequestId.number}")
|
||||
|
||||
@@ -113,7 +115,7 @@ class GHPRStateServiceImpl internal constructor(private val progressManager: Pro
|
||||
GithubApiRequests.Repos.PullRequests.squashMerge(serverPath, repoPath, pullRequestId.number,
|
||||
commitMessage.first, commitMessage.second,
|
||||
currentHeadRef))
|
||||
GHPRStatisticsCollector.logMergedEvent(GithubPullRequestMergeMethod.squash)
|
||||
GHPRStatisticsCollector.logMergedEvent(project, GithubPullRequestMergeMethod.squash)
|
||||
return@submitIOTask
|
||||
}.logError(LOG, "Error occurred while squash-merging PR ${pullRequestId.number}")
|
||||
|
||||
|
||||
@@ -18,6 +18,7 @@ import com.intellij.openapi.actionSystem.DefaultActionGroup
|
||||
import com.intellij.openapi.actionSystem.Presentation
|
||||
import com.intellij.openapi.actionSystem.ex.CustomComponentAction
|
||||
import com.intellij.openapi.actionSystem.impl.SimpleDataContext
|
||||
import com.intellij.openapi.project.Project
|
||||
import com.intellij.ui.components.JBOptionButton
|
||||
import com.intellij.ui.components.panels.Wrapper
|
||||
import kotlinx.coroutines.CoroutineScope
|
||||
@@ -39,20 +40,21 @@ internal object GHPRDetailsActionsComponentFactory {
|
||||
|
||||
fun create(
|
||||
scope: CoroutineScope,
|
||||
project: Project,
|
||||
reviewRequestState: Flow<ReviewRequestState>,
|
||||
reviewFlowVm: GHPRReviewFlowViewModel,
|
||||
dataProvider: GHPRDataProvider
|
||||
): JComponent {
|
||||
val reviewActions = CodeReviewActions(
|
||||
requestReviewAction = GHPRRequestReviewAction(scope, reviewFlowVm),
|
||||
reRequestReviewAction = GHPRReRequestReviewAction(scope, reviewFlowVm),
|
||||
closeReviewAction = GHPRCloseAction(scope, reviewFlowVm),
|
||||
reopenReviewAction = GHPRReopenAction(scope, reviewFlowVm),
|
||||
setMyselfAsReviewerAction = GHPRSetMyselfAsReviewerAction(scope, reviewFlowVm),
|
||||
postReviewAction = GHPRPostReviewAction(scope, reviewFlowVm),
|
||||
mergeReviewAction = GHPRCommitMergeAction(scope, reviewFlowVm),
|
||||
mergeSquashReviewAction = GHPRSquashMergeAction(scope, reviewFlowVm),
|
||||
rebaseReviewAction = GHPRRebaseMergeAction(scope, reviewFlowVm)
|
||||
requestReviewAction = GHPRRequestReviewAction(scope, project, reviewFlowVm),
|
||||
reRequestReviewAction = GHPRReRequestReviewAction(scope, project, reviewFlowVm),
|
||||
closeReviewAction = GHPRCloseAction(scope, project, reviewFlowVm),
|
||||
reopenReviewAction = GHPRReopenAction(scope, project, reviewFlowVm),
|
||||
setMyselfAsReviewerAction = GHPRSetMyselfAsReviewerAction(scope, project, reviewFlowVm),
|
||||
postReviewAction = GHPRPostReviewAction(scope, project, reviewFlowVm),
|
||||
mergeReviewAction = GHPRCommitMergeAction(scope, project, reviewFlowVm),
|
||||
mergeSquashReviewAction = GHPRSquashMergeAction(scope, project, reviewFlowVm),
|
||||
rebaseReviewAction = GHPRRebaseMergeAction(scope, project, reviewFlowVm)
|
||||
)
|
||||
val moreActionsGroup = DefaultActionGroup(GithubBundle.message("pull.request.merge.commit.action"), true)
|
||||
|
||||
|
||||
@@ -12,6 +12,7 @@ import com.intellij.openapi.actionSystem.ActionManager
|
||||
import com.intellij.openapi.actionSystem.ActionPlaces
|
||||
import com.intellij.openapi.actionSystem.ex.ActionUtil
|
||||
import com.intellij.openapi.actionSystem.impl.SimpleDataContext
|
||||
import com.intellij.openapi.project.Project
|
||||
import com.intellij.ui.PopupHandler
|
||||
import kotlinx.coroutines.CoroutineScope
|
||||
import net.miginfocom.layout.AC
|
||||
@@ -35,6 +36,7 @@ internal object GHPRDetailsComponentFactory {
|
||||
|
||||
fun create(
|
||||
scope: CoroutineScope,
|
||||
project: Project,
|
||||
reviewDetailsVm: CodeReviewDetailsViewModel,
|
||||
branchesVm: CodeReviewBranchesViewModel,
|
||||
reviewStatusVm: GHPRStatusViewModel,
|
||||
@@ -57,8 +59,10 @@ internal object GHPRDetailsComponentFactory {
|
||||
.add(GHPRActionKeys.REVIEW_BRANCH_VM, branchesVm)
|
||||
.build()))
|
||||
}
|
||||
val statusChecks = GHPRStatusChecksComponentFactory.create(scope, reviewStatusVm, reviewFlowVm, securityService, avatarIconsProvider)
|
||||
val actionsComponent = GHPRDetailsActionsComponentFactory.create(scope, reviewDetailsVm.reviewRequestState, reviewFlowVm, dataProvider)
|
||||
val statusChecks = GHPRStatusChecksComponentFactory.create(scope, project, reviewStatusVm, reviewFlowVm, securityService,
|
||||
avatarIconsProvider)
|
||||
val actionsComponent = GHPRDetailsActionsComponentFactory.create(scope, project, reviewDetailsVm.reviewRequestState, reviewFlowVm,
|
||||
dataProvider)
|
||||
val actionGroup = ActionManager.getInstance().getAction("Github.PullRequest.Details.Popup") as ActionGroup
|
||||
|
||||
return JPanel(MigLayout(
|
||||
|
||||
@@ -8,6 +8,7 @@ import com.intellij.collaboration.ui.util.bindTextIn
|
||||
import com.intellij.collaboration.ui.util.toAnAction
|
||||
import com.intellij.icons.AllIcons
|
||||
import com.intellij.openapi.actionSystem.DefaultActionGroup
|
||||
import com.intellij.openapi.project.Project
|
||||
import com.intellij.ui.ScrollPaneFactory
|
||||
import com.intellij.ui.components.panels.Wrapper
|
||||
import com.intellij.util.childScope
|
||||
@@ -28,6 +29,7 @@ import javax.swing.JScrollPane
|
||||
internal object GHPRStatusChecksComponentFactory {
|
||||
fun create(
|
||||
parentScope: CoroutineScope,
|
||||
project: Project,
|
||||
reviewStatusVm: GHPRStatusViewModel,
|
||||
reviewFlowVm: GHPRReviewFlowViewModel,
|
||||
securityService: GHPRSecurityService,
|
||||
@@ -48,7 +50,9 @@ internal object GHPRStatusChecksComponentFactory {
|
||||
add(CodeReviewDetailsStatusComponentFactory.createNeedReviewerComponent(scope, reviewFlowVm.reviewerReviews))
|
||||
add(CodeReviewDetailsStatusComponentFactory.createReviewersReviewStateComponent(
|
||||
scope, reviewFlowVm.reviewerReviews,
|
||||
reviewerActionProvider = { reviewer -> DefaultActionGroup(GHPRRemoveReviewerAction(scope, reviewFlowVm, reviewer).toAnAction()) },
|
||||
reviewerActionProvider = { reviewer ->
|
||||
DefaultActionGroup(GHPRRemoveReviewerAction(scope, project, reviewFlowVm, reviewer).toAnAction())
|
||||
},
|
||||
reviewerNameProvider = { reviewer -> reviewer.getPresentableName() },
|
||||
avatarKeyProvider = { reviewer -> reviewer.avatarUrl },
|
||||
iconProvider = { iconKey, iconSize -> avatarIconsProvider.getIcon(iconKey, iconSize) }
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
// 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.pullrequest.ui.details.action
|
||||
|
||||
import com.intellij.openapi.project.Project
|
||||
import kotlinx.coroutines.CoroutineScope
|
||||
import kotlinx.coroutines.launch
|
||||
import org.jetbrains.plugins.github.i18n.GithubBundle
|
||||
@@ -11,7 +12,7 @@ import java.awt.event.ActionEvent
|
||||
import javax.swing.AbstractAction
|
||||
import javax.swing.JButton
|
||||
|
||||
internal class GHPRCloseAction(scope: CoroutineScope, private val reviewFlowVm: GHPRReviewFlowViewModel)
|
||||
internal class GHPRCloseAction(scope: CoroutineScope, private val project: Project, private val reviewFlowVm: GHPRReviewFlowViewModel)
|
||||
: AbstractAction(GithubBundle.message("pull.request.close.action")) {
|
||||
|
||||
init {
|
||||
@@ -23,7 +24,7 @@ internal class GHPRCloseAction(scope: CoroutineScope, private val reviewFlowVm:
|
||||
}
|
||||
|
||||
override fun actionPerformed(e: ActionEvent?) {
|
||||
GHPRStatisticsCollector.logDetailsActionInvoked(GHPRAction.CLOSE, e?.source is JButton)
|
||||
GHPRStatisticsCollector.logDetailsActionInvoked(project, GHPRAction.CLOSE, e?.source is JButton)
|
||||
reviewFlowVm.closeReview()
|
||||
}
|
||||
}
|
||||
@@ -3,6 +3,7 @@ package org.jetbrains.plugins.github.pullrequest.ui.details.action
|
||||
|
||||
import com.intellij.collaboration.async.combineAndCollect
|
||||
import com.intellij.collaboration.messages.CollaborationToolsBundle
|
||||
import com.intellij.openapi.project.Project
|
||||
import kotlinx.coroutines.CoroutineScope
|
||||
import kotlinx.coroutines.launch
|
||||
import org.jetbrains.plugins.github.pullrequest.GHPRAction
|
||||
@@ -12,7 +13,7 @@ import java.awt.event.ActionEvent
|
||||
import javax.swing.AbstractAction
|
||||
import javax.swing.JButton
|
||||
|
||||
internal class GHPRCommitMergeAction(scope: CoroutineScope, private val reviewFlowVm: GHPRReviewFlowViewModel)
|
||||
internal class GHPRCommitMergeAction(scope: CoroutineScope, private val project: Project, private val reviewFlowVm: GHPRReviewFlowViewModel)
|
||||
: AbstractAction(CollaborationToolsBundle.message("review.details.action.merge")) {
|
||||
|
||||
init {
|
||||
@@ -24,7 +25,7 @@ internal class GHPRCommitMergeAction(scope: CoroutineScope, private val reviewFl
|
||||
}
|
||||
|
||||
override fun actionPerformed(e: ActionEvent?) {
|
||||
GHPRStatisticsCollector.logDetailsActionInvoked(GHPRAction.MERGE, e?.source is JButton)
|
||||
GHPRStatisticsCollector.logDetailsActionInvoked(project, GHPRAction.MERGE, e?.source is JButton)
|
||||
reviewFlowVm.mergeReview()
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,7 @@
|
||||
// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package org.jetbrains.plugins.github.pullrequest.ui.details.action
|
||||
|
||||
import com.intellij.openapi.project.Project
|
||||
import kotlinx.coroutines.CoroutineScope
|
||||
import kotlinx.coroutines.launch
|
||||
import org.jetbrains.plugins.github.i18n.GithubBundle
|
||||
@@ -11,7 +12,7 @@ import java.awt.event.ActionEvent
|
||||
import javax.swing.AbstractAction
|
||||
import javax.swing.JButton
|
||||
|
||||
internal class GHPRPostReviewAction(scope: CoroutineScope, private val reviewFlowVm: GHPRReviewFlowViewModel)
|
||||
internal class GHPRPostReviewAction(scope: CoroutineScope, private val project: Project, private val reviewFlowVm: GHPRReviewFlowViewModel)
|
||||
: AbstractAction(GithubBundle.message("pull.request.post.action")) {
|
||||
|
||||
init {
|
||||
@@ -23,7 +24,7 @@ internal class GHPRPostReviewAction(scope: CoroutineScope, private val reviewFlo
|
||||
}
|
||||
|
||||
override fun actionPerformed(e: ActionEvent?) {
|
||||
GHPRStatisticsCollector.logDetailsActionInvoked(GHPRAction.POST_REVIEW, e?.source is JButton)
|
||||
GHPRStatisticsCollector.logDetailsActionInvoked(project, GHPRAction.POST_REVIEW, e?.source is JButton)
|
||||
reviewFlowVm.postDraftedReview()
|
||||
}
|
||||
}
|
||||
@@ -2,6 +2,7 @@
|
||||
package org.jetbrains.plugins.github.pullrequest.ui.details.action
|
||||
|
||||
import com.intellij.collaboration.messages.CollaborationToolsBundle
|
||||
import com.intellij.openapi.project.Project
|
||||
import kotlinx.coroutines.CoroutineScope
|
||||
import kotlinx.coroutines.launch
|
||||
import org.jetbrains.plugins.github.pullrequest.GHPRAction
|
||||
@@ -11,7 +12,9 @@ import java.awt.event.ActionEvent
|
||||
import javax.swing.AbstractAction
|
||||
import javax.swing.JButton
|
||||
|
||||
internal class GHPRReRequestReviewAction(scope: CoroutineScope, private val reviewFlowVm: GHPRReviewFlowViewModel)
|
||||
internal class GHPRReRequestReviewAction(scope: CoroutineScope,
|
||||
private val project: Project,
|
||||
private val reviewFlowVm: GHPRReviewFlowViewModel)
|
||||
: AbstractAction(CollaborationToolsBundle.message("review.details.action.rerequest")) {
|
||||
|
||||
init {
|
||||
@@ -23,7 +26,7 @@ internal class GHPRReRequestReviewAction(scope: CoroutineScope, private val revi
|
||||
}
|
||||
|
||||
override fun actionPerformed(event: ActionEvent) {
|
||||
GHPRStatisticsCollector.logDetailsActionInvoked(GHPRAction.RE_REQUEST_REVIEW, event.source is JButton)
|
||||
GHPRStatisticsCollector.logDetailsActionInvoked(project, GHPRAction.RE_REQUEST_REVIEW, event.source is JButton)
|
||||
reviewFlowVm.reRequestReview()
|
||||
}
|
||||
}
|
||||
@@ -3,6 +3,7 @@ package org.jetbrains.plugins.github.pullrequest.ui.details.action
|
||||
|
||||
import com.intellij.collaboration.async.combineAndCollect
|
||||
import com.intellij.collaboration.messages.CollaborationToolsBundle
|
||||
import com.intellij.openapi.project.Project
|
||||
import kotlinx.coroutines.CoroutineScope
|
||||
import kotlinx.coroutines.launch
|
||||
import org.jetbrains.plugins.github.pullrequest.GHPRAction
|
||||
@@ -12,7 +13,7 @@ import java.awt.event.ActionEvent
|
||||
import javax.swing.AbstractAction
|
||||
import javax.swing.JButton
|
||||
|
||||
internal class GHPRRebaseMergeAction(scope: CoroutineScope, private val reviewFlowVm: GHPRReviewFlowViewModel)
|
||||
internal class GHPRRebaseMergeAction(scope: CoroutineScope, private val project: Project, private val reviewFlowVm: GHPRReviewFlowViewModel)
|
||||
: AbstractAction(CollaborationToolsBundle.message("review.details.action.rebase")) {
|
||||
|
||||
init {
|
||||
@@ -24,7 +25,7 @@ internal class GHPRRebaseMergeAction(scope: CoroutineScope, private val reviewFl
|
||||
}
|
||||
|
||||
override fun actionPerformed(e: ActionEvent?) {
|
||||
GHPRStatisticsCollector.logDetailsActionInvoked(GHPRAction.REBASE_MERGE, e?.source is JButton)
|
||||
GHPRStatisticsCollector.logDetailsActionInvoked(project, GHPRAction.REBASE_MERGE, e?.source is JButton)
|
||||
reviewFlowVm.rebaseReview()
|
||||
}
|
||||
}
|
||||
@@ -2,6 +2,7 @@
|
||||
package org.jetbrains.plugins.github.pullrequest.ui.details.action
|
||||
|
||||
import com.intellij.collaboration.messages.CollaborationToolsBundle
|
||||
import com.intellij.openapi.project.Project
|
||||
import kotlinx.coroutines.CoroutineScope
|
||||
import kotlinx.coroutines.launch
|
||||
import org.jetbrains.plugins.github.api.data.pullrequest.GHPullRequestRequestedReviewer
|
||||
@@ -11,6 +12,7 @@ import javax.swing.AbstractAction
|
||||
|
||||
internal class GHPRRemoveReviewerAction(
|
||||
scope: CoroutineScope,
|
||||
private val project: Project,
|
||||
private val reviewFlowVm: GHPRReviewFlowViewModel,
|
||||
private val reviewer: GHPullRequestRequestedReviewer
|
||||
) : AbstractAction(CollaborationToolsBundle.message("review.details.action.remove.reviewer", reviewer.name ?: reviewer.shortName)) {
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
// 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.pullrequest.ui.details.action
|
||||
|
||||
import com.intellij.openapi.project.Project
|
||||
import kotlinx.coroutines.CoroutineScope
|
||||
import kotlinx.coroutines.launch
|
||||
import org.jetbrains.plugins.github.i18n.GithubBundle
|
||||
@@ -11,7 +12,7 @@ import java.awt.event.ActionEvent
|
||||
import javax.swing.AbstractAction
|
||||
import javax.swing.JButton
|
||||
|
||||
internal class GHPRReopenAction(scope: CoroutineScope, private val reviewFlowVm: GHPRReviewFlowViewModel)
|
||||
internal class GHPRReopenAction(scope: CoroutineScope, private val project: Project, private val reviewFlowVm: GHPRReviewFlowViewModel)
|
||||
: AbstractAction(GithubBundle.message("pull.request.reopen.action")) {
|
||||
|
||||
init {
|
||||
@@ -23,7 +24,7 @@ internal class GHPRReopenAction(scope: CoroutineScope, private val reviewFlowVm:
|
||||
}
|
||||
|
||||
override fun actionPerformed(e: ActionEvent?) {
|
||||
GHPRStatisticsCollector.logDetailsActionInvoked(GHPRAction.REOPEN, e?.source is JButton)
|
||||
GHPRStatisticsCollector.logDetailsActionInvoked(project, GHPRAction.REOPEN, e?.source is JButton)
|
||||
reviewFlowVm.reopenReview()
|
||||
}
|
||||
}
|
||||
@@ -2,6 +2,7 @@
|
||||
package org.jetbrains.plugins.github.pullrequest.ui.details.action
|
||||
|
||||
import com.intellij.collaboration.messages.CollaborationToolsBundle
|
||||
import com.intellij.openapi.project.Project
|
||||
import kotlinx.coroutines.CoroutineScope
|
||||
import kotlinx.coroutines.launch
|
||||
import org.jetbrains.plugins.github.pullrequest.GHPRAction
|
||||
@@ -12,7 +13,7 @@ import javax.swing.AbstractAction
|
||||
import javax.swing.JButton
|
||||
import javax.swing.JComponent
|
||||
|
||||
internal class GHPRRequestReviewAction(scope: CoroutineScope, private val reviewFlowVm: GHPRReviewFlowViewModel)
|
||||
internal class GHPRRequestReviewAction(scope: CoroutineScope, private val project: Project, private val reviewFlowVm: GHPRReviewFlowViewModel)
|
||||
: AbstractAction(CollaborationToolsBundle.message("review.details.action.request")) {
|
||||
|
||||
init {
|
||||
@@ -25,7 +26,7 @@ internal class GHPRRequestReviewAction(scope: CoroutineScope, private val review
|
||||
|
||||
override fun actionPerformed(event: ActionEvent) {
|
||||
val parentComponent = event.source as JComponent
|
||||
GHPRStatisticsCollector.logDetailsActionInvoked(GHPRAction.REQUEST_REVIEW, parentComponent is JButton)
|
||||
GHPRStatisticsCollector.logDetailsActionInvoked(project, GHPRAction.REQUEST_REVIEW, parentComponent is JButton)
|
||||
return reviewFlowVm.requestReview(parentComponent)
|
||||
}
|
||||
}
|
||||
@@ -2,6 +2,7 @@
|
||||
package org.jetbrains.plugins.github.pullrequest.ui.details.action
|
||||
|
||||
import com.intellij.collaboration.messages.CollaborationToolsBundle
|
||||
import com.intellij.openapi.project.Project
|
||||
import kotlinx.coroutines.CoroutineScope
|
||||
import kotlinx.coroutines.launch
|
||||
import org.jetbrains.plugins.github.pullrequest.GHPRAction
|
||||
@@ -11,7 +12,7 @@ import java.awt.event.ActionEvent
|
||||
import javax.swing.AbstractAction
|
||||
import javax.swing.JButton
|
||||
|
||||
internal class GHPRSetMyselfAsReviewerAction(scope: CoroutineScope, private val reviewFlowVm: GHPRReviewFlowViewModel)
|
||||
internal class GHPRSetMyselfAsReviewerAction(scope: CoroutineScope, private val project: Project, private val reviewFlowVm: GHPRReviewFlowViewModel)
|
||||
: AbstractAction(CollaborationToolsBundle.message("review.details.action.set.myself.as.reviewer")) {
|
||||
|
||||
init {
|
||||
@@ -23,7 +24,7 @@ internal class GHPRSetMyselfAsReviewerAction(scope: CoroutineScope, private val
|
||||
}
|
||||
|
||||
override fun actionPerformed(event: ActionEvent) {
|
||||
GHPRStatisticsCollector.logDetailsActionInvoked(GHPRAction.REQUEST_REVIEW_MYSELF, event.source is JButton)
|
||||
GHPRStatisticsCollector.logDetailsActionInvoked(project, GHPRAction.REQUEST_REVIEW_MYSELF, event.source is JButton)
|
||||
reviewFlowVm.setMyselfAsReviewer()
|
||||
}
|
||||
}
|
||||
@@ -3,6 +3,7 @@ package org.jetbrains.plugins.github.pullrequest.ui.details.action
|
||||
|
||||
import com.intellij.collaboration.async.combineAndCollect
|
||||
import com.intellij.collaboration.messages.CollaborationToolsBundle
|
||||
import com.intellij.openapi.project.Project
|
||||
import kotlinx.coroutines.CoroutineScope
|
||||
import kotlinx.coroutines.launch
|
||||
import org.jetbrains.plugins.github.pullrequest.GHPRAction
|
||||
@@ -12,7 +13,7 @@ import java.awt.event.ActionEvent
|
||||
import javax.swing.AbstractAction
|
||||
import javax.swing.JButton
|
||||
|
||||
internal class GHPRSquashMergeAction(scope: CoroutineScope, private val reviewFlowVm: GHPRReviewFlowViewModel)
|
||||
internal class GHPRSquashMergeAction(scope: CoroutineScope, private val project: Project, private val reviewFlowVm: GHPRReviewFlowViewModel)
|
||||
: AbstractAction(CollaborationToolsBundle.message("review.details.action.squash.and.merge")) {
|
||||
|
||||
init {
|
||||
@@ -24,7 +25,7 @@ internal class GHPRSquashMergeAction(scope: CoroutineScope, private val reviewFl
|
||||
}
|
||||
|
||||
override fun actionPerformed(e: ActionEvent?) {
|
||||
GHPRStatisticsCollector.logDetailsActionInvoked(GHPRAction.SQUASH_MERGE, e?.source is JButton)
|
||||
GHPRStatisticsCollector.logDetailsActionInvoked(project, GHPRAction.SQUASH_MERGE, e?.source is JButton)
|
||||
reviewFlowVm.squashAndMergeReview()
|
||||
}
|
||||
}
|
||||
@@ -103,7 +103,7 @@ internal class GHPRBranchesViewModel(
|
||||
val branch = "${headRemote.name}/${headBranch}"
|
||||
invokeLater {
|
||||
GitBranchPopupActions.RemoteBranchActions.CheckoutRemoteBranchAction.checkoutRemoteBranch(project, listOf(repository), branch)
|
||||
GHPRStatisticsCollector.logDetailsBranchCheckedOut()
|
||||
GHPRStatisticsCollector.logDetailsBranchCheckedOut(project)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -162,7 +162,7 @@ internal class GHPRBranchesViewModel(
|
||||
val source = _sourceBranch.value
|
||||
val target = _targetBranch.value
|
||||
_showBranchesRequests.emit(CodeReviewBranches(source, target))
|
||||
GHPRStatisticsCollector.logDetailsBranchesOpened()
|
||||
GHPRStatisticsCollector.logDetailsBranchesOpened(project)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -6,6 +6,7 @@ import com.intellij.collaboration.async.modelFlow
|
||||
import com.intellij.collaboration.ui.codereview.details.data.CodeReviewCIJob
|
||||
import com.intellij.collaboration.ui.codereview.details.model.CodeReviewStatusViewModel
|
||||
import com.intellij.openapi.diagnostic.thisLogger
|
||||
import com.intellij.openapi.project.Project
|
||||
import com.intellij.util.childScope
|
||||
import kotlinx.coroutines.CoroutineScope
|
||||
import kotlinx.coroutines.flow.*
|
||||
@@ -21,7 +22,11 @@ interface GHPRStatusViewModel : CodeReviewStatusViewModel {
|
||||
val requiredApprovingReviewsCount: Flow<Int>
|
||||
}
|
||||
|
||||
class GHPRStatusViewModelImpl(parentCs: CoroutineScope, stateModel: GHPRStateModel) : GHPRStatusViewModel {
|
||||
class GHPRStatusViewModelImpl(
|
||||
parentCs: CoroutineScope,
|
||||
private val project: Project,
|
||||
stateModel: GHPRStateModel
|
||||
) : GHPRStatusViewModel {
|
||||
private val cs = parentCs.childScope()
|
||||
|
||||
override val viewerDidAuthor: Boolean = stateModel.viewerDidAuthor
|
||||
@@ -59,7 +64,7 @@ class GHPRStatusViewModelImpl(parentCs: CoroutineScope, stateModel: GHPRStateMod
|
||||
cs.launchNow {
|
||||
val jobs = ciJobs.first()
|
||||
_showJobsDetailsRequests.emit(jobs)
|
||||
GHPRStatisticsCollector.logDetailsChecksOpened()
|
||||
GHPRStatisticsCollector.logDetailsChecksOpened(project)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2,6 +2,7 @@
|
||||
package org.jetbrains.plugins.github.pullrequest.ui.details.model.impl
|
||||
|
||||
import com.intellij.collaboration.ui.codereview.details.model.CodeReviewChangesViewModelBase
|
||||
import com.intellij.openapi.project.Project
|
||||
import kotlinx.coroutines.CoroutineScope
|
||||
import kotlinx.coroutines.flow.SharingStarted
|
||||
import kotlinx.coroutines.flow.StateFlow
|
||||
@@ -17,6 +18,7 @@ import org.jetbrains.plugins.github.pullrequest.ui.toolwindow.GHPRDiffController
|
||||
|
||||
internal class GHPRCommitsViewModel(
|
||||
scope: CoroutineScope,
|
||||
private val project: Project,
|
||||
commitsLoadingModel: GHSimpleLoadingModel<List<GHCommit>>,
|
||||
securityService: GHPRSecurityService,
|
||||
private val diffBridge: GHPRDiffController
|
||||
@@ -39,16 +41,16 @@ internal class GHPRCommitsViewModel(
|
||||
diffBridge.activeTree = GHPRDiffController.ActiveTree.FILES
|
||||
}
|
||||
super.selectCommit(index)
|
||||
GHPRStatisticsCollector.logDetailsCommitChosen()
|
||||
GHPRStatisticsCollector.logDetailsCommitChosen(project)
|
||||
}
|
||||
|
||||
override fun selectNextCommit() {
|
||||
super.selectNextCommit()
|
||||
GHPRStatisticsCollector.logDetailsNextCommitChosen()
|
||||
GHPRStatisticsCollector.logDetailsNextCommitChosen(project)
|
||||
}
|
||||
|
||||
override fun selectPreviousCommit() {
|
||||
super.selectPreviousCommit()
|
||||
GHPRStatisticsCollector.logDetailsPrevCommitChosen()
|
||||
GHPRStatisticsCollector.logDetailsPrevCommitChosen(project)
|
||||
}
|
||||
}
|
||||
@@ -4,6 +4,7 @@ package org.jetbrains.plugins.github.pullrequest.ui.filters
|
||||
import com.intellij.collaboration.async.launchNow
|
||||
import com.intellij.collaboration.ui.codereview.list.search.ReviewListQuickFilter
|
||||
import com.intellij.collaboration.ui.codereview.list.search.ReviewListSearchPanelViewModelBase
|
||||
import com.intellij.openapi.project.Project
|
||||
import kotlinx.coroutines.CoroutineScope
|
||||
import kotlinx.coroutines.FlowPreview
|
||||
import kotlinx.coroutines.flow.debounce
|
||||
@@ -18,6 +19,7 @@ import org.jetbrains.plugins.github.pullrequest.ui.filters.GHPRListQuickFilter.*
|
||||
@OptIn(FlowPreview::class)
|
||||
internal class GHPRSearchPanelViewModel(
|
||||
scope: CoroutineScope,
|
||||
private val project: Project,
|
||||
private val repositoryDataService: GHPRRepositoryDataService,
|
||||
historyViewModel: GHPRSearchHistoryModel,
|
||||
currentUser: GHUser
|
||||
@@ -62,7 +64,7 @@ internal class GHPRSearchPanelViewModel(
|
||||
scope.launchNow {
|
||||
// with debounce to avoid collecting intermediate state
|
||||
searchState.drop(1).debounce(5000).collect {
|
||||
GHPRStatisticsCollector.logListFiltersApplied(it)
|
||||
GHPRStatisticsCollector.logListFiltersApplied(project, it)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -57,7 +57,7 @@ internal class GHPRListPanelFactory(private val project: Project,
|
||||
val actionManager = ActionManager.getInstance()
|
||||
|
||||
val historyModel = GHPRSearchHistoryModel(project.service<GHPRListPersistentSearchHistory>())
|
||||
val searchVm = GHPRSearchPanelViewModel(scope, repositoryDataService, historyModel, securityService.currentUser)
|
||||
val searchVm = GHPRSearchPanelViewModel(scope, project, repositoryDataService, historyModel, securityService.currentUser)
|
||||
scope.launch {
|
||||
searchVm.searchState.collectLatest {
|
||||
listLoader.searchQuery = it.toQuery()
|
||||
|
||||
@@ -182,7 +182,7 @@ internal class GHPRViewComponentFactory(private val actionManager: ActionManager
|
||||
val scope = DisposingScope(disposable, SupervisorJob() + Dispatchers.Main.immediate)
|
||||
val reviewDetailsVm = GHPRDetailsViewModelImpl(detailsModel, stateModel)
|
||||
val reviewBranchesVm = GHPRBranchesViewModel(scope, project, branchesModel, dataProvider.detailsData)
|
||||
val reviewStatusVm = GHPRStatusViewModelImpl(scope, stateModel)
|
||||
val reviewStatusVm = GHPRStatusViewModelImpl(scope, project, stateModel)
|
||||
val reviewFlowVm = GHPRReviewFlowViewModelImpl(scope,
|
||||
metadataModel,
|
||||
stateModel,
|
||||
@@ -191,9 +191,10 @@ internal class GHPRViewComponentFactory(private val actionManager: ActionManager
|
||||
dataProvider.detailsData,
|
||||
dataProvider.reviewData,
|
||||
disposable)
|
||||
val commitsVm = GHPRCommitsViewModel(scope, commitsLoadingModel, dataContext.securityService, diffBridge)
|
||||
val commitsVm = GHPRCommitsViewModel(scope, project, commitsLoadingModel, dataContext.securityService, diffBridge)
|
||||
|
||||
GHPRDetailsComponentFactory.create(scope,
|
||||
project,
|
||||
reviewDetailsVm, reviewBranchesVm, reviewStatusVm, reviewFlowVm, commitsVm,
|
||||
dataProvider,
|
||||
dataContext.securityService, dataContext.avatarIconsProvider,
|
||||
@@ -275,7 +276,7 @@ internal class GHPRViewComponentFactory(private val actionManager: ActionManager
|
||||
|
||||
tree.addSelectionListener {
|
||||
if (tree.isFocusOwner) {
|
||||
GHPRStatisticsCollector.logChangeSelected()
|
||||
GHPRStatisticsCollector.logChangeSelected(project)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -69,7 +69,7 @@ internal class MultiTabGHPRToolWindowContentController(parentDisposable: Disposa
|
||||
_contentController = CompletableFuture()
|
||||
}
|
||||
showSelectorsTab(requestFocus)
|
||||
GHPRStatisticsCollector.logSelectorsOpened()
|
||||
GHPRStatisticsCollector.logSelectorsOpened(project)
|
||||
}
|
||||
else {
|
||||
val controller = showRepositoryContent(conn, requestFocus)
|
||||
|
||||
@@ -56,7 +56,7 @@ internal class MultiTabGHPRToolWindowRepositoryContentController(
|
||||
it.type == TabType.New
|
||||
} ?: createAndAddNewPRContent()
|
||||
contentManager.setSelectedContent(content, requestFocus)
|
||||
GHPRStatisticsCollector.logNewPRViewOpened()
|
||||
GHPRStatisticsCollector.logNewPRViewOpened(project)
|
||||
}
|
||||
|
||||
private fun createAndAddNewPRContent(): Content {
|
||||
@@ -90,7 +90,7 @@ internal class MultiTabGHPRToolWindowRepositoryContentController(
|
||||
it.type == TabType.List
|
||||
} ?: createAndAddListContent()
|
||||
contentManager.setSelectedContent(content, requestFocus)
|
||||
GHPRStatisticsCollector.logListOpened()
|
||||
GHPRStatisticsCollector.logListOpened(project)
|
||||
}
|
||||
|
||||
private fun createAndAddListContent(): Content {
|
||||
@@ -143,7 +143,7 @@ internal class MultiTabGHPRToolWindowRepositoryContentController(
|
||||
(it.type as? TabType.PR)?.id == id
|
||||
} ?: createAndAddPRContent(id)
|
||||
contentManager.setSelectedContent(content, requestFocus)
|
||||
GHPRStatisticsCollector.logDetailsOpened()
|
||||
GHPRStatisticsCollector.logDetailsOpened(project)
|
||||
|
||||
return UIUtil.findComponentOfType(content.component, ChangesTree::class.java)?.let {
|
||||
ClientProperty.get(it, GHPRCommitBrowserComponentController.KEY)
|
||||
|
||||
Reference in New Issue
Block a user