Module: NodeDashboardHelper

Defined in:
app/helpers/node_dashboard_helper.rb

Overview

You should have received a copy of the GNU General Public License along with ForemanFogProxmox. If not, see <www.gnu.org/licenses/>.

Instance Method Summary collapse

Instance Method Details

#compute_data(statistics) ⇒ Object



21
22
23
24
25
26
27
28
29
# File 'app/helpers/node_dashboard_helper.rb', line 21

def compute_data(statistics)
  data = []
  statistics.each do |statistic|
    t = Time.zone.at(statistic['time'])
    x = t.hour.to_s + ':' + t.min.to_s
    data << [x, statistic['loadavg'] * 100]
  end
  data
end

#render_node_statistics(statistics, options = {}) ⇒ Object



31
32
33
34
# File 'app/helpers/node_dashboard_helper.rb', line 31

def render_node_statistics(statistics, options = {})
  data = compute_data(statistics)
  flot_bar_chart('node_statistics', _('Time'), _('Average load (x100)'), data, options)
end