-
Notifications
You must be signed in to change notification settings - Fork 273
feat(amazonq): Enable one-click collection of logs from chat #5923
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 11 commits
04cfd8a
563986f
22b6735
244cffa
4594a25
48d6e14
97b0bd7
aa0072a
7e8addd
8d9284d
5925e9b
9e29e32
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
// Copyright 2025 Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
package software.aws.toolkits.jetbrains.services.amazonq | ||
|
||
import com.intellij.icons.AllIcons | ||
import com.intellij.ide.actions.RevealFileAction | ||
import com.intellij.ide.logsUploader.LogPacker | ||
import com.intellij.openapi.actionSystem.ActionUpdateThread | ||
import com.intellij.openapi.actionSystem.AnActionEvent | ||
import com.intellij.openapi.project.DumbAwareAction | ||
import com.intellij.openapi.project.Project | ||
import com.intellij.openapi.ui.Messages | ||
import com.intellij.openapi.util.IconLoader | ||
import com.intellij.ui.ColorUtil | ||
import com.intellij.ui.JBColor | ||
import com.intellij.util.IconUtil | ||
import com.intellij.util.ui.UIUtil | ||
import kotlinx.coroutines.runBlocking | ||
import software.aws.toolkits.jetbrains.utils.notifyInfo | ||
import software.aws.toolkits.jetbrains.utils.runUnderProgressIfNeeded | ||
import software.aws.toolkits.resources.AmazonQBundle.message | ||
import software.aws.toolkits.resources.AwsCoreBundle | ||
|
||
class GetAmazonQLogsAction : DumbAwareAction(message("amazonq.getLogs.tooltip.text")) { | ||
private val baseIcon = IconLoader.getIcon("/icons/file.svg", GetAmazonQLogsAction::class.java) | ||
|
||
private val lightIcon by lazy { | ||
IconUtil.colorize(baseIcon, ColorUtil.brighter(UIUtil.getLabelForeground(), 2)) | ||
} | ||
|
||
|
||
|
||
override fun update(e: AnActionEvent) { | ||
e.presentation.icon = if (!JBColor.isBright()) { | ||
baseIcon | ||
} else { | ||
lightIcon | ||
} | ||
} | ||
|
||
override fun getActionUpdateThread() = ActionUpdateThread.BGT | ||
override fun actionPerformed(e: AnActionEvent) { | ||
val project = e.project ?: return | ||
showLogCollectionWarningGetLogs(project) | ||
} | ||
|
||
companion object { | ||
Check warning on line 48 in plugins/amazonq/chat/jetbrains-community/src/software/aws/toolkits/jetbrains/services/amazonq/GetAmazonQLogsAction.kt
|
||
|
||
fun showLogCollectionWarningGetLogs(project: Project) { | ||
if (Messages.showOkCancelDialog( | ||
message("amazonq.logs.warning"), | ||
message("amazonq.getLogs"), | ||
Check warning on line 52 in plugins/amazonq/chat/jetbrains-community/src/software/aws/toolkits/jetbrains/services/amazonq/GetAmazonQLogsAction.kt
|
||
Check warningCode scanning / QDJVMC Incorrect string capitalization Warning
String 'Get Amazon Q logs' is not properly capitalized. It should have title capitalization
|
||
AwsCoreBundle.message("general.ok"), | ||
AwsCoreBundle.message("general.cancel"), | ||
AllIcons.General.Warning | ||
) == 0 | ||
) { | ||
runUnderProgressIfNeeded(project, message("amazonq.getLogs"), cancelable = true) { | ||
runBlocking { | ||
try { | ||
RevealFileAction.openFile(LogPacker.packLogs(project)) | ||
Check warning on line 61 in plugins/amazonq/chat/jetbrains-community/src/software/aws/toolkits/jetbrains/services/amazonq/GetAmazonQLogsAction.kt
|
||
|
||
} catch (_: Exception) { | ||
notifyInfo(message("amazonq.getLogs"), message("amazonq.logs.error"), project) | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} |
Uh oh!
There was an error while loading. Please reload this page.