Skip to content

Commit

Permalink
Changed the server utilization widget into the server availability wi…
Browse files Browse the repository at this point in the history
…dget
  • Loading branch information
skovic committed Mar 29, 2018
1 parent 8c3ce22 commit f6fb0f3
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 14 deletions.
11 changes: 11 additions & 0 deletions app/models/physical_server.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@ class PhysicalServer < ApplicationRecord

scope :with_hosts, -> { where("physical_servers.id in (select hosts.physical_server_id from hosts)") }

virtual_column :v_availability, :type => :string
virtual_column :v_host_os, :type => :string

def name_with_details
details % {
:name => name,
Expand Down Expand Up @@ -91,4 +94,12 @@ def refresh_ems
end
EmsRefresh.queue_refresh(self)
end

def v_availability
host.try(:physical_server_id).nil? ? N_("Available") : N_("In use")
end

def v_host_os
host.try(:vmm_product).nil? ? N_("") : host.vmm_product
end
end
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
description: chart_server_utilization
title: "Physical Server Utilization"
description: chart_server_availability
title: "Physical Server Availability"
content_type: chart
options:
:timezone_matters: false
visibility:
:roles:
- _ALL_
user_id:
resource_name: Physical Server Utilization
resource_name: Physical Server Availability
resource_type: MiqReport
miq_schedule_options:
:run_at:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,18 +1,20 @@
---
title: Physical Server Utilization
title: Physical Server Availability
order: Ascending
graph:
:type: Pie
:count: 10
:other: true
menu_name: Physical Server Utilization
menu_name: Physical Server Availability
rpt_group: Custom
rpt_type: Custom
priority:
col_order:
- hostname
- v_availability
- health_state
- power_state
- v_host_os
- product_name
timeline:
file_mtime:
Expand All @@ -21,27 +23,23 @@ filename:
db: PhysicalServer
cols:
- hostname
- v_availability
- health_state
- power_state
- v_host_os
- product_name
include:
host:
columns:
- physical_server_id
template_type: report
sortby:
- host.physical_server_id
- v_availability
- hostname
headers:
- Hostname
- Availability
- Health State
- Power State
- Host OS
- Product Name
conditions: !ruby/object:MiqExpression
exp:
or:
- IS NOT NULL:
field: PhysicalServer.host-physical_server_id
- IS NULL:
field: PhysicalServer.host-physical_server_id
context_type:

0 comments on commit f6fb0f3

Please sign in to comment.