Skip to content
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

Disable Web Console button when VM's platform is Windows #1282

Merged

Conversation

bmclaughlin
Copy link
Contributor

@bmclaughlin
Copy link
Contributor Author

@miq-bot add_labels bug, compute/infrastructure, compute/cloud

@@ -4,6 +4,7 @@ class ApplicationHelper::Button::CockpitConsole < ApplicationHelper::Button::Bas
def disabled?
record_type = @record.respond_to?(:current_state) ? _('VM') : _('Container Node')
@error_message = _("The web-based console is not available because the %{record_type} is not powered on" % {:record_type => record_type}) unless on?
@error_message = _('The web-based console is not available because the Windows platform is not supported') unless platform_supported? && @record.respond_to?(:current_state)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:current_state is already being looked at in platform_supported? right? There's no need to test it twice.

@@ -13,4 +14,8 @@ def on?
return @record.current_state == 'on' if @record.respond_to?(:current_state) # VM status
@record.ready_condition_status == 'True' if @record.respond_to?(:ready_condition_status) # Container status
end

def platform_supported?
@record.platform.downcase != 'windows' if @record.respond_to?(:current_state)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't quite understand how :current_state and @record.platform come together.

As in if we don't know the current state, we also do not know the platform? I'm not saying this
is incorrect, I'm just curious.

Also, if the above is correct, I'd rather change the above line to:

@record.respond_to?(:current_state) && @record.platform.downcase != 'windows'

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mzazrivec, I'm checking if it responds to current state to verify it's a VM so that the platform can be checked. In my research I was unable to determine a reliable way to verify the platform of a Container Node.

@bmclaughlin bmclaughlin force-pushed the cockpit-doesnt-support-windows branch from 9fb8dd9 to b31810b Compare June 7, 2017 02:38
@miq-bot
Copy link
Member

miq-bot commented Jun 7, 2017

Checked commits bmclaughlin/manageiq-ui-classic@58666d4~...b31810b with ruby 2.2.6, rubocop 0.47.1, and haml-lint 0.20.0
2 files checked, 0 offenses detected
Everything looks fine. 🍰

@mzazrivec mzazrivec added this to the Sprint 63 Ending Jun 19, 2017 milestone Jun 7, 2017
@mzazrivec mzazrivec merged commit 5ea3f51 into ManageIQ:master Jun 7, 2017
@bmclaughlin bmclaughlin deleted the cockpit-doesnt-support-windows branch June 7, 2017 14:26
simaishi pushed a commit that referenced this pull request Jun 12, 2017
Disable Web Console button when VM's platform is Windows
(cherry picked from commit 5ea3f51)

https://bugzilla.redhat.com/show_bug.cgi?id=1460807
@simaishi
Copy link
Contributor

Fine backport details:

$ git log -1
commit 0076c6b0e442b29fa6a2b019d4369b3f4d6a9f1c
Author: Milan Zázrivec <mzazrivec@redhat.com>
Date:   Wed Jun 7 16:21:58 2017 +0200

    Merge pull request #1282 from bmclaughlin/cockpit-doesnt-support-windows
    
    Disable Web Console button when VM's platform is Windows
    (cherry picked from commit 5ea3f5124a3361cf4a9f161187661e43342ab26f)
    
    https://bugzilla.redhat.com/show_bug.cgi?id=1460807

@bmclaughlin
Copy link
Contributor Author

@miq-bot add_label euwe/yes

@simaishi
Copy link
Contributor

Euwe backport details:

$ git log -1
commit f159817e51adf8c4d4c20fbdb3b220b1c828cbdb
Author: Milan Zázrivec <mzazrivec@redhat.com>
Date:   Wed Jun 7 16:21:58 2017 +0200

    Merge pull request #1282 from bmclaughlin/cockpit-doesnt-support-windows
    
    Disable Web Console button when VM's platform is Windows
    (cherry picked from commit 5ea3f5124a3361cf4a9f161187661e43342ab26f)
    
    https://bugzilla.redhat.com/show_bug.cgi?id=1462146

@petervo
Copy link
Contributor

petervo commented Aug 7, 2017

The logic here is a bit wrong and ignores container nodes that also use this button. A machine or vm that doesn't respond to current_status should not be treated as a windows machine

@bmclaughlin
Copy link
Contributor Author

Opened #1988 to fix the logic error, please take a look.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants