-
Notifications
You must be signed in to change notification settings - Fork 274
Display startup and emergency notifications #5143
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
Merged
Merged
Changes from all commits
Commits
Show all changes
57 commits
Select commit
Hold shift + click to select a range
ca9deaa
Merge main into feature/ideNotifs
aws-toolkit-automation 2b4bf19
Merge main into feature/ideNotifs
aws-toolkit-automation dc05bcb
Merge main into feature/ideNotifs
aws-toolkit-automation 9750c75
Merge main into feature/ideNotifs
aws-toolkit-automation f996c1f
Merge main into feature/ideNotifs
aws-toolkit-automation c98b8b2
Merge main into feature/ideNotifs
aws-toolkit-automation 0b2cc44
Merge main into feature/ideNotifs
aws-toolkit-automation 3f4cad0
Merge main into feature/ideNotifs
aws-toolkit-automation a49f037
Merge main into feature/ideNotifs
aws-toolkit-automation 55692b3
Merge main into feature/ideNotifs
aws-toolkit-automation 9b54788
Merge main into feature/ideNotifs
aws-toolkit-automation a7fc49c
Merge main into feature/ideNotifs
aws-toolkit-automation 61dfe59
Merge main into feature/ideNotifs
aws-toolkit-automation 51633da
Merge main into feature/ideNotifs
aws-toolkit-automation 35b059e
Merge main into feature/ideNotifs
aws-toolkit-automation 71997df
Merge main into feature/ideNotifs
aws-toolkit-automation 1981f4a
Merge main into feature/ideNotifs
aws-toolkit-automation 302595c
Merge main into feature/ideNotifs
aws-toolkit-automation c02bc78
Merge main into feature/ideNotifs
aws-toolkit-automation 9da9389
Merge main into feature/ideNotifs
aws-toolkit-automation 0b4a5d9
Merge main into feature/ideNotifs
aws-toolkit-automation 26d1d25
Merge main into feature/ideNotifs
aws-toolkit-automation b5be852
Merge main into feature/ideNotifs
aws-toolkit-automation 69b684f
Merge main into feature/ideNotifs
aws-toolkit-automation 6bec379
Merge main into feature/ideNotifs
aws-toolkit-automation acd476e
Merge main into feature/ideNotifs
aws-toolkit-automation e7bbcab
Merge main into feature/ideNotifs
aws-toolkit-automation 07c627c
Merge main into feature/ideNotifs
aws-toolkit-automation 2a6524e
Merge main into feature/ideNotifs
aws-toolkit-automation d4eae94
Merge main into feature/ideNotifs
aws-toolkit-automation b16b598
Merge main into feature/ideNotifs
aws-toolkit-automation 09930b0
Merge main into feature/ideNotifs
aws-toolkit-automation 794f006
Merge main into feature/ideNotifs
aws-toolkit-automation 5974403
Add framework for processing notifications (#5112)
manodnyab a235000
Merge main into feature/ideNotifs
aws-toolkit-automation a1a5728
Add deserialization for notification messages retrieved from the noti…
manodnyab ae6d01a
Merge main into feature/ideNotifs
aws-toolkit-automation bc31b59
Merge main into feature/ideNotifs
aws-toolkit-automation 6666e60
Merge main into feature/ideNotifs
aws-toolkit-automation 93af131
Merge main into feature/ideNotifs
aws-toolkit-automation fcf7d38
Merge main into feature/ideNotifs
aws-toolkit-automation dcb4204
Merge main into feature/ideNotifs
aws-toolkit-automation 87bbbce
Merge main into feature/ideNotifs
aws-toolkit-automation dfe18e9
Show toasts for notifications and notification banner on critical not…
manodnyab b4950be
Merge main into feature/ideNotifs
aws-toolkit-automation cbe7474
Merge main into feature/ideNotifs
aws-toolkit-automation fe4788f
Merge main into feature/ideNotifs
aws-toolkit-automation 0cb5655
Merge main into feature/ideNotifs
aws-toolkit-automation a987d25
Merge main into feature/ideNotifs
aws-toolkit-automation 038fffb
Merge main into feature/ideNotifs
aws-toolkit-automation 5bb683e
Merge main into feature/ideNotifs
aws-toolkit-automation 2fdb1d8
Merge main into feature/ideNotifs
aws-toolkit-automation 5f43277
Adding update/restart action to notifications (#5136)
bryceitoc9 33bfa44
Poll for new notifications (#5119)
samgst-amazon 1eefd62
Merge main into feature/ideNotifs
aws-toolkit-automation b2e012a
Add logging info to IDE notification polling and processing (#5138)
samgst-amazon 1c6f0d4
fix isFirstPoll not setting to false on first pass
samgst-amazon File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
39 changes: 39 additions & 0 deletions
39
...nity/src/software/aws/toolkits/jetbrains/services/amazonq/toolwindow/OuterAmazonQPanel.kt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,39 @@ | ||
| // Copyright 2024 Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
| // SPDX-License-Identifier: Apache-2.0 | ||
|
|
||
| package software.aws.toolkits.jetbrains.services.amazonq.toolwindow | ||
|
|
||
| import com.intellij.openapi.project.Project | ||
| import com.intellij.ui.components.panels.Wrapper | ||
| import com.intellij.util.ui.components.BorderLayoutPanel | ||
| import software.aws.toolkits.core.utils.error | ||
| import software.aws.toolkits.core.utils.getLogger | ||
| import software.aws.toolkits.jetbrains.core.webview.BrowserState | ||
| import software.aws.toolkits.jetbrains.services.amazonq.QWebviewPanel | ||
| import software.aws.toolkits.jetbrains.utils.isQConnected | ||
| import software.aws.toolkits.jetbrains.utils.isQExpired | ||
| import software.aws.toolkits.telemetry.FeatureId | ||
| import javax.swing.JComponent | ||
|
|
||
| class OuterAmazonQPanel(val project: Project) : BorderLayoutPanel() { | ||
| private val wrapper = Wrapper() | ||
| init { | ||
| isOpaque = false | ||
| addToCenter(wrapper) | ||
| val component = if (isQConnected(project) && !isQExpired(project)) { | ||
| AmazonQToolWindow.getInstance(project).component | ||
| } else { | ||
| QWebviewPanel.getInstance(project).browser?.prepareBrowser(BrowserState(FeatureId.AmazonQ)) | ||
| QWebviewPanel.getInstance(project).component | ||
| } | ||
| updateQPanel(component) | ||
| } | ||
|
|
||
| fun updateQPanel(content: JComponent) { | ||
Check noticeCode scanning / QDJVMC Class member can have 'private' visibility Note
Function 'updateQPanel' could be private
|
||
| try { | ||
| wrapper.setContent(content) | ||
| } catch (e: Exception) { | ||
| getLogger<OuterAmazonQPanel>().error { "Error while creating window" } | ||
| } | ||
| } | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
132 changes: 132 additions & 0 deletions
132
...munity/src/software/aws/toolkits/jetbrains/core/notifications/CustomizeNotificationsUi.kt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,132 @@ | ||
| // Copyright 2024 Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
| // SPDX-License-Identifier: Apache-2.0 | ||
|
|
||
| package software.aws.toolkits.jetbrains.core.notifications | ||
|
|
||
| import com.intellij.icons.AllIcons | ||
| import com.intellij.ide.BrowserUtil | ||
| import com.intellij.openapi.actionSystem.AnAction | ||
| import com.intellij.openapi.actionSystem.AnActionEvent | ||
| import com.intellij.openapi.application.runInEdt | ||
| import com.intellij.openapi.progress.ProgressIndicator | ||
| import com.intellij.openapi.progress.ProgressManager | ||
| import com.intellij.openapi.progress.Task | ||
| import com.intellij.openapi.project.Project | ||
| import com.intellij.openapi.ui.Messages | ||
| import com.intellij.ui.EditorNotificationPanel | ||
| import software.aws.toolkits.jetbrains.AwsPlugin | ||
| import software.aws.toolkits.jetbrains.AwsToolkit | ||
| import software.aws.toolkits.jetbrains.core.plugin.PluginUpdateManager | ||
| import software.aws.toolkits.resources.AwsCoreBundle | ||
|
|
||
| fun checkSeverity(notificationSeverity: String): NotificationSeverity = when (notificationSeverity) { | ||
| "Critical" -> NotificationSeverity.CRITICAL | ||
| "Warning" -> NotificationSeverity.WARNING | ||
| "Info" -> NotificationSeverity.INFO | ||
| else -> NotificationSeverity.INFO | ||
| } | ||
|
|
||
| object NotificationManager { | ||
| fun createActions( | ||
| project: Project, | ||
| followupActions: List<NotificationFollowupActions>?, | ||
| message: String, | ||
| title: String, | ||
|
|
||
| ): List<NotificationActionList> = buildList { | ||
| var url: String? = null | ||
| followupActions?.forEach { action -> | ||
| if (action.type == "ShowUrl") { | ||
| url = action.content.locale.url | ||
| } | ||
|
|
||
| if (action.type == "UpdateExtension") { | ||
| add( | ||
| NotificationActionList(AwsCoreBundle.message("notification.update")) { | ||
| updatePlugins() | ||
| } | ||
| ) | ||
| } | ||
|
|
||
| if (action.type == "OpenChangelog") { | ||
| add( | ||
| NotificationActionList(AwsCoreBundle.message("notification.changelog")) { | ||
| BrowserUtil.browse(AwsToolkit.GITHUB_CHANGELOG) | ||
| } | ||
| ) | ||
| } | ||
| } | ||
| add( | ||
| NotificationActionList(AwsCoreBundle.message("general.more_dialog")) { | ||
| if (url == null) { | ||
| Messages.showYesNoDialog( | ||
| project, | ||
| message, | ||
| title, | ||
| AwsCoreBundle.message("general.acknowledge"), | ||
| AwsCoreBundle.message("general.cancel"), | ||
| AllIcons.General.Error | ||
| ) | ||
| } else { | ||
| val link = url ?: AwsToolkit.GITHUB_URL | ||
| val openLink = Messages.showYesNoDialog( | ||
| project, | ||
| message, | ||
| title, | ||
| AwsCoreBundle.message(AwsCoreBundle.message("notification.learn_more")), | ||
| AwsCoreBundle.message("general.cancel"), | ||
| AllIcons.General.Error | ||
| ) | ||
| if (openLink == 0) { | ||
| BrowserUtil.browse(link) | ||
| } | ||
| } | ||
| } | ||
| ) | ||
| } | ||
|
|
||
| fun buildNotificationActions(actions: List<NotificationActionList>): List<AnAction> = actions.map { (title, block) -> | ||
| object : AnAction(title) { | ||
| override fun actionPerformed(e: AnActionEvent) { | ||
| block() | ||
| } | ||
| } | ||
| } | ||
|
|
||
| fun buildBannerPanel(panel: EditorNotificationPanel, actions: List<NotificationActionList>): EditorNotificationPanel { | ||
| actions.forEach { (actionTitle, block) -> | ||
| panel.createActionLabel(actionTitle) { | ||
| block() | ||
| } | ||
| } | ||
|
|
||
| return panel | ||
| } | ||
| private fun updatePlugins() { | ||
| val pluginUpdateManager = PluginUpdateManager() | ||
| runInEdt { | ||
| ProgressManager.getInstance().run(object : Task.Backgroundable( | ||
| null, | ||
| AwsCoreBundle.message("aws.settings.auto_update.progress.message") | ||
| ) { | ||
| override fun run(indicator: ProgressIndicator) { | ||
| pluginUpdateManager.checkForUpdates(indicator, AwsPlugin.CORE) | ||
| pluginUpdateManager.checkForUpdates(indicator, AwsPlugin.TOOLKIT) | ||
| pluginUpdateManager.checkForUpdates(indicator, AwsPlugin.Q) | ||
| } | ||
| }) | ||
| } | ||
| } | ||
| } | ||
|
|
||
| data class NotificationActionList( | ||
| val title: String, | ||
| val blockToExecute: () -> Unit, | ||
| ) | ||
|
|
||
| data class BannerContent( | ||
| val title: String, | ||
| val message: String, | ||
| val actions: List<NotificationActionList>, | ||
| val id: String, | ||
| ) |
6 changes: 6 additions & 0 deletions
6
...unity/src/software/aws/toolkits/jetbrains/core/notifications/DisplayToastNotifications.kt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| // Copyright 2024 Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
| // SPDX-License-Identifier: Apache-2.0 | ||
|
|
||
| package software.aws.toolkits.jetbrains.core.notifications | ||
|
|
||
| object DisplayToastNotifications | ||
Check warningCode scanning / QDJVMC Unused symbol Warning
Object "DisplayToastNotifications" is never used
|
||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Check warning
Code scanning / QDJVMC
Unused symbol Warning