update node

This commit is contained in:
bee0005 2016-09-28 09:55:02 +00:00
parent ac1527acf0
commit 537921c0ca
5 changed files with 22 additions and 99 deletions

View File

@ -1,6 +1,7 @@
source 'https://rubygems.org' source 'https://rubygems.org'
gem 'carrierwave' gem 'carrierwave'
gem 'devise' gem 'devise'
gem 'net-ping'
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails' # Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.2.4' gem 'rails', '4.2.4'
# Use sqlite3 as the database for Active Record # Use sqlite3 as the database for Active Record

View File

@ -96,6 +96,7 @@ GEM
mini_portile2 (2.0.0) mini_portile2 (2.0.0)
minitest (5.8.4) minitest (5.8.4)
multi_json (1.11.2) multi_json (1.11.2)
net-ping (2.0.1)
nokogiri (1.6.7.2) nokogiri (1.6.7.2)
mini_portile2 (~> 2.0.0.rc2) mini_portile2 (~> 2.0.0.rc2)
orm_adapter (0.5.0) orm_adapter (0.5.0)
@ -183,6 +184,7 @@ DEPENDENCIES
font-awesome-rails font-awesome-rails
jbuilder (~> 2.0) jbuilder (~> 2.0)
jquery-rails jquery-rails
net-ping
rails (= 4.2.4) rails (= 4.2.4)
sass-rails (~> 5.0) sass-rails (~> 5.0)
sdoc (~> 0.4.0) sdoc (~> 0.4.0)

View File

@ -1,6 +1,5 @@
class NodeController < ApplicationController class NodeController < ApplicationController
before_action :require_login before_action :require_login
def index def index
@hosts = Array.new @hosts = Array.new
@nodes = Node.all.order("id asc") @nodes = Node.all.order("id asc")

View File

@ -1,2 +1,7 @@
module NodeHelper module NodeHelper
require 'net/ping'
def ping_test?(host)
check = Net::Ping::External.new(host)
check.ping?
end
end end

View File

@ -9,7 +9,7 @@
<div class="clearfix"></div> <div class="clearfix"></div>
<div class="row"> <div class="row">
<div class="col-md-6 col-sm-6 col-xs-6"> <div class="col-md-12 col-sm-12 col-xs-12">
<div class="x_panel"> <div class="x_panel">
<div class="x_title"> <div class="x_title">
<h2><i class="fa fa-plus-square-o"></i> Add Node</h2> <h2><i class="fa fa-plus-square-o"></i> Add Node</h2>
@ -25,8 +25,6 @@
</li> </li>
</ul> </ul>
</li> </li>
<li><a class="close-link"><i class="fa fa-close"></i></a>
</li>
</ul> </ul>
<div class="clearfix"></div> <div class="clearfix"></div>
</div> </div>
@ -77,7 +75,7 @@
</div> </div>
</div> </div>
</div> </div>
<div class="col-md-6 col-sm-6 col-xs-6"> <div class="col-md-12 col-sm-12 col-xs-12">
<div class="x_panel"> <div class="x_panel">
<div class="x_title"> <div class="x_title">
<h2><i class="fa fa-align-left"></i> Node List <small>Try hovering over the rows</small></h2> <h2><i class="fa fa-align-left"></i> Node List <small>Try hovering over the rows</small></h2>
@ -93,8 +91,6 @@
</li> </li>
</ul> </ul>
</li> </li>
<li><a class="close-link"><i class="fa fa-close"></i></a>
</li>
</ul> </ul>
<div class="clearfix"></div> <div class="clearfix"></div>
</div> </div>
@ -102,24 +98,29 @@
<table class="table table-hover"> <table class="table table-hover">
<thead> <thead>
<tr> <tr>
<th>#</th> <th>Ping</th> <!-- Ping-->
<th>Status</th>
<th>Host Name</th> <th>Host Name</th>
<th>Host IP</th> <th>Host IP</th>
<th>User Name</th> <th>User Name</th>
<th>Date</th> <th>Date</th>
<!-- <th></th>--> <th></th> <!-- Delete-->
<th></th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
<%@nodes.each do |t|%> <%@nodes.each do |t|%>
<tr> <tr>
<th scope="row"><%=t.id%></th> <%if ping_test?(t.host_ip)%>
<td><%=t.host_name%></td> <td><i class="fa fa-circle-o green"></i></a></td>
<td>Prove</td>
<%else%>
<td><i class="fa fa-close red"></i></a></td>
<td>-</td>
<%end%>
<th scope="row"><%=t.host_name%></th>
<td><%=t.host_ip%></td> <td><%=t.host_ip%></td>
<td><%=t.user_name%></td> <td><%=t.user_name%></td>
<td><%=t.created_at%></td> <td><%=t.created_at%></td>
<!-- <td><i class="fa fa-pencil"></i></td>-->
<td><a href="/node/delete/<%=t.id%>"><i class="fa fa-trash"></i></a></td> <td><a href="/node/delete/<%=t.id%>"><i class="fa fa-trash"></i></a></td>
</tr> </tr>
<%end%> <%end%>
@ -129,91 +130,6 @@
</div> </div>
</div> </div>
</div> </div>
<div class="row">
<div class="col-md-6 col-sm-6 col-xs-6">
<div class="x_panel">
<div class="x_title">
<h2><i class="fa fa-align-left"></i> Node List</h2>
<ul class="nav navbar-right panel_toolbox">
<li><a class="collapse-link"><i class="fa fa-chevron-up"></i></a>
</li>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false"><i class="fa fa-wrench"></i></a>
<ul class="dropdown-menu" role="menu">
<li><a href="#">Settings 1</a>
</li>
<li><a href="#">Settings 2</a>
</li>
</ul>
</li>
<li><a class="close-link"><i class="fa fa-close"></i></a>
</li>
</ul>
<div class="clearfix"></div>
</div>
<div class="x_content">
<!-- start accordion -->
<div class="accordion" id="accordion1" role="tablist" aria-multiselectable="true">
<div class="panel">
<a class="panel-heading" role="tab" id="headingOne1" data-toggle="collapse" data-parent="#accordion1" href="#collapseOne1" aria-expanded="true" aria-controls="collapseOne">
<h4 class="panel-title">Collapsible Group Item #1</h4>
</a>
<div id="collapseOne1" class="panel-collapse collapse in" role="tabpanel" aria-labelledby="headingOne">
<div class="panel-body">
<table class="table table-striped">
<thead>
<tr>
<th>#</th>
<th>First Name</th>
<th>Last Name</th>
<th>Username</th>
</tr>
</thead>
<tbody>
<tr>
<th scope="row">1</th>
<td>Mark</td>
<td>Otto</td>
<td>@mdo</td>
</tr>
<tr>
<th scope="row">2</th>
<td>Jacob</td>
<td>Thornton</td>
<td>@fat</td>
</tr>
<tr>
<th scope="row">3</th>
<td>Larry</td>
<td>the Bird</td>
<td>@twitter</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
<div class="panel">
<a class="panel-heading collapsed" role="tab" id="headingTwo1" data-toggle="collapse" data-parent="#accordion1" href="#collapseTwo1" aria-expanded="false" aria-controls="collapseTwo">
<h4 class="panel-title">Collapsible Group Item #2</h4>
</a>
<div id="collapseTwo1" class="panel-collapse collapse" role="tabpanel" aria-labelledby="headingTwo">
<div class="panel-body">
<p><strong>Collapsible Item 2 data</strong>
</p>
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,
</div>
</div>
</div>
</div>
<!-- end of accordion -->
</div>
</div>
</div>
</div>
</div> </div>
<!-- /page content --> <!-- /page content -->
<script> <script>