From b5384529f9fd26ece001a2483b7fab4443fe6534 Mon Sep 17 00:00:00 2001 From: Daniel M Date: Fri, 1 Dec 2023 10:08:09 -0500 Subject: [PATCH] chore(deps):update dependencies --- .../com/dsoftware/ghmanager/Constants.kt | 30 +++++++++++++++++-- .../ghmanager/ui/panels/LogConsolePanel.kt | 4 +-- 2 files changed, 28 insertions(+), 6 deletions(-) diff --git a/src/main/kotlin/com/dsoftware/ghmanager/Constants.kt b/src/main/kotlin/com/dsoftware/ghmanager/Constants.kt index c9d62ae6..857d5588 100644 --- a/src/main/kotlin/com/dsoftware/ghmanager/Constants.kt +++ b/src/main/kotlin/com/dsoftware/ghmanager/Constants.kt @@ -1,15 +1,39 @@ package com.dsoftware.ghmanager +import com.intellij.ide.BrowserUtil +import com.intellij.ui.SimpleTextAttributes +import com.intellij.util.ui.StatusText + object Constants { const val LOG_MSG_PICK_JOB = "Pick a job to view logs" const val LOG_MSG_MISSING = "Job logs missing for: " - const val LOG_MSG_JOB_IN_PROGRESS = "Job is still in progress, can't view logs" + const val LOG_MSG_JOB_IN_PROGRESS = "Job is still in progress, can't view logs." fun emptyTextMessage(logValue: String): Boolean { return (logValue.startsWith(LOG_MSG_MISSING) || logValue.startsWith(LOG_MSG_PICK_JOB) - || logValue.startsWith(LOG_MSG_JOB_IN_PROGRESS) - ) + || logValue.startsWith( + LOG_MSG_JOB_IN_PROGRESS + )) } + fun updateEmptyText(logValue: String, emptyText: StatusText): Boolean { + if (logValue.startsWith(LOG_MSG_MISSING) + || logValue.startsWith(LOG_MSG_PICK_JOB) + ) { + emptyText.text = logValue + return true + } + if (logValue.startsWith(LOG_MSG_JOB_IN_PROGRESS)) { + emptyText.text = "Job is still in progress, can't view logs." + emptyText.appendSecondaryText( + "Please upvote this issue on GitHub so they will prioritize it.", + SimpleTextAttributes.LINK_PLAIN_ATTRIBUTES + ) { + BrowserUtil.browse("https://github.com/orgs/community/discussions/75518") + } + return true + } + return false + } } diff --git a/src/main/kotlin/com/dsoftware/ghmanager/ui/panels/LogConsolePanel.kt b/src/main/kotlin/com/dsoftware/ghmanager/ui/panels/LogConsolePanel.kt index f64e2833..c5685881 100644 --- a/src/main/kotlin/com/dsoftware/ghmanager/ui/panels/LogConsolePanel.kt +++ b/src/main/kotlin/com/dsoftware/ghmanager/ui/panels/LogConsolePanel.kt @@ -87,9 +87,7 @@ fun createLogConsolePanel( if (logValue.isNullOrBlank()) { return } - if (Constants.emptyTextMessage(logValue)) { - panel.emptyText.text = logValue - } else { + if (!Constants.updateEmptyText(logValue, panel.emptyText)) { panel.removeAll() val console = LogConsolePanel(project, logValue, parentDisposable) panel.add(console.component, BorderLayout.CENTER)