This commit is contained in:
kyg516 2016-09-14 17:54:30 +09:00
parent b97c484ff8
commit 40682aaec4
9 changed files with 86 additions and 119 deletions

View File

@ -2,7 +2,6 @@ class ApplicationController < ActionController::Base
# Prevent CSRF attacks by raising an exception.
# For APIs, you may want to use :null_session instead.
# protect_from_forgery with: :exception
helper_method :volume_mount, :volume_unmount, :volume_create, :volume_delete, :volume_start, :volume_stop
def get_conf
@config = Hash.new

View File

@ -0,0 +1,15 @@
class NodeController < ApplicationController
def index
@hosts = Array.new
if get_hosts.blank?
flash[:danger] = "Check Server"
else
@hosts = get_hosts
end
end
def get_hosts
return ['2', 'aaa', 'bbb', 'ccc']
end
end

View File

@ -1,20 +0,0 @@
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

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

View File

@ -0,0 +1,62 @@
<!-- page content -->
<div class="right_col" role="main">
<div class="page-title">
<div class="title_left"><h3>Peer</h3></div>
<div class="title_right">
</div>
</div>
<div class="clearfix"></div>
<div class="row">
<div class="col-md-6 col-sm-6 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>
<td>tmp</td>
</tr>
<%end%>
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
<!-- /page content -->

View File

@ -27,17 +27,7 @@
</li>
<li><a><i class="fa fa-desktop"></i> Node <span class="fa fa-chevron-down"></span></a>
<ul class="nav child_menu" style="display: none">
<li><a href="#">Add-brick</a>
</li>
<li><a href="#">Remove brick</a>
</li>
<li><a href="#">Replace brick</a>
</li>
<li><a href="#">Rebalance start</a>
</li>
<li><a href="#">Rebalance stop</a>
</li>
<li><a href="#">Rebalance status</a>
<li><a href="/node/index">Control</a>
</li>
</ul>
</li>

View File

@ -1,77 +0,0 @@
<!-- 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

@ -93,10 +93,10 @@
<input type="hidden" value='<%=@current_dir + "/" + t["name"]%>'>
<button type="submit" class="btn btn-primary pull-right">select</botton>
</form>
</td>
</tr>
<%end%>
<%end%>
</td>
</tr>
<%end%>
<%end%>
</tbody>
</table>
</div>
@ -169,7 +169,7 @@
<i class="fa fa-pause" style="color:#d9534f;"></i>
<p style="color:#d9534f;">Stop</p>
</a>
<a class="btn btn-app" href="/volume/index?volume_name=<%=t['Volume Name'].delete(' ')%>#popup_mount"><i class="fa fa-download"></i> Mount</a>
<a class="btn btn-app" href="?volume_name=<%=t['Volume Name'].delete(' ')%>#popup_mount"><i class="fa fa-download"></i> Mount</a>
<% else %>
<a class="btn btn-app" href="/volume/start/<%=t['Volume Name'].delete(' ')%>">
<i class="fa fa-play" style="color:#26B99A;"></i>
@ -221,7 +221,7 @@
var new_tr = "";
new_tr += "<tr role='row' class='odd'> <td><i class='fa fa-reply'></i>";
new_tr += "<a style='cursor: pointer' onclick='change_upper(" + '"' + directory + '"' +")'> ..</a>";
new_tr += "</td><td> </td><td> </td><td> </td></tr>";
new_tr += "</td><td> </td><td>";
for( var i = 0; i < result.file.length; i++){
if(result.file[i].auth[0] != "d") continue;
var row_class = i % 2 == 0 ? 'odd' : 'even';

View File

@ -26,8 +26,8 @@ Rails.application.routes.draw do
get 'volume/stop/:volume_name' => "volume#volume_stop"
get 'volume/delete/:volume_name' => "volume#volume_delete"
#Peer
get 'peer/index' => 'peer#index'
#Node
get 'node/index' => 'node#index'