Add BamBuddy AMS, queue, history and stats to the print farm page
Deploy HickLab3D Dashboard / Deploy to production (push) Successful in 28s

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
Hickmeister
2026-10-11 20:14:29 +01:00
co-authored by Claude Sonnet 5.5
parent f7e3c8fe16
commit b11538944f
6 changed files with 135 additions and 3 deletions
+23 -1
View File
@@ -3,6 +3,7 @@
namespace App\Http\Controllers;
use App\Services\Bambuddy;
use Closure;
use Illuminate\View\View;
use Throwable;
@@ -20,6 +21,27 @@ class BambuddyController extends Controller
$integrationError = 'BamBuddy is unavailable. Check its API key and connection.';
}
return view('printers.index', compact('printers', 'integrationError') + ['bambuddyUrl' => $bambuddy->url()]);
$queue = $printers === [] ? [] : $this->optional(fn (): array => $bambuddy->queue());
$recentPrints = $printers === [] ? [] : $this->optional(fn (): array => $bambuddy->recentPrints());
$stats = $printers === [] ? [] : $this->optional(fn (): array => $bambuddy->stats());
return view('printers.index', compact('printers', 'integrationError', 'queue', 'recentPrints', 'stats') + ['bambuddyUrl' => $bambuddy->url()]);
}
/**
* Load secondary page data without letting a failure hide the printers.
*
* @param Closure(): array<mixed> $load
* @return array<mixed>
*/
private function optional(Closure $load): array
{
try {
return $load();
} catch (Throwable $exception) {
report($exception);
return [];
}
}
}