Skip to content

Commit

Permalink
Merge pull request #4022 from skateman/provider-suspended-quadicon
Browse files Browse the repository at this point in the history
Display providers' suspended status in their quadicon
  • Loading branch information
mzazrivec committed Jun 7, 2018
2 parents f0eac47 + b0202ec commit 8bfa17f
Show file tree
Hide file tree
Showing 8 changed files with 24 additions and 33 deletions.
5 changes: 1 addition & 4 deletions app/decorators/host_decorator.rb
Expand Up @@ -15,10 +15,7 @@ def quadicon
:fileicon => fileicon,
:tooltip => ui_lookup(:model => type)
},
:bottom_right => {
:fileicon => QuadiconHelper.status_img(authentication_status),
:tooltip => authentication_status
}
:bottom_right => QuadiconHelper.provider_status(authentication_status)
}
icon[:middle] = QuadiconHelper::POLICY_SHIELD if get_policies.present?
icon
Expand Down
5 changes: 1 addition & 4 deletions app/decorators/manageiq/providers/cloud_manager_decorator.rb
Expand Up @@ -19,10 +19,7 @@ def quadicon
:fileicon => fileicon,
:tooltip => ui_lookup(:model => type)
},
:bottom_right => {
:fileicon => QuadiconHelper.status_img(authentication_status),
:tooltip => authentication_status
}
:bottom_right => QuadiconHelper.provider_status(authentication_status, enabled?)
}
icon[:middle] = QuadiconHelper::POLICY_SHIELD if get_policies.present?
icon
Expand Down
Expand Up @@ -19,10 +19,7 @@ def quadicon
:fileicon => fileicon,
:tooltip => ui_lookup(:model => type)
},
:bottom_right => {
:fileicon => QuadiconHelper.status_img(authentication_status),
:tooltip => authentication_status
}
:bottom_right => QuadiconHelper.provider_status(authentication_status, enabled?)
}
icon[:middle] = QuadiconHelper::POLICY_SHIELD if get_policies.present?
icon
Expand Down
5 changes: 1 addition & 4 deletions app/decorators/manageiq/providers/infra_manager_decorator.rb
Expand Up @@ -19,10 +19,7 @@ def quadicon
:fileicon => fileicon,
:tooltip => ui_lookup(:model => type)
},
:bottom_right => {
:fileicon => QuadiconHelper.status_img(authentication_status),
:tooltip => authentication_status
}
:bottom_right => QuadiconHelper.provider_status(authentication_status, enabled?)
}
icon[:middle] = QuadiconHelper::POLICY_SHIELD if get_policies.present?
icon
Expand Down
Expand Up @@ -25,10 +25,7 @@ def quadicon
:fileicon => fileicon,
:tooltip => ui_lookup(:model => type)
},
:bottom_right => {
:fileicon => QuadiconHelper.status_img(authentication_status),
:tooltip => authentication_status
}
:bottom_right => QuadiconHelper.provider_status(authentication_status, enabled?)
}
icon[:middle] = QuadiconHelper::POLICY_SHIELD if get_policies.present?
icon
Expand Down
Expand Up @@ -19,10 +19,7 @@ def quadicon
:fileicon => fileicon,
:tooltip => ui_lookup(:model => type)
},
:bottom_right => {
:fileicon => QuadiconHelper.status_img(authentication_status),
:tooltip => authentication_status
}
:bottom_right => QuadiconHelper.provider_status(authentication_status, enabled?)
}
icon[:middle] = QuadiconHelper::POLICY_SHIELD if get_policies.present?
icon
Expand Down
Expand Up @@ -19,10 +19,7 @@ def quadicon
:fileicon => fileicon,
:tooltip => ui_lookup(:model => type)
},
:bottom_right => {
:fileicon => QuadiconHelper.status_img(authentication_status),
:tooltip => authentication_status
}
:bottom_right => QuadiconHelper.provider_status(authentication_status, enabled?)
}
icon[:middle] = QuadiconHelper::POLICY_SHIELD if get_policies.present?
icon
Expand Down
22 changes: 17 additions & 5 deletions app/helpers/quadicon_helper.rb
Expand Up @@ -34,12 +34,24 @@ module QuadiconHelper
'template' => {:fonticon => 'pficon pficon-template', :background => '#336699'},
}.freeze

def self.status_img(status)
def self.provider_status(status, enabled = true)
# If the provider is suspended, we don't care about the status itself
unless enabled
return {
:fonticon => 'pficon pficon-asleep',
:tooltip => _('Data collection for this provider is suspended.')
}
end

case status
when "Invalid" then "100/x.png"
when "Valid" then "100/checkmark.png"
when "None" then "100/unknown.png"
else "100/exclamationpoint.png"
when "Invalid"
{:fileicon => '100/x.png', :tooltip => _('Invalid authentication credentials')}
when "Valid"
{:fileicon => '100/checkmark.png', :tooltip => _('Authentication credentials are valid')}
when "None"
{:fileicon => '100/unknown.png', :tooltip => _('Could not determine the authentication status')}
else
{:fileicon => '100/exclamationpoint.png', :tooltip => _('Authentication status is %{status}') % {:status => status} }
end
end

Expand Down

0 comments on commit 8bfa17f

Please sign in to comment.