Skip to content

Commit 7e8addd

Browse files
committed
feedback
1 parent 97b0bd7 commit 7e8addd

File tree

3 files changed

+36
-21
lines changed

3 files changed

+36
-21
lines changed

plugins/amazonq/chat/jetbrains-community/resources/META-INF/plugin-chat.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
<action id="aws.toolkit.open.q.window" class="software.aws.toolkits.jetbrains.services.amazonq.QRefreshPanelAction"/>
3434
<group id="aws.q.toolwindow.titleBar" popup="false" compact="true">
3535
<reference id="aws.toolkit.open.q.window"/>
36-
<action class="software.aws.toolkits.jetbrains.services.amazonq.GetAmazonQLogsAction"/>
36+
<action class="software.aws.toolkits.jetbrains.services.amazonq.GetAmazonQLogsAction" id="q.getLogs"/>
3737
</group>
3838
<!-- TODO: q.openchat will eventually be in amazonq, aws.toolkit.q.sign.in will eventually be in core. -->
3939
<action id="q.openchat" class="software.aws.toolkits.jetbrains.services.amazonq.QOpenPanelAction"/>

plugins/amazonq/chat/jetbrains-community/src/software/aws/toolkits/jetbrains/services/amazonq/GetAmazonQLogsAction.kt

Lines changed: 33 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -3,35 +3,39 @@
33

44
package software.aws.toolkits.jetbrains.services.amazonq
55

6-
import com.intellij.openapi.actionSystem.ActionManager
7-
import com.intellij.openapi.actionSystem.ActionPlaces
8-
import com.intellij.openapi.actionSystem.ActionUiKind
6+
import com.intellij.icons.AllIcons
7+
import com.intellij.ide.actions.RevealFileAction
8+
import com.intellij.ide.logsUploader.LogPacker
99
import com.intellij.openapi.actionSystem.ActionUpdateThread
1010
import com.intellij.openapi.actionSystem.AnActionEvent
11-
import com.intellij.openapi.actionSystem.CommonDataKeys
12-
import com.intellij.openapi.actionSystem.impl.SimpleDataContext
1311
import com.intellij.openapi.project.DumbAwareAction
1412
import com.intellij.openapi.project.Project
13+
import com.intellij.openapi.ui.Messages
1514
import com.intellij.openapi.util.IconLoader
1615
import com.intellij.ui.ColorUtil
1716
import com.intellij.ui.JBColor
1817
import com.intellij.util.IconUtil
1918
import com.intellij.util.ui.UIUtil
19+
import kotlinx.coroutines.runBlocking
2020
import software.aws.toolkits.jetbrains.utils.notifyInfo
21-
import software.aws.toolkits.resources.AmazonQBundle
21+
import software.aws.toolkits.jetbrains.utils.runUnderProgressIfNeeded
2222
import software.aws.toolkits.resources.AmazonQBundle.message
23+
import software.aws.toolkits.resources.AwsCoreBundle
24+
25+
class GetAmazonQLogsAction : DumbAwareAction(message("amazonq.getLogs.tooltip.text")) {
26+
private val baseIcon = IconLoader.getIcon("/icons/file.svg", GetAmazonQLogsAction::class.java)
27+
28+
private val lightIcon by lazy {
29+
IconUtil.colorize(baseIcon, ColorUtil.brighter(UIUtil.getLabelForeground(), 2))
30+
}
31+
2332

24-
class GetAmazonQLogsAction : DumbAwareAction(
25-
AmazonQBundle.message("amazonq.getLogs.tooltip.text")
26-
) {
2733

2834
override fun update(e: AnActionEvent) {
29-
super.update(e)
30-
val baseIcon = IconLoader.getIcon("/icons/file.svg", GetAmazonQLogsAction::class.java)
3135
e.presentation.icon = if (!JBColor.isBright()) {
3236
baseIcon
3337
} else {
34-
IconUtil.colorize(baseIcon, ColorUtil.brighter(UIUtil.getLabelForeground(), 2))
38+
lightIcon
3539
}
3640
}
3741

@@ -43,13 +47,23 @@ class GetAmazonQLogsAction : DumbAwareAction(
4347

4448
companion object {
4549
fun showLogCollectionWarningGetLogs(project: Project) {
46-
try {
47-
val action = ActionManager.getInstance().getAction("CollectZippedLogs")
48-
val datacontxt = SimpleDataContext.builder().add(CommonDataKeys.PROJECT, project).build()
49-
val ae = AnActionEvent.createEvent(action, datacontxt, null, ActionPlaces.UNKNOWN, ActionUiKind.POPUP, null)
50-
action.actionPerformed(ae)
51-
} catch (_: Exception) {
52-
notifyInfo(message("amazonq.getLogs.tooltip.text"), message("amazonq.logs.warning"))
50+
if (Messages.showOkCancelDialog(
51+
message("amazonq.logs.warning"),
52+
message("amazonq.getLogs"),
53+
AwsCoreBundle.message("general.ok"),
54+
AwsCoreBundle.message("general.cancel"),
55+
AllIcons.General.Warning
56+
) == 0
57+
) {
58+
runUnderProgressIfNeeded(project, message("amazonq.getLogs"), cancelable = true) {
59+
runBlocking {
60+
try {
61+
RevealFileAction.openFile(LogPacker.packLogs(project))
62+
} catch (_: Exception) {
63+
notifyInfo(message("amazonq.getLogs"), message("amazonq.logs.error"), project)
64+
}
65+
}
66+
}
5367
}
5468
}
5569
}

plugins/amazonq/shared/jetbrains-community/resources/software/aws/toolkits/resources/AmazonQBundle.properties

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@ amazonqInlineChat.popup.reject=Reject \u238B
88
amazonqInlineChat.popup.title=Enter Instructions for Q
99
amazonq.getLogs=Get Amazon Q logs
1010
amazonq.getLogs.tooltip.text=Show Logs
11-
amazonq.logs.warning=Cannot retrieve logs. Please try Help-> Collect Logs and Diagnostic data
11+
amazonq.logs.error=Cannot retrieve logs. Please try Help-> Collect Logs and Diagnostic data
12+
amazonq.logs.warning=Log files may contain sensitive information such as account IDs, resource names, and other data. Please be careful when sharing these logs.
1213
amazonq.refresh.panel=Refresh Chat Session
1314
amazonq.title=Amazon Q
1415
amazonq.workspace.settings.open.prompt=Workspace index is now enabled. You can disable it from Amazon Q settings.

0 commit comments

Comments
 (0)