-
Notifications
You must be signed in to change notification settings - Fork 356
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 Monitoring main navigation section, with Alert sections #507
Conversation
@@ -0,0 +1,38 @@ | |||
class AlertsListController < ApplicationController | |||
extend ActiveSupport::Concern | |||
include UiServiceMixin |
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.
@himdel This probably shouldn't be here, should I create a service for it?
4235661
to
92eedff
Compare
.then(function() { | ||
return _this.getAlertsData(limit, offset, filters, sortField, sortAscending); | ||
}); | ||
}; | ||
|
||
_this.updateHostIcons = function(response) { |
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.
I'd simplify this to just..
_this.updateHostIcons = function(response) {
return $http.get('/alerts_list/class_icons')
.then(function(response) {
_this.hostIcons = response.data;
return response;
});
};
@@ -1,5 +1,6 @@ | |||
class AlertsListController < ApplicationController | |||
extend ActiveSupport::Concern | |||
include UiServiceMixin |
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.
Not sure this is being used here?
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.
It is used for icons
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.
Aaah... missed that.. in that case, are you sure that's the right place?
Because .. that's not a list of all available icons (or classes), that's just a list of things that are shown in one of the topology views.
Any chance the UI can ask for a list of classes instead?
def class_icons | ||
res = {} | ||
icons.each do |k, _val| | ||
file_name = "100/#{k.to_s.underscore}.png" |
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 line would be better as k.decorate.listicon_image
(assuming k is the class) .. but you'd need to add this method to the relevant decorators... so up to you.
But if you leave this like this, can you mention the list of classes that you're expecting to pass through here please? (So that it's easier to fix after.)
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.
That would be nice and allow me to simplify code a bit, is decorate available for classes too or only instances? I can't seem to use it
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.
It is available now :) (You need current master for both manageiq and ui-classic)
Then to use it, all you have to do is add a static method to the relevant decorator...
So you'd go to MiqPolicyDecorator
for example, add something like def self.listicon_image; "100/miq_policy.png"; end
.. aaand then MiqPolicy.decorate.listicon_image
will work.
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.
(Don't worry too much about having the method there twice (once class once instance), we were talking about doing something like defaulting to the class method unless the instance method needs to exist because the icon depends on some state, but for now... shrug :).)
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.
uploaded a new version, still haven't convinced it to work tough...
I keep getting:
[----] F, [2017-02-28T20:19:32.671115 #5014:2f04e3c] FATAL -- : Error caught: [NoMethodError] undefined method `listicon_image' for #<Draper::CollectionDecorator:0x0000000b7d4280>
/home/mtayer/dev/manageiq-ui-classic/app/controllers/alerts_list_controller.rb:22:in `block in class_icons'
I'll try to rebase the client code as well tomorrow
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.
..for #<Draper::CollectionDecorator..
That's a dead giveaway that you have not updated ManageIQ ;)
@moolitayer nice work, completely agreed with the approach, just found a few details.. :) |
Thanks for the review @himdel! addressed comments. |
625f0fa
to
d981fd7
Compare
@himdel cool, working now, thanks. |
d981fd7
to
74e2a53
Compare
@miq-bot add_label "pending core", enhancement, euwe/no |
@moolitayer Cannot apply the following label because they are not recognized: "pending core" |
@moolitayer if this is supposed to replace #254 isn't the title of the PR misleading? |
@miq-bot assign moolitayer |
Updated the title |
@@ -0,0 +1,5 @@ | |||
class ContainerNodeDecorator < MiqDecorator | |||
def self.listicon_image | |||
ActionController::Base.helpers.image_path("100/container_node.png") |
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.
Please keep this in line with the rest.. listicon_image
never calls image_path
, only returns the string.
It's the caller's responsibility to call image_path
.
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.
sorry, fixed
@@ -16,6 +16,14 @@ def index | |||
redirect_to :action => 'show' | |||
end | |||
|
|||
def class_icons | |||
res = {} | |||
['ManageIQ::Providers::Kubernetes::ContainerManager::ContainerNode'].each do |klass| |
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.
Wait, is this really always just this one class?
Or are we expecting more to be added?
deferred.resolve(response); | ||
}); | ||
return deferred.promise; | ||
}; |
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.
... I guess you forgot to remove the original version? I'm seeing updateHostIcons
twice now.
return $http.get('/alerts_list/class_icons') | ||
.then(function(response) { | ||
_this.hostIcons = response.data; | ||
return response; |
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.
extra space ;) (one too many now)
} | ||
|
||
summaryItem.objectType = objectType.replace(/([a-z\d])([A-Z]+)/g, '$1_$2').replace(/[-\s]+/g, '_').toLowerCase(); | ||
summaryItem.objectTypeImg = path + 'vendor-' + summaryItem.objectType + suffix; |
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 path needs to come from the server as well I believe.
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.
Agreed, same problem :)
62f0583
to
ba9f755
Compare
@jeff-phillips-18 would it be possible for you to address the comments still outstanding from @himdel ? |
@moolitayer I have put up a PR to your branch with fixes for the outstanding issues. |
Thanks @jeff-phillips-18 ! I guess I could have done the same thing instead of creating this PR. Next time... |
@himdel Ready for another review! |
@moolitayer So.. how do I enable the feature? Adding |
@himdel use
(the name was discussed in ManageIQ/manageiq#14096) |
Tested in the UI, looks good 👍, except for the Will merge when fixed :) EDIT: aaand fixed :) ( |
9c87662
to
4e3dd03
Compare
Checked commits moolitayer/manageiq-ui-classic@dc62746~...4e3dd03 with ruby 2.2.6, rubocop 0.47.1, and haml-lint 0.20.0 |
@himdel Thank you very much for the fast responses and vigilant review! 🍺 |
🙇♂️ :) |
https://bugzilla.redhat.com/show_bug.cgi?id=1421173
Depends on [MERGED] ManageIQ/manageiq#14096 Adding the new setting
Closes #254