This commit is contained in:
Youngkyun Kim 2016-08-27 12:14:35 +00:00
parent d28f7467f3
commit 404e72f01c
2 changed files with 20 additions and 22 deletions

View File

@ -1,6 +1,5 @@
class VolumeController < ApplicationController class VolumeController < ApplicationController
def info def info
mnt_path = "/opt/gluster-web-interface/app/mntpoint"
@volumes = Array.new @volumes = Array.new
volume = Hash.new volume = Hash.new
i = 0 i = 0
@ -14,13 +13,11 @@ class VolumeController < ApplicationController
temp = output[t].split(":") temp = output[t].split(":")
volume[temp[0]] = temp[1] volume[temp[0]] = temp[1]
else else
volume["files"] = file_directory(mnt_path + "/" + volume["Volume Name"].delete(' '), volume["Volume Name"].delete(' '))
@volumes[i] = volume @volumes[i] = volume
volume = Hash.new volume = Hash.new
i+=1 i+=1
end end
end end
volume["files"] = file_directory(mnt_path + "/" + volume["Volume Name"].delete(' '), volume["Volume Name"].delete(' '))
@volumes[i] = volume @volumes[i] = volume
puts @volumes puts @volumes
end end
@ -38,35 +35,33 @@ class VolumeController < ApplicationController
end end
def file_directory(dir, dir_name) def get_files(name)
mnt_path = "/opt/gluster-web-interface/app/mntpoint" + "/" + name.delete(' ')
files = Array.new
file = Hash.new
puts "start///////" puts "start///////"
puts "dir: " + dir puts "path: " + mnt_path
puts "dir_name: " + dir_name
@current_dir = dir
`sudo mkdir #{dir}` `sudo mkdir #{dir}`
`sudo mount.glusterfs gluster-1:/#{dir_name} #{dir}` `sudo mount.glusterfs gluster-1:/#{dir_name} #{dir}`
dir_list = `ls #{@current_dir} -l` dir_list = `ls #{dir} -l`
puts dir_list puts dir_list
parsing_list = dir_list.split("\n") parsing_list = dir_list.split("\n")
@total = parsing_list[0]
@cur_dir = dir
files = Array.new
file = Hash.new
i = 0 i = 0
@total_list = parsing_list[0]
for t in 1..(parsing_list.length-1) for t in 1..(parsing_list.length-1)
puts "@@@@@@@@@@@" + parsing_list[t] puts "@@@@@@@@@@@" + parsing_list[t]
parsing_file = parsing_list[t].split(" ") parsing_file = parsing_list[t].split(" ")
file["auth"] = parsing_file[0] file["auth"] = parsing_file[0]
file["size"] = parsing_file[4] file["size"] = parsing_file[4]
file["date"] = parsing_file[5] + " " + parsing_file[6] + " "+ parsing_file[7] file["date"] = parsing_file[5] + " " + parsing_file[6] + " "+ parsing_file[7]
file["name"] = parsing_file[8] file["name"] = parsing_file[8]
@files[i] = file files[i] = file
file = Hash.new file = Hash.new
i+=1 i+=1
end end

View File

@ -67,9 +67,11 @@
<br/> <br/>
</div> </div>
<%f = get_files(t["Volume Name"])%>
<%f.each do |t|%>
<div class="col-md-12 col-sm-12 col-xs-12"> <div class="col-md-12 col-sm-12 col-xs-12">
Current directory : <%=@current_dir%></br> Current directory : <%=@cur_dir%></br>
Numbers : <%=@total_list%></br> Numbers : <%=@total%></br>
</div> </div>
<div class="col-md-12 col-sm-12 col-xs-12"> <div class="col-md-12 col-sm-12 col-xs-12">
<p class="text-muted font-13 m-b-30"><code>File Manager</code></p> <p class="text-muted font-13 m-b-30"><code>File Manager</code></p>
@ -84,18 +86,19 @@
</thead> </thead>
<tbody> <tbody>
<%f = t["files"]%>
<%f.each do |t|%>
<tr> <tr>
<td><%=t["name"]%></td> <td><%=t["name"]%></td>
<td><%=t["auth"][0]%></td> <td><%=t["auth"][0]%></td>
<td><%=t["size"]%></td> <td><%=t["size"]%></td>
<td><%=t["date"]%></td> <td><%=t["date"]%></td>
</tr> </tr>
<%end%>
</tbody> </tbody>
</table> </table>
</div> </div>
<%end%>
</div> </div>
</div> </div>
</div> </div>