-
Notifications
You must be signed in to change notification settings - Fork 3.5k
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
Templated notifications #4291
Templated notifications #4291
Conversation
Build failed.
|
9fcb5bc
to
cc834b8
Compare
This comment has been minimized.
This comment has been minimized.
awx/ui/client/lib/components/syntax-highlight/syntax-highlight.directive.js
Show resolved
Hide resolved
awx/ui/client/lib/components/syntax-highlight/syntax-highlight.directive.js
Show resolved
Hide resolved
awx/ui/client/lib/components/syntax-highlight/syntax-highlight.directive.js
Show resolved
Hide resolved
awx/ui/client/lib/components/syntax-highlight/syntax-highlight.partial.html
Show resolved
Hide resolved
@@ -35,6 +38,16 @@ export default ['Rest', 'Wait', | |||
} | |||
}); | |||
|
|||
Rest.setUrl(GetBasePath('notification_templates')); |
This comment was marked as resolved.
This comment was marked as resolved.
Sorry, something went wrong.
This comment was marked as resolved.
This comment was marked as resolved.
Sorry, something went wrong.
This comment was marked as resolved.
This comment was marked as resolved.
Sorry, something went wrong.
This comment was marked as resolved.
This comment was marked as resolved.
Sorry, something went wrong.
This comment was marked as resolved.
This comment was marked as resolved.
Sorry, something went wrong.
This comment was marked as resolved.
This comment was marked as resolved.
Sorry, something went wrong.
This comment was marked as resolved.
This comment was marked as resolved.
Sorry, something went wrong.
This comment was marked as resolved.
This comment was marked as resolved.
Sorry, something went wrong.
@keithjgrant this is probably unrelated to your changes and is pretty low priority but it looks like an error gets thrown if the user changes the notif type back to the empty state: I'm pretty sure this error is benign and the user isn't impacted. If this isn't a regression I'd be 👌 with creating a new low priority issue unrelated to this PR. |
After having read through the code I think I understand why we're showing <DEFAULT_MESSAGE> to read-only users when no changes to the structure of a particular message has changed: The UI doesn't have access to those default message templates because they're provided in the |
Last thing I'm curious about: Do we actually need this checkbox? As far as I can tell it really just acts like a show/hide for those codemirrors. If the user changes the notif type then the fields in that section change. I'm sure you all probably talked about this but I'm just wondering if we need that extra click. |
We're looking into adding the defaults onto the
I did this in an effort to reduce the visual noise of the form, basically hiding "advanced" options until the user needs them. These fields add a lot of length to the form, especially for e-mail notifications which also have longer body field for each notification type (started/succeeded/failed). |
Just now catching up on all the threads here. @mabashian, I mentioned this in response to one of the code comments, and @keithjgrant basically already said this, but wanted to echo that I'm working on getting the defaults |
@keithjgrant (cc @mabashian) - I pushed a commit that surfaces the By default, we explicitly filter out While this works, I'm not sure if it's the best approach. Changing our framework feels like a pretty heavy hammer, although since we explicitly drop |
awx/api/serializers.py
Outdated
@@ -4167,6 +4167,9 @@ class NotificationTemplateSerializer(BaseSerializer): | |||
class Meta: | |||
model = NotificationTemplate | |||
fields = ('*', 'organization', 'notification_type', 'notification_configuration', 'messages') | |||
# preserve metadata for `messages` so default value can be shown for users with read-only access | |||
preserve_metadata = {'messages': 'default'} |
This comment was marked as resolved.
This comment was marked as resolved.
Sorry, something went wrong.
This comment was marked as resolved.
This comment was marked as resolved.
Sorry, something went wrong.
@keithjgrant @mabashian - the API team seems to think that what I have for exposing the |
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 seems like a reasonable approach to me.
awx/api/metadata.py
Outdated
preserve_metadata = serializer.Meta.preserve_metadata | ||
if field in preserve_metadata: | ||
if type(preserve_metadata[field]) is str: | ||
preserve_metadata[field] = {preserve_metadata[field]} |
This comment was marked as resolved.
This comment was marked as resolved.
Sorry, something went wrong.
This comment was marked as resolved.
This comment was marked as resolved.
Sorry, something went wrong.
@jladdjr re: default messages in GET 👍 thanks for that! |
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.
UI changes lgtm. Ping @unlikelyzero I think this will be ready for your eyes soon.
awx/main/models/notifications.py
Outdated
|
||
from awx.api.serializers import UnifiedJobSerializer # Need to import here (To avoid circular import?) | ||
job_serialization = UnifiedJobSerializer(self).to_representation(self) # TODO: Filter job serialization to only include whitelisted fields | ||
context = dict(job=job_serialization, |
This comment was marked as resolved.
This comment was marked as resolved.
Sorry, something went wrong.
This comment was marked as resolved.
This comment was marked as resolved.
Sorry, something went wrong.
e7824a6
to
a5182f0
Compare
d750353
to
0a83a02
Compare
d74ea97
to
13de642
Compare
This comment has been minimized.
This comment has been minimized.
13de642
to
901d41e
Compare
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
@unlikelyzero @one-t - I believe everything has been addressed for notification templates. Can either of you think of anything else that needs to be addressed before we plan a merge mtg? |
9a2a12a
to
901d41e
Compare
This comment has been minimized.
This comment has been minimized.
Build succeeded (gate pipeline).
|
See #79 (see notes on templated notifications)
ISSUE TYPE
COMPONENT NAME
ADDITIONAL INFORMATION
Currently a work in progress PR, but think this will be wrapped up soon.
Home stretch: