Skip to content

Commit

Permalink
Merge pull request #17172 from skovic/physical-server-widget-files
Browse files Browse the repository at this point in the history
Add product files for physical server dashboard widgets
  • Loading branch information
gtanzillo authored Apr 9, 2018
2 parents c9e7f02 + fbc1e4d commit a5379c4
Show file tree
Hide file tree
Showing 9 changed files with 198 additions and 2 deletions.
11 changes: 11 additions & 0 deletions app/models/physical_server.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,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, :uses => :host
virtual_column :v_host_os, :type => :string, :uses => :host

def name_with_details
details % {
:name => name,
Expand Down Expand Up @@ -92,4 +95,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
18 changes: 18 additions & 0 deletions product/dashboard/widgets/chart_server_availability.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
description: chart_server_availability
title: "Physical Server Availability"
content_type: chart
options:
:timezone_matters: false
visibility:
:roles:
- _ALL_
user_id:
resource_name: Physical Server Availability
resource_type: MiqReport
miq_schedule_options:
:run_at:
:interval:
:value: "1"
:unit: hourly
enabled: true
read_only: true
18 changes: 18 additions & 0 deletions product/dashboard/widgets/chart_server_health.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
description: chart_server_health
title: "Physical Server Health"
content_type: chart
options:
:timezone_matters: false
visibility:
:roles:
- _ALL_
user_id:
resource_name: Physical Server Health
resource_type: MiqReport
miq_schedule_options:
:run_at:
:interval:
:value: "1"
:unit: hourly
enabled: true
read_only: true
18 changes: 18 additions & 0 deletions product/dashboard/widgets/rss_newest_servers.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
description: rss_newest_servers
title: "Recently Discovered Physical Servers"
content_type: report
options:
:row_count: 5
visibility:
:roles:
- _ALL_
user_id:
resource_name: Recently Discovered Physical Servers
resource_type: MiqReport
miq_schedule_options:
:run_at:
:interval:
:value: "1"
:unit: hourly
enabled: true
read_only: true
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
---
title: Recently Discovered Physical Servers
rpt_group: Custom
rpt_type: Custom
priority:
db: PhysicalServer
cols:
- hostname
- health_state
- power_state
- product_name
include: {}
col_order:
- hostname
- health_state
- power_state
- product_name
headers:
- Hostname
- Health State
- Power State
- Product Name
conditions:
order: Ascending
sortby:
- hostname
group:
graph:
dims:
filename:
file_mtime:
categories: []
timeline:
template_type: report
where_clause:
db_options: {}
generate_cols:
generate_rows:
col_formats:
-
-
-
-
-
-
tz:
time_profile_id:
display_filter:
col_options: {}
rpt_options:
:pdf:
:page_size: US-Letter
:queue_timeout:
menu_name: Recently Discovered Physical Servers
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
---
title: Physical Server Health
conditions:
order: Ascending
graph:
:type: Pie
:count: 10
:other: true
menu_name: Physical Server Health
rpt_group: Custom
rpt_type: Custom
priority:
col_order:
- hostname
- health_state
- power_state
- product_name
timeline:
file_mtime:
categories:
filename:
db: PhysicalServer
cols:
- hostname
- health_state
- power_state
- product_name
template_type: report
sortby:
- health_state
- hostname
headers:
- Hostname
- Health State
- Power State
- Product Name
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
---
title: Physical Server Availability
order: Ascending
graph:
:type: Pie
:count: 10
:other: true
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:
categories:
filename:
db: PhysicalServer
cols:
- hostname
- v_availability
- health_state
- power_state
- v_host_os
- product_name
template_type: report
sortby:
- v_availability
- hostname
headers:
- Hostname
- Availability
- Health State
- Power State
- Host OS
- Product Name
2 changes: 1 addition & 1 deletion spec/models/miq_report/seeding_spec.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
describe MiqReport do
context "Seeding" do
include_examples(".seed called multiple times", 140)
include_examples(".seed called multiple times", 143)
end
end
2 changes: 1 addition & 1 deletion spec/models/miq_widget_spec.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
describe MiqWidget do
describe '.seed' do
before { [MiqReport, RssFeed].each(&:seed) }
include_examples(".seed called multiple times", 21)
include_examples(".seed called multiple times", 24)
end

before do
Expand Down

0 comments on commit a5379c4

Please sign in to comment.