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

Add severity to alert definitions #16040

Merged
merged 1 commit into from
Oct 5, 2017
Merged

Conversation

gtanzillo
Copy link
Member

@gtanzillo gtanzillo commented Sep 25, 2017

  • Add column to miq_alerts
  • Allow "info", "warning", "error" or nil for no severity
  • Assign severity when alert fires
  • Allow severity in incoming event to override serenity in alert definition

Migration in ManageIQ/manageiq-schema#77

https://www.pivotaltracker.com/story/show/151341252

@@ -0,0 +1,5 @@
class AddSeverityToMiqAlerts < ActiveRecord::Migration[5.0]
Copy link
Member

Choose a reason for hiding this comment

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

This needs to be added to manageiq-schema

Copy link
Member Author

Choose a reason for hiding this comment

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

Wow, thanks @bdunne. My first migration after the split. I'll open a PR there.

@@ -1,6 +1,13 @@
class MiqAlert < ApplicationRecord
include UuidMixin

AVAILABLE_SEVERITIES = {
Copy link
Member

Choose a reason for hiding this comment

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

What does the word AVAILABLE signify here and in the method below? Is it possible to havemore severities? Might be better to just remove the word entirely

nil => nil,
:info => "Information",
:warning => "Warning",
:error => "Error"
Copy link
Member

Choose a reason for hiding this comment

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

Is this a presentation string, or is this the value store in the database? If the former, I would expect the lookup to be the UI's domain, and if the latter, I would expect it to be downcased.

Copy link
Member Author

Choose a reason for hiding this comment

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

@Fryguy Yes, that was the intention. I worked that out with @dclarizio. Dan, can this be move over to the UI side?

@dclarizio
Copy link

Fryguy
Is this a presentation string, or is this the value store in the database? If the former, I would expect the lookup to be the UI's domain, and if the latter, I would expect it to be downcased.
gtanzillo
@Fryguy Yes, that was the intention. I worked that out with @dclarizio. Dan, can this be move over to the UI side?

@Fryguy Our intentions were that the UI would simply present the options and not have to worry if they changed or some were added at a later time. Once separated, we'll have to make sure the model has it's values and the UI has the presentation strings and keep the 2 in sync. That said, I have no problem separating this out.

@martinpovolny Can you help out with where we should move the presentation side of this? Do we have a decorator already perhaps that can do a dictionary lookup to get the friendly names for the drop down?

@martinpovolny
Copy link
Member

How will these SEVERITIES be represented in the API? As strings corresponding to the symbols %w(info warning error)?

Or as "nice" strings? "Information", "Warning", "Error"? Who will do i18n on these? I guess the UI, right?

I guess there's no other way than to have list of these on the UI side once we are purely javascript. And yes, it will need to be kept in sync with the backend.

- Add column to miq_alerts
- Allow "info", "warning", "error" or nil for no severity
- Assign severity when alert fires
- Allow severity in incoming event to override serenity in alert definition

https://www.pivotaltracker.com/story/show/151341252
@miq-bot
Copy link
Member

miq-bot commented Oct 3, 2017

Checked commit gtanzillo@80a6aa1 with ruby 2.2.6, rubocop 0.47.1, and haml-lint 0.20.0
3 files checked, 1 offense detected

app/models/miq_alert.rb

@Fryguy Fryguy closed this Oct 5, 2017
@Fryguy Fryguy reopened this Oct 5, 2017
@Fryguy Fryguy merged commit 60d57f3 into ManageIQ:master Oct 5, 2017
@Fryguy Fryguy added this to the Sprint 71 Ending Oct 16, 2017 milestone Oct 5, 2017
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.

6 participants