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 alerts drop down to provider view #1918

Merged
merged 7 commits into from
Sep 6, 2017

Conversation

nimrodshn
Copy link
Contributor

Adding alert drop down to container provider view.
GIF:
screencast_08-15-2017_04-08-37 pm

Screenshot of the produced endpoint:
screenshot from 2017-08-15 14-00-18

CC: @moolitayer @himdel
@simon3z

@nimrodshn
Copy link
Contributor Author

nimrodshn commented Aug 15, 2017

@moolitayer This PR is depending on #1501 where we change retrieve_metrics_selection at container_controller, currently to retrieve the metrics we check @ems.endpoints.count == 1 ? 'hawkular_disabled' : 'hawkular_enabled' this of course will be false in the case of added prometheus_alerts which will in turn make hawkular tab enabled.

@nimrodshn nimrodshn changed the title add alerts drop down to provider view [WIP] Add alerts drop down to provider view Aug 15, 2017
@miq-bot miq-bot added the wip label Aug 15, 2017
@nimrodshn nimrodshn force-pushed the add_alert_drop_down branch 4 times, most recently from c2d3384 to 2a723c0 Compare August 21, 2017 09:46
@nimrodshn
Copy link
Contributor Author

nimrodshn commented Aug 21, 2017

@moolitayer PTAL (ignore code climate 'similar code' issues, according to @himdel it is set too high..)

@moolitayer
Copy link

@nimrodshn how are we doing validation for this endpoint? we should use the code we have in monitoring_manager.verify_credentials (we might need to expose it differently)

@nimrodshn
Copy link
Contributor Author

nimrodshn commented Aug 21, 2017

@moolitayer we do use monitoring_manager.verify_credentials.

You can look here: authentication_check (which is the method used when the client clicks on validate) calls authentication_check_no_validation which calls verify_credentials.

@moolitayer
Copy link

@nimrodshn it's not using monitoring_manager.verify_credentials. It's using container_manager_mixin.verify_credentials. A change is needed in the backend and i'm not really sure how to handle that, anyway I will handle that.

@nimrodshn
Copy link
Contributor Author

nimrodshn commented Aug 23, 2017

@moolitayer good catch! for some reason the trace in my IDE led me to believe we are using monitoring manager.. let me know if there is something I can do to help with that.

@ilackarms
Copy link
Contributor

alerts endpoint configuration isn't producing an Authentication

from rails c:

irb(main):014:0> ap ems.connection_configurations[:prometheus_alerts]
OpenStruct {
          :endpoint => #<Endpoint:0x0056215892a9a8> {
                           :id => 3,
                         :role => "prometheus_alerts",
                    :ipaddress => nil,
                     :hostname => "alerts-kube-system.10.35.48.200.nip.io",
                         :port => 443,
                :resource_type => "ExtManagementSystem",
                  :resource_id => 1,
                   :created_at => Sun, 27 Aug 2017 12:40:45 UTC +00:00,
                   :updated_at => Sun, 27 Aug 2017 14:07:54 UTC +00:00,
                   :verify_ssl => 0,
                          :url => nil,
            :security_protocol => "ssl-without-validation",
                  :api_version => nil,
                         :path => nil,
        :certificate_authority => nil
    },
    :authentication => nil
}
=> nil

@nimrodshn
Copy link
Contributor Author

@ilackarms good catch! @moolitayer could this be related to our previous discussion?

@moolitayer
Copy link

@nimrodshn This is something else.

Looks like you are creating the endpoint correct but missing the authentication.
You will need to add the new authentication, I think it starts here[1]
this is what you should have eventually[2]
Pay special attention to:

  • :role => "prometheus_alerts",
  • :authtype => "prometheus_alerts",

[1] https://github.com/nimrodshn/manageiq-ui-classic/blame/2a723c03de96e3d5c6e9365a27216bbf597463e2/app/controllers/mixins/ems_common_angular.rb#L529
[2] https://paste.fedoraproject.org/paste/L9J4KLFRFiYQygOtlchekw

@moolitayer
Copy link

@nimrodshn btw if you run the alerts collection you can make sure the new endpoint is configured correctly.

@moolitayer
Copy link

@nimrodshn can you remove the WIP please?
We have the Monitoring Manager in master for some time now.

@nimrodshn
Copy link
Contributor Author

@moolitayer just added authentication.
Screenshot:
screenshot from 2017-08-28 10-56-40

@nimrodshn nimrodshn changed the title [WIP] Add alerts drop down to provider view Add alerts drop down to provider view Aug 28, 2017
@miq-bot miq-bot removed the wip label Aug 28, 2017
@nimrodshn nimrodshn force-pushed the add_alert_drop_down branch 2 times, most recently from d263025 to fdc8e27 Compare August 29, 2017 05:44
@miq-bot
Copy link
Member

miq-bot commented Aug 30, 2017

This pull request is not mergeable. Please rebase and repush.

@yaacov yaacov force-pushed the add_alert_drop_down branch 2 times, most recently from fdc8e27 to 4a35d46 Compare August 31, 2017 10:50
@yaacov yaacov force-pushed the add_alert_drop_down branch 3 times, most recently from 59cfd30 to c09bedd Compare August 31, 2017 12:19
@yaacov yaacov force-pushed the add_alert_drop_down branch from f620892 to 5026e76 Compare September 6, 2017 12:06
@yaacov yaacov force-pushed the add_alert_drop_down branch from 5026e76 to 5196725 Compare September 6, 2017 12:09
@yaacov yaacov force-pushed the add_alert_drop_down branch from 5196725 to 3228bb5 Compare September 6, 2017 12:18
@moolitayer
Copy link

@dclarizio please review

@yaacov
Copy link
Member

yaacov commented Sep 6, 2017

@moolitayer @ilackarms can you report here that this is tested and working on your environments ?
I think that will help the UI guys reiew this.

@moolitayer
Copy link

Right, tested today and working as expected!

@dclarizio dclarizio self-assigned this Sep 6, 2017
@@ -247,10 +264,15 @@ ManageIQ.angular.app.controller('emsCommonFormController', ['$http', '$scope', '
($scope.emsCommonModel.default_hostname != '' && $scope.emsCommonModel.default_api_port) &&
($scope.emsCommonModel.default_password != '' && $scope.angularForm.default_password.$valid)) {
return true;
} else if(($scope.emsCommonModel.metrics_selection != "disabled" && $scope.emsCommonModel.ems_controller == "ems_container") &&
} else if(($scope.emsCommonModel.ems_controller == "ems_container") &&
Copy link
Contributor

Choose a reason for hiding this comment

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

Use === instead of ==

Also, a space is preferred after if per style guide

Copy link
Member

Choose a reason for hiding this comment

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

@AparnaKarve Thanks 👍 the if with no space, looked wrong ... but codeclimate didn't shout so I thought is was ok :-)

($scope.emsCommonModel.emstype) &&
($scope.emsCommonModel.metrics_hostname != '' && $scope.emsCommonModel.metrics_api_port) &&
($scope.emsCommonModel.default_password != '' && $scope.angularForm.default_password.$valid)) {
($scope.emsCommonModel.default_password != '' && $scope.angularForm.default_password.$valid) &&
Copy link
Contributor

Choose a reason for hiding this comment

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

Similarly !== instead of !=

Please apply this elsewhere too (to all your PR changes where this is applicable)

amqp: {},
metrics: {},
ssh_keypair: {},
prometheus_alerts: {}
Copy link
Contributor

Choose a reason for hiding this comment

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

trailing comma is missing

Copy link
Member

Choose a reason for hiding this comment

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

👍 Thanks ! how did this pass code climate ?

} else {
angular.element("#metrics_tab").show();
angular.element(tabSelector).show();
}
Copy link
Contributor

Choose a reason for hiding this comment

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

This code is OK for the first pass, since it has already been tested.
But I'm wondering if we should move this code in a directive later.

Copy link
Member

Choose a reason for hiding this comment

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

Yes 👍 , the whole ruby = select_tag(... in the .haml file, should be in angular so will not need this hack :-(

@yaacov yaacov force-pushed the add_alert_drop_down branch from 2872702 to 473c334 Compare September 6, 2017 18:09
@AparnaKarve
Copy link
Contributor

Based on what I saw in the uploaded video above, when the Alerts tab is added, it contains fields inside it that are Required.
If that is true, the Alerts tab should have an error indicator (red exclaimation mark) on it.

It is essential to have the error indicator on the tab to be consistent with the rest of our UI and also for better UX.

If you want to implement this in a follow-up PR, that would be perfectly OK.

@yaacov
Copy link
Member

yaacov commented Sep 6, 2017

If you want to implement this in a follow-up PR, that would be perfectly OK.

We do (*)

(*) Actually we are currently fixing the validation code in the backend :-( and we may need to retouch this UI if we find that we missed something that we didn't see because of a bug in the backend (like what happened in #2102 )

@yaacov
Copy link
Member

yaacov commented Sep 6, 2017

Based on what I saw in the uploaded video above

@ilackarms @moolitayer the screenshots here are obsolete, do you have current screenshots of what this PR looks now ?

cc @AparnaKarve

@@ -24,7 +24,7 @@
= _("Metrics")
= miq_tab_header('alerts', nil, 'ng-click' => "changeAuthTab('alerts')") do
%div{"ng-if" => "emsCommonModel.alerts_selection == 'prometheus'"}
%i{"error-on-tab" => "alerts", :style => "color:#cc0000"}
%i{"error-on-tab" => "prometheus_alerts", :style => "color:#cc0000"}
Copy link
Contributor

Choose a reason for hiding this comment

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

Nice! Easy enough! :)

Copy link
Member

Choose a reason for hiding this comment

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

:-)

@yaacov
Copy link
Member

yaacov commented Sep 6, 2017

@AparnaKarve 👍 Thanks, I think the tab missing "error" sign is fixed, see last commit.

A screen shot of none valid alerts tab:
screenshot-5b7fd941-f833-4da3-bedb-5e20f2fd793d-2017-09-06-21-31-45

@miq-bot
Copy link
Member

miq-bot commented Sep 6, 2017

Checked commits nimrodshn/manageiq-ui-classic@a67c6ed~...6da318b with ruby 2.2.6, rubocop 0.47.1, and haml-lint 0.20.0
3 files checked, 0 offenses detected
Everything looks fine. 🏆

Copy link
Contributor

@AparnaKarve AparnaKarve left a comment

Choose a reason for hiding this comment

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

@yaacov Thanks for the updated screenshot and all the other code updates.

@dclarizio LGTM and GTG

@dclarizio dclarizio merged commit 660dce0 into ManageIQ:master Sep 6, 2017
@dclarizio dclarizio added this to the Sprint 69 Ending Sep 18, 2017 milestone Sep 6, 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.

7 participants