forked from Alex/Pterodactyl-Panel
redesign parts of the file manager
ignore yarn.lock file
This commit is contained in:
parent
0c1559c922
commit
c62312b8af
3
.gitignore
vendored
3
.gitignore
vendored
@ -9,4 +9,5 @@ Homestead.yaml
|
||||
Vagrantfile
|
||||
Vagrantfile
|
||||
|
||||
node_modules
|
||||
node_modules
|
||||
yarn.lock
|
||||
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -29,15 +29,22 @@ class ActionsClass {
|
||||
this.element = undefined;
|
||||
}
|
||||
|
||||
folder() {
|
||||
const nameBlock = $(this.element).find('td[data-identifier="name"]');
|
||||
const currentName = decodeURIComponent(nameBlock.attr('data-name'));
|
||||
const currentPath = decodeURIComponent(nameBlock.data('path'));
|
||||
folder(path) {
|
||||
let inputValue
|
||||
if (path) {
|
||||
inputValue = path
|
||||
} else {
|
||||
const nameBlock = $(this.element).find('td[data-identifier="name"]');
|
||||
const currentName = decodeURIComponent(nameBlock.data('name'));
|
||||
const currentPath = decodeURIComponent(nameBlock.data('path'));
|
||||
|
||||
let inputValue = `${currentPath}${currentName}/`;
|
||||
if ($(this.element).data('type') === 'file') {
|
||||
inputValue = currentPath;
|
||||
if ($(this.element).data('type') === 'file') {
|
||||
inputValue = currentPath;
|
||||
} else {
|
||||
inputValue = `${currentPath}${currentName}/`;
|
||||
}
|
||||
}
|
||||
|
||||
swal({
|
||||
type: 'input',
|
||||
title: 'Create Folder',
|
||||
|
@ -33,7 +33,7 @@ class ContextMenuClass {
|
||||
$(document).find('#fileOptionMenu').remove();
|
||||
if (!_.isNull(this.activeLine)) this.activeLine.removeClass('active');
|
||||
|
||||
let newFilePath = $('#headerTableRow').attr('data-currentDir');
|
||||
let newFilePath = $('#file_listing').data('current-dir');
|
||||
if (parent.data('type') === 'folder') {
|
||||
const nameBlock = parent.find('td[data-identifier="name"]');
|
||||
const currentName = decodeURIComponent(nameBlock.attr('data-name'));
|
||||
|
@ -44,6 +44,7 @@ class FileManager {
|
||||
$('#load_files').slideUp(10).html(data).slideDown(10, () => {
|
||||
ContextMenu.run();
|
||||
this.reloadFilesButton();
|
||||
this.addFolderButton();
|
||||
if (_.isFunction(next)) {
|
||||
return next();
|
||||
}
|
||||
@ -82,6 +83,12 @@ class FileManager {
|
||||
});
|
||||
}
|
||||
|
||||
addFolderButton() {
|
||||
$('i[data-action="add-folder"]').unbind().on('click', () => {
|
||||
new ActionsClass().folder($('#file_listing').data('current-dir') || '/');
|
||||
})
|
||||
}
|
||||
|
||||
decodeHash() {
|
||||
return decodeURIComponent(window.location.hash.substring(1));
|
||||
}
|
||||
|
@ -84,7 +84,7 @@
|
||||
window.onbeforeunload = function () {
|
||||
return 'A file upload in in progress, are you sure you want to continue?';
|
||||
};
|
||||
event.file.meta.path = $('#headerTableRow').attr('data-currentdir');
|
||||
event.file.meta.path = $('#file_listing').data('current-dir');
|
||||
event.file.meta.identifier = Math.random().toString(36).slice(2);
|
||||
|
||||
$('#append_files_to').append('<tr id="file-upload-' + event.file.meta.identifier +'"> \
|
||||
|
@ -212,6 +212,7 @@ return [
|
||||
'size' => 'Size',
|
||||
'last_modified' => 'Last Modified',
|
||||
'add_new' => 'Add New File',
|
||||
'add_folder' => 'Add New Folder',
|
||||
'edit' => [
|
||||
'header' => 'Edit File',
|
||||
'header_sub' => 'Make modifications to a file from the web.',
|
||||
|
@ -38,8 +38,10 @@
|
||||
<div class="col-xs-12">
|
||||
<div class="box box-primary">
|
||||
<div class="overlay file-overlay"><i class="fa fa-refresh fa-spin"></i></div>
|
||||
<div class="box-body table-responsive no-padding" id="load_files">
|
||||
<div class="callout callout-info" style="margin:10px;">@lang('server.files.loading')</div>
|
||||
<div id="load_files">
|
||||
<div class="box-body table-responsive no-padding">
|
||||
<div class="callout callout-info" style="margin:10px;">@lang('server.files.loading')</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="box-footer with-border">
|
||||
<p class="text-muted small" style="margin: 0 0 2px;">@lang('server.files.path', ['path' => '<code>/home/container</code>', 'size' => '<code>' . $node->upload_size . ' MB</code>'])</p>
|
||||
|
@ -17,148 +17,151 @@
|
||||
{{-- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, --}}
|
||||
{{-- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE --}}
|
||||
{{-- SOFTWARE. --}}
|
||||
<table class="table table-hover" id="file_listing">
|
||||
<thead>
|
||||
<tr>
|
||||
<th style="width:2%;text-align:center;" class="middle"><i class="fa fa-refresh muted muted-hover use-pointer" data-action="reload-files"></i></th>
|
||||
<th style="width:55%">@lang('server.files.file_name')</th>
|
||||
<th style="width:15%" class="hidden-xs">@lang('server.files.size')</th>
|
||||
<th style="width:20%" class="hidden-xs">@lang('server.files.last_modified')</th>
|
||||
<th style="width:8%">
|
||||
<label class="btn btn-primary btn-xs btn-file">
|
||||
Upload <input type="file" id="files_touch_target" style="display: none;"/>
|
||||
</label>
|
||||
</th>
|
||||
</tr>
|
||||
<tr id="headerTableRow" data-currentdir="{{ $directory['header'] }}">
|
||||
<th><i class="fa fa-folder-open"></i></th>
|
||||
<th colspan="4">
|
||||
<code>/home/container{{ $directory['header'] }}</code>
|
||||
<small>
|
||||
<a href="/server/{{ $server->uuidShort }}/files/add/@if($directory['header'] !== '')?dir={{ $directory['header'] }}@endif" class="text-muted">
|
||||
<i class="fa fa-plus" data-toggle="tooltip" data-placement="top" title="@lang('server.files.add_new')"></i>
|
||||
</a>
|
||||
</small>
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody id="append_files_to">
|
||||
@if (isset($directory['first']) && $directory['first'] === true)
|
||||
<tr data-type="disabled">
|
||||
<td><i class="fa fa-folder" style="margin-left: 0.859px;"></i></td>
|
||||
<td><a href="/server/{{ $server->uuidShort }}/files" data-action="directory-view">←</a></a></td>
|
||||
<td class="hidden-xs"></td>
|
||||
<td class="hidden-xs"></td>
|
||||
<td></td>
|
||||
|
||||
<div class="box-header">
|
||||
<i class="fa fa-refresh muted muted-hover use-pointer" data-action="reload-files"></i>
|
||||
<code class="box-title">/home/container{{ $directory['header'] }}</code>
|
||||
<a class="text-muted">
|
||||
<i class="fa fa-plus" data-action="add-folder" data-toggle="tooltip" data-placement="top" title="@lang('server.files.add_folder')"></i>
|
||||
</a>
|
||||
<div class="box-tools pull-right">
|
||||
<a class="btn btn-primary btn-sm" href="/server/{{ $server->uuidShort }}/files/add/@if($directory['header'] !== '')?dir={{ $directory['header'] }}@endif">
|
||||
<i class="fa fa-file"></i> Create File
|
||||
</a>
|
||||
<a class="btn btn-primary btn-sm btn-icon btn-file">
|
||||
<i class="fa fa-upload"></i> Upload <input type="file" id="files_touch_target" style="display: none;">
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="box-body table-responsive no-padding">
|
||||
<table class="table table-hover" id="file_listing" data-current-dir="{{ $directory['header'] }}">
|
||||
<thead>
|
||||
<tr>
|
||||
<th style="width:2%;" class="middle"></th>
|
||||
<th style="width:55%">@lang('server.files.file_name')</th>
|
||||
<th style="width:15%" class="hidden-xs">@lang('server.files.size')</th>
|
||||
<th style="width:20%" class="hidden-xs">@lang('server.files.last_modified')</th>
|
||||
<th style="width:8%"></th>
|
||||
</tr>
|
||||
@endif
|
||||
@if (isset($directory['show']) && $directory['show'] === true)
|
||||
<tr data-type="disabled">
|
||||
<td><i class="fa fa-folder" style="margin-left: 0.859px;"></i></td>
|
||||
<td data-name="{{ rawurlencode($directory['link']) }}">
|
||||
<a href="/server/{{ $server->uuidShort }}/files" data-action="directory-view">← {{ $directory['link_show'] }}</a>
|
||||
</td>
|
||||
<td class="hidden-xs"></td>
|
||||
<td class="hidden-xs"></td>
|
||||
<td></td>
|
||||
</tr>
|
||||
@endif
|
||||
@foreach ($folders as $folder)
|
||||
<tr data-type="folder">
|
||||
<td data-identifier="type" class="middle"><i class="fa fa-folder" style="margin-left: 0.859px;"></i></td>
|
||||
<td data-identifier="name" data-name="{{ rawurlencode($folder['entry']) }}" data-path="@if($folder['directory'] !== ''){{ rawurlencode($folder['directory']) }}@endif/">
|
||||
<a href="/server/{{ $server->uuidShort }}/files" data-action="directory-view">{{ $folder['entry'] }}</a>
|
||||
</td>
|
||||
<td data-identifier="size" class="hidden-xs">{{ $folder['size'] }}</td>
|
||||
<td data-identifier="modified" class="hidden-xs">
|
||||
<?php $carbon = Carbon::createFromTimestamp($folder['date'])->timezone(env('APP_TIMEZONE', 'America/New_York')); ?>
|
||||
@if($carbon->diffInMinutes(Carbon::now()) > 60)
|
||||
{{ $carbon->format('m/d/y H:i:s') }}
|
||||
@elseif($carbon->diffInSeconds(Carbon::now()) < 5 || $carbon->isFuture())
|
||||
<em>@lang('server.files.seconds_ago')</em>
|
||||
@else
|
||||
{{ $carbon->diffForHumans() }}
|
||||
@endif
|
||||
</td>
|
||||
<td><button class="btn btn-xxs btn-default disable-menu-hide" data-action="toggleMenu" style="padding:2px 6px 0px;"><i class="fa fa-ellipsis-h disable-menu-hide"></i></button></td>
|
||||
</tr>
|
||||
@endforeach
|
||||
@foreach ($files as $file)
|
||||
<tr data-type="file" data-mime="{{ $file['mime'] }}">
|
||||
<td data-identifier="type" class="middle">
|
||||
{{-- oh boy --}}
|
||||
@if(in_array($file['mime'], [
|
||||
'application/x-7z-compressed',
|
||||
'application/zip',
|
||||
'application/x-compressed-zip',
|
||||
'application/x-tar',
|
||||
'application/x-gzip',
|
||||
'application/x-bzip',
|
||||
'application/x-bzip2',
|
||||
'application/java-archive'
|
||||
]))
|
||||
<i class="fa fa-file-archive-o" style="margin-left: 2px;"></i>
|
||||
@elseif(in_array($file['mime'], [
|
||||
'application/json',
|
||||
'application/javascript',
|
||||
'application/xml',
|
||||
'application/xhtml+xml',
|
||||
'text/xml',
|
||||
'text/css',
|
||||
'text/html',
|
||||
'text/x-perl',
|
||||
'text/x-shellscript'
|
||||
]))
|
||||
<i class="fa fa-file-code-o" style="margin-left: 2px;"></i>
|
||||
@elseif(starts_with($file['mime'], 'image'))
|
||||
<i class="fa fa-file-image-o" style="margin-left: 2px;"></i>
|
||||
@elseif(starts_with($file['mime'], 'video'))
|
||||
<i class="fa fa-file-video-o" style="margin-left: 2px;"></i>
|
||||
@elseif(starts_with($file['mime'], 'video'))
|
||||
<i class="fa fa-file-audio-o" style="margin-left: 2px;"></i>
|
||||
@elseif(starts_with($file['mime'], 'application/vnd.ms-powerpoint'))
|
||||
<i class="fa fa-file-powerpoint-o" style="margin-left: 2px;"></i>
|
||||
@elseif(in_array($file['mime'], [
|
||||
'application/vnd.openxmlformats-officedocument.wordprocessingml.document',
|
||||
'application/vnd.openxmlformats-officedocument.wordprocessingml.template',
|
||||
'application/msword'
|
||||
]) || starts_with($file['mime'], 'application/vnd.ms-word'))
|
||||
<i class="fa fa-file-word-o" style="margin-left: 2px;"></i>
|
||||
@elseif(in_array($file['mime'], [
|
||||
'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
|
||||
'application/vnd.openxmlformats-officedocument.spreadsheetml.template',
|
||||
]) || starts_with($file['mime'], 'application/vnd.ms-excel'))
|
||||
<i class="fa fa-file-excel-o" style="margin-left: 2px;"></i>
|
||||
@elseif($file['mime'] === 'application/pdf')
|
||||
<i class="fa fa-file-pdf-o" style="margin-left: 2px;"></i>
|
||||
@else
|
||||
<i class="fa fa-file-text-o" style="margin-left: 2px;"></i>
|
||||
@endif
|
||||
</td>
|
||||
<td data-identifier="name" data-name="{{ rawurlencode($file['entry']) }}" data-path="@if($file['directory'] !== ''){{ rawurlencode($file['directory']) }}@endif/">
|
||||
@if(in_array($file['mime'], $editableMime))
|
||||
@can('edit-files', $server)
|
||||
<a href="/server/{{ $server->uuidShort }}/files/edit/@if($file['directory'] !== ''){{ rawurlencode($file['directory']) }}/@endif{{ rawurlencode($file['entry']) }}" class="edit_file">{{ $file['entry'] }}</a>
|
||||
</thead>
|
||||
<tbody id="append_files_to">
|
||||
@if (isset($directory['first']) && $directory['first'] === true)
|
||||
<tr data-type="disabled">
|
||||
<td><i class="fa fa-folder" style="margin-left: 0.859px;"></i></td>
|
||||
<td><a href="/server/{{ $server->uuidShort }}/files" data-action="directory-view">←</a></a></td>
|
||||
<td class="hidden-xs"></td>
|
||||
<td class="hidden-xs"></td>
|
||||
<td></td>
|
||||
</tr>
|
||||
@endif
|
||||
@if (isset($directory['show']) && $directory['show'] === true)
|
||||
<tr data-type="disabled">
|
||||
<td><i class="fa fa-folder" style="margin-left: 0.859px;"></i></td>
|
||||
<td data-name="{{ rawurlencode($directory['link']) }}">
|
||||
<a href="/server/{{ $server->uuidShort }}/files" data-action="directory-view">← {{ $directory['link_show'] }}</a>
|
||||
</td>
|
||||
<td class="hidden-xs"></td>
|
||||
<td class="hidden-xs"></td>
|
||||
<td></td>
|
||||
</tr>
|
||||
@endif
|
||||
@foreach ($folders as $folder)
|
||||
<tr data-type="folder">
|
||||
<td data-identifier="type" class="middle"><i class="fa fa-folder" style="margin-left: 0.859px;"></i></td>
|
||||
<td data-identifier="name" data-name="{{ rawurlencode($folder['entry']) }}" data-path="@if($folder['directory'] !== ''){{ rawurlencode($folder['directory']) }}@endif/">
|
||||
<a href="/server/{{ $server->uuidShort }}/files" data-action="directory-view">{{ $folder['entry'] }}</a>
|
||||
</td>
|
||||
<td data-identifier="size" class="hidden-xs">{{ $folder['size'] }}</td>
|
||||
<td data-identifier="modified" class="hidden-xs">
|
||||
<?php $carbon = Carbon::createFromTimestamp($folder['date'])->timezone(env('APP_TIMEZONE', 'America/New_York')); ?>
|
||||
@if($carbon->diffInMinutes(Carbon::now()) > 60)
|
||||
{{ $carbon->format('m/d/y H:i:s') }}
|
||||
@elseif($carbon->diffInSeconds(Carbon::now()) < 5 || $carbon->isFuture())
|
||||
<em>@lang('server.files.seconds_ago')</em>
|
||||
@else
|
||||
{{ $carbon->diffForHumans() }}
|
||||
@endif
|
||||
</td>
|
||||
<td><button class="btn btn-xxs btn-default disable-menu-hide" data-action="toggleMenu" style="padding:2px 6px 0px;"><i class="fa fa-ellipsis-h disable-menu-hide"></i></button></td>
|
||||
</tr>
|
||||
@endforeach
|
||||
@foreach ($files as $file)
|
||||
<tr data-type="file" data-mime="{{ $file['mime'] }}">
|
||||
<td data-identifier="type" class="middle">
|
||||
{{-- oh boy --}}
|
||||
@if(in_array($file['mime'], [
|
||||
'application/x-7z-compressed',
|
||||
'application/zip',
|
||||
'application/x-compressed-zip',
|
||||
'application/x-tar',
|
||||
'application/x-gzip',
|
||||
'application/x-bzip',
|
||||
'application/x-bzip2',
|
||||
'application/java-archive'
|
||||
]))
|
||||
<i class="fa fa-file-archive-o" style="margin-left: 2px;"></i>
|
||||
@elseif(in_array($file['mime'], [
|
||||
'application/json',
|
||||
'application/javascript',
|
||||
'application/xml',
|
||||
'application/xhtml+xml',
|
||||
'text/xml',
|
||||
'text/css',
|
||||
'text/html',
|
||||
'text/x-perl',
|
||||
'text/x-shellscript'
|
||||
]))
|
||||
<i class="fa fa-file-code-o" style="margin-left: 2px;"></i>
|
||||
@elseif(starts_with($file['mime'], 'image'))
|
||||
<i class="fa fa-file-image-o" style="margin-left: 2px;"></i>
|
||||
@elseif(starts_with($file['mime'], 'video'))
|
||||
<i class="fa fa-file-video-o" style="margin-left: 2px;"></i>
|
||||
@elseif(starts_with($file['mime'], 'video'))
|
||||
<i class="fa fa-file-audio-o" style="margin-left: 2px;"></i>
|
||||
@elseif(starts_with($file['mime'], 'application/vnd.ms-powerpoint'))
|
||||
<i class="fa fa-file-powerpoint-o" style="margin-left: 2px;"></i>
|
||||
@elseif(in_array($file['mime'], [
|
||||
'application/vnd.openxmlformats-officedocument.wordprocessingml.document',
|
||||
'application/vnd.openxmlformats-officedocument.wordprocessingml.template',
|
||||
'application/msword'
|
||||
]) || starts_with($file['mime'], 'application/vnd.ms-word'))
|
||||
<i class="fa fa-file-word-o" style="margin-left: 2px;"></i>
|
||||
@elseif(in_array($file['mime'], [
|
||||
'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
|
||||
'application/vnd.openxmlformats-officedocument.spreadsheetml.template',
|
||||
]) || starts_with($file['mime'], 'application/vnd.ms-excel'))
|
||||
<i class="fa fa-file-excel-o" style="margin-left: 2px;"></i>
|
||||
@elseif($file['mime'] === 'application/pdf')
|
||||
<i class="fa fa-file-pdf-o" style="margin-left: 2px;"></i>
|
||||
@else
|
||||
<i class="fa fa-file-text-o" style="margin-left: 2px;"></i>
|
||||
@endif
|
||||
</td>
|
||||
<td data-identifier="name" data-name="{{ rawurlencode($file['entry']) }}" data-path="@if($file['directory'] !== ''){{ rawurlencode($file['directory']) }}@endif/">
|
||||
@if(in_array($file['mime'], $editableMime))
|
||||
@can('edit-files', $server)
|
||||
<a href="/server/{{ $server->uuidShort }}/files/edit/@if($file['directory'] !== ''){{ rawurlencode($file['directory']) }}/@endif{{ rawurlencode($file['entry']) }}" class="edit_file">{{ $file['entry'] }}</a>
|
||||
@else
|
||||
{{ $file['entry'] }}
|
||||
@endcan
|
||||
@else
|
||||
{{ $file['entry'] }}
|
||||
@endcan
|
||||
@else
|
||||
{{ $file['entry'] }}
|
||||
@endif
|
||||
</td>
|
||||
<td data-identifier="size" class="hidden-xs">{{ $file['size'] }}</td>
|
||||
<td data-identifier="modified" class="hidden-xs">
|
||||
<?php $carbon = Carbon::createFromTimestamp($file['date'])->timezone(env('APP_TIMEZONE', 'America/New_York')); ?>
|
||||
@if($carbon->diffInMinutes(Carbon::now()) > 60)
|
||||
{{ $carbon->format('m/d/y H:i:s') }}
|
||||
@elseif($carbon->diffInSeconds(Carbon::now()) < 5 || $carbon->isFuture())
|
||||
<em>@lang('server.files.seconds_ago')</em>
|
||||
@else
|
||||
{{ $carbon->diffForHumans() }}
|
||||
@endif
|
||||
</td>
|
||||
<td><button class="btn btn-xxs btn-default disable-menu-hide" data-action="toggleMenu" style="padding:2px 6px 0px;"><i class="fa fa-ellipsis-h disable-menu-hide"></i></button></td>
|
||||
</tr>
|
||||
@endforeach
|
||||
</tbody>
|
||||
</table>
|
||||
@endif
|
||||
</td>
|
||||
<td data-identifier="size" class="hidden-xs">{{ $file['size'] }}</td>
|
||||
<td data-identifier="modified" class="hidden-xs">
|
||||
<?php $carbon = Carbon::createFromTimestamp($file['date'])->timezone(env('APP_TIMEZONE', 'America/New_York')); ?>
|
||||
@if($carbon->diffInMinutes(Carbon::now()) > 60)
|
||||
{{ $carbon->format('m/d/y H:i:s') }}
|
||||
@elseif($carbon->diffInSeconds(Carbon::now()) < 5 || $carbon->isFuture())
|
||||
<em>@lang('server.files.seconds_ago')</em>
|
||||
@else
|
||||
{{ $carbon->diffForHumans() }}
|
||||
@endif
|
||||
</td>
|
||||
<td><button class="btn btn-xxs btn-default disable-menu-hide" data-action="toggleMenu" style="padding:2px 6px 0px;"><i class="fa fa-ellipsis-h disable-menu-hide"></i></button></td>
|
||||
</tr>
|
||||
@endforeach
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
Loading…
Reference in New Issue
Block a user