Skip to content

Commit

Permalink
Merge pull request #4524 from skateman/summary-powerstate
Browse files Browse the repository at this point in the history
Use fonticon+background for powerstate icons in textual summaries
  • Loading branch information
mzazrivec committed Aug 24, 2018
2 parents 2546a56 + 7167e91 commit 9718f72
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 14 deletions.
1 change: 1 addition & 0 deletions app/assets/stylesheets/application.css
Expand Up @@ -25,4 +25,5 @@
*= require ./remote_console
*= require graphiql/graphiql.css
*= require piecharts
*= require @manageiq/react-ui-components/dist/textual_summary
*/
21 changes: 8 additions & 13 deletions app/helpers/textual_mixins/textual_power_state.rb
@@ -1,19 +1,14 @@
module TextualMixins::TextualPowerState
VALID_POWER_STATE = %w(
archived connecting disconnected image_locked install_failed maintenance
migrating never non_operational not_responding off on orphaned paused
powering_down powering-down powering_up powering-up preparing_for_maintenance
reboot_in_progress retired shelved_offloaded shelved standby suspended
template terminated unknown wait_for_launch
).freeze

def power_state_to_image(state)
"svg/currentstate-#{state}.svg" if VALID_POWER_STATE.include?(state)
end

def textual_power_state_whitelisted(state)
state = state.blank? ? 'unknown' : state.downcase
{:label => _('Power State'), :value => state, :image => power_state_to_image(state)}
quad_icon = QuadiconHelper::MACHINE_STATE_QUADRANT[state]

{
:label => _('Power State'),
:value => state,
:icon => quad_icon[:fonticon],
:background => quad_icon[:background]
}
end

def textual_power_state_whitelisted_with_template
Expand Down
2 changes: 1 addition & 1 deletion package.json
Expand Up @@ -21,7 +21,7 @@
},
"homepage": "https://github.com/ManageIQ/manageiq#readme",
"dependencies": {
"@manageiq/react-ui-components": "~0.10.7",
"@manageiq/react-ui-components": "~0.10.8",
"angular": "~1.6.6",
"angular-animate": "~1.6.6",
"angular-bootstrap-switch": "~0.5.2",
Expand Down

0 comments on commit 9718f72

Please sign in to comment.