Update volume controller

This commit is contained in:
Youngkyun Kim 2016-08-27 07:50:36 -04:00
parent 6bebf599ce
commit 8fe78e8384
11 changed files with 31 additions and 16 deletions

View File

@ -1,11 +1,10 @@
class VolumeController < ApplicationController
def info
file_directory('/home/ubuntu')
mnt_path = "/opt/gluster-web-interface/app/mntpoint"
@volumes = Array.new
volume = Hash.new
i = 0
if get_info.blank?
flash[:danger] = "Check Server"
else
@ -15,11 +14,13 @@ class VolumeController < ApplicationController
temp = output[t].split(":")
volume[temp[0]] = temp[1]
else
volume["files"] = file_directory(mnt_path + "/" + volume["Volume Name"].delete(' '), volume["Volume Name"].delete(' '))
@volumes[i] = volume
volume = Hash.new
i+=1
end
end
volume["files"] = file_directory(mnt_path + "/" + volume["Volume Name"].delete(' '), volume["Volume Name"].delete(' '))
@volumes[i] = volume
puts @volumes
end
@ -37,13 +38,24 @@ class VolumeController < ApplicationController
end
def file_directory(dir)
def file_directory(dir, dir_name)
puts "start///////"
puts "dir: " + dir
puts "dir_name: " + dir_name
@current_dir = dir
`sudo mkdir #{dir}`
`sudo mount.glusterfs gluster-1:/#{dir_name} #{dir}`
dir_list = `ls #{@current_dir} -l`
puts dir_list
parsing_list = dir_list.split("\n")
@files = Array.new
files = Array.new
file = Hash.new
i = 0
@total_list = parsing_list[0]
@ -52,12 +64,14 @@ class VolumeController < ApplicationController
parsing_file = parsing_list[t].split(" ")
file["auth"] = parsing_file[0]
file["size"] = parsing_file[4]
file["date"] = parsing_file[5] + " " + parsing_file[6] + " "+ parsing_file[7]
file["name"] = parsing_file[8]
@files[i] = file
file = Hash.new
i+=1
file["date"] = parsing_file[5] + " " + parsing_file[6] + " "+ parsing_file[7]
file["name"] = parsing_file[8]
@files[i] = file
file = Hash.new
i+=1
end
puts @files
puts files
return files
end
end

Binary file not shown.

View File

View File

View File

View File

View File

View File

@ -4,7 +4,7 @@
<div class="">
<div class="page-title">
<div class="title_left">
<h3>Volume Info </h3>
<h3>Volume</h3>
</div>
<div class="title_right">
<div class="col-md-5 col-sm-5 col-xs-12 form-group pull-right top_search">
@ -84,7 +84,8 @@
</thead>
<tbody>
<%@files.each do |t|%>
<%f = t["files"]%>
<%f.each do |t|%>
<tr>
<td><%=t["name"]%></td>
<td><%=t["auth"][0]%></td>
@ -156,4 +157,4 @@
});
});
TableManageButtons.init();
</script>
</script>

View File

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