diff --git a/app/views/home/index.html.erb b/app/views/home/index.html.erb index b7b48af..bc0367a 100644 --- a/app/views/home/index.html.erb +++ b/app/views/home/index.html.erb @@ -36,8 +36,8 @@ <% users = User.all %> - <% nodes = Node.all %> - <% vols = ssh_volume_info %> + <% nodes = ssh_nodes %> + <% volumes = ssh_volume_info %> <% today_user = User.where(:last_sign_in_at => Date.today..Date.tomorrow) %> <% today_node = Node.where(:created_at => Date.today..Date.tomorrow) %>
@@ -83,10 +83,10 @@
Total volumes -
<%= vols.nil? ? 0 : vols.length %>
+
<%= volumes.nil? ? 0 : volumes.length %>
- <%= vols.count{|x| x['Status'].eql? " Started"} %> started / - <%= vols.count{|x| x['Mount State'].eql? "mounted"} %> mounted + <%= volumes.count{|x| x['Status'].eql? " Started"} %> started / + <%= volumes.count{|x| x['Mount State'].eql? "mounted"} %> mounted
@@ -101,8 +101,8 @@ +
-
@@ -131,9 +131,9 @@
+ - <% nodes = ssh_nodes %> - <% volumes = ssh_volume_info %> +
@@ -156,238 +156,234 @@
- <% if nodes.nil? %> -
- <% ping = ((nodes.select{ |node| node["ping"].eql? "true" }.length.to_f / nodes.length.to_f) * 100).to_i %> -
- ping -
-
-
-
-
-
-
-
- <%= nodes.select{ |node| node["ping"].eql? "true" }.length %> / <%= nodes.length %> -
-
+ <% if !nodes.nil? %> +
+ <% ping = ((nodes.select{ |node| node["ping"].eql? "true" }.length.to_f / nodes.length.to_f) * 100).to_i %> +
+ ping
-
- <% ssh = ((nodes.select{ |node| node["ssh"].eql? "on" }.length.to_f / nodes.length.to_f) * 100).to_i %> -
- ssh -
-
-
-
-
-
-
-
- <%= nodes.select{ |node| node["ssh"].eql? "on" }.length %> / <%= nodes.length %> -
-
-
-
- <% gluster = ((nodes.select{ |node| node["gluster"].eql? "on" }.length.to_f / nodes.length.to_f) * 100).to_i %> -
- gluster operation -
-
-
-
-
-
-
-
- <%= nodes.select{ |node| node["gluster"].eql? "on" }.length %> / <%= nodes.length %> -
-
-
- <% else %> -
- - -
-
-

Volumes Status

- +
+
+ <%= nodes.select{ |node| node["ping"].eql? "true" }.length %> / <%= nodes.length %> +
-
- <% if volumes.nil? %> -
- <% start = ((volumes.select{ |volume| volume["Status"].eql? " Started" }.length.to_f / volumes.length.to_f) * 100).to_i %> -
- started -
-
-
-
-
-
-
-
- <%= volumes.select{ |volume| volume["Status"].eql? " Started" }.length %> / <%= volumes.length %> -
-
+
+ <% ssh = ((nodes.select{ |node| node["ssh"].eql? "on" }.length.to_f / nodes.length.to_f) * 100).to_i %> +
+ ssh +
+
+
+
-
- <% mount = ((volumes.select{ |volume| volume["Mount State"].eql? "mounted" }.length.to_f / volumes.length.to_f) * 100).to_i %> -
- mounted -
-
-
-
-
-
-
-
- <%= volumes.select{ |volume| volume["Mount State"].eql? "mounted" }.length %> / <%= volumes.length %> -
-
-
- <% else %> -
- -
- <% end %> +
+
+
+ <%= nodes.select{ |node| node["ssh"].eql? "on" }.length %> / <%= nodes.length %> +
+
+
+
+ <% gluster = ((nodes.select{ |node| node["gluster"].eql? "on" }.length.to_f / nodes.length.to_f) * 100).to_i %> +
+ gluster operation +
+
+
+
+
+
+ <%= nodes.select{ |node| node["gluster"].eql? "on" }.length %> / <%= nodes.length %> +
+
- - - -
-
-
-

Nodes List

- -
-
-
-
    - <% if nodes.nil? %> - <% nodes.each do |node| %> -
  • - <% if node["ping"].eql? "true" %> - - - - <% else %> - - - - <% end %> -
    - "><%= node["host_name"] %> -

    <%= node["host_ip"] %> <%= node["user_name"] %>

    - <% if node["gluster"].eql? "on" %> -

    number of peers: <%= node["number_of_peers"] %>

    - <% end %> -
    -
  • - <% end %> - <% else %> -
    - -
    - <% end %> -
-
+ <% else %> +
+
- - - -
-
-
-

Mounted usage

- -
-
-
- - <% if volumes.nil? or ( (volumes.select{ |volume| volume["Mount State"].eql? "mounted" }.length) == 0) %> -
- -
-
- <%= raw html_disk_file_table %> -
- <% else %> - - <%= raw html_disk_file_table %> - <% end %> -
-
-
- - + <% end %>
- -
+
+
+
+

Volumes Status

+ +
+
+ <% if !volumes.nil? %> +
+ <% start = ((volumes.select{ |volume| volume["Status"].eql? " Started" }.length.to_f / volumes.length.to_f) * 100).to_i %> +
+ started +
+
+
+
+
+
+
+
+ <%= volumes.select{ |volume| volume["Status"].eql? " Started" }.length %> / <%= volumes.length %> +
+
+
+
+ <% mount = ((volumes.select{ |volume| volume["Mount State"].eql? "mounted" }.length.to_f / volumes.length.to_f) * 100).to_i %> +
+ mounted +
+
+
+
+
+
+
+
+ <%= volumes.select{ |volume| volume["Mount State"].eql? "mounted" }.length %> / <%= volumes.length %> +
+
+
+<% else %> +
+ +
+<% end %> +
+
+
+ + + +
+
+
+

Nodes List

+ +
+
+
+
    + <% if !nodes.nil? %> + <% nodes.each do |node| %> +
  • + <% if node["ping"].eql? "true" %> + + + + <% else %> + + + + <% end %> +
    + "><%= node["host_name"] %> +

    <%= node["host_ip"] %> <%= node["user_name"] %>

    + <% if node["gluster"].eql? "on" %> +

    number of peers: <%= node["number_of_peers"] %>

    + <% end %> +
    +
  • + <% end %> + <% else %> +
    + +
    + <% end %> +
+
+
+
+ + + +
+
+
+

Mounted usage

+ +
+
+
+ <% if volumes.nil? or ( (volumes.select{ |volume| volume["Mount State"].eql? "mounted" }.length) == 0) %> +
+ +
+
+ <%= raw html_disk_file_table %> +
+ <% else %> + + <%= raw html_disk_file_table %> + <% end %> +
+
+
+ +
+ +