Add scope resolution to Routes and Controllers
This commit is contained in:
parent
3312f36cb8
commit
15db7f27de
3
Gemfile
3
Gemfile
@ -36,9 +36,6 @@ group :development, :test do
|
||||
end
|
||||
|
||||
group :development do
|
||||
# Access an IRB console on exception pages or by using <%= console %> in views
|
||||
gem 'web-console', '~> 2.0'
|
||||
|
||||
# Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
|
||||
gem 'spring'
|
||||
end
|
||||
|
@ -20,3 +20,7 @@
|
||||
//= require gentelella/vendors/moment/moment.js
|
||||
//= require gentelella/vendors/nprogress/nprogress.js
|
||||
//= require gentelella/vendors/validator/validator.js
|
||||
|
||||
$(function() {
|
||||
console.log("Application js");
|
||||
});
|
||||
|
77
app/assets/javascripts/web/home/index.js
Normal file
77
app/assets/javascripts/web/home/index.js
Normal file
@ -0,0 +1,77 @@
|
||||
function draw_datatable(){
|
||||
$('#file_manager_table').dataTable( {
|
||||
"bSort": false,
|
||||
initComplete: function(){
|
||||
$('#file_manager_table_filter').detach().appendTo("#file_manager_title_div").css({
|
||||
'width':'250px'
|
||||
});
|
||||
$('#file_manager_table_length').detach().appendTo("#file_manager_title_div").css({
|
||||
'width':'150px',
|
||||
'float':'right'
|
||||
});
|
||||
$('#file_manager_title_div').css({
|
||||
'width':'100%',
|
||||
'height':'48px',
|
||||
});
|
||||
$('#file_manager_title_div input').css({
|
||||
'width':'70%',
|
||||
'height':'70%',
|
||||
'font-size':'14px',
|
||||
'padding':'5px'
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
$('#disk_usage_tile_table').dataTable({
|
||||
"bSort":false,
|
||||
"bFilter":false,
|
||||
"bInfo":false,
|
||||
initComplete: function(){
|
||||
$('#disk_usage_tile_table_length').detach().appendTo("#disk_usage_title_div").css({
|
||||
'width':'150px',
|
||||
'float':'right'
|
||||
});
|
||||
$('#disk_usage_title_div').css({
|
||||
'width':'100%',
|
||||
'height':'48px',
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function draw_chart(du){
|
||||
var options = {
|
||||
legend: false,
|
||||
responsive: false
|
||||
};
|
||||
var colors = ["#3498DB", "#26B99A", "#E74C3C", "#9B59B6", "#BDC3C7"];
|
||||
var labels = [];
|
||||
var data = [];
|
||||
var backgroundColor = [];
|
||||
var hoverBackgroundColor = [];
|
||||
|
||||
for(var i = 0; i < du.length; i++){
|
||||
labels.push(du[i]['file_name']);
|
||||
data.push(du[i]['usage']);
|
||||
backgroundColor.push(colors[i % colors.length]);
|
||||
hoverBackgroundColor.push(colors[i % colors.length]);
|
||||
}
|
||||
|
||||
new Chart(document.getElementById("disk_usage_table_canvas"), {
|
||||
type: 'doughnut',
|
||||
tooltipFillColor: "rgba(51, 51, 51, 0.55)",
|
||||
data: {
|
||||
labels: labels,
|
||||
datasets: [{
|
||||
data: data,
|
||||
backgroundColor: backgroundColor,
|
||||
hoverBackgroundColor: hoverBackgroundColor
|
||||
}]
|
||||
},
|
||||
options: options
|
||||
});
|
||||
}
|
||||
|
||||
$(function() {
|
||||
console.log("Home js");
|
||||
});
|
@ -1,5 +1,6 @@
|
||||
@import "bootstrap";
|
||||
@import "bootstrap-sprockets";
|
||||
@import "bootstrap";
|
||||
|
||||
@import "contextmenu";
|
||||
@import "font-awesome";
|
||||
@import "loading";
|
||||
|
@ -1,16 +1,14 @@
|
||||
class ApplicationController < ActionController::Base
|
||||
# Prevent CSRF attacks by raising an exception.
|
||||
# For APIs, you may want to use :null_session instead.
|
||||
# protect_from_forgery with: :exception
|
||||
include ApplicationHelper
|
||||
include HomeHelper
|
||||
include VolumeHelper
|
||||
include NodeHelper
|
||||
protect_from_forgery with: :exception
|
||||
include ApplicationHelper
|
||||
include HomeHelper
|
||||
include VolumeHelper
|
||||
include NodeHelper
|
||||
|
||||
def require_login
|
||||
unless user_signed_in?
|
||||
flash[:error] = "Please, Login required to use the service."
|
||||
redirect_to "/users/sign_in" # halts request cycle
|
||||
end
|
||||
def require_login
|
||||
unless user_signed_in?
|
||||
flash[:error] = "Please, Login required to use the service."
|
||||
redirect_to "/users/sign_in" # halts request cycle
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -1,4 +1,4 @@
|
||||
class HomeController < ApplicationController
|
||||
class Web::HomeController < WebController
|
||||
before_action :require_login
|
||||
|
||||
def index
|
@ -1,4 +1,4 @@
|
||||
class NodeController < ApplicationController
|
||||
class Web::NodeController < WebController
|
||||
before_action :require_login
|
||||
|
||||
def index
|
||||
@ -6,7 +6,7 @@ class NodeController < ApplicationController
|
||||
def detail
|
||||
@node_id = params[:node_id]
|
||||
end
|
||||
|
||||
|
||||
def node_update
|
||||
one_node = Node.find(params[:node_id])
|
||||
one_node.host_name = params[:host_name]
|
||||
@ -14,9 +14,9 @@ class NodeController < ApplicationController
|
||||
one_node.user_name = params[:user_name]
|
||||
one_node.user_password = params[:user_password]
|
||||
one_node.save
|
||||
|
||||
|
||||
redirect_to '/node/detail/' + params[:node_id]
|
||||
|
||||
|
||||
end
|
||||
|
||||
def node_add
|
@ -1,4 +1,4 @@
|
||||
class VolumeController < ApplicationController
|
||||
class Web::VolumeController < WebController
|
||||
before_action :require_login
|
||||
|
||||
def index
|
2
app/controllers/web_controller.rb
Normal file
2
app/controllers/web_controller.rb
Normal file
@ -0,0 +1,2 @@
|
||||
class WebController < ApplicationController
|
||||
end
|
@ -2,126 +2,38 @@
|
||||
<html>
|
||||
<head>
|
||||
<title><%= content_for?(:title) ? yield(:title) : "gluster-web" %> </title>
|
||||
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track' => false %>
|
||||
<%= javascript_include_tag 'application', 'data-turbolinks-track' => false %>
|
||||
|
||||
<%= csrf_meta_tags %>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
|
||||
<!-- Datatable functions -->
|
||||
<script>
|
||||
function draw_datatable(){
|
||||
$('#file_manager_table').dataTable( {
|
||||
"bSort": false,
|
||||
initComplete: function(){
|
||||
$('#file_manager_table_filter').detach().appendTo("#file_manager_title_div").css({
|
||||
'width':'250px'
|
||||
});
|
||||
$('#file_manager_table_length').detach().appendTo("#file_manager_title_div").css({
|
||||
'width':'150px',
|
||||
'float':'right'
|
||||
});
|
||||
$('#file_manager_title_div').css({
|
||||
'width':'100%',
|
||||
'height':'48px',
|
||||
});
|
||||
$('#file_manager_title_div input').css({
|
||||
'width':'70%',
|
||||
'height':'70%',
|
||||
'font-size':'14px',
|
||||
'padding':'5px'
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
$('#disk_usage_tile_table').dataTable({
|
||||
"bSort":false,
|
||||
"bFilter":false,
|
||||
"bInfo":false,
|
||||
initComplete: function(){
|
||||
$('#disk_usage_tile_table_length').detach().appendTo("#disk_usage_title_div").css({
|
||||
'width':'150px',
|
||||
'float':'right'
|
||||
});
|
||||
$('#disk_usage_title_div').css({
|
||||
'width':'100%',
|
||||
'height':'48px',
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
function draw_chart(du){
|
||||
var options = {
|
||||
legend: false,
|
||||
responsive: false
|
||||
};
|
||||
var colors = ["#3498DB", "#26B99A", "#E74C3C", "#9B59B6", "#BDC3C7"];
|
||||
var labels = [];
|
||||
var data = [];
|
||||
var backgroundColor = [];
|
||||
var hoverBackgroundColor = [];
|
||||
|
||||
for(var i = 0; i < du.length; i++){
|
||||
labels.push(du[i]['file_name']);
|
||||
data.push(du[i]['usage']);
|
||||
backgroundColor.push(colors[i % colors.length]);
|
||||
hoverBackgroundColor.push(colors[i % colors.length]);
|
||||
}
|
||||
|
||||
new Chart(document.getElementById("disk_usage_table_canvas"), {
|
||||
type: 'doughnut',
|
||||
tooltipFillColor: "rgba(51, 51, 51, 0.55)",
|
||||
data: {
|
||||
labels: labels,
|
||||
datasets: [{
|
||||
data: data,
|
||||
backgroundColor: backgroundColor,
|
||||
hoverBackgroundColor: hoverBackgroundColor
|
||||
}]
|
||||
},
|
||||
options: options
|
||||
});
|
||||
}
|
||||
function loading(){
|
||||
$(location).attr('href',"#loading");
|
||||
}
|
||||
</script>
|
||||
<!-- /Datatable functions -->
|
||||
</head>
|
||||
<div id="loading" class="overlay">
|
||||
<div class="sk-fading-circle" class="overlay">
|
||||
<div class="sk-circle1 sk-circle"></div>
|
||||
<div class="sk-circle2 sk-circle"></div>
|
||||
<div class="sk-circle3 sk-circle"></div>
|
||||
<div class="sk-circle4 sk-circle"></div>
|
||||
<div class="sk-circle5 sk-circle"></div>
|
||||
<div class="sk-circle6 sk-circle"></div>
|
||||
<div class="sk-circle7 sk-circle"></div>
|
||||
<div class="sk-circle8 sk-circle"></div>
|
||||
<div class="sk-circle9 sk-circle"></div>
|
||||
<div class="sk-circle10 sk-circle"></div>
|
||||
<div class="sk-circle11 sk-circle"></div>
|
||||
<div class="sk-circle12 sk-circle"></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<body class="nav-md">
|
||||
|
||||
<div class="container body">
|
||||
|
||||
<% flash.each do |key, value| %>
|
||||
<div align="center" id="flash" class="alert alert-<%= key %>"><%= value %>
|
||||
<a href="#" data-dismiss="alert" class="close">×</a>
|
||||
<div id="spinner" class="overlay">
|
||||
<div class="sk-fading-circle" class="overlay">
|
||||
<div class="sk-circle1 sk-circle"></div>
|
||||
<div class="sk-circle2 sk-circle"></div>
|
||||
<div class="sk-circle3 sk-circle"></div>
|
||||
<div class="sk-circle4 sk-circle"></div>
|
||||
<div class="sk-circle5 sk-circle"></div>
|
||||
<div class="sk-circle6 sk-circle"></div>
|
||||
<div class="sk-circle7 sk-circle"></div>
|
||||
<div class="sk-circle8 sk-circle"></div>
|
||||
<div class="sk-circle9 sk-circle"></div>
|
||||
<div class="sk-circle10 sk-circle"></div>
|
||||
<div class="sk-circle11 sk-circle"></div>
|
||||
<div class="sk-circle12 sk-circle"></div>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
</div>
|
||||
<% flash.each do |key, value| %>
|
||||
<div align="center" id="flash" class="alert alert-<%= key %>"><%= value %>
|
||||
<a href="#" data-dismiss="alert" class="close">×</a>
|
||||
</div>
|
||||
<% end %>
|
||||
<div class="container body">
|
||||
<%= render "partials/sidenav" %>
|
||||
<%= render "partials/topnav" %>
|
||||
|
||||
<%= yield %>
|
||||
|
||||
<%= render "partials/footer" %>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
|
@ -1,140 +0,0 @@
|
||||
<!-- page content -->
|
||||
<div class="right_col" role="main">
|
||||
<div class="">
|
||||
<div class="page-title">
|
||||
<div class="title_left">
|
||||
<h3>Plain Page</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">
|
||||
<input type="text" class="form-control" placeholder="Search for...">
|
||||
<span class="input-group-btn">
|
||||
<button class="btn btn-default" type="button">Go!</button>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="clearfix"></div>
|
||||
|
||||
<div class="row">
|
||||
|
||||
<div class="col-md-12 col-sm-12 col-xs-12">
|
||||
<div class="x_panel" style="height:600px;">
|
||||
<div class="x_title">
|
||||
<h2>Plain Page</h2>
|
||||
<ul class="nav navbar-right panel_toolbox">
|
||||
<li><a class="collapse-link"><i class="fa fa-chevron-up"></i></a>
|
||||
</li>
|
||||
<li class="dropdown">
|
||||
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false"><i class="fa fa-wrench"></i></a>
|
||||
<ul class="dropdown-menu" role="menu">
|
||||
<li><a href="#">Settings 1</a>
|
||||
</li>
|
||||
<li><a href="#">Settings 2</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li><a class="close-link"><i class="fa fa-close"></i></a>
|
||||
</li>
|
||||
</ul>
|
||||
<div class="clearfix"></div>
|
||||
</div>
|
||||
ttt
|
||||
<div class="col-md-6">
|
||||
<div id="reportrange" class="pull-right" style="background: #fff; cursor: pointer; padding: 5px 10px; border: 1px solid #ccc">
|
||||
<i class="glyphicon glyphicon-calendar fa fa-calendar"></i>
|
||||
<span>December 30, 2014 - January 28, 2015</span> <b class="caret"></b>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- /page content -->
|
||||
|
||||
<!--Test Page specific JS -->
|
||||
<script type="text/javascript">
|
||||
|
||||
//alert ('Test Page specific JS')
|
||||
</script>
|
||||
|
||||
<!-- datepicker -->
|
||||
<script type="text/javascript">
|
||||
$(document).ready(function() {
|
||||
|
||||
var cb = function(start, end, label) {
|
||||
console.log(start.toISOString(), end.toISOString(), label);
|
||||
$('#reportrange span').html(start.format('MMMM D, YYYY') + ' - ' + end.format('MMMM D, YYYY'));
|
||||
//alert("Callback has fired: [" + start.format('MMMM D, YYYY') + " to " + end.format('MMMM D, YYYY') + ", label = " + label + "]");
|
||||
}
|
||||
|
||||
var optionSet1 = {
|
||||
startDate: moment().subtract(29, 'days'),
|
||||
endDate: moment(),
|
||||
minDate: '01/01/2012',
|
||||
maxDate: '12/31/2015',
|
||||
dateLimit: {
|
||||
days: 60
|
||||
},
|
||||
showDropdowns: true,
|
||||
showWeekNumbers: true,
|
||||
timePicker: false,
|
||||
timePickerIncrement: 1,
|
||||
timePicker12Hour: true,
|
||||
ranges: {
|
||||
'Today': [moment(), moment()],
|
||||
'Yesterday': [moment().subtract(1, 'days'), moment().subtract(1, 'days')],
|
||||
'Last 7 Days': [moment().subtract(6, 'days'), moment()],
|
||||
'Last 30 Days': [moment().subtract(29, 'days'), moment()],
|
||||
'This Month': [moment().startOf('month'), moment().endOf('month')],
|
||||
'Last Month': [moment().subtract(1, 'month').startOf('month'), moment().subtract(1, 'month').endOf('month')]
|
||||
},
|
||||
opens: 'left',
|
||||
buttonClasses: ['btn btn-default'],
|
||||
applyClass: 'btn-small btn-primary',
|
||||
cancelClass: 'btn-small',
|
||||
format: 'MM/DD/YYYY',
|
||||
separator: ' to ',
|
||||
locale: {
|
||||
applyLabel: 'Submit',
|
||||
cancelLabel: 'Clear',
|
||||
fromLabel: 'From',
|
||||
toLabel: 'To',
|
||||
customRangeLabel: 'Custom',
|
||||
daysOfWeek: ['Su', 'Mo', 'Tu', 'We', 'Th', 'Fr', 'Sa'],
|
||||
monthNames: ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'],
|
||||
firstDay: 1
|
||||
}
|
||||
};
|
||||
$('#reportrange span').html(moment().subtract(29, 'days').format('MMMM D, YYYY') + ' - ' + moment().format('MMMM D, YYYY'));
|
||||
$('#reportrange').daterangepicker(optionSet1, cb);
|
||||
$('#reportrange').on('show.daterangepicker', function() {
|
||||
console.log("show event fired");
|
||||
});
|
||||
$('#reportrange').on('hide.daterangepicker', function() {
|
||||
console.log("hide event fired");
|
||||
});
|
||||
$('#reportrange').on('apply.daterangepicker', function(ev, picker) {
|
||||
console.log("apply event fired, start/end dates are " + picker.startDate.format('MMMM D, YYYY') + " to " + picker.endDate.format('MMMM D, YYYY'));
|
||||
});
|
||||
$('#reportrange').on('cancel.daterangepicker', function(ev, picker) {
|
||||
console.log("cancel event fired");
|
||||
});
|
||||
$('#options1').click(function() {
|
||||
$('#reportrange').data('daterangepicker').setOptions(optionSet1, cb);
|
||||
});
|
||||
$('#options2').click(function() {
|
||||
$('#reportrange').data('daterangepicker').setOptions(optionSet2, cb);
|
||||
});
|
||||
$('#destroy').click(function() {
|
||||
$('#reportrange').data('daterangepicker').remove();
|
||||
});
|
||||
});
|
||||
</script>
|
@ -378,162 +378,3 @@
|
||||
<!-- /disk usage -->
|
||||
</div>
|
||||
<!-- /second row -->
|
||||
|
||||
</div>
|
||||
<!-- /page content -->
|
||||
|
||||
<!-- On ready -->
|
||||
<script>
|
||||
$(document).ready(function() {
|
||||
var du = [];
|
||||
<% get_du.each_with_index do |du, index| %>
|
||||
du.push({
|
||||
'file_name':"<%= du['file_name'] %>",
|
||||
'usage':"<%= du['usage'] %>"
|
||||
});
|
||||
<% end %>
|
||||
draw_datatable();
|
||||
draw_chart(du);
|
||||
|
||||
var options = {
|
||||
legend: false,
|
||||
responsive: false
|
||||
};
|
||||
var colors = ["#3498DB", "#26B99A", "#E74C3C", "#9B59B6", "#BDC3C7"];
|
||||
var labels = [];
|
||||
var data = [];
|
||||
var backgroundColor = [];
|
||||
var hoverBackgroundColor = [];
|
||||
|
||||
var df = [];
|
||||
|
||||
<% nodes = Node.all %>
|
||||
<% get_df.each_with_index do |df, index| %>
|
||||
<% ip = df['Filesystem'].split(":").first %>
|
||||
<% next if nodes.select{|node| node["host_ip"].eql? ip}.length == 0 %>
|
||||
df.push({
|
||||
'file_name':"<%= df['Filesystem'] %>",
|
||||
'usage':"<%= (df["Use%"][0..df["Use%"].length - 1]).to_f / 100 %>"
|
||||
});
|
||||
<% end %>
|
||||
|
||||
for(var i = 0; i < df.length; i++){
|
||||
labels.push(df[i]['file_name']);
|
||||
data.push(df[i]['usage']);
|
||||
backgroundColor.push(colors[i % colors.length]);
|
||||
hoverBackgroundColor.push(colors[i % colors.length]);
|
||||
}
|
||||
|
||||
new Chart(document.getElementById("disk_file_table_canvas"), {
|
||||
type: 'doughnut',
|
||||
tooltipFillColor: "rgba(51, 51, 51, 0.55)",
|
||||
data: {
|
||||
labels: labels,
|
||||
datasets: [{
|
||||
data: data,
|
||||
backgroundColor: backgroundColor,
|
||||
hoverBackgroundColor: hoverBackgroundColor
|
||||
}]
|
||||
},
|
||||
options: options
|
||||
});
|
||||
})
|
||||
</script>
|
||||
<!-- /On ready -->
|
||||
|
||||
<!-- File manager functions -->
|
||||
<script>
|
||||
// change directory
|
||||
$(document).on("click", "#file_manager_div .chdir", function(){
|
||||
var file_name = $(this).text().trim();
|
||||
var current_dir = $("#file_manager_div span").text().trim();
|
||||
if(current_dir == "/") current_dir = "";
|
||||
var next_dir = current_dir + "/" + file_name;
|
||||
|
||||
$.ajax({
|
||||
method : "post",
|
||||
url : "/home/chdir",
|
||||
data : { next_dir : next_dir },
|
||||
beforeSend : function(){
|
||||
$(location).attr('href',"#loading");
|
||||
//Pace.start();
|
||||
},
|
||||
success : function(result){
|
||||
$("#current_dir").val(next_dir);
|
||||
$("#file_manager_title_div").empty().append("<h2 style='width:130px'>File manager</h2>");
|
||||
$("#disk_usage_title_div").empty().append("<h2 style='width:130px'>Disk usage</h2>");
|
||||
$("#file_manager_div").empty().append(result.file_manager_table);
|
||||
$("#disk_usage_div").empty().append(result.disk_usage_table);
|
||||
|
||||
draw_datatable();
|
||||
draw_chart(result.du);
|
||||
$(location).attr('href',"#");
|
||||
//check_divheight();
|
||||
//Pace.stop();
|
||||
}
|
||||
})
|
||||
})
|
||||
// change upper
|
||||
$(document).on("click", "#file_manager_div .chupper", function(){
|
||||
var current_dir = $("#file_manager_div span").text().trim();
|
||||
if(current_dir == "/") return;
|
||||
var lastindex = current_dir.lastIndexOf("/");
|
||||
console.log("curdir : " + current_dir);
|
||||
console.log("last idx : " + lastindex);
|
||||
if(lastindex == 0) lastindex++;
|
||||
var next_dir = current_dir.substring(0, lastindex);
|
||||
|
||||
$.ajax({
|
||||
method : "POST",
|
||||
url : "/home/chdir",
|
||||
data : { next_dir : next_dir },
|
||||
beforeSend : function(){
|
||||
//Pace.start();
|
||||
$(location).attr('href',"#loading");
|
||||
},
|
||||
success : function(result){
|
||||
$("#current_dir").val(next_dir);
|
||||
$("#file_manager_title_div").empty().append("<h2 style='width:130px'>File manager</h2>");
|
||||
$("#disk_usage_title_div").empty().append("<h2 style='width:130px'>Disk usage</h2>");
|
||||
$("#file_manager_div").empty().append(result.file_manager_table);
|
||||
$("#disk_usage_div").empty().append(result.disk_usage_table);
|
||||
|
||||
draw_datatable();
|
||||
draw_chart(result.du);
|
||||
//Pace.stop();
|
||||
|
||||
//check_divheight();
|
||||
$(location).attr('href',"#");
|
||||
}
|
||||
})
|
||||
})
|
||||
// remove directory
|
||||
$(document).on("click", "#file_manager_div .rmdir", function(){
|
||||
var file_name = $(this).data("name").trim();
|
||||
var current_dir = $("#file_manager_div span").text().trim();
|
||||
var target = current_dir + "/" + file_name;
|
||||
if(confirm("Are you sure you want to delete '"+ file_name +"' ?")) {
|
||||
$.ajax({
|
||||
method: "POST",
|
||||
url: "/home/rmdir",
|
||||
data: { target : target , current_dir : current_dir},
|
||||
beforeSend : function(){
|
||||
$(location).attr('href',"#loading");
|
||||
},
|
||||
success : function(result){
|
||||
$("#current_dir").val(current_dir);
|
||||
$("#file_manager_title_div").empty().append("<h2 style='width:130px'>File manager</h2>");
|
||||
$("#disk_usage_title_div").empty().append("<h2 style='width:130px'>Disk usage</h2>");
|
||||
$("#file_manager_div").empty().append(result.file_manager_table);
|
||||
$("#disk_usage_div").empty().append(result.disk_usage_table);
|
||||
|
||||
draw_datatable();
|
||||
draw_chart(result.du);
|
||||
//check_divheight();
|
||||
$(location).attr('href',"#");
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
</script>
|
||||
<!-- /File manager functions -->
|
106
config/routes.rb
106
config/routes.rb
@ -1,88 +1,40 @@
|
||||
Rails.application.routes.draw do
|
||||
devise_for :users, controllers: { sessions: 'users/sessions' , registrations: 'users/registrations', confirmations: 'users/confirmations', passwords: 'users/passwords', unlocks: 'users/unlocks'}
|
||||
devise_for :users, controllers: {
|
||||
sessions: 'users/sessions',
|
||||
registrations: 'users/registrations',
|
||||
confirmations: 'users/confirmations',
|
||||
passwords: 'users/passwords',
|
||||
unlocks: 'users/unlocks'
|
||||
}
|
||||
# The priority is based upon order of creation: first created -> highest priority.
|
||||
# See how all your routes lay out with "rake routes".
|
||||
|
||||
# You can have the root of your site routed with "root"
|
||||
root 'home#index'
|
||||
root 'web/home#index'
|
||||
|
||||
get 'index' => 'plainpage#index'
|
||||
|
||||
#Home
|
||||
get 'file_download' => 'home#file_download'
|
||||
get 'home/index' => 'home#index'
|
||||
post 'home/chdir' => 'home#chdir'
|
||||
post 'home/mkdir' => 'home#make_directory'
|
||||
post 'home/rmdir' => 'home#rmdir'
|
||||
|
||||
#Volume
|
||||
get 'volume/index' => 'volume#index'
|
||||
post 'volume/chdir' => 'volume#chdir'
|
||||
post 'file_upload/:volume_name' => 'volume#file_upload'
|
||||
post 'volume/mount' => "volume#volume_mount"
|
||||
post 'volume/create' => "volume#volume_create"
|
||||
post 'volume/unmount' => "volume#volume_unmount"
|
||||
post 'volume/start' => "volume#volume_start"
|
||||
post 'volume/stop' => "volume#volume_stop"
|
||||
post 'volume/delete' => "volume#volume_delete"
|
||||
|
||||
#Node
|
||||
get 'node/index' => 'node#index'
|
||||
post 'node/add' => "node#node_add"
|
||||
get 'node/delete/:node_id' => "node#node_delete"
|
||||
get 'node/detail/:node_id' => "node#detail"
|
||||
post 'node/update' => "node#node_update"
|
||||
post 'node/probe' => "node#node_probe"
|
||||
post 'node/detach' => "node#node_detach"
|
||||
scope module: 'web' do
|
||||
get 'home/index' => 'home#index'
|
||||
post 'home/chdir' => 'home#chdir'
|
||||
post 'home/mkdir' => 'home#make_directory'
|
||||
post 'home/rmdir' => 'home#rmdir'
|
||||
|
||||
get 'volume/index' => 'volume#index'
|
||||
post 'volume/chdir' => 'volume#chdir'
|
||||
post 'volume/mount' => "volume#volume_mount"
|
||||
post 'volume/create' => "volume#volume_create"
|
||||
post 'volume/unmount' => "volume#volume_unmount"
|
||||
post 'volume/start' => "volume#volume_start"
|
||||
post 'volume/stop' => "volume#volume_stop"
|
||||
post 'volume/delete' => "volume#volume_delete"
|
||||
|
||||
|
||||
# Example of regular route:
|
||||
# get 'products/:id' => 'catalog#view'
|
||||
|
||||
# Example of named route that can be invoked with purchase_url(id: product.id)
|
||||
# get 'products/:id/purchase' => 'catalog#purchase', as: :purchase
|
||||
|
||||
# Example resource route (maps HTTP verbs to controller actions automatically):
|
||||
# resources :products
|
||||
|
||||
# Example resource route with options:
|
||||
# resources :products do
|
||||
# member do
|
||||
# get 'short'
|
||||
# post 'toggle'
|
||||
# end
|
||||
#
|
||||
# collection do
|
||||
# get 'sold'
|
||||
# end
|
||||
# end
|
||||
|
||||
# Example resource route with sub-resources:
|
||||
# resources :products do
|
||||
# resources :comments, :sales
|
||||
# resource :seller
|
||||
# end
|
||||
|
||||
# Example resource route with more complex sub-resources:
|
||||
# resources :products do
|
||||
# resources :comments
|
||||
# resources :sales do
|
||||
# get 'recent', on: :collection
|
||||
# end
|
||||
# end
|
||||
|
||||
# Example resource route with concerns:
|
||||
# concern :toggleable do
|
||||
# post 'toggle'
|
||||
# end
|
||||
# resources :posts, concerns: :toggleable
|
||||
# resources :photos, concerns: :toggleable
|
||||
|
||||
# Example resource route within a namespace:
|
||||
# namespace :admin do
|
||||
# # Directs /admin/products/* to Admin::ProductsController
|
||||
# # (app/controllers/admin/products_controller.rb)
|
||||
# resources :products
|
||||
# end
|
||||
get 'node/index' => 'node#index'
|
||||
post 'node/add' => "node#node_add"
|
||||
get 'node/delete/:node_id' => "node#node_delete"
|
||||
get 'node/detail/:node_id' => "node#detail"
|
||||
post 'node/update' => "node#node_update"
|
||||
post 'node/probe' => "node#node_probe"
|
||||
post 'node/detach' => "node#node_detach"
|
||||
end
|
||||
end
|
||||
|
Loading…
Reference in New Issue
Block a user