-
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 3 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,55 @@ | ||
// 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 kotlinx.coroutines.runBlocking | ||
import software.aws.toolkits.jetbrains.utils.notifyInfo | ||
import software.aws.toolkits.jetbrains.utils.runUnderProgressIfNeeded | ||
import software.aws.toolkits.resources.AmazonQBundle | ||
import software.aws.toolkits.resources.AwsCoreBundle | ||
|
||
class GetAmazonQLogsAction : DumbAwareAction( | ||
AmazonQBundle.message("amazonq.getLogs"), | ||
Check warning on line 22 in plugins/amazonq/chat/jetbrains-community/src/software/aws/toolkits/jetbrains/services/amazonq/GetAmazonQLogsAction.kt
|
||
|
||
null, | ||
IconLoader.getIcon("/META-INF/file.svg", GetAmazonQLogsAction::class.java) | ||
) { | ||
|
||
override fun getActionUpdateThread() = ActionUpdateThread.BGT | ||
override fun actionPerformed(e: AnActionEvent) { | ||
val project = e.project ?: return | ||
showLogCollectionWarning(project) | ||
} | ||
|
||
companion object { | ||
|
||
fun showLogCollectionWarning(project: Project) { | ||
if (Messages.showOkCancelDialog( | ||
AmazonQBundle.message("amazonq.logs.warning"), | ||
AmazonQBundle.message("amazonq.getLogs"), | ||
Check warning on line 37 in plugins/amazonq/chat/jetbrains-community/src/software/aws/toolkits/jetbrains/services/amazonq/GetAmazonQLogsAction.kt
|
||
|
||
AwsCoreBundle.message("general.ok"), | ||
AwsCoreBundle.message("general.cancel"), | ||
AllIcons.General.Warning | ||
) == 0 | ||
) { | ||
runUnderProgressIfNeeded(project, AmazonQBundle.message("amazonq.getLogs"), cancelable = true) { | ||
runBlocking { | ||
try { | ||
RevealFileAction.openFile(LogPacker.packLogs(project)) | ||
Check warning on line 46 in plugins/amazonq/chat/jetbrains-community/src/software/aws/toolkits/jetbrains/services/amazonq/GetAmazonQLogsAction.kt
|
||
|
||
} catch (_: Exception) { | ||
notifyInfo("Cannot retrieve logs. Please try Help-> Collect Logs and Diagnostic data") | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} |
Uh oh!
There was an error while loading. Please reload this page.