Add peer page

This commit is contained in:
Youngkyun Kim 2016-08-25 10:22:11 +00:00
parent cbfa6976c7
commit d6b6db9da5
9 changed files with 120 additions and 1 deletions

View File

@ -0,0 +1,3 @@
# Place all the behaviors and hooks related to the matching controller here.
# All this logic will automatically be available in application.js.
# You can use CoffeeScript in this file: http://coffeescript.org/

View File

@ -0,0 +1,3 @@
// Place all the styles related to the peer controller here.
// They will automatically be included in application.css.
// You can use Sass (SCSS) here: http://sass-lang.com/

View File

@ -0,0 +1,20 @@
class PeerController < ApplicationController
def index
@hosts = Array.new
if get_hosts.blank?
flash[:danger] = "Check Server"
else
@hosts = get_hosts
end
end
def get_hosts
file_str = `cat ` + @hostfile_path
hosts_str = file_str.split("hosts:")[1]
return hosts_str.split("\n")
end
@hostfile_path = "../../../configure.conf"
end

View File

@ -0,0 +1,2 @@
module PeerHelper
end

View File

@ -84,7 +84,7 @@
</li>
<li><a><i class="fa fa-bar-chart-o"></i> Peer <span class="fa fa-chevron-down"></span></a>
<ul class="nav child_menu" style="display: none">
<li><a href="#">Probe</a>
<li><a href="/peer/index">Probe</a>
</li>
<li><a href="#">Detach</a>
</li>

View File

@ -0,0 +1,77 @@
<!-- page content -->
<div class="right_col" role="main">
<div class="">
<div class="page-title">
<div class="title_left"><h3>Peer</h3></div>
<div class="title_right">
<div class="col-md-5 col-sm-5 col-xs-12 form-group pull-right top_search">
<div class="input-group">
<input type="text" class="form-control" placeholder="Search for...">
<span class="input-group-btn">
<button class="btn btn-default" type="button">Go!</button>
</span>
</div>
</div>
</div>
</div>
<div class="clearfix"></div>
<div class="row">
<div class="col-md-12 col-sm-12 col-xs-12">
<div class="x_panel">
<div class="x_title">
<h2>Hover rows <small>Try hovering over the rows</small></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">
<table class="table table-hover">
<thead>
<tr>
<th>#</th>
<th>Host Name</th>
<th>IP Address</th>
<th>Status</th>
<th>UUID</th>
</tr>
</thead>
<tbody>
<%@hosts.each do |t|%>
<tr>
<th scope="row">1</th>
<td>Mark</td>
<td>Otto</td>
<td>@mdo</td>
</tr>
<%end%>
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
</div>
<!-- /page content -->

View File

@ -1,4 +1,6 @@
Rails.application.routes.draw do
get 'peer/index'
get 'volume/info'
get 'home/index'
@ -13,6 +15,7 @@ Rails.application.routes.draw do
get 'index' => 'plainpage#index'
get 'volume/info' => 'volume#info'
get 'peer/index' => 'peer#index'
post 'file_upload' => 'volume#file_upload'
# Example of regular route:

2
configure.conf Normal file
View File

@ -0,0 +1,2 @@
host:
124.63.216.174:2222 gluster-1

View File

@ -0,0 +1,9 @@
require 'test_helper'
class PeerControllerTest < ActionController::TestCase
test "should get index" do
get :index
assert_response :success
end
end