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 Alert Definitions (MiqAlert) REST API support #13967

Merged
merged 1 commit into from
Mar 6, 2017

Conversation

dkorn
Copy link
Contributor

@dkorn dkorn commented Feb 17, 2017

Adding CRUD actions support to alert definitions API endpoint.

@dkorn
Copy link
Contributor Author

dkorn commented Feb 17, 2017

@miq-bot add_label enhancement, api, control

@dkorn
Copy link
Contributor Author

dkorn commented Feb 17, 2017

@moolitayer @zeari @simon3z please review

:identifier: alert_definition
:options:
- :collection
:verbs: *gpd
Copy link
Contributor

Choose a reason for hiding this comment

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

@dkorn where is delete?

Copy link
Contributor Author

@dkorn dkorn Feb 20, 2017

Choose a reason for hiding this comment

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

@dkorn
Copy link
Contributor Author

dkorn commented Feb 20, 2017

@abellotti please review

:feature_type: admin
:hidden: true
:identifier: alert_definition_delete

Copy link
Member

Choose a reason for hiding this comment

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

/cc @h-kataria for new miq_product_features

Copy link
Member

Choose a reason for hiding this comment

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

ping @h-kataria

Copy link
Contributor

Choose a reason for hiding this comment

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

@abellotti changes to product features look good.

expect(alert_definition).to be_truthy
expect(response.parsed_body["results"].first["description"]).to eq(alert_definition["description"])
expect(response.parsed_body["results"].first["db"]).to eq(alert_definition["db"])
expect(response.parsed_body["results"].first["expression"]).to eq(alert_definition["expression"])
Copy link
Member

Choose a reason for hiding this comment

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

too many expects, would prefer expect(response.parsed_body).to include(...)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done, thanks

:identifier: alert_definitions_show_list
:post:
- :name: create
:identifier: alert_definition_new
Copy link
Member

Choose a reason for hiding this comment

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

should support delete action on collection too (i.e. bulk deletes) and add test.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done, thanks

- :name: edit
:identifier: alert_definition_edit
- :name: delete
:identifier: alert_definition_delete
Copy link
Member

Choose a reason for hiding this comment

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

also add support for http DELETE on resource and add test.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done, thanks

module Api
class AlertDefinitionsController < BaseController
end
end
Copy link
Member

Choose a reason for hiding this comment

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

we need support code here, minimally for create. I got a 500 internal server error creating an alert definition with bogus attributes.

Need to test for minimally description, also validation of expression attribute so bogus ones aren't created. see arbitration_rules_controller.rb or conditions_controller.rb.

create will need to be rescued returning a BadRequestError.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done, thanks

module Api
class AlertDefinitionsController < BaseController
end
end
Copy link
Member

Choose a reason for hiding this comment

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

also probably code for edit to parse/build MiqExpression.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done, thanks

@abellotti
Copy link
Member

/cc @imtayadeway for another pair or 👀 Thanks.

@dkorn
Copy link
Contributor Author

dkorn commented Feb 28, 2017

@abellotti I'm almost certain I addressed all your comments, let me know if I need to change/add something

config/api.yml Outdated
- :name: delete
:identifier: alert_definition_delete
- :name: delete
:identifier: alert_definition_delete
Copy link
Member

Choose a reason for hiding this comment

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

double definition of delete

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixed, thanks

:feature_type: admin
:hidden: true
:identifier: alert_definition_delete

Copy link
Member

Choose a reason for hiding this comment

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

ping @h-kataria

Adding CRUD actions support to alert definitions API endpoint
@miq-bot
Copy link
Member

miq-bot commented Mar 2, 2017

Checked commit dkorn@ca15956 with ruby 2.2.6, rubocop 0.47.1, and haml-lint 0.20.0
2 files checked, 0 offenses detected
Everything looks good. 👍

Copy link
Member

@abellotti abellotti left a comment

Choose a reason for hiding this comment

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

Thanks @dkorn for the updates.

we need @h-kataria to review product features and give a 👍 before I can merge. Thanks.

@abellotti abellotti requested a review from h-kataria March 2, 2017 16:11
@Loicavenel
Copy link

@h-kataria quick review will help us here.. thanks

@abellotti
Copy link
Member

Thanks @h-kataria for lending your 👀 and reviewing.

@abellotti abellotti added this to the Sprint 56 Ending Mar 13, 2017 milestone Mar 6, 2017
@abellotti
Copy link
Member

abellotti commented Mar 6, 2017

@dkorn PR Looks good. Thanks for the enhancement !! Merging.

/cc @Loicavenel

@abellotti abellotti merged commit 649fe14 into ManageIQ:master Mar 6, 2017
@dkorn dkorn deleted the alerts_api branch March 7, 2017 09:17
:post:
- :name: create
:identifier: alert_definition_new
- :name: delete
Copy link
Member

Choose a reason for hiding this comment

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

@dkorn looks like we're missing bulk edits, i.e. POST action "edit" on the collection. When you get a chance, can you create an enhancement PR for that and add the appropriate test ? Thanks.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@abellotti PR submitted #14397

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