Skip to content

Commit

Permalink
Merge pull request #1 from safedrivepod/fix/wrong-log-path
Browse files Browse the repository at this point in the history
fix files structure
  • Loading branch information
erik-safedrivepod authored Mar 7, 2023
2 parents f395db3 + a2ed1e8 commit 9e42812
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 11 deletions.
19 changes: 12 additions & 7 deletions src/Rap2hpoutre/LaravelLogViewer/LaravelLogViewer.php
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,11 @@ public function getFolderName()
return $this->folder;
}

public function getCurrentFolder()
{
return str_replace($this->storage_path, '', $this->folder);
}

/**
* @return string
*/
Expand Down Expand Up @@ -299,7 +304,7 @@ public function getFolders($folder = '')
*/
public function getFolderFiles($basename = false, $fullPath = false)
{
$folder = $fullPath ? $this->folder : str_replace($this->storage_path, '', $this->folder);
$folder = $fullPath ? $this->folder : $this->getCurrentFolder();

return $this->getFiles($basename, $folder);
}
Expand Down Expand Up @@ -375,12 +380,12 @@ class="fa fa-folder"></span> ' . basename($v) . '
$file = $v;


echo '<div class="list-group">
<a href="?l=' . \Illuminate\Support\Facades\Crypt::encrypt($file) . '&f=' . \Illuminate\Support\Facades\Crypt::encrypt($folder) . '">
<span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span> <span
class="fa fa-file"></span> ' . $show2 . '
</a>
</div>';
// echo '<div class="list-group">
// <a href="?l=' . \Illuminate\Support\Facades\Crypt::encrypt($file) . '&f=' . \Illuminate\Support\Facades\Crypt::encrypt($folder) . '">
// <span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span> <span
// class="fa fa-file"></span> ' . basename($show2) . '
// </a>
// </div>';

}
}
Expand Down
2 changes: 1 addition & 1 deletion src/controllers/LogViewerController.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ public function index()
'folders' => $this->log_viewer->getFolders(),
'current_folder' => $this->log_viewer->getFolderName() ?? $this->log_viewer->getStoragePath(),
'folder_files' => $folderFiles,
'files' => $this->log_viewer->getFiles(false),
'files' => $this->log_viewer->getFiles(false, $this->log_viewer->getCurrentFolder()),
'current_file' => $this->log_viewer->getFileName(),
'standardFormat' => true,
'structure' => $this->log_viewer->foldersAndFiles(),
Expand Down
16 changes: 13 additions & 3 deletions src/views/log.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -185,15 +185,22 @@ function resetTheme() {
@foreach($folders as $folder)
<div class="list-group-item">
<?php
echo '<div class="list-group folder">
<a href="?f=' . \Illuminate\Support\Facades\Crypt::encrypt($storage_path) . '">
<span></span><span
class="fa fa-folder"></span> ' . basename($storage_path) . '
</a>
</div>';
\Rap2hpoutre\LaravelLogViewer\LaravelLogViewer::DirectoryTreeStructure( $storage_path, $structure );
?>

</div>
@endforeach
@foreach($files as $file)
<a href="?l={{ \Illuminate\Support\Facades\Crypt::encrypt($file) }}"
@foreach($show_files as $file)
<a href="?l={{ \Illuminate\Support\Facades\Crypt::encrypt($file) }}&f={{ \Illuminate\Support\Facades\Crypt::encrypt($current_folder) }}"
class="list-group-item @if ($current_file == $file) llv-active @endif">
{{$file}}
{{basename($file)}}
</a>
@endforeach
</div>
Expand All @@ -204,6 +211,9 @@ class="list-group-item @if ($current_file == $file) llv-active @endif">
Log file >50M, please download it.
</div>
@else

<h1> {{ str_replace($storage_path, '', $current_folder)}}</h1>
<br/>
<table id="table-log" class="table table-striped" data-ordering-index="{{ $standardFormat ? 2 : 0 }}">
<thead>
<tr>
Expand Down

0 comments on commit 9e42812

Please sign in to comment.