Update volume_controller: add shell command 'pwd'
This commit is contained in:
parent
7f2362ddb4
commit
b7e07572ae
@ -2,7 +2,17 @@ class VolumeController < ApplicationController
|
|||||||
helper_method :file_directory
|
helper_method :file_directory
|
||||||
|
|
||||||
def info
|
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
|
@volumes = Array.new
|
||||||
volume = Hash.new
|
volume = Hash.new
|
||||||
|
|
||||||
@ -29,13 +39,12 @@ class VolumeController < ApplicationController
|
|||||||
end
|
end
|
||||||
|
|
||||||
def get_info
|
def get_info
|
||||||
conf_list = get_conf
|
|
||||||
host_user = "root"
|
host_user = "root"
|
||||||
host_ip = "127.0.0.1"
|
host_ip = "127.0.0.1"
|
||||||
host_password = "secret"
|
host_password = "secret"
|
||||||
host_port = ""
|
host_port = ""
|
||||||
|
|
||||||
conf_list.each do |t|
|
@conf_list.each do |t|
|
||||||
if t.include? "host_name="
|
if t.include? "host_name="
|
||||||
host_user = t.split("host_user=")[1]
|
host_user = t.split("host_user=")[1]
|
||||||
elsif t.include? "host_ip="
|
elsif t.include? "host_ip="
|
||||||
@ -70,7 +79,7 @@ class VolumeController < ApplicationController
|
|||||||
parsing_file = parsing_list[t].split(" ")
|
parsing_file = parsing_list[t].split(" ")
|
||||||
file["auth"] = parsing_file[0]
|
file["auth"] = parsing_file[0]
|
||||||
file["size"] = parsing_file[4]
|
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]
|
file["name"] = parsing_file[8]
|
||||||
@files << file
|
@files << file
|
||||||
file = Hash.new
|
file = Hash.new
|
||||||
|
@ -93,10 +93,12 @@
|
|||||||
<tr>
|
<tr>
|
||||||
<% if t["auth"][0]=='d'%>
|
<% if t["auth"][0]=='d'%>
|
||||||
<td style="color:#0d8ade;"><i class="fa fa-folder-open-o"></i>
|
<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>
|
</td>
|
||||||
<% else %>
|
<% 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 %>
|
<% end %>
|
||||||
<td><%=t["auth"]%></td>
|
<td><%=t["auth"]%></td>
|
||||||
<td><%=t["size"]%></td>
|
<td><%=t["size"]%></td>
|
||||||
@ -175,13 +177,13 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
function change_directory(directory){
|
function change_directory(directory){
|
||||||
$.ajax({
|
$.ajax({
|
||||||
method: "POST",
|
method: "POST",
|
||||||
url: "/volume/changeDir",
|
url: "/volume/changeDir",
|
||||||
data: { path: directory },
|
data: { path: directory },
|
||||||
success : function(result){
|
success : function(result){
|
||||||
$("#table_div").empty();
|
$("#table_div").empty();
|
||||||
var new_table = "<p class='text-muted font-13 m-b-30'><code>File Manager</code></p>"
|
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 += "<p>Current directory : " + directory + "</p></br>";
|
||||||
new_table += "<table id='datatable' class='table table-striped table-bordered jambo_table'>";
|
new_table += "<table id='datatable' class='table table-striped table-bordered jambo_table'>";
|
||||||
new_table += "<thead>";
|
new_table += "<thead>";
|
||||||
@ -192,11 +194,12 @@
|
|||||||
new_table += "<th>Date</th>";
|
new_table += "<th>Date</th>";
|
||||||
new_table += "</tr>";
|
new_table += "</tr>";
|
||||||
new_table += "</thead>";
|
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>";
|
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 += "<a onclick='change_upper(" + '"' + directory + '"' +")'> ..</a>";
|
||||||
new_tr += "</td><td> </td><td> </td><td> </td></tr>"
|
new_tr += "</td><td> </td><td> </td><td> </td></tr>";
|
||||||
|
|
||||||
for( var i = 0; i < result.file.length; i++){
|
for( var i = 0; i < result.file.length; i++){
|
||||||
if(i % 2 == 0)
|
if(i % 2 == 0)
|
||||||
new_tr += "<tr role='row' class='odd'>";
|
new_tr += "<tr role='row' class='odd'>";
|
||||||
@ -205,11 +208,11 @@
|
|||||||
if(result.file[i].auth[0] == "d"){
|
if(result.file[i].auth[0] == "d"){
|
||||||
new_tr += "<td style='color:#0d8ade;' class='sorting_1'><i class='fa fa-folder-open-o'></i> ";
|
new_tr += "<td style='color:#0d8ade;' class='sorting_1'><i class='fa fa-folder-open-o'></i> ";
|
||||||
if(result.current != "/")
|
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
|
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{
|
}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].auth+"</td>";
|
||||||
new_tr += "<td>"+result.file[i].size+"</td>";
|
new_tr += "<td>"+result.file[i].size+"</td>";
|
||||||
|
Loading…
Reference in New Issue
Block a user