Add helper method for 'volumes'

This commit is contained in:
kyg516
2016-09-20 21:13:24 +09:00
parent 595252011e
commit 37538b5112
3 changed files with 84 additions and 62 deletions

View File

@@ -115,7 +115,7 @@
</div>
<div class="clearfix"></div>
<div class="row">
<%@volumes.each do |t|%>
<% get_volumes.each_with_index do |t, index| %>
<div class="col-md-6 col-sm-6 col-xs-12">
<div class="x_panel">
<div class="x_title">
@@ -123,7 +123,12 @@
<h2>Infomation <small><%=t["Volume Name"]%></small></h2>
<!-- right title -->
<ul class="nav navbar-right panel_toolbox">
<li><a class="collapse-link"><i <%if t!=@volumes[0]%> class="fa fa-chevron-down" <%else%> class="fa fa-chevron-up" <%end%> ></i></a>
<li><a class="collapse-link">
<% if index == 0 %>
<i class="fa fa-chevron-up"></i>
<% else %>
<i class="fa fa-chevron-down"></i>
<% end %></a>
</li>
<li class="dropdown">
<a class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false"><i class="fa fa-wrench"></i></a>
@@ -149,7 +154,7 @@
<% end %>
</li>
<li>
<%if t['Status'].eql? " Stopped" %>
<%if t['Status'].eql? " Stopped" or t['Status'].eql? " Created" %>
<a><i class="fa fa-circle red"></i></a>
<% else %>
<a><i class="fa fa-circle"></i></a>
@@ -158,21 +163,16 @@
</ul>
<div class="clearfix"></div>
</div>
<div class="x_content" <%if t!=@volumes[0]%> style="display: none;" <%end%> >
<% if index == 0 %>
<div class="x_content">
<% else %>
<div class="x_content" style="display: none;">
<% end %>
<!-- left content -->
<div class="col-md-6 col-sm-6 col-xs-12">
<div style="margin: 10px">
<p class="text-muted font-13 m-b-30"><span class="badge bg-blue">Volume Info</span></p>
Type : <%=t["Type"]%> <br>
Volume ID : <%=t["Volume ID"]%> <br>
Status : <%=t["Status"]%> <br>
Number of Bricks : <%=t["Number of Bricks"]%> <br>
Transport-type : <%=t["Transport-type"]%> <br>
Bricks : <%=t["Bricks"]%> <br>
Bricks1 : <%=t["Brick1"]%> <br>
Options Reconfigured : <%=t["Options Reconfigured"]%> <br>
performance.readdir-ahead : <%=t["performance.readdir-ahead"]%> <br>
mount state: <%=t["Mount State"]%> <br>
<%= volume_info t %>
</div>
<% if t["Mount State"] == "mounted" %>
<a class="btn btn-app" href="/volume/unmount/<%=t['Volume Name'].delete(' ')%>"><i class="fa fa-upload"></i> Unmount</a>
@@ -292,7 +292,7 @@
alert("Volume name can't contains white spaces");
return;
}
<% @volumes.each do |t| %>
<% get_volumes.each do |t| %>
if(volume_name == "<%=t["Volume Name"].delete(' ')%>"){
alert("Already has a volume which name is same");
return;