Update volume_controller: add shell command 'pwd'

This commit is contained in:
Youngkyun Kim 2016-08-28 10:12:08 +00:00
parent 7f2362ddb4
commit b7e07572ae
2 changed files with 27 additions and 15 deletions

View File

@ -2,7 +2,17 @@ class VolumeController < ApplicationController
helper_method :file_directory
def info
file_directory(`pwd`)
@conf_list = get_conf
project_path = String.new
@conf_list.each do |t|
if t.include? "project_path="
project_path = t.split("project_path=")[1]
end
end
file_directory(project_path)
@volumes = Array.new
volume = Hash.new
@ -29,13 +39,12 @@ class VolumeController < ApplicationController
end
def get_info
conf_list = get_conf
host_user = "root"
host_ip = "127.0.0.1"
host_password = "secret"
host_port = ""
conf_list.each do |t|
@conf_list.each do |t|
if t.include? "host_name="
host_user = t.split("host_user=")[1]
elsif t.include? "host_ip="
@ -70,7 +79,7 @@ class VolumeController < ApplicationController
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 << file
file = Hash.new

View File

@ -93,10 +93,12 @@
<tr>
<% if t["auth"][0]=='d'%>
<td style="color:#0d8ade;"><i class="fa fa-folder-open-o"></i>
<a onclick="change_directory('<%=@current_dir + "/" + t["name"]%>')"><%=t["name"]%></a>
<a style="cursor: pointer" onclick="change_directory('<%=@current_dir + "/" + t["name"]%>')"><%=t["name"]%></a>
</td>
<% else %>
<td><i class="fa fa-file-o"></i> <%=t["name"]%></td>
<td><i class="fa fa-file-o"></i>
<a style="cursor: pointer"><%=t["name"]%></a>
</td>
<% end %>
<td><%=t["auth"]%></td>
<td><%=t["size"]%></td>
@ -175,14 +177,14 @@
}
function change_directory(directory){
$.ajax({
$.ajax({
method: "POST",
url: "/volume/changeDir",
data: { path: directory },
success : function(result){
$("#table_div").empty();
var new_table = "<p class='text-muted font-13 m-b-30'><code>File Manager</code></p>"
new_table += "<p>Current directory : " + directory + "</p></br>";
var new_table = "<p class='text-muted font-13 m-b-30'><code>File Manager</code></p>";
new_table += "<p>Current directory : " + directory + "</p></br>";
new_table += "<table id='datatable' class='table table-striped table-bordered jambo_table'>";
new_table += "<thead>";
new_table += "<tr class='headings'>";
@ -192,11 +194,12 @@
new_table += "<th>Date</th>";
new_table += "</tr>";
new_table += "</thead>";
new_table += "<tbody id='tbody_volume1'>"
new_table += "<tbody id='tbody_volume1'>";
var new_tr = "<tr role='row' class='odd'> <td><i class='fa fa-reply'></i>";
new_tr += "<a onclick='change_upper(" + '"' + directory + '"' +")'> ..</a>"
new_tr += "</td><td> </td><td> </td><td> </td></tr>"
new_tr += "<a onclick='change_upper(" + '"' + directory + '"' +")'> ..</a>";
new_tr += "</td><td> </td><td> </td><td> </td></tr>";
for( var i = 0; i < result.file.length; i++){
if(i % 2 == 0)
new_tr += "<tr role='row' class='odd'>";
@ -205,11 +208,11 @@
if(result.file[i].auth[0] == "d"){
new_tr += "<td style='color:#0d8ade;' class='sorting_1'><i class='fa fa-folder-open-o'></i> ";
if(result.current != "/")
new_tr += "<a onclick='change_directory(" +'"' + result.current + "/" + result.file[i].name +'"'+ ")'>" + result.file[i].name + "</a></td>";
new_tr += "<a style='cursor: pointer' onclick='change_directory(" +'"' + result.current + "/" + result.file[i].name +'"'+ ")'>" + result.file[i].name + "</a></td>";
else
new_tr += "<a onclick='change_directory(" +'"' + "/" + result.file[i].name +'"'+ ")'>" + result.file[i].name + "</a></td>";
new_tr += "<a style='cursor: pointer' onclick='change_directory(" +'"' + "/" + result.file[i].name +'"'+ ")'>" + result.file[i].name + "</a></td>";
}else{
new_tr += "<td><i class='fa fa-file-o'></i> " + result.file[i].name + "</td>";
new_tr += "<td><i class='fa fa-file-o'></i><a style='cursor: pointer'>" + result.file[i].name + "</a></td>";
}
new_tr += "<td>"+result.file[i].auth+"</td>";
new_tr += "<td>"+result.file[i].size+"</td>";