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

Display providers' suspended status in their quadicon #4022

Merged
merged 5 commits into from Jun 7, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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
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
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