diff --git a/Gemfile b/Gemfile index 5538447..153be72 100644 --- a/Gemfile +++ b/Gemfile @@ -1,6 +1,7 @@ source 'https://rubygems.org' gem 'carrierwave' gem 'devise' +gem 'net-ping' # Bundle edge Rails instead: gem 'rails', github: 'rails/rails' gem 'rails', '4.2.4' # Use sqlite3 as the database for Active Record diff --git a/Gemfile.lock b/Gemfile.lock index 12bf38b..51f55de 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -96,6 +96,7 @@ GEM mini_portile2 (2.0.0) minitest (5.8.4) multi_json (1.11.2) + net-ping (2.0.1) nokogiri (1.6.7.2) mini_portile2 (~> 2.0.0.rc2) orm_adapter (0.5.0) @@ -183,6 +184,7 @@ DEPENDENCIES font-awesome-rails jbuilder (~> 2.0) jquery-rails + net-ping rails (= 4.2.4) sass-rails (~> 5.0) sdoc (~> 0.4.0) diff --git a/app/controllers/node_controller.rb b/app/controllers/node_controller.rb index d870f47..02b4108 100644 --- a/app/controllers/node_controller.rb +++ b/app/controllers/node_controller.rb @@ -1,6 +1,5 @@ class NodeController < ApplicationController - before_action :require_login - + before_action :require_login def index @hosts = Array.new @nodes = Node.all.order("id asc") diff --git a/app/helpers/node_helper.rb b/app/helpers/node_helper.rb index ff049b0..a0b203f 100644 --- a/app/helpers/node_helper.rb +++ b/app/helpers/node_helper.rb @@ -1,2 +1,7 @@ module NodeHelper + require 'net/ping' + def ping_test?(host) + check = Net::Ping::External.new(host) + check.ping? + end end diff --git a/app/views/node/index.html.erb b/app/views/node/index.html.erb index 44cadcd..d1a3904 100644 --- a/app/views/node/index.html.erb +++ b/app/views/node/index.html.erb @@ -9,7 +9,7 @@
-
+

Add Node

@@ -25,8 +25,6 @@ -
  • -
  • @@ -77,7 +75,7 @@
    -
    +

    Node List Try hovering over the rows

    @@ -93,8 +91,6 @@ -
  • -
  • @@ -102,24 +98,29 @@ - + + - - + <%@nodes.each do |t|%> - - + <%if ping_test?(t.host_ip)%> + + + <%else%> + + + <%end%> + - <%end%> @@ -129,91 +130,6 @@ -
    -
    -
    -
    -

    Node List

    - -
    -
    -
    #Ping Status Host Name Host IP User Name Date
    <%=t.id%><%=t.host_name%>Prove-<%=t.host_name%> <%=t.host_ip%> <%=t.user_name%> <%=t.created_at%>
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    #First NameLast NameUsername
    1MarkOtto@mdo
    2JacobThornton@fat
    3Larrythe Bird@twitter
    -
    -
    -
    -
    - -
    -
    -

    Collapsible Item 2 data -

    - Anim pariatur cliche reprehenderit, enim eiusmod high life accusamus terry richardson ad squid. 3 wolf moon officia aute, non cupidatat skateboard dolor brunch. Food truck quinoa nesciunt laborum eiusmod. Brunch 3 wolf moon tempor, -
    -
    -
    -
    - - - - - - -