From 62c94dd7404a520892b2a9348b613510276799d0 Mon Sep 17 00:00:00 2001 From: devfake Date: Wed, 19 Oct 2016 11:19:34 +0200 Subject: [PATCH] sync scout in settings --- README.md | 5 -- backend/app/Console/Commands/Sync.php | 1 + backend/app/Console/Kernel.php | 4 + .../Http/Controllers/SettingController.php | 9 ++ backend/composer.lock | 87 +++++++++---------- backend/routes/web.php | 1 + client/app/components/Content/Settings.vue | 15 +++- 7 files changed, 70 insertions(+), 52 deletions(-) diff --git a/README.md b/README.md index a818071..0e6fa79 100644 --- a/README.md +++ b/README.md @@ -89,11 +89,6 @@ You can also set options to display release date and/or genre of your own movie * Give `backend/storage`, `public/assets` and `public/exports` recursive write access. -### Todo - -* Settings - * Sync scout driver - ### Further Development * Multi User diff --git a/backend/app/Console/Commands/Sync.php b/backend/app/Console/Commands/Sync.php index f2f3532..3e3e4bf 100644 --- a/backend/app/Console/Commands/Sync.php +++ b/backend/app/Console/Commands/Sync.php @@ -20,6 +20,7 @@ try { $this->info('TRYING TO SYNC YOUR MOVIES TO ' . strtoupper($scoutDriver)); + $this->call('scout:flush', ['model' => 'App\\Item']); $this->call('scout:import', ['model' => 'App\\Item']); $this->info('SYNCHRONIZATION COMPLETED'); } catch(\Exception $e) { diff --git a/backend/app/Console/Kernel.php b/backend/app/Console/Kernel.php index f73af16..29b49a6 100644 --- a/backend/app/Console/Kernel.php +++ b/backend/app/Console/Kernel.php @@ -4,6 +4,8 @@ namespace App\Console; use Illuminate\Console\Scheduling\Schedule; use Illuminate\Foundation\Console\Kernel as ConsoleKernel; +use Laravel\Scout\Console\FlushCommand; +use Laravel\Scout\Console\ImportCommand; class Kernel extends ConsoleKernel { @@ -16,6 +18,8 @@ class Kernel extends ConsoleKernel Commands\Init::class, Commands\DB::class, Commands\Sync::class, + ImportCommand::class, + FlushCommand::class, ]; /** diff --git a/backend/app/Http/Controllers/SettingController.php b/backend/app/Http/Controllers/SettingController.php index edd83af..e9b1c82 100644 --- a/backend/app/Http/Controllers/SettingController.php +++ b/backend/app/Http/Controllers/SettingController.php @@ -7,6 +7,7 @@ use App\Services\Storage; use App\Services\TMDB; use App\Setting; + use Illuminate\Support\Facades\Artisan; use Illuminate\Support\Facades\Auth; use Illuminate\Support\Facades\Input; @@ -88,6 +89,14 @@ } } + /** + * Sync Flox with laravel scout driver in settings. + */ + public function syncScout() + { + Artisan::call('flox:sync'); + } + /** * Return user settings for frontend. * diff --git a/backend/composer.lock b/backend/composer.lock index a544466..51445d4 100644 --- a/backend/composer.lock +++ b/backend/composer.lock @@ -214,16 +214,16 @@ }, { "name": "guzzlehttp/guzzle", - "version": "6.2.1", + "version": "6.2.2", "source": { "type": "git", "url": "https://github.com/guzzle/guzzle.git", - "reference": "3f808fba627f2c5b69e2501217bf31af349c1427" + "reference": "ebf29dee597f02f09f4d5bbecc68230ea9b08f60" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/guzzle/guzzle/zipball/3f808fba627f2c5b69e2501217bf31af349c1427", - "reference": "3f808fba627f2c5b69e2501217bf31af349c1427", + "url": "https://api.github.com/repos/guzzle/guzzle/zipball/ebf29dee597f02f09f4d5bbecc68230ea9b08f60", + "reference": "ebf29dee597f02f09f4d5bbecc68230ea9b08f60", "shasum": "" }, "require": { @@ -272,7 +272,7 @@ "rest", "web service" ], - "time": "2016-07-15 17:22:37" + "time": "2016-10-08 15:01:37" }, { "name": "guzzlehttp/promises", @@ -530,16 +530,16 @@ }, { "name": "laravel/framework", - "version": "v5.3.16", + "version": "v5.3.19", "source": { "type": "git", "url": "https://github.com/laravel/framework.git", - "reference": "9932861dee0fef30138f9839102fb00ddd6ddce1" + "reference": "f1a5bb417b3e0d1949fe84617eacd1a14d75d7f1" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/laravel/framework/zipball/9932861dee0fef30138f9839102fb00ddd6ddce1", - "reference": "9932861dee0fef30138f9839102fb00ddd6ddce1", + "url": "https://api.github.com/repos/laravel/framework/zipball/f1a5bb417b3e0d1949fe84617eacd1a14d75d7f1", + "reference": "f1a5bb417b3e0d1949fe84617eacd1a14d75d7f1", "shasum": "" }, "require": { @@ -621,7 +621,7 @@ "pusher/pusher-php-server": "Required to use the Pusher broadcast driver (~2.0).", "symfony/css-selector": "Required to use some of the crawler integration testing tools (3.1.*).", "symfony/dom-crawler": "Required to use most of the crawler integration testing tools (3.1.*).", - "symfony/psr-http-message-bridge": "Required to psr7 bridging features (0.2.*)." + "symfony/psr-http-message-bridge": "Required to use psr7 bridging features (0.2.*)." }, "type": "library", "extra": { @@ -654,20 +654,20 @@ "framework", "laravel" ], - "time": "2016-10-04 16:05:47" + "time": "2016-10-17 19:35:14" }, { "name": "laravel/scout", - "version": "v1.1.5", + "version": "v1.1.8", "source": { "type": "git", "url": "https://github.com/laravel/scout.git", - "reference": "e8209540a39ab19c3e5849ab7b7bf57b4a1454a6" + "reference": "31e07d8734d0b0c9d7311d762cef9b9f39840251" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/laravel/scout/zipball/e8209540a39ab19c3e5849ab7b7bf57b4a1454a6", - "reference": "e8209540a39ab19c3e5849ab7b7bf57b4a1454a6", + "url": "https://api.github.com/repos/laravel/scout/zipball/31e07d8734d0b0c9d7311d762cef9b9f39840251", + "reference": "31e07d8734d0b0c9d7311d762cef9b9f39840251", "shasum": "" }, "require": { @@ -717,24 +717,24 @@ "laravel", "search" ], - "time": "2016-09-27 13:41:14" + "time": "2016-10-17 21:22:21" }, { "name": "league/flysystem", - "version": "1.0.27", + "version": "1.0.30", "source": { "type": "git", "url": "https://github.com/thephpleague/flysystem.git", - "reference": "50e2045ed70a7e75a5e30bc3662904f3b67af8a9" + "reference": "75138bb14160f3ba963750aa95e08d1d394fb198" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/thephpleague/flysystem/zipball/50e2045ed70a7e75a5e30bc3662904f3b67af8a9", - "reference": "50e2045ed70a7e75a5e30bc3662904f3b67af8a9", + "url": "https://api.github.com/repos/thephpleague/flysystem/zipball/75138bb14160f3ba963750aa95e08d1d394fb198", + "reference": "75138bb14160f3ba963750aa95e08d1d394fb198", "shasum": "" }, "require": { - "php": ">=5.4.0" + "php": ">=5.5.9" }, "conflict": { "league/flysystem-sftp": "<1.0.6" @@ -800,7 +800,7 @@ "sftp", "storage" ], - "time": "2016-08-10 08:55:11" + "time": "2016-10-18 16:20:02" }, { "name": "monolog/monolog", @@ -1024,16 +1024,16 @@ }, { "name": "paragonie/random_compat", - "version": "v2.0.2", + "version": "v2.0.3", "source": { "type": "git", "url": "https://github.com/paragonie/random_compat.git", - "reference": "088c04e2f261c33bed6ca5245491cfca69195ccf" + "reference": "c0125896dbb151380ab47e96c621741e79623beb" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/paragonie/random_compat/zipball/088c04e2f261c33bed6ca5245491cfca69195ccf", - "reference": "088c04e2f261c33bed6ca5245491cfca69195ccf", + "url": "https://api.github.com/repos/paragonie/random_compat/zipball/c0125896dbb151380ab47e96c621741e79623beb", + "reference": "c0125896dbb151380ab47e96c621741e79623beb", "shasum": "" }, "require": { @@ -1068,7 +1068,7 @@ "pseudorandom", "random" ], - "time": "2016-04-03 06:00:07" + "time": "2016-10-17 15:23:22" }, { "name": "psr/http-message", @@ -1122,16 +1122,16 @@ }, { "name": "psr/log", - "version": "1.0.1", + "version": "1.0.2", "source": { "type": "git", "url": "https://github.com/php-fig/log.git", - "reference": "5277094ed527a1c4477177d102fe4c53551953e0" + "reference": "4ebe3a8bf773a19edfe0a84b6585ba3d401b724d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-fig/log/zipball/5277094ed527a1c4477177d102fe4c53551953e0", - "reference": "5277094ed527a1c4477177d102fe4c53551953e0", + "url": "https://api.github.com/repos/php-fig/log/zipball/4ebe3a8bf773a19edfe0a84b6585ba3d401b724d", + "reference": "4ebe3a8bf773a19edfe0a84b6585ba3d401b724d", "shasum": "" }, "require": { @@ -1165,7 +1165,7 @@ "psr", "psr-3" ], - "time": "2016-09-19 16:02:08" + "time": "2016-10-10 12:19:37" }, { "name": "psy/psysh", @@ -2912,16 +2912,16 @@ }, { "name": "phpunit/phpunit", - "version": "5.5.6", + "version": "5.6.1", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "146e0fe0bb7f44d1cefade0c93e86fe0b206dd79" + "reference": "60c32c5b5e79c2248001efa2560f831da11cc2d7" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/146e0fe0bb7f44d1cefade0c93e86fe0b206dd79", - "reference": "146e0fe0bb7f44d1cefade0c93e86fe0b206dd79", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/60c32c5b5e79c2248001efa2560f831da11cc2d7", + "reference": "60c32c5b5e79c2248001efa2560f831da11cc2d7", "shasum": "" }, "require": { @@ -2955,7 +2955,6 @@ "ext-pdo": "*" }, "suggest": { - "ext-tidy": "*", "ext-xdebug": "*", "phpunit/php-invoker": "~1.1" }, @@ -2965,7 +2964,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "5.5.x-dev" + "dev-master": "5.6.x-dev" } }, "autoload": { @@ -2991,20 +2990,20 @@ "testing", "xunit" ], - "time": "2016-10-03 07:48:45" + "time": "2016-10-07 13:03:26" }, { "name": "phpunit/phpunit-mock-objects", - "version": "3.3.1", + "version": "3.4.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit-mock-objects.git", - "reference": "03500345483e1e17b52e2e4d34a89c9408ab2902" + "reference": "238d7a2723bce689c79eeac9c7d5e1d623bb9dc2" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit-mock-objects/zipball/03500345483e1e17b52e2e4d34a89c9408ab2902", - "reference": "03500345483e1e17b52e2e4d34a89c9408ab2902", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit-mock-objects/zipball/238d7a2723bce689c79eeac9c7d5e1d623bb9dc2", + "reference": "238d7a2723bce689c79eeac9c7d5e1d623bb9dc2", "shasum": "" }, "require": { @@ -3050,7 +3049,7 @@ "mock", "xunit" ], - "time": "2016-10-04 11:03:26" + "time": "2016-10-09 07:01:45" }, { "name": "sebastian/code-unit-reverse-lookup", diff --git a/backend/routes/web.php b/backend/routes/web.php index 5b37d4f..41f4f1a 100644 --- a/backend/routes/web.php +++ b/backend/routes/web.php @@ -17,6 +17,7 @@ Route::get('/export', 'SettingController@export'); Route::post('/import', 'SettingController@import'); + Route::get('/sync-scout', 'SettingController@syncScout'); Route::get('/update-genre', 'SettingController@updateGenre'); Route::patch('/settings', 'SettingController@changeSettings'); diff --git a/client/app/components/Content/Settings.vue b/client/app/components/Content/Settings.vue index ffb70d5..3195b9b 100644 --- a/client/app/components/Content/Settings.vue +++ b/client/app/components/Content/Settings.vue @@ -13,7 +13,7 @@
Export / Import - Export movies + Export Movies
Misc - + + OR + OR
@@ -132,7 +134,14 @@ this.SET_LOADING(true); this.$http.get(`${config.api}/update-genre`).then(value => { - console.log(value); + this.SET_LOADING(false); + }); + }, + + syncScout() { + this.SET_LOADING(true); + + this.$http.get(`${config.api}/sync-scout`).then(value => { this.SET_LOADING(false); }); },