-
Notifications
You must be signed in to change notification settings - Fork 898
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 CustomButton event emiter #17764
Conversation
@miq-bot add_label events, enhancement, automate |
@gmcculloug , @Fryguy can you please review and let me know if this would suit the needs of this RFE? Is |
@miq-bot assign @gmcculloug |
cc @skateman |
app/models/custom_button.rb
Outdated
:args => args, | ||
:automate_entry_point => resource_action.ae_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.
The CustomEvent
model and its parent EventStream
is a little bit unclear for me. In the UI we're using EventMixin#has_events?
for enabling/disabling timeline buttons for a given entity. This invokes an event_where_clause
on the entity that doesn't always operate with the target
. For example for providers, it's checking the ems_id
that this method doesn't even set. For VMs it's a little trickier, depending on the event type, it checks the vm_or_template_id
or the target
.
So this is a little confusing ... the ugly solution would be to edit all the event_where_clause
methods, but I really hope 🙏 🙏 there's a better solution for this.
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.
oh, probably @gmcculloug
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 events are not intended to be displayed on the timelime. That might be the good and bad news. I'll updated the associated doc but the idea is to have a link from the item summary page that will show a list-view of these events.
As far as the modeling I would recommend creating a new event model that is derived from EventStream
instead of using the CustomEvent
model. Maybe CustomButtonEvent < EventStream
As this will be shared between a number of different models it would make sense to do most of this work in a new mixin.
cc @lfu
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.
@dclarizio pinging you here as you asked me to do timelines 😉
@gmcculloug I seem to recall that this was mainly for debugging purposes and that we had considered just logging these custom button events. Can we just do that? (Not sure which log, but that's just a detail 😄 ) |
@gmcculloug can you please give me any resolution on this? How this RFE should be implemented?
Both ways are fine with me, I just need to know which path I should follow. |
5e4160e
to
9cea6c4
Compare
Unless it is decided otherwise, I've added the |
9cea6c4
to
63dcfc0
Compare
@gmcculloug If the purpose of this PR is to keep track of what custom buttons have been executed for a VM, maybe we can use These issues should be addressed If we continue with
|
@lfu, can you please explain me the first bullet point? I'm not sure what you're asking me to do. As the design document states this PR should cover the first step - catching the events. To the second bullet point: I'm aware of this need, however I've decided to wait until we have a green light on the |
app/models/custom_button.rb
Outdated
:message => 'Custom button launched', | ||
:source => source, | ||
:target_id => target.id, | ||
:target_type => target.type, |
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 above two lines can be just:
:target => target,
spec/models/custom_button_spec.rb
Outdated
:source => 'UI', | ||
:target_id => vm.id, | ||
:type => 'CustomButtonEvent', | ||
:event_type => 'custom_button_event', |
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.
event_type
is supposed to specify a uniq ID for the event instance. Now that we have a new class CustomButtonEvent
, the event_type
value seems redundant in this case.
We need to name event_type
better for each CustomButtonEvent
instance.
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.
@lfu do you have any suggestions what we can do with that? I can't find any valid and reasonable information which would suit here and is available at the button invocation.
spec/models/custom_button_spec.rb
Outdated
expect(CustomButtonEvent.count).to eq(1) | ||
expect(CustomButtonEvent.first).to have_attributes( | ||
:source => 'UI', | ||
:target_id => vm.id, |
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.
We can also test :target_type here.
@tumido The first bullet point is more of a comment regarding the design doc. Usually |
The purpose of this is to show a history of custom button actions for a resource. It was discussed and we do not want to build this off of the AuditEvent. Visually the Summary screen for the resource should have a link that takes you to a list-view showing the basic event properties for that resource. |
63dcfc0
to
87dfd93
Compare
7e1cada
to
06ad2d5
Compare
spec/models/custom_button_spec.rb
Outdated
:target_id => vm.id, | ||
:target_type => 'VmOrTemplate', | ||
:type => 'CustomButtonEvent', | ||
:event_type => 'custom_button_event', |
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.
event_type
has changed.
06ad2d5
to
ac9f797
Compare
@gmcculloug We've been discussing the We already have the event class named These are the option we have:
What do you think? |
@lfu I would not get caught up in the assumption that the design doc needs to be followed exactly. It was a first pass to get ideas written out for discussion and scoping. For example, automate changing the event_type is a potential future feature. It is not in scope for this initial implementations. I would agree that the redundant naming does not make a lot of sense and like the idea of using it to identify that the event is for a "on_launch" or "triggered" action. Maybe we following something like the OpenStack naming which has
|
|
ac9f797
to
b9cc5a6
Compare
Checked commit tumido@b9cc5a6 with ruby 2.3.3, rubocop 0.52.1, haml-lint 0.20.0, and yamllint 1.10.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.
@tumido This PR looks good. Are you planning to add an association between the resources and this new event class? Would that happen in a separate PR?
@gmcculloug, sorry I was not planning to do that. I'm actually not sure what's the complete list of resources to associate the events with. Since I'm on PTO next week, can you please delegate that to someone else? Thanks! |
Talk to @lfu. She is going to continue the backend work in another PR. 👍 |
When
CustomButton
is invoked, let's create aCustomEvent
logging the activity.Tracked data:
button.trigger.start
)Design: GDoc
RFE: BUGZILLA 1511126
Related: ManageIQ/manageiq-ui-classic#4363