-
Notifications
You must be signed in to change notification settings - Fork 48
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
Updating Preview Message functionality while setting notifications in detector alerts #1241
Conversation
} from '../../../types'; | ||
import { getIsNotificationPluginInstalled } from '../../utils/helpers'; | ||
import Mustache from 'mustache'; |
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.
Can we use named imports here and other places too?
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.
Done
@@ -53,6 +58,8 @@ export const NotificationForm: React.FC<NotificationFormProps> = ({ | |||
const hasNotificationPlugin = getIsNotificationPluginInstalled(); | |||
const [shouldSendNotification, setShouldSendNotification] = useState(!!action?.destination_id); | |||
const selectedNotificationChannelOption: NotificationChannelOption[] = []; | |||
const onDisplayPreviewChange = (e) => setDisplayPreview(e.target.checked); |
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.
memoize this using useCallback
?
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.
Done
onChange={onDisplayPreviewChange} | ||
/> | ||
</EuiFlexItem> | ||
{displayPreview ? ( |
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.
Nit: We can also do `displayPreview && () instead of the ternary to keep it short
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.
Done
@@ -537,6 +559,9 @@ export default class AlertConditionPanel extends Component< | |||
|
|||
<NotificationForm | |||
action={alertCondition.actions[0]} | |||
context={{ | |||
ctx: context, | |||
}} |
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.
This doesn't seem to match the expected type TriggerContext
. It doesn't have ctx
as the expected field.
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.
Done
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.
Do we have a github issue for this?
no github issue. |
The backport to
To backport manually, run these commands in your terminal: # Navigate to the root of your repository
cd $(git rev-parse --show-toplevel)
# Fetch latest updates from GitHub
git fetch
# Create a new working tree
git worktree add ../.worktrees/security-analytics-dashboards-plugin/backport-2.x 2.x
# Navigate to the new working tree
pushd ../.worktrees/security-analytics-dashboards-plugin/backport-2.x
# Create a new branch
git switch --create backport-1241-to-2.x
# Cherry-pick the merged commit of this pull request and resolve the conflicts
git cherry-pick -x --mainline 1 a72fbc0e3d0c78fcaa152bb9eae8d4b8e83adcac
# Push it to GitHub
git push --set-upstream origin backport-1241-to-2.x
# Go back to the original working tree
popd
# Delete the working tree
git worktree remove ../.worktrees/security-analytics-dashboards-plugin/backport-2.x Then, create a pull request where the |
Description
This PR updates the message preview feature while setting notifications for detector triggers. The user can click on Preview message check box and view the notification content. The user can also update the message subject and body which will be updated in the notification content.
Current behaviour
Updated Preview
Issues Resolved
[List any issues this PR will resolve]
Check List
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.