This commit is contained in:
Youngkyun Kim 2016-09-02 08:36:16 +00:00
commit b3ea700922
5 changed files with 34 additions and 18 deletions

View File

@ -45,7 +45,6 @@
//= require js/datatables/dataTables.buttons.min.js
//= require js/datatables/buttons.bootstrap.min.js
//= require js/datatables/jszip.min.js
//= require js/datatables/pdfmake.min.js
//= require js/datatables/vfs_fonts.js
//= require js/datatables/buttons.html5.min.js
//= require js/datatables/buttons.print.min.js

View File

@ -1,7 +1,20 @@
class HomeController < ApplicationController
def index
config = get_conf
@current_dir = config["project_path"]
#@current_dir = config["project_path"]
@current_dir = "/mnt"
file_directory(@current_dir)
end
def make_directory
current_dir = params[:current_dir]
directory_name = params[:directory_name]
# `cd /#{current_dir}`
# `cd /#{current_dir} & mkdir #{directory_name}`
puts "mkdir #{current_dir}/#{directory_name}"
`mkdir #{current_dir}/#{directory_name}`
#output = `sshpass -p#{@config["host_password"]} ssh #{@config["host_port"]} #{@config["host_user"]}@#{@config["host_ip"]} gluster volume delete #{volume_name}`
redirect_to '/home/index'
end
end

View File

@ -5,7 +5,6 @@
<div class="title_left">
<h3>Dash Board</h3>
</div>
<div class="title_right">
<div class="col-md-5 col-sm-5 col-xs-12 form-group pull-right top_search">
<div class="input-group">
@ -21,7 +20,7 @@
<div class="row">
<div class="col-md-12">
<div class="x_panel">
<div class="x_panel">
<div class="x_title">
<h2>Input knob</h2>
<ul class="nav navbar-right panel_toolbox">
@ -68,11 +67,11 @@
</div>
</div>
</div>
</div>
<div class="col-md-6 col-sm-6 col-xs-6">
<div class="x_panel" style="height:600px;">
</div>
<div class="col-md-12 col-sm-12 col-xs-12">
<div class="x_panel">
<div class="x_title">
<h2>Dash Board</h2>
<h2>File Manager</h2>
<ul class="nav navbar-right panel_toolbox">
<li><a class="collapse-link"><i class="fa fa-chevron-up"></i></a>
</li>
@ -94,8 +93,16 @@
<div class="x_content">
<div class="col-md-12 col-sm-12 col-xs-12" id="table_div">
<p class="text-muted font-13 m-b-30"><code>File Manager</code></p>
<p> Current directory : <%=@current_dir%></p></br>
<p> Current directory : <%=@current_dir%></p>
<p>
<form style="text-align:right;" action="/home/mkdir" method="post">
<input type="text" name="directory_name" placeholder="Directory name" style="padding:6px 12px; vertical-align:middle;"/>
<input type="hidden" name="current_dir" value="<%=@current_dir%>"/>
<button class="btn btn-default" type="submit">
<i class="fa fa-plus"></i> Make Directory
</button>
</form>
</p>
<table id="datatable" class="table table-striped table-bordered jambo_table">
<thead>
<tr class="headings">
@ -109,7 +116,7 @@
<tbody id="tbody_volume1">
<tr>
<td><i class="fa fa-reply"></i>
<a onclick="change_upper('<%=@current_dir%>')"> ..</a>
<a onclick="change_upper('<%=@current_dir%>')"> ..</a>
</td>
<td></td>
<td></td>
@ -119,7 +126,7 @@
<tr>
<% if t["auth"][0]=='d'%>
<td style="color:#0d8ade;"><i class="fa fa-folder-open-o"></i>
<a style="cursor: pointer" 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>
@ -134,9 +141,7 @@
</tbody>
</table>
</div>
</div>
</div>
</div>
@ -213,6 +218,7 @@
$("#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>";
new_table += "<p style='text-align:right;'><a class='btn btn-app' href='/home/mkdir/<%=@current_dir%>'><i class='fa fa-plus'></i>Make Directory</a></p>"
new_table += "<table id='datatable' class='table table-striped table-bordered jambo_table'>";
new_table += "<thead>";
new_table += "<tr class='headings'>";
@ -240,7 +246,7 @@
else
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><a style='cursor: pointer'>" + result.file[i].name + "</a></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>";

View File

@ -117,9 +117,6 @@
</div>
<!-- /page content -->
<!-- volume functions -->
<script>
function volume_create() {

View File

@ -12,6 +12,7 @@ Rails.application.routes.draw do
#Home
get 'home/index' => 'home#index'
post 'home/mkdir' => 'home#make_directory'
#Volume