mirror of
https://github.com/snipe/snipe-it.git
synced 2024-12-25 05:34:06 -08:00
Move files to computed property
This commit is contained in:
parent
b7744105a0
commit
7e89b58746
|
@ -5,12 +5,11 @@ namespace App\Livewire;
|
||||||
use App\Models\CustomField;
|
use App\Models\CustomField;
|
||||||
use App\Models\Import;
|
use App\Models\Import;
|
||||||
use Illuminate\Support\Facades\Storage;
|
use Illuminate\Support\Facades\Storage;
|
||||||
|
use Livewire\Attributes\Computed;
|
||||||
use Livewire\Component;
|
use Livewire\Component;
|
||||||
|
|
||||||
class Importer extends Component
|
class Importer extends Component
|
||||||
{
|
{
|
||||||
public $files;
|
|
||||||
|
|
||||||
public $progress = -1; //upload progress - '-1' means don't show
|
public $progress = -1; //upload progress - '-1' means don't show
|
||||||
public $progress_message;
|
public $progress_message;
|
||||||
public $progress_bar_class = 'progress-bar-warning';
|
public $progress_bar_class = 'progress-bar-warning';
|
||||||
|
@ -545,6 +544,8 @@ class Importer extends Component
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
unset($this->files);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function clearMessage()
|
public function clearMessage()
|
||||||
|
@ -553,9 +554,14 @@ class Importer extends Component
|
||||||
$this->message_type = null;
|
$this->message_type = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[Computed]
|
||||||
|
public function files()
|
||||||
|
{
|
||||||
|
return Import::orderBy('id', 'desc')->get();
|
||||||
|
}
|
||||||
|
|
||||||
public function render()
|
public function render()
|
||||||
{
|
{
|
||||||
$this->files = Import::orderBy('id','desc')->get(); //HACK - slows down renders.
|
|
||||||
return view('livewire.importer')
|
return view('livewire.importer')
|
||||||
->extends('layouts.default')
|
->extends('layouts.default')
|
||||||
->section('content');
|
->section('content');
|
||||||
|
|
|
@ -118,7 +118,7 @@
|
||||||
</th>
|
</th>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
@foreach($files as $currentFile)
|
@foreach($this->files as $currentFile)
|
||||||
|
|
||||||
<tr style="{{ ($activeFile && ($currentFile->id == $activeFile->id)) ? 'font-weight: bold' : '' }}" class="{{ ($activeFile && ($currentFile->id == $activeFile->id)) ? 'warning' : '' }}">
|
<tr style="{{ ($activeFile && ($currentFile->id == $activeFile->id)) ? 'font-weight: bold' : '' }}" class="{{ ($activeFile && ($currentFile->id == $activeFile->id)) ? 'warning' : '' }}">
|
||||||
<td class="col-md-6">{{ $currentFile->file_path }}</td>
|
<td class="col-md-6">{{ $currentFile->file_path }}</td>
|
||||||
|
|
Loading…
Reference in a new issue