-
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
Ofer/311468 filter event by storage system #8424
Ofer/311468 filter event by storage system #8424
Conversation
Hey @GilbertCherrie, the addition of the storage system field for the VMS and instances was not intentional, as this PR was related to physical storage. |
997e245
to
8da576e
Compare
@Oferlis You can create a variable in the physical storage controller file and set it to true, such as |
Hey @agrare @GilbertCherrie, |
I'd like a UI reviewer before I merge this, @jeffibm @GilbertCherrie @DavidResende0 |
@@ -31,6 +33,14 @@ ManageIQ.angular.app.controller('timelineOptionsController', ['miqService', 'url | |||
vm.reportModel.tl_categories = []; | |||
}; | |||
|
|||
vm.showFilterField = function() { | |||
let bool = false; | |||
if(vm.model === "PhysicalStorage" || vm.model === "ExtManagementSystem"){ |
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.
@Oferlis The vm.model === "ExtManagementSystem"
shouldn't be used because if you go into the monitoring page for a cloud provider it will have the value of "ExtManagementSystem"
for vm.model
and cause this field to be rendered there as shown in the screenshot.
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.
Just changed it to rely on the Autosde model so any other model will not be effected.
Changes will be pushed today.
app/helpers/application_helper.rb
Outdated
storages = PhysicalStorage.all.ids | ||
storages.map{|k| [PhysicalStorage.find_by(:id=>k).name, k]} |
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.
Hm there is a lot wrong with this...
- I don't think this should be in the base application_helper when it is storage_system specific
- It queries for physical storages one-at-a-time rather than in batches
- It is showing ALL physical storages regardless of tenant/group/RBAC
This needs a re-think IMO
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.
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.
If you want to return an array of [name, id]
the way to do that in the most efficient way possible is PhysicalStorage.pluck(:name, :id)
I still don't think we can return all physical storages here though, if you have two tenants wouldn't tenant A see all physical storages in tenant B and vice versa?
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.
Changed it to the pluck method you suggested, and it looks good.
For the other part, I can use the Autosde::PhysicalStorage, is this better? it will make sure only AutoSDE objects are returned
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 the other part, I can use the Autosde::PhysicalStorage, is this better? it will make sure only AutoSDE objects are returned
No it really doesn't because two tenants can both have AutoSDE providers. Need help from the UI team here because I'm not sure what is common here but you have to use something that has a user context like a selected provider or an RBAC filtered list of physical_storages
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.
Who can I contact in the UI team?
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 hope they are already reviewing this, but /cc @jeffibm @DavidResende0 @GilbertCherrie
def calculate_properties | ||
super | ||
self[:hidden] = true unless visible? | ||
end | ||
|
||
def visible? | ||
@record.supports?(:timeline) | ||
end |
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.
These are identical to the parent class, why override them?
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 file was a reminder from the first commit, it is deleted.
end | ||
|
||
def disabled? | ||
@error_message.present? |
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.
Will this ever be true? The parent class sets @error_message
in a conditional block then checks for .present?
but this never sets it so how could it ever be true?
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 file was a reminder from the first commit, it is deleted.
@@ -7,6 +7,7 @@ ManageIQ.angular.app.controller('timelineOptionsController', ['miqService', 'url | |||
tl_timerange: 'weeks', | |||
tl_timepivot: 'ending', | |||
tl_result: 'success', | |||
tl_storage_systems: [''], |
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.
Is the rest of this provider specific? I don't see anything else here about infra hosts or cloud vms...
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 is storage specific, is there a better solution in your eyes?
rec_cond, *rec_params = @tl_record.event_where_clause(@tl_options.evt_type) | ||
parameters = rec_params + [from_dt, to_dt] | ||
else | ||
rec_cond = tl_map_storage_systems(params[:tl_storage_systems]) |
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.
So it looks like if you aren't on a specific record, you want to show all events from all storage systems?
Would it make more sense to have @tl_record be the Autosde::StorageManager
and keep using the same @tl_record.event_where_clause
?
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 edited the function as you recommended, the function is related to the StorageManager and PhysicalStorage models now.
Changes will be pushed hopefully today.
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.
Just going to throw a NAK on this since I have a couple serious concerns
@@ -93,10 +93,11 @@ def tl_build_timeline_report_options | |||
from_dt = create_time_in_utc("#{from_date.strftime} 00:00:00", | |||
session[:user_tz]) | |||
|
|||
rec_cond, *rec_params = @tl_record.event_where_clause(@tl_options.evt_type) | |||
conditions = [rec_cond, "timestamp >= ?", "timestamp <= ?"] | |||
rec_cond, *rec_params = @tl_record.event_where_clause(@tl_options.evt_type, params[:tl_storage_systems]) |
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.
So the comment seems to have been lost in the changes, but this is still an issue. We can't be adding in provider specifics like storage_systems here in the general timeline options.
I think it is better to have @tl_record
be your EMS and you can return all the storages related to the ems (this also fixes your RBAC issue) and/or have @tl_record
be a specific storage system (also resolves the RBAC issue)
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 suggested change is the situation today (Master branch), where when using the EMS, all the physical storages are displayed, and when selecting specific storage only its events are presented.
The params are returned from the form the user filled, so not passing them will mean no filtering, which is the purpose of the PR.
As I see it, the change will have to add provider-specific code somewhere in the code (which I agree is not good), so the problem will be moved to another file or function. Is there a solution that you think might fit 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.
@jeffibm @GilbertCherrie @DavidResende0 is there a way for the Autosde provider to override the timeline UI page without modifying the core options?
Hi just got sent this PR, catching up on reading all the comments. Currently this page is due in for a conversion to React and is currently underway. With this conversion we can add schema to the AutoSDE provider a la https://github.com/ManageIQ/manageiq-providers-openstack/blob/master/app/models/manageiq/providers/openstack/storage_manager/cinder_manager/cloud_volume.rb#L135-L146 and have that include the 'Select Storage System' field when is appropriate. This will leave the rest of the fields intact for all other cases. |
@agrare I agree with @MelsHyrule here, it would probably be much easier to just handle this with a react conversion than figuring out how to make the form provider specific |
@GilbertCherrie @MelsHyrule 👍 sounds good to me thanks |
Checked commits Autosde/manageiq-ui-classic@a222e7d~...9954745 with ruby 2.6.10, rubocop 1.28.2, haml-lint 0.35.0, and yamllint app/views/layouts/_tl_options.html.haml
|
Hi, @GilbertCherrie @MelsHyrule, |
@Oferlis The conversion should be introduced sometime before Q4 so within the next month or so |
This pull request is not mergeable. Please rebase and repush. |
Hi @agrare @MelsHyrule, I am back at this PR as I noticed the transition to React. another approach will be to filter the JSON response in the miq_timeline.js file, but it will introduce provider-specific code in the UI files. Any thoughts? |
So poking around what I would do, is I would start testing to see how I would introduce the physical storage filter using react. In my original comment I pointed out params_for_attach so you could introduce the drop down with an API.options call. You'll need to rebase this branch onto latest since some of the files you've changed here no longer exist within the repo. We're already passing in the Once the drop down is actually set up and behaving as expected then I would look into including the physical storage option into the ruby file logic. It would likely go in Hopefully this answers your question. Let me know if you need any further help! |
I have opened another branch for the new changes, but the conversation is documented here Thank you for the reply, I have managed to get to the point where I need to handle the Ruby files, (tl_build_timeline_report_options or tl_gen_timeline_data functions). As @agrare commented in #8424 (comment) |
So the steps to take would be the following:
|
I managed to use the API link in the browser to test the response to the call:
As I understand, that data (from the API call) needs to be passed to the |
@MelsHyrule, I didn't tag you in the last comment, so you probably weren't notified. what you think? How should we proceed? |
@Oferlis Hey! Just got back from vacation so only just saw your messages. I'll be reaching out to the UI team to discuss what's the best way to proceed further with this. Will ping you once we have an answer. |
This pull request has been automatically closed because it has not been updated for at least 3 months. Feel free to reopen this pull request if these changes are still valid. Thank you for all your contributions! More information about the ManageIQ triage process can be found in the triage process documentation. |
Added a new selection field in the events monitoring page to filter by a physical storage system.
Before:
After:
The new field will show the connected physical storage systems and will filter by the selection.