-
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 #254
Conversation
a378b07
to
f8f29e9
Compare
@jeff-phillips-18 @serenamarie125 @moolitayer what's the status here? Is there something blocking it? (Still in WIP?) Do you need any information/reviews/etc? |
@simon3z This is waiting for ManageIQ/manageiq#13653 to be merged and I am finishing up the unit tests. |
@jeff-phillips-18 an nice! I didn't know you were trying to squeeze that in already (or maybe @moolitayer mentioned it but I didn't fully get we would have had the support in the first cycle). |
f8f29e9
to
e61f3fd
Compare
Unit tests are in Removing WIP @miq-bot remove_label wip |
@serenamarie125 @martinpovolny @dclarizio This PR is ready for review. |
@martinpovolny @himdel thinking this might need some eyes on it, can you please review? Thx, Dan |
bower.json
Outdated
@@ -42,6 +42,7 @@ | |||
"manageiq-ui-components": "~0.0.9", | |||
"moment-strftime": "~0.2.0", | |||
"moment-timezone": "~0.4.1", | |||
"moment-duration-format": "~1.3.0", |
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 now, you'll have to do the same change in manageiq/bower.json
, we're in the process of moving it to ui-classic .. but .. right now, manageiq/bower.json
is the one that ends up being used.
(But do keep it here too, will be easier to figure out if both are the same :)).
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.
Added PR ManageIQ/manageiq#13772
@@ -2125,7 +2125,8 @@ def set_global_session_data | |||
case controller_name | |||
|
|||
# These controllers don't use breadcrumbs, see above get method to store URL | |||
when "dashboard", "report", "support", "alert", "jobs", "ui_jobs", "miq_ae_tools", "miq_policy", "miq_action", "miq_capacity", "chargeback", "service" | |||
# when "dashboard", "report", "support", "alert", "alert_center", "jobs", "ui_jobs", |
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.
seems like this change doesn't belong here, does 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.
Rubocop complains of an empty 'when' block. I commented it out rather than removing it for clarity of what sections are being ignored.
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.
Oh I'd just ignore rubocop, but maybe it makes sense then.. :)
vm.loadingDone = false; | ||
|
||
function setupInitialValues() { | ||
angular.element(document.querySelector('#center_div')).addClass("miq-body"); |
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.
Could you update this to document.getElementById("center_div").className += " miq-body";
please? Or change the other two to this, I don't care as long as they're the same.
So.. I'll give it a more thorough test in the morning but overall this looks really good, css is scoped, One more thing in addition to the above.. @martinpovolny can probably tell you more but each rails controller should have a |
angular.module('alertsCenter') | ||
.controller('EditAlertDialogController',['$scope', 'vm', | ||
function($scope, vm) { | ||
$scope.vm = vm; |
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, use controllerAs
instad of $scope
for new code. Also, please, don't inject $scope
when not needed.
app/presenters/menu/default_menu.rb
Outdated
'monitor_alerts_most_recent', | ||
{:feature => 'monitor_alerts_most_recent', :any => true}, | ||
'/alerts_most_recent' | ||
) |
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 would not say that this way of aligning the menu items is more readable than the way most of the file is alligned.
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 did this to resolve rubocop issues with line lengths.
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 understand that.
We should probably disable the long line check for the menu definition and disable the alignment check for the toolbars.
Both seem much more readable when we don't follow the rules. And readability is the goal, not following Rubocop in all details.
There seems to be a way to disable a check using comments in the source code -- see https://github.com/bbatsov/rubocop/blob/master/manual/configuration.md and of the page.
What do you think?
@jeff-phillips-18, @himdel : please, see the above comment regarding rubocop rules exception. Shall I create a PR adding the exceptions for the menus and toolbars? |
@martinpovolny agreed with the exception (or with removing that rule altogether :)) |
2a1fc3f
to
4b756dc
Compare
I put back the original coding style and disabled line length checks for those two files. |
4b756dc
to
b8a10e7
Compare
This PR will provide viewing of alerts and the ability to assign/unassign, acknowledge/unacknowledge, or add comments to alerts.
prefix = 'os-'; | ||
} | ||
|
||
var typeImage = path + prefix + imageName + 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.
Nope nope nope, this will never work in production, sorry.
The full image path needs to come from the backend, and needs to pass through the image_path
helper, otherwise, you'll get an invalid URL in production mode.
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.
Yeah that's my fault...
@himdel do you have an example for an API returning images?
I could not find a proper way to implement it in ManageIQ
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.. you're right, the API is probably not the place to serve images from...
Frankly we're not quite prepared for that, so I'm afraid every solution will have to be a bit hacky..
But.. maybe something simple like... add a method to the (non-api) controller that just gives you the list of images you need, and query that on load?
Something like...
def whatever_images
render :json => {
:this_vendor => image_path('svg/vendor-foo.svg'),
:that_vendor => image_path('svg/vendor-bar.svg'),
...
}
end
WDYT?
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 page works purely on REST AFAIK, it took some time to get the API ready and would definitely need improvements down the road. On next iteration I plan to add
- URL for the show view of each entity (both alert targets and providers)
- URL for image of each entity (both alert targets and providers)
I think you had some idea when I asked before (using an api decorator), and I also asked @abellotti about it, but I'm still not sure exactly how to do it and need some time to research it.
What ever solution we find for this now I will come back to solving this through the API.
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.
The problem with API and icons is that we're actually going in the way of removing decorators from the API.
So I'm afraid the "give me the images" request can't go through the API.
I think at some point we may have to push the decorators to a JS library, but.. until we move to webpack, we can't have predictable image urls in production.
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.
As for using the decorators, definitely for it, if there is a nice way :) (going to add support for class decorators soon, if it helps)
%span.no-wrap{"tooltip" => "{{item.hostName}}", | ||
"tooltip-placement" => "bottom", | ||
"tooltip-popup-delay" => "1000"} | ||
%img.list-view-type-img{"ng-src" => "/assets/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.
Same problem here, this needs to be :src => image_path("100/container_node.png")
(or ng-src, either)
expect(alertsList.length).toBe(4); | ||
|
||
expect(alertsList[0].objectType).toBe("Hawkular"); | ||
expect(alertsList[0].objectTypeImg).toBe("/assets/svg/vendor-hawkular.svg"); |
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.
won't be, you may have more luck with something like .toMatch(/svg\/vendor-hawkular/)
} | ||
|
||
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.
Another place that needs the image path to come from the server.
Also, @jeff-phillips-18 is there any way to get some data here? Hard to test with 0 alerts :) |
@himdel my latest dump available at: It might have missing fields, let me know if it does |
Checked commits jeff-phillips-18/manageiq-ui-classic@4a4099c~...347b071 with ruby 2.2.6, rubocop 0.47.1, and haml-lint 0.20.0 |
Updated per @himdel comments. Please advise on how to handle the images. Is there a good way currently to get the image path? |
@jeff-phillips-18 So.. if I understand it right, you're getting the I think the backend consensus was that decorators and icons are something that should live in the UI, therefore we can't expect to get that info from the API. So.. there is really no other way than asking the UI for that info :). (Unless it can never be anything but one of a small number of classes that can never be expected to change in which case, you could just put them all in the view, and pick the right one when needed.) Now, the prefferred way to get the right images is decorators, but for now, these depend on having an instance to decorate (should be fixed in the next sprint though, hopefully). Another thing is that some decorators do give you a different icon based on some property of that instance, but I guess that's not the case here, right? Yet another thing, we're slowly moving towards fonticons over images, so ideally your code should support both. So.. you do need to add a method to the ruby non-api controller that gives you the right icon, and you do need to call it for every class you encounter - with the whole classname, no splits. With class decorators, that method could be as simple as def icon_for_class
klass = params[:type].constantize
render :json => {:image => ActionController::Base.helpers.image_path(klass.decorate.listicon_image),
:icon => klass.decorate.fonticon}
end (If you need it faster than we can get fonticon decorators, you'll probably need a custom case with every class and the right icon, and a FIXME comment :). Or alternatively, you can also send the EDIT: added EDIT2: an optimization where you |
There are two objects I need images for, the provider (which I get the type in the format above) and the host, which I currently only get ContainerNode (so we always use the container_node.png). I don't have the type until I get data back from the API, using the ruby controller has no idea what types I will be getting back. |
Sure, that's expected, but after you get that data back from the API, you can do the UI request to get the images. I mean something like... (pseudocode-ish) API.get('/api/alerts')
.then(function(resources) {
var klasses = _(resources).pluck('type').sort().uniq().values();
$http.post('/monitoring/icon_for_class', klasses)
.then(function(object) {
resources.forEach(function(res) {
res.image = object[res[type]];
});
})
}); |
Update: @simon3z will be drafting images for sandbox delivery to openshift-ops tomorrow morning. |
@himdel @jeff-phillips-18 is there anything blocking us here besides ManageIQ/manageiq#13772 ? |
@moolitayer AFAIK, just a solution for the images |
@jeff-phillips-18 @himdel I don't think we should introduce any other mechanism since AFAIK we all agree that is the best solution in the long range. cc @simon3z |
Well, I thought I've already provided a workable solution for the images, even though it'd have to be a big case until #237 gets in. And .. please note that there are currently no plans to add image support to the API. |
But sorry, we can't merge as is, because this will not work in production. |
@moolitayer would you have time to work on the image solution provided by @himdel ? I have been re-prioritized and am knee deep in other issues there. Not sure when I can get back to this. |
@himdel I guess it isn't that easy as I thought it is, thanks for helping resolve that |
@jeff-phillips-18 @himdel I've added an icon endpoint in #507. |
I had to rebase some commits here (mostly due to #204) in #507. So maybe now it would be better to merge that one instead (all @jeff-phillips-18 commits remain unchanged except for the rebase) |
Ok, added a |
This pull request is not mergeable. Please rebase and repush. |
Depends on: ManageIQ/manageiq#13772
This PR will provide viewing of alerts and the ability to assign, un-assign, acknowledge, un-acknowledge, and add comments to alerts.
Please see Jira stories for this contribution for UX designs:
https://patternfly.atlassian.net/browse/CFUX-117
https://patternfly.atlassian.net/browse/CFUX-118
https://patternfly.atlassian.net/browse/CFUX-121
https://patternfly.atlassian.net/browse/CFUX-153
https://patternfly.atlassian.net/browse/CFUX-164
This was ManageIQ/manageiq#11962 in the manageiq repo prior to the split. I did not move the PR due to significant changes due to API implementation changes.
UI Changes:
Todo:
Alert descriptions are not yet shown. This is being worked by ManageIQ/manageiq#13653
Add unit tests
@serenamarie125 @moolitayer @simon3z @martinpovolny @zgalor @abonas @dclarizio @cben
@miq-bot add_label wip, enhancement