diff --git a/app/controllers/volume_controller.rb b/app/controllers/volume_controller.rb
index f0a57c0..afef770 100644
--- a/app/controllers/volume_controller.rb
+++ b/app/controllers/volume_controller.rb
@@ -1,6 +1,5 @@
class VolumeController < ApplicationController
def info
- mnt_path = "/opt/gluster-web-interface/app/mntpoint"
@volumes = Array.new
volume = Hash.new
i = 0
@@ -14,13 +13,11 @@ 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
@@ -38,35 +35,33 @@ class VolumeController < ApplicationController
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 "dir: " + dir
- puts "dir_name: " + dir_name
+ puts "path: " + mnt_path
-
- @current_dir = dir
`sudo mkdir #{dir}`
`sudo mount.glusterfs gluster-1:/#{dir_name} #{dir}`
- dir_list = `ls #{@current_dir} -l`
-
+ dir_list = `ls #{dir} -l`
puts dir_list
-
+
parsing_list = dir_list.split("\n")
+ @total = parsing_list[0]
+ @cur_dir = dir
-
- files = Array.new
- file = Hash.new
i = 0
- @total_list = parsing_list[0]
for t in 1..(parsing_list.length-1)
puts "@@@@@@@@@@@" + parsing_list[t]
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["date"] = parsing_file[5] + " " + parsing_file[6] + " "+ parsing_file[7]
file["name"] = parsing_file[8]
- @files[i] = file
+ files[i] = file
file = Hash.new
i+=1
end
diff --git a/app/views/volume/info.html.erb b/app/views/volume/info.html.erb
index 3bd10c7..49539eb 100644
--- a/app/views/volume/info.html.erb
+++ b/app/views/volume/info.html.erb
@@ -67,9 +67,11 @@
+ <%f = get_files(t["Volume Name"])%>
+ <%f.each do |t|%>
File Manager