diff --git a/FIXME.txt b/FIXME.txt
index 1a644d9b5..96fdaa9f2 100644
--- a/FIXME.txt
+++ b/FIXME.txt
@@ -8,8 +8,10 @@ X - (fixed somehow?!) The Livewire.first() thing is still dumb (but Id o'nt know
X - Deletes need to work (I got this working before using $.ajax; it's not even hard)
-Then mapping and so on.
+X - 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)
+X - 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
+X - I suspect the Alert section is not yet wired up - but should be. Doesn't seem too hard?
+
+???? translations on the main import screen seem donked for some inexplicable reason? PRobably we newly-tranlsated them?
\ No newline at end of file
diff --git a/app/Http/Controllers/ImportsController.php b/app/Http/Controllers/ImportsController.php
deleted file mode 100644
index 342203846..000000000
--- a/app/Http/Controllers/ImportsController.php
+++ /dev/null
@@ -1,22 +0,0 @@
-authorize('import');
- // $imports = (new ImportsTransformer)->transformImports(Import::latest()->get());
-
- return view('importer/import'); //->with('imports', $imports);
- }
-}
diff --git a/app/Http/Livewire/Importer.php b/app/Http/Livewire/Importer.php
index f72eae985..ec8d6ac6f 100644
--- a/app/Http/Livewire/Importer.php
+++ b/app/Http/Livewire/Importer.php
@@ -30,10 +30,11 @@ class Importer extends Component
'files.*.filesize' => 'required|integer'
];
- protected $listeners = ['hideDetails' => 'hideDetails', 'importError' => 'importError'];
+ protected $listeners = ['hideDetails' => 'hideDetails', 'importError' => 'importError', 'alert' => 'alert'];
public function mount()
{
+ //$this->authorize('import'); // FIXME - gotta do this somewhere!!!!!
//$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'
@@ -52,6 +53,13 @@ class Importer extends Component
$this->import_errors = $errors;
}
+ public function alert($obj)
+ {
+ \Log::info("Alert object received: ".print_r($obj,true));
+ $this->message = $obj;
+ $this->message_type = "danger"; // FIXME - when does this get reset? Only when you click the 'x'?
+ }
+
public function toggleEvent($id)
{
Log::error("toggled on: ".$id);
@@ -84,6 +92,12 @@ class Importer extends Component
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')
+ ->section('content')
+ ->layoutData(['title', trans('general.import')]); /* return view('livewire.show-posts')
+4 ->layout('layouts.base', ['title' => 'Show Posts'])
+ ->section('body') // or whatever?
+5 */
}
}
diff --git a/app/Http/Livewire/ImporterFile.php b/app/Http/Livewire/ImporterFile.php
index 052f5ba05..7766e0b72 100644
--- a/app/Http/Livewire/ImporterFile.php
+++ b/app/Http/Livewire/ImporterFile.php
@@ -171,78 +171,6 @@ class ImporterFile extends Component
$this->statusType = 'pending';
$this->statusText = "Processing...";
- axios.post('{{ route('api.imports.importFile', $activeFile->id) }}', {
- 'import-update': !!@this.update,
- 'send-welcome': !!@this.send_welcome,
- 'import-type': @this.activeFile.import_type,
- 'run-backup': !!@this.run_backup,
- 'column-mappings': mappings // FIXME - terrible name
- }).then( (body) => {
- Log::warn("success!!!")
- // Success
- $this->statusType = "success";
- $this->statusText = "Success... Redirecting.";
- // FIXME - can we 'flash' an update here?
- window.location.href = body.data.messages.redirect_url; // definite fixme here!
- }, (body) => {
- // Failure
- console.warn("failure!!!!")
- if(body.response.data.status == 'import-errors') {
- //window.eventHub.$emit('importErrors', body.messages);
- console.warn("import error")
- console.dir(body)
- @this.set('statusType','error');
- @this.emit('importError', body.response.data.messages)
- //@this.set('statusText', "Error: "+body.response.data.messages.join("
"));
- } else {
- console.warn("not import-errors, just regular errors")
- console.dir(body)
- @this.set('statusType','error');
- @this.emit('importError',body.response.data.messages ? body.response.data.messages : {'import-type': ['Unknown error']})
- @this.set('statusText',body.response.data.messages ? body.response.data.messages : 'Unknown error');
- }
- // @this.emit('hideDetails');
- });
- }
-$(function () {
- $('#import').on('click',function () {
- console.warn("okay, click handler firing!!!")
- postSave()
- })
- console.warn("JS click handler loaded!")
- })
-window.setTimeout(function() {
- var what = @this.dinglefarts
- console.warn("What is this: ",what)
- },1000)
-
- $class = title_case($this->option('item-type'));
- $classString = "App\\Importer\\{$class}Importer";
- $importer = new $classString($filename);
- $importer->setCallbacks([$this, 'log'], [$this, 'progress'], [$this, 'errorCallback'])
- ->setUserId($this->option('user_id'))
- ->setUpdating($this->option('update'))
- ->setShouldNotify($this->option('send-welcome'))
- ->setUsernameFormat($this->option('username_format'));
-
- // This $logFile/useFiles() bit is currently broken, so commenting it out for now
- // $logFile = $this->option('logfile');
- // \Log::useFiles($logFile);
- $this->comment('======= Importing Items from '.$filename.' =========');
- $importer->import();
-
- $this->bar = null;
-
- if (! empty($this->errors)) {
- $this->comment('The following Errors were encountered.');
- foreach ($this->errors as $asset => $error) {
- $this->comment('Error: Item: '.$asset.' failed validation: '.json_encode($error));
- }
- } else {
- $this->comment('All Items imported successfully!');
- }
- $this->comment('');
-
}
public function changeTypes() // UNUSED?
diff --git a/app/Providers/RouteServiceProvider.php b/app/Providers/RouteServiceProvider.php
index 90520738d..d5b10bde3 100644
--- a/app/Providers/RouteServiceProvider.php
+++ b/app/Providers/RouteServiceProvider.php
@@ -39,7 +39,7 @@ class RouteServiceProvider extends ServiceProvider
{
Route::group([
'middleware' => 'web',
- 'namespace' => $this->namespace,
+// 'namespace' => $this->namespace, //okay, I don't know what this means, but somehow this might be a problem for us?
], function ($router) {
require base_path('routes/web/hardware.php');
require base_path('routes/web/models.php');
@@ -65,7 +65,7 @@ class RouteServiceProvider extends ServiceProvider
{
Route::group([
'middleware' => 'auth:api',
- 'namespace' => $this->namespace,
+// 'namespace' => $this->namespace, // this might also be a problem? I don't really know :/
'prefix' => 'api',
], function ($router) {
require base_path('routes/api.php');
diff --git a/composer.json b/composer.json
index abcf675b1..2f1007fa7 100644
--- a/composer.json
+++ b/composer.json
@@ -127,6 +127,9 @@
"sort-packages": true,
"optimize-autoloader": true,
"discard-changes": true,
- "process-timeout": 3000
+ "process-timeout": 3000,
+ "allow-plugins": {
+ "dealerdirect/phpcodesniffer-composer-installer": true
+ }
}
}
diff --git a/resources/views/importer/import.blade.php b/resources/views/importer/import.blade.php
deleted file mode 100644
index 22dd8e7c7..000000000
--- a/resources/views/importer/import.blade.php
+++ /dev/null
@@ -1,34 +0,0 @@
-@extends('layouts/default')
-
-{{-- Page title --}}
-@section('title')
-{{ trans('general.import') }}
-@parent
-@stop
-
-{{-- Page content --}}
-@section('content')
- {{-- Hide importer until vue has rendered it, if we continue using vue for other things we should move this higher in the style --}}
- {{-- --}}
-
- {{-- YET ANOTHER FIXME! argh. This file shouldn't exist. --}}
-
- @livewire('importer') {{-- Yes, this is stupid - we should be able to route straight over and not have this, but Livewire doesn't work in this app that way :/ --}}
-@stop
-
-@section('moar_scripts')
-
-
-
- {{-- --}}
-@endsection
diff --git a/resources/views/livewire/importer-file.blade.php b/resources/views/livewire/importer-file.blade.php
index e80783b28..cf4b6ff52 100644
--- a/resources/views/livewire/importer-file.blade.php
+++ b/resources/views/livewire/importer-file.blade.php
@@ -94,7 +94,7 @@