-
Notifications
You must be signed in to change notification settings - Fork 274
Condition Matcher for displaying notifications #5093
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
Condition Matcher for displaying notifications #5093
Conversation
Qodana Community for JVM4 new problems were found
💡 Qodana analysis was run in the pull request mode: only the changed files were checked Contact Qodana teamContact us at [email protected]
|
...ommunity/src/software/aws/toolkits/jetbrains/core/notifications/DisplayToastNotifications.kt
Fixed
Show fixed
Hide fixed
...ommunity/src/software/aws/toolkits/jetbrains/core/notifications/DisplayToastNotifications.kt
Fixed
Show fixed
Hide fixed
| return shouldShow | ||
| } | ||
|
|
||
| fun matchesAllRules(notificationConditions: NotificationDisplayCondition, project: Project): Boolean { |
Check notice
Code scanning / QDJVMC
Class member can have 'private' visibility Note
...re/jetbrains-community/src/software/aws/toolkits/jetbrains/core/notifications/RulesEngine.kt
Fixed
Show fixed
Hide fixed
…ons' into manodnyb/checkRulesForNotifications
...-community/src/software/aws/toolkits/jetbrains/core/notifications/NotificationFormatUtils.kt
Outdated
Show resolved
Hide resolved
...-community/src/software/aws/toolkits/jetbrains/core/notifications/NotificationFormatUtils.kt
Outdated
Show resolved
Hide resolved
| is NotificationExpression.NotCondition -> performNotOp(notificationExpression, value) | ||
| is NotificationExpression.OrCondition -> performOrOp(notificationExpression, value) | ||
| is NotificationExpression.AndCondition -> performAndOp(notificationExpression, value) | ||
| is NotificationExpression.ComparisonCondition -> notificationExpression.value == value | ||
| is NotificationExpression.NotEqualsCondition -> notificationExpression.value != value | ||
| is NotificationExpression.GreaterThanCondition -> value > notificationExpression.value | ||
| is NotificationExpression.LessThanCondition -> value < notificationExpression.value | ||
| is NotificationExpression.GreaterThanOrEqualsCondition -> value >= notificationExpression.value | ||
| is NotificationExpression.LessThanOrEqualsCondition -> value <= notificationExpression.value | ||
| is NotificationExpression.AnyOfCondition -> notificationExpression.value.contains(value) | ||
| is NotificationExpression.NoneOfCondition -> !notificationExpression.value.contains(value) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it would be cleaner to just have an evaluate() method on the expression class
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I actually wanted to keep the operations separate from deserialization!
...munity/tst/software/aws/toolkits/jetbrains/core/notifications/NotificationFormatUtilsTest.kt
Outdated
Show resolved
Hide resolved
...munity/tst/software/aws/toolkits/jetbrains/core/notifications/NotificationFormatUtilsTest.kt
Outdated
Show resolved
Hide resolved
…/checkRulesForNotifications
|
|
||
| package software.aws.toolkits.jetbrains.core.notifications | ||
|
|
||
| fun checkSeverity(notificationSeverity: String): NotificationSeverity = when (notificationSeverity) { |
Check warning
Code scanning / QDJVMC
Unused symbol Warning
...ommunity/src/software/aws/toolkits/jetbrains/core/notifications/DisplayToastNotifications.kt
Fixed
Show fixed
Hide fixed
...ommunity/src/software/aws/toolkits/jetbrains/core/notifications/DisplayToastNotifications.kt
Fixed
Show fixed
Hide fixed
...ommunity/src/software/aws/toolkits/jetbrains/core/notifications/DisplayToastNotifications.kt
Fixed
Show fixed
Hide fixed
| // TODO: calls the Rule engine and notifies listeners | ||
| fun processNotification(project: Project, notificationData: NotificationData) { | ||
| val shouldShow = RulesEngine.displayNotification(project, notificationData) | ||
| if(shouldShow) { |
Check warning
Code scanning / QDJVMC
Control flow with empty body Warning
|
please make sure all cases are exercised by test |
* Add framework for processing notifications (#5112) * Add deserialization for notification messages retrieved from the notification file and criteria on whether it should be displayed (#5093) * Display toast notifications with actions * Condition matcher for displaying notifications * Modified deserialization cases and added tests * not required file change * feedback 1 * modified the base class * modified test instance lifecycle * Show toasts for notifications and notification banner on critical notifications(#5097) * Display toast notifications with actions * Condition matcher for displaying notifications * Show notification banner * feedback 1 * Modified deserialization cases and added tests * not required file change * feedback 1 * feedback 1 * modified the base class * merge conflicts resolved * rearranged call site * show notifications when panel is opened * fixed tests * detekt * feedback * convert panels into wrappers * fixed test * Adding update/restart action to notifications (#5136) * Poll for new notifications (#5119) * initial commit * run on startup * detekt * move vals * remote resource implementation * comments * detekt * Validate file before saving * cache path * observer implementation * deserialize notifs from file * detekt * remove unused interface * internal class * Fix observer * etag singleton state component * add telemetry * atomicBoolean * initialize once per IDE startup * code scan * Omit (Unit) * specify etag storage location * detekt * fix detekt issues * basic tests * no star imports * coroutine scope delay instead of thread.sleep * feedback fixes * test fix * Application Exists for tests * endpoint object * detekt * detekt fixes * boolean flag * boolean flag * update tests * move startup flag handling to processBase * fix delay * fix delay * Notification dismissal state tracking (#5129) * split notifications into separated lists. * add persistent notification dismissal state logic * boolean changes * group persistant states * comments * Service initialized automatically * isStartup global * Deserialized notification schedule type * tests * persistent state syntax * convert to light services * Remove state from companion object * detekt * endpoint as registryKey * detekt * fix startup issues * Expiry issues * Add logging info to IDE notification polling and processing (#5138) * add logs for polling and processing notifs * redundant * finish log * fix isFirstPoll not setting to false on first pass --------- Co-authored-by: aws-toolkit-automation <[email protected]> Co-authored-by: manodnyab <[email protected]> Co-authored-by: Bryce Ito <[email protected]>
* Add framework for processing notifications (#5112) * Add deserialization for notification messages retrieved from the notification file and criteria on whether it should be displayed (#5093) * Display toast notifications with actions * Condition matcher for displaying notifications * Modified deserialization cases and added tests * not required file change * feedback 1 * modified the base class * modified test instance lifecycle * Show toasts for notifications and notification banner on critical notifications(#5097) * Display toast notifications with actions * Condition matcher for displaying notifications * Show notification banner * feedback 1 * Modified deserialization cases and added tests * not required file change * feedback 1 * feedback 1 * modified the base class * merge conflicts resolved * rearranged call site * show notifications when panel is opened * fixed tests * detekt * feedback * convert panels into wrappers * fixed test * Adding update/restart action to notifications (#5136) * Poll for new notifications (#5119) * initial commit * run on startup * detekt * move vals * remote resource implementation * comments * detekt * Validate file before saving * cache path * observer implementation * deserialize notifs from file * detekt * remove unused interface * internal class * Fix observer * etag singleton state component * add telemetry * atomicBoolean * initialize once per IDE startup * code scan * Omit (Unit) * specify etag storage location * detekt * fix detekt issues * basic tests * no star imports * coroutine scope delay instead of thread.sleep * feedback fixes * test fix * Application Exists for tests * endpoint object * detekt * detekt fixes * boolean flag * boolean flag * update tests * move startup flag handling to processBase * fix delay * fix delay * Notification dismissal state tracking (#5129) * split notifications into separated lists. * add persistent notification dismissal state logic * boolean changes * group persistant states * comments * Service initialized automatically * isStartup global * Deserialized notification schedule type * tests * persistent state syntax * convert to light services * Remove state from companion object * detekt * endpoint as registryKey * detekt * fix startup issues * Expiry issues * Add logging info to IDE notification polling and processing (#5138) * add logs for polling and processing notifs * redundant * finish log * show message instead of yesNoDialogue * initialize ProcessNotificationsBase listener before Polling service * fix isFirstPoll not setting to false on first pass --------- Co-authored-by: aws-toolkit-automation <[email protected]> Co-authored-by: manodnyab <[email protected]> Co-authored-by: Bryce Ito <[email protected]>
* Add framework for processing notifications (aws#5112) * Add deserialization for notification messages retrieved from the notification file and criteria on whether it should be displayed (aws#5093) * Display toast notifications with actions * Condition matcher for displaying notifications * Modified deserialization cases and added tests * not required file change * feedback 1 * modified the base class * modified test instance lifecycle * Show toasts for notifications and notification banner on critical notifications(aws#5097) * Display toast notifications with actions * Condition matcher for displaying notifications * Show notification banner * feedback 1 * Modified deserialization cases and added tests * not required file change * feedback 1 * feedback 1 * modified the base class * merge conflicts resolved * rearranged call site * show notifications when panel is opened * fixed tests * detekt * feedback * convert panels into wrappers * fixed test * Adding update/restart action to notifications (aws#5136) * Poll for new notifications (aws#5119) * initial commit * run on startup * detekt * move vals * remote resource implementation * comments * detekt * Validate file before saving * cache path * observer implementation * deserialize notifs from file * detekt * remove unused interface * internal class * Fix observer * etag singleton state component * add telemetry * atomicBoolean * initialize once per IDE startup * code scan * Omit (Unit) * specify etag storage location * detekt * fix detekt issues * basic tests * no star imports * coroutine scope delay instead of thread.sleep * feedback fixes * test fix * Application Exists for tests * endpoint object * detekt * detekt fixes * boolean flag * boolean flag * update tests * move startup flag handling to processBase * fix delay * fix delay * Notification dismissal state tracking (aws#5129) * split notifications into separated lists. * add persistent notification dismissal state logic * boolean changes * group persistant states * comments * Service initialized automatically * isStartup global * Deserialized notification schedule type * tests * persistent state syntax * convert to light services * Remove state from companion object * detekt * endpoint as registryKey * detekt * fix startup issues * Expiry issues * Add logging info to IDE notification polling and processing (aws#5138) * add logs for polling and processing notifs * redundant * finish log * fix isFirstPoll not setting to false on first pass --------- Co-authored-by: aws-toolkit-automation <[email protected]> Co-authored-by: manodnyab <[email protected]> Co-authored-by: Bryce Ito <[email protected]>
* Add framework for processing notifications (aws#5112) * Add deserialization for notification messages retrieved from the notification file and criteria on whether it should be displayed (aws#5093) * Display toast notifications with actions * Condition matcher for displaying notifications * Modified deserialization cases and added tests * not required file change * feedback 1 * modified the base class * modified test instance lifecycle * Show toasts for notifications and notification banner on critical notifications(aws#5097) * Display toast notifications with actions * Condition matcher for displaying notifications * Show notification banner * feedback 1 * Modified deserialization cases and added tests * not required file change * feedback 1 * feedback 1 * modified the base class * merge conflicts resolved * rearranged call site * show notifications when panel is opened * fixed tests * detekt * feedback * convert panels into wrappers * fixed test * Adding update/restart action to notifications (aws#5136) * Poll for new notifications (aws#5119) * initial commit * run on startup * detekt * move vals * remote resource implementation * comments * detekt * Validate file before saving * cache path * observer implementation * deserialize notifs from file * detekt * remove unused interface * internal class * Fix observer * etag singleton state component * add telemetry * atomicBoolean * initialize once per IDE startup * code scan * Omit (Unit) * specify etag storage location * detekt * fix detekt issues * basic tests * no star imports * coroutine scope delay instead of thread.sleep * feedback fixes * test fix * Application Exists for tests * endpoint object * detekt * detekt fixes * boolean flag * boolean flag * update tests * move startup flag handling to processBase * fix delay * fix delay * Notification dismissal state tracking (aws#5129) * split notifications into separated lists. * add persistent notification dismissal state logic * boolean changes * group persistant states * comments * Service initialized automatically * isStartup global * Deserialized notification schedule type * tests * persistent state syntax * convert to light services * Remove state from companion object * detekt * endpoint as registryKey * detekt * fix startup issues * Expiry issues * Add logging info to IDE notification polling and processing (aws#5138) * add logs for polling and processing notifs * redundant * finish log * show message instead of yesNoDialogue * initialize ProcessNotificationsBase listener before Polling service * fix isFirstPoll not setting to false on first pass --------- Co-authored-by: aws-toolkit-automation <[email protected]> Co-authored-by: manodnyab <[email protected]> Co-authored-by: Bryce Ito <[email protected]>
Description
License
I confirm that my contribution is made under the terms of the Apache 2.0 license.