Update
This commit is contained in:
parent
d28f7467f3
commit
404e72f01c
@ -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
|
||||
|
@ -67,9 +67,11 @@
|
||||
<br/>
|
||||
</div>
|
||||
|
||||
<%f = get_files(t["Volume Name"])%>
|
||||
<%f.each do |t|%>
|
||||
<div class="col-md-12 col-sm-12 col-xs-12">
|
||||
Current directory : <%=@current_dir%></br>
|
||||
Numbers : <%=@total_list%></br>
|
||||
Current directory : <%=@cur_dir%></br>
|
||||
Numbers : <%=@total%></br>
|
||||
</div>
|
||||
<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>
|
||||
@ -84,18 +86,19 @@
|
||||
</thead>
|
||||
|
||||
<tbody>
|
||||
<%f = t["files"]%>
|
||||
<%f.each do |t|%>
|
||||
|
||||
<tr>
|
||||
<td><%=t["name"]%></td>
|
||||
<td><%=t["auth"][0]%></td>
|
||||
<td><%=t["size"]%></td>
|
||||
<td><%=t["date"]%></td>
|
||||
</tr>
|
||||
<%end%>
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<%end%>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
Loading…
Reference in New Issue
Block a user