Blame · Line-by-line history
ViewHealthAction.kt
Each line is annotated with the commit that last touched it. Click any SHA to jump to that commit and see the surrounding change.
| 0377886 | 1 | package com.gluecron.actions |
| 2 | ||
| 3 | import com.gluecron.GluecronUtil | |
| 4 | import com.gluecron.settings.GluecronSettingsState | |
| 5 | import com.intellij.notification.NotificationType | |
| 6 | import com.intellij.openapi.actionSystem.AnAction | |
| 7 | import com.intellij.openapi.actionSystem.AnActionEvent | |
| 8 | import com.intellij.openapi.project.DumbAware | |
| 9 | ||
| 10 | /** | |
| 11 | * Opens a browser tab showing the repository health / CI dashboard. | |
| 12 | * | |
| 13 | * URL pattern: {host}/{owner}/{repo}/health | |
| 14 | * | |
| 15 | * The health page aggregates: | |
| 16 | * - GateTest scan results from the most recent push | |
| 17 | * - CI/CD pipeline status | |
| 18 | * - Branch protection rule compliance | |
| 19 | * - Open PR count and review coverage | |
| 20 | * | |
| 21 | * This is the JetBrains equivalent of the VS Code "gluecron.viewHealth" command, | |
| 22 | * and mirrors the /admin/deploys live step stream mentioned in the project docs. | |
| 23 | */ | |
| 24 | class ViewHealthAction : AnAction(), DumbAware { | |
| 25 | ||
| 26 | override fun actionPerformed(e: AnActionEvent) { | |
| 27 | val project = e.project ?: return | |
| 28 | val settings = GluecronSettingsState.getInstance() | |
| 29 | ||
| 30 | val (owner, repo) = GluecronUtil.detectOwnerRepo(project) | |
| 31 | ?: run { | |
| 32 | GluecronUtil.notify( | |
| 33 | project, | |
| 34 | "No Gluecron remote detected. Ensure the project has a git remote " + | |
| 35 | "pointing to ${settings.host}.", | |
| 36 | NotificationType.WARNING | |
| 37 | ) | |
| 38 | return | |
| 39 | } | |
| 40 | ||
| 41 | val url = "${settings.host}/$owner/$repo/health" | |
| 42 | GluecronUtil.openBrowser(url) | |
| 43 | } | |
| 44 | ||
| 45 | override fun update(e: AnActionEvent) { | |
| 46 | e.presentation.isEnabledAndVisible = e.project != null | |
| 47 | } | |
| 48 | } |