From 404e72f01c6e9f1f6e9e462a767bfe9f81ff01a2 Mon Sep 17 00:00:00 2001 From: Youngkyun Kim Date: Sat, 27 Aug 2016 12:14:35 +0000 Subject: [PATCH] Update --- app/controllers/volume_controller.rb | 29 ++++++++++++---------------- app/views/volume/info.html.erb | 13 ++++++++----- 2 files changed, 20 insertions(+), 22 deletions(-) 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|%>
- Current directory : <%=@current_dir%>
- Numbers : <%=@total_list%>
+ Current directory : <%=@cur_dir%>
+ Numbers : <%=@total%>

File Manager

@@ -84,18 +86,19 @@ - <%f = t["files"]%> - <%f.each do |t|%> + <%=t["name"]%> <%=t["auth"][0]%> <%=t["size"]%> <%=t["date"]%> - <%end%> +
+ <%end%> +