diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 73c0a64..45ea341 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -32,17 +32,17 @@ class ApplicationController < ActionController::Base file = Hash.new @total_list = parsing_list[0] - for t in 1..(parsing_list.length-1) - 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 << file - file = Hash.new - end - puts @files - return @files + for t in 1..(parsing_list.length-1) + 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 << file + file = Hash.new + end + puts @files + return @files end def checkDir diff --git a/app/controllers/volume_controller.rb b/app/controllers/volume_controller.rb index 600ab1c..3f09e1e 100644 --- a/app/controllers/volume_controller.rb +++ b/app/controllers/volume_controller.rb @@ -10,21 +10,35 @@ class VolumeController < ApplicationController if get_info.blank? flash[:danger] = "Check Server" else - output = get_info.split("\n") - for t in 1..(output.length-1) - if output[t].include? ":" - temp = output[t].split(":") - volume[temp[0]] = temp[1] - else - @volumes << volume - volume = Hash.new - end + info = get_info.split("\n") + df = get_df + puts df + + for t in 1..(info.length-1) + if info[t].include? ":" + temp = info[t].split(":") + volume[temp[0]] = temp[1] + else + if df.include? volume['Volume Name'] + volume['Mount State'] = "Mounted" + else + volume['Mount State'] = "UnMounted" + end + puts volume['Volume Name'] + ": " + volume['Mount State'] + + @volumes << volume + volume = Hash.new + end end @volumes << volume # puts @volumes end end + def get_df + @config = get_conf + return `sshpass -p#{@config["host_password"]} ssh #{@config["host_port"]} #{@config["host_user"]}@#{@config["host_ip"]} df -P` + end def get_info @config = get_conf diff --git a/app/views/home/index.html.erb b/app/views/home/index.html.erb index c2cf6d7..d51336b 100644 --- a/app/views/home/index.html.erb +++ b/app/views/home/index.html.erb @@ -110,10 +110,10 @@ -
+