Skip to content
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

Model for Async notification #10623

Merged
merged 5 commits into from
Aug 23, 2016

Conversation

isimluk
Copy link
Member

@isimluk isimluk commented Aug 19, 2016

Purpose

The asynchronous notification will notify user about started/running/finished tasks in the backend of ManageIQ. The POC for UI was in #6809.

Sample of the requirements was:

  • be able to limit audience of notification to user/(possibly group?)/tenant/global
  • track seen/unseen flag per each user
  • allow for custom messages from automate
  • expire messages from view (different type may age differently)
  • should support message levels info/warning/error/success
  • allow hyperlinks in messages to the concerned objects
  • internationalization

Entity Relationship Diagram

notification_erd

Note: This pr does not bring NotificationSubscription as this will be delivered in later stages.

@miq-bot add_label core, darga/no, sql migration, events, enhancement
@miq-bot assign @skateman

@miq-bot
Copy link
Member

miq-bot commented Aug 19, 2016

@isimluk Cannot apply the following label because they are not recognized: sql_migration

@miq-bot
Copy link
Member

miq-bot commented Aug 19, 2016

@isimluk unrecognized command 'assig', ignoring...

Accepted commands are: add_label, remove_label, rm_label, assign, set_milestone

@isimluk
Copy link
Member Author

isimluk commented Aug 19, 2016

@miq-bot assign @skateman

@isimluk isimluk force-pushed the async-notification-model branch from f24608c to 646bed3 Compare August 19, 2016 11:36
@chessbyte
Copy link
Member

/cc @gtanzillo

has_many :notification_recipients, :dependent => :delete_all
has_many :recipients, :class_name => User, :through => :notification_recipients

def self.emit(type, opts = {})
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This can be moved into initialize with callbacks.

Each notification emitted by ManageIQ will have a type. That will make
us more flexible, as we will have useful metadata for each notification.

The application will emit many notification, it is expected that some
users will want to customize what they receive. The notification type
enables also that.

Since we have the type in the database, we can later enable users to
create their own notification types for their automate.
A notification has 3 optional attributes.
 - subject is something the notification is concerned with it can be a
   vm, provider, etc.
 - cause is something that initiated the operation, it can be a task,
   request, service order, etc.
 - initiator is user who initiated the process in question
M-to-N mapping between notification and users that can tell whether a
particular user has already seen the notification that s/he received.
We will add much more notification types as we will need them.
Whenever you want to emit a new notification, you will write something
like

  Notification.create!(:type => :vm_powered_off, :subject => vm)

Various callers may or may not know the subject/cause/initiator
attributes. That's why we make them optional.
@isimluk isimluk force-pushed the async-notification-model branch from 646bed3 to b8119e9 Compare August 23, 2016 08:19
@isimluk
Copy link
Member Author

isimluk commented Aug 23, 2016

Improved based on feedback. Thanks @skateman.

@miq-bot
Copy link
Member

miq-bot commented Aug 23, 2016

Checked commits isimluk/manageiq@9e99b6e~...b8119e9 with ruby 2.2.5, rubocop 0.37.2, and haml-lint 0.16.1
10 files checked, 0 offenses detected
Everything looks good. 🏆

@skateman
Copy link
Member

skateman commented Aug 23, 2016

LGTM!!!
giphy

@gtanzillo
Copy link
Member

👍 Looks great!

@gtanzillo gtanzillo added this to the Sprint 46 Ending Sep 12, 2016 milestone Aug 23, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants