From: Vincent Vanwaelscappel Date: Thu, 16 Jun 2022 08:36:52 +0000 (+0200) Subject: wip #4210 @0.25 X-Git-Url: http://git.cubedesigners.com/?a=commitdiff_plain;h=f77a95208ca973ac4b5ad3890f0ac299d627c1f1;p=fluidbook-toolbox.git wip #4210 @0.25 --- diff --git a/app/Console/Commands/Precache.php b/app/Console/Commands/Precache.php deleted file mode 100644 index 46835bd1c..000000000 --- a/app/Console/Commands/Precache.php +++ /dev/null @@ -1,92 +0,0 @@ - 'class:' . User::class, - 'Cache company data' => 'class:' . Company::class, - 'Cache permissions data' => 'permissions', - 'Cache fluidbook quote data' => 'class:' . FluidbookQuote::class, - 'Cache fluidbook theme data' => 'class:' . FluidbookTheme::class, - 'Cache fluidbook icon set data' => 'class:' . FluidbookIconset::class, - 'Cache fluidbook signature data' => 'class:' . Signature::class, - 'Cache fluidbook collection data' => 'class:' . FluidbookCollection::class, - 'Cache fluidbook translation data' => 'class:' . FluidbookTranslate::class, - 'Cache quiz data' => 'class:' . Quiz::class, - 'Cache elearning media data' => 'class:' . ELearningMedia::class, - 'Cache elearning package data' => 'class:' . ELearningPackage::class, - 'Cache fluidbook publication data' => 'class:' . FluidbookPublication::class, - ]; - - $user = AuthUser::where('id', self::$_admin)->first(); - backpack_auth()->login($user); - - $this->progressBar = $this->output->createProgressBar(count($actions)); - - $this->line('Begins data caching'); - $this->progressBar->start(); - - - foreach ($actions as $comment => $action) { - $this->line($comment); - $this->action($action); - $this->progressBar->advance(); - } - - $this->line('End of caching data'); - } - - protected function action($actionName) - { - sleep(1); - if (method_exists($this, $actionName)) { - return $this->$actionName(); - } - if (str_contains($actionName, 'class:')) { - $class = substr($actionName, 6); - return $this->preCacheClass($class); - } - - } - - protected function preCacheClass($className) - { - $instance = $className::withoutGlobalScopes()->first(); - if ($instance instanceof CubistMagicAbstractModel) { - $instance->preCache(); - } - } - - protected function permissions() - { - Permissions::getManagedUsers(self::$_admin); - } -} diff --git a/app/Console/Kernel.php b/app/Console/Kernel.php index 2a65121f5..523f3a220 100644 --- a/app/Console/Kernel.php +++ b/app/Console/Kernel.php @@ -26,7 +26,7 @@ class Kernel extends \Cubist\Backpack\Console\Kernel { parent::schedule($schedule); - $schedule->command('ws:precache')->everyFiveMinutes(); + $schedule->command('cubist:magic:precache')->everyFiveMinutes(); $schedule->command('job:dispatch ProcessTotals')->everyTwoHours(); } diff --git a/app/Models/Company.php b/app/Models/Company.php index 1815ac82b..318d9a916 100644 --- a/app/Models/Company.php +++ b/app/Models/Company.php @@ -1,6 +1,9 @@ 'client', 'plural' => 'clients']; + public function preCache($force = false) + { + parent::preCache($force); + Permissions::_getData($force); + } + } diff --git a/app/Models/Locale.php b/app/Models/Locale.php index 093c2285c..5637e0045 100644 --- a/app/Models/Locale.php +++ b/app/Models/Locale.php @@ -1,8 +1,14 @@ setTimeout(r, 1000 * (options.delay - 1))); - // Set page and take a screenshot + // Show slider and thumbs await page.evaluate(() => fluidbook.slider.hover(512)); + // Move to page 2 await page.evaluate(() => fluidbook.setCurrentPage(2)); + // Move mouse to hover a link (show tooltip and link) await page.mouse.move(150, 300); - + // Wait 1s and take a screenshot await new Promise(r => setTimeout(r, 1000)); await page.screenshot({path: options.dest, type: 'jpeg', quality: 95});