diff --git a/FIXME.txt b/FIXME.txt index 8f95bcb814..1a644d9b51 100644 --- a/FIXME.txt +++ b/FIXME.txt @@ -1,11 +1,15 @@ -remove Ziggy -and ziggy-js too -And what is /public/js/snipeit.js ? That looks like a generated file +X - remove Ziggy +X - and ziggy-js too +X - And what is /public/js/snipeit.js ? That looks like a generated file The 'flash' (forced refresh/fake refresh) on uploads is dumb -I'm not sure if the order on the uploaded files is right? -The Livewire.first() thing is still dumb (but Id o'nt know that we can fix it). +X - the order on the uploaded files is wrong (backwards) +X - (fixed somehow?!) The Livewire.first() thing is still dumb (but Id o'nt know that we can fix it). -Deletes need to work (I got this working before using $.ajax; it's not even hard) +X - Deletes need to work (I got this working before using $.ajax; it's not even hard) -Then mapping and so on. \ No newline at end of file +Then mapping and so on. + +Can we potentially delete whatever that this.$http thing? Or is that some side-effect of Vue.js that we don't get for free? (yes, it was that) + +I suspect the Alert section is not yet wired up - but should be. Doesn't seem too hard? \ No newline at end of file diff --git a/app/Http/Livewire/Importer.php b/app/Http/Livewire/Importer.php index 1bcd501ba1..32f0d50351 100644 --- a/app/Http/Livewire/Importer.php +++ b/app/Http/Livewire/Importer.php @@ -5,6 +5,7 @@ namespace App\Http\Livewire; use Livewire\Component; use App\Models\Import; +use Storage; use Log; @@ -14,6 +15,13 @@ class Importer extends Component public $processDetails; public $forcerefresh; + public $progress; //upload progress - '-1' means don't show + public $progress_message; //progress message + public $progress_bar_class; + + public $message; //status/error message? + public $message_type; //success/error? + protected $rules = [ 'files.*.file_path' => 'required|string', 'files.*.created_at' => 'required|string', @@ -22,13 +30,15 @@ class Importer extends Component public function mount() { - //$this->files = Import::all(); // this *SHOULD* be how it works, but...it doesn't? - $this->forcerefresh = 0; + //$this->files = Import::all(); // this *SHOULD* be how it works, but...it doesn't? (note orderBy/get, below) + //$this->forcerefresh = 0; + $this->progress = -1; // '-1' means 'don't show the progressbar' + $this->progress_bar_class = 'progress-bar-warning'; } - public function test() + public function hideMessages() { - Log::error("Test Button Clicked!!!!"); + $this->message=''; } public function toggleEvent($id) @@ -37,9 +47,26 @@ class Importer extends Component $this->processDetails = Import::find($id); } + public function destroy($id) + { + foreach($this->files as $file) { + \Log::debug("File id is: ".$file->id); + //\Log::debug("File is: ".print_r($file,true)); + if($id == $file->id) { + // FIXME - should I do a try/catch on this and use the file_delete_failure or whatever, if needed? + \Log::debug("I FOUND IT!!!!"); + Storage::delete('imports/'.$file->file_path); // FIXME - last time I ran this, it *didn't* delete the file?! + $file->delete(); + + $this->message = trans('admin/hardware/message.import.file_delete_success'); + $this->message_type = 'success'; // uhm, I mean, I guess? + } + } + } + public function render() { - $this->files = Import::all(); //HACK - slows down renders. + $this->files = Import::orderBy('id','desc')->get(); //HACK - slows down renders. return view('livewire.importer'); } } diff --git a/resources/views/livewire/importer.blade.php b/resources/views/livewire/importer.blade.php index f998d6363f..8a2b3832e4 100644 --- a/resources/views/livewire/importer.blade.php +++ b/resources/views/livewire/importer.blade.php @@ -32,16 +32,18 @@ {{-- alert --}} - + +@endif @endpush \ No newline at end of file