2015-12-06 18:58:49 +00:00
@ extends ( 'layouts.master' )
@ section ( 'title' )
Managing Files for : {{ $server -> name }}
@ endsection
@ section ( 'content' )
2016-01-04 21:48:22 +00:00
< div class = " col-md-12 " >
2016-01-01 23:08:15 +00:00
< div class = " row " >
< div class = " col-md-12 " id = " internal_alert " >
2015-12-06 18:58:49 +00:00
< div class = " alert alert-info " >
< i class = " fa fa-spinner fa-spin " ></ i > {{ trans ( 'server.files.loading' ) }}
</ div >
</ div >
</ div >
< div class = " row " >
< div class = " col-md-12 " >
2015-12-07 05:47:19 +00:00
< div class = " ajax_loading_box " >< i class = " fa fa-refresh fa-spin " id = " position_me " ></ i ></ div >
2015-12-06 18:58:49 +00:00
</ div >
</ div >
< div class = " row " >
< div class = " col-md-12 " id = " load_files " ></ div >
< div class = " col-md-12 " >
< div class = " panel panel-default " >
< div class = " panel-heading " >
< h3 class = " panel-title " > File Path Information </ h3 >
</ div >
< div class = " panel-body " >
When configuring any file paths in your server plugins or settings you should use < code >/ home / container </ code > as your base path . While your SFTP client sees the files as < code >/ public </ code > this is not true for the server process .
</ div >
</ div >
</ div >
</ div >
</ div >
< script >
$ ( document ) . ready ( function () {
$ ( '.server-files' ) . addClass ( 'active' );
});
$ ( window ) . load ( function (){
var doneLoad = false ;
// Show Loading Animation
function handleLoader ( show ) {
// Hide animation if no files displayed.
if ( $ ( '#load_files' ) . height () < 5 ) { return ; }
// Show Animation
if ( show === true ){
var height = $ ( '#load_files' ) . height ();
2015-12-07 05:47:19 +00:00
var width = $ ( '.ajax_loading_box' ) . width ();
2015-12-06 18:58:49 +00:00
var center_height = ( height / 2 ) - 30 ;
var center_width = ( width / 2 ) - 30 ;
$ ( '#position_me' ) . css ({
'top' : center_height ,
'left' : center_width ,
'font-size' : '60px'
});
2015-12-07 05:47:19 +00:00
$ ( " .ajax_loading_box " ) . css ( 'height' , ( height + 5 )) . fadeIn ();
2015-12-06 18:58:49 +00:00
} else {
2015-12-07 05:47:19 +00:00
$ ( '.ajax_loading_box' ) . fadeOut ( 100 );
2015-12-06 18:58:49 +00:00
}
}
function reloadActions () {
reloadActionClick ();
reloadActionDelete ();
}
// Handle folder clicking to load new contents
function reloadActionClick () {
$ ( 'a.load_new' ) . click ( function ( e ) {
e . preventDefault ();
window . history . pushState ( null , null , $ ( this ) . attr ( 'href' ));
loadDirectoryContents ( $ . urlParam ( 'dir' , $ ( this ) . attr ( 'href' )));
});
}
// Handle Deleting Files
function reloadActionDelete () {
$ ( 'a.delete_file' ) . click ( function ( e ) {
e . preventDefault ();
var clicked = $ ( this );
var deleteItemPath = $ ( this ) . attr ( 'href' );
2016-01-09 01:08:20 +00:00
swal ({
type : 'warning' ,
title : 'Really Delete this File?' ,
showCancelButton : true ,
showConfirmButton : true ,
closeOnConfirm : false ,
showLoaderOnConfirm : true
}, function () {
$ . ajax ({
type : 'DELETE' ,
url : '{{ $node->scheme }}://{{ $node->fqdn }}:{{ $node->daemonListen }}/server/file/' + deleteItemPath ,
headers : {
'X-Access-Token' : '{{ $server->daemonSecret }}' ,
'X-Access-Server' : '{{ $server->uuid }}'
}
}) . done ( function ( data ) {
clicked . parent () . parent () . parent () . parent () . fadeOut ();
swal ({
type : 'success' ,
title : 'File Deleted'
});
}) . fail ( function ( jqXHR ) {
console . error ( jqXHR );
swal ({
type : 'error' ,
title : 'Whoops!' ,
html : true ,
text : 'An error occured while attempting to delete this file. Please try again.' ,
});
});
2015-12-06 18:58:49 +00:00
});
});
}
// Handle Loading Contents
function loadDirectoryContents ( dir ) {
handleLoader ( true );
var outputContent ;
var urlDirectory = ( dir === null ) ? '/' : dir ;
$ . ajax ({
type : 'POST' ,
2016-01-09 00:54:06 +00:00
url : '{{ route(' server . files . directory - list ', $server->uuidShort) }}' ,
2015-12-06 18:58:49 +00:00
headers : { 'X-CSRF-Token' : '{{ csrf_token() }}' },
data : { directory : urlDirectory }
}) . done ( function ( data ) {
handleLoader ( false );
$ ( " #load_files " ) . slideUp ( function () {
$ ( " #load_files " ) . html ( data ) . slideDown ();
$ ( '[data-toggle="tooltip"]' ) . tooltip ();
$ ( '#internal_alert' ) . slideUp ();
// Run Actions Again
reloadActions ();
});
}) . fail ( function ( jqXHR ) {
$ ( " #internal_alert " ) . html ( '<div class="alert alert-danger">An error occured while attempting to process this request. Please try again.</div>' ) . show ();
console . log ( jqXHR );
});
}
// Load on Initial Page Load
loadDirectoryContents ( $ . urlParam ( 'dir' ));
});
</ script >
@ endsection