-
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
Expose provider disable for containers providers #1663
Conversation
cc @moolitayer @cben |
@zeari Does "pause/Resume" will make more sense ? Disable seems more definitive that what we are doing here.. |
:confirm => proc do | ||
if @record.enabled? | ||
N_("Warning: While this provider is disabled you will not collect ANY data from it. " \ | ||
"This may cause gaps in inventory, metrics and events!") |
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.
s/While this provider is disabled you will not collect ANY data from it./While this provider is disabled no data will be collected from it./
app/controllers/ems_common.rb
Outdated
:target_id => id, | ||
:target_class => model.to_s, | ||
:userid => session[:userid]} | ||
AuditEvent.success(audit) |
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.
👍
app/controllers/ems_common.rb
Outdated
return if @flash_array.present? | ||
|
||
add_flash(n_("Disable initiated for %{count} %{model} from the %{product} Database", | ||
"Disable initiated for %{count} %{models} from the %{product} Database", emss.length) % |
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 think you only allowed disable for individual managers, right?
That's probably a good idea. You would have a weird behavior for more then one, if some are already disabled.
(some would be disabled and some enabled)
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 think disabling multiple managers is a valid use case. To avoid the behavior we can go with separate buttons for Enable selected Providers
and Disable selected providers
when dealing with multiple select.
app/controllers/ems_common.rb
Outdated
@@ -548,6 +549,26 @@ def process_emss(emss, task) | |||
:product => I18n.t('product.name'), | |||
:model => ui_lookup(:table => table_name), | |||
:models => ui_lookup(:tables => table_name)}) if @flash_array.nil? | |||
elsif task == "disable_ems" |
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 raise an error emss if there is more then one ems
I think that would work well. Its more easily understandable. we need to choose icons though. |
@miq-bot add_label wip |
@simon3z i think its enough to warn users that they will be missing data if they keep their provider paused(disabled). I can also add a 'Resumed\Paused' row under the 'Status' table in the summary screen to indicate the current state. |
Yes, we need a warning... if people are putting a provider in pause for Maintenance on the provider, they may miss some data. |
d7f7f2b
to
94a5efe
Compare
app/controllers/ems_common.rb
Outdated
model.where(:id => emss).order("lower(name)").each do |ems| | ||
id = ems.id | ||
ems_name = ems.name | ||
audit = {:event => "ems_record_pause_initiated", |
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.
resume
app/controllers/ems_common.rb
Outdated
process_emss(emss, "pause_ems") unless emss.empty? | ||
return if @flash_array.present? | ||
|
||
add_flash(n_("Disable initiated for %{count} %{model} from the %{product} Database", |
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 think process_emss(emss, "pause_ems")
already adds exactly this flash?
app/controllers/ems_common.rb
Outdated
end | ||
end | ||
|
||
def resumeemss |
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 extremely similar to pauseems
method. Consider DRYing to one method with a param?
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 what would you rather I do 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.
Oh yes please :)
refreshems
and pauseems
seem to differ only in the flash message and calling call_ems_*
.
call_ems_*
differ only in a flash message and an argument to process_emss
.
And even those elsif task == "resume_ems"
and elsif task == "pause_ems"
differ only in the flash/audit message and calling disable!
vs enable!
.
So, definitely for DRYing this up a little ;).
Also, I notice that both call_ems_*
and those elsif task == ..
bits use the same exact flash messages, so maybe those should be shared somehow as well.... oh and there's a difference where call_ems_pause
says Disable initiated
while task pause_ems
says Pause initiated
.. which is probably a bug, right? :)
OK, yes @zeari I have the feeling that we should do all we can to make it simple to understand that a provider is disabled. Maybe we can even plan to have an extra symbol (a pause symbol?) on top of the provider icon. For now having it in the status should be OK. |
4c7bfc2
to
34acebd
Compare
@simon3z @dclarizio @Loicavenel updated screenshots with indicator on the status table. |
I love it. |
@miq-bot remove_label wip |
Nice! 👍 |
def textual_paused_state | ||
state = @record.enabled? | ||
h = {:label => _("Running State"), :value => state ? _("Running") : _("Paused")} | ||
if state |
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 current wording is Running State: Running\Paused
I feel this is a little misleading to users since its not the external provider thats paused but the data collection from it on miq side.
Do you think it should be Data Collection Workers: Running\Paused
or something else that better indicates that its only on the miq side?
@simon3z @Loicavenel
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.
Good point... this will be really confusing... it should be: "Collection Status" @serenamarie125 Idea?
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.
or just Data Collection
. I think we should use these terms in the dropdowns too.
ce86d99
to
90dbf4c
Compare
@zeari ok, now i am understanding, you want to add a flash message (inline notification) when going to the dashboard so that people understand that the provider is disconnected. I agree with that! I think for this case, it would be an informational inline notification ( http://www.patternfly.org/pattern-library/communication/inline-notifications/ ) And yes, I'm sorry, i meant to change the initial dialog that appears when you choose to pause the provider, if possible |
@serenamarie125 the flash message: |
f6b2f4f
to
cb5cc48
Compare
cb5cc48
to
3adb20c
Compare
Checked commit zeari@3adb20c with ruby 2.2.6, rubocop 0.47.1, and haml-lint 0.20.0 app/controllers/ems_common.rb
app/helpers/application_helper/toolbar/ems_container_center.rb
|
@zeari LGTM! I think we should have a follow up PR once PatternFly gets the appropriate icons in |
Thanks @serenamarie125 . @himdel is there anything else needed here? |
@zeari No idea. I'm not seeing any new toolbar buttons anywhere, and not seeing any info on where to find this in the description either :) EDIT: never mind, right branch, but commented out |
Tested in the UI, I can see it working on all the container provider detail screens. But.. this looks like we should really change the container provider quadicons to show this too, otherwise there's no indication of paused/resumed in the list view. |
@himdel Any good PRs to copy off of? 😅 |
Should we determine what goes in the quad icon, as well as where :) I think that would be a great exercise! What info is available? We have a matrix somewhere regarding suggested location for data, lemme find it this morning ... |
Heheh, there's been some quadicon refactorings recently so this should not be that hard...
Looks like So.. looks like we just need to enable this in settings, and add a elsif case that does the right thing. (Those a72, b72, ... denote the individual quadrants) |
@serenamarie125 Looks like for ems, we get:
|
@zeari A quick and dirty test... diff --git a/app/helpers/quadicon_helper.rb b/app/helpers/quadicon_helper.rb
index 304b41c60f..a38818b79d 100644
--- a/app/helpers/quadicon_helper.rb
+++ b/app/helpers/quadicon_helper.rb
@@ -553,16 +553,18 @@ module QuadiconHelper
def render_ext_management_system_quadicon(item, options)
output = []
- if settings(:quadicons, db_for_quadicon)
+ if true #settings(:quadicons, db_for_quadicon)
output << flobj_img_simple("layout/base.png")
item_count = case item
when EmsPhysicalInfra then item.physical_servers.size
when EmsCloud then item.total_vms
+ when ::ManageIQ::Providers::ContainerManager then item.containers.size
else
item.hosts.size
end
output << flobj_p_simple("a72", item_count)
output << flobj_p_simple("b72", item.total_miq_templates) if item.kind_of?(EmsCloud)
+ output << flobj_img_simple("svg/currentstate-paused.svg", "b72") if item.kind_of?(::ManageIQ::Providers::ContainerManager)
output << flobj_img_simple("svg/vendor-#{h(item.image_name)}.svg", "c72")
output << flobj_img_simple(img_for_auth_status(item), "d72")
output << flobj_img_simple('100/shield.png', "g72") unless item.get_policies.empty? |
We definitely need more @himdels in this project 😄 |
Compute > Containers > Providers
pick a provider
toolbar Configuration > Pause/Resume this Containers Provider
BZ: https://bugzilla.redhat.com/show_bug.cgi?id=1464924
BEFORE anyone looks at the code, im trying to figure out if this is something we want to expose to users at all. We can discuss that here.Disable Providers data collection from UI
Screenshots:
@simon3z @Loicavenel @bronaghs @dclarizio