mirror of
https://github.com/PhyreApps/PhyrePanel.git
synced 2024-11-22 07:30:25 +00:00
update
This commit is contained in:
parent
b865f1ef35
commit
7345ae9df9
5 changed files with 76 additions and 1 deletions
|
@ -27,6 +27,11 @@ class ManageBackups extends ManageRecords
|
|||
}
|
||||
|
||||
return [
|
||||
|
||||
Actions\Action::make('restoring')
|
||||
->label('Restoring backup...')
|
||||
->icon('heroicon-o-clock'),
|
||||
|
||||
Actions\Action::make('restore')
|
||||
->hidden($restoringBackup)
|
||||
->icon('heroicon-o-cloud-arrow-up')
|
||||
|
|
43
web/app/Livewire/JobQueueNotifications.php
Normal file
43
web/app/Livewire/JobQueueNotifications.php
Normal file
|
@ -0,0 +1,43 @@
|
|||
<?php
|
||||
|
||||
namespace App\Livewire;
|
||||
|
||||
use Illuminate\Contracts\View\View;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Livewire\Component;
|
||||
|
||||
class JobQueueNotifications extends Component
|
||||
{
|
||||
|
||||
public function render(): View
|
||||
{
|
||||
|
||||
$jobs = [];
|
||||
$getJobs = DB::table('jobs')->orderBy('id', 'desc')->get();
|
||||
foreach ($getJobs as $job) {
|
||||
$job->payload = json_decode($job->payload);
|
||||
if (isset($job->payload->displayName)) {
|
||||
$jobClassInstance = new $job->payload->displayName;
|
||||
$displayName = 'Unknown Job';
|
||||
if (method_exists($jobClassInstance, 'getDisplayName')) {
|
||||
$displayName = $jobClassInstance->getDisplayName();
|
||||
} else {
|
||||
$explodeDisplayName = explode('\\', $job->payload->displayName);
|
||||
$displayName = end($explodeDisplayName);
|
||||
}
|
||||
$jobs[] = [
|
||||
'id' => $job->id,
|
||||
'displayName' => $displayName,
|
||||
'status' => $job->attempts == 0 ? 'Pending' : 'Processing',
|
||||
'createdAt' => $job->created_at
|
||||
];
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
return view('filament.job-queue-notifications', [
|
||||
'jobs' => $jobs
|
||||
]);
|
||||
}
|
||||
|
||||
}
|
|
@ -14,6 +14,7 @@ use App\Listeners\ModelHostingSubscriptionDeletingListener;
|
|||
use App\Livewire\BackupLog;
|
||||
use App\Livewire\Components\QuickServiceRestartMenu;
|
||||
use App\Livewire\HostingSubscriptionBackupLog;
|
||||
use App\Livewire\JobQueueNotifications;
|
||||
use App\Models\Domain;
|
||||
use App\Models\HostingSubscription;
|
||||
use App\Policies\CustomerPolicy;
|
||||
|
@ -64,6 +65,7 @@ class AppServiceProvider extends ServiceProvider
|
|||
Filament::registerViteTheme('resources/css/app.css');
|
||||
});
|
||||
|
||||
Livewire::component('jobs-queue-notifications', JobQueueNotifications::class);
|
||||
Livewire::component('quick-service-restart-menu', QuickServiceRestartMenu::class);
|
||||
Livewire::component('hosting-subscription-backup-log', HostingSubscriptionBackupLog::class);
|
||||
Livewire::component('backup-log', BackupLog::class);
|
||||
|
|
|
@ -35,12 +35,15 @@ class AdminPanelProvider extends PanelProvider
|
|||
{
|
||||
public function panel(Panel $panel): Panel
|
||||
{
|
||||
|
||||
$panel->default()
|
||||
->darkMode(true)
|
||||
->id('admin')
|
||||
->path('admin')
|
||||
->login()
|
||||
->renderHook(
|
||||
name: PanelsRenderHook::BODY_START,
|
||||
hook: fn (): string => Blade::render('@livewire(\'jobs-queue-notifications\')')
|
||||
)
|
||||
->renderHook(
|
||||
name: PanelsRenderHook::TOPBAR_START,
|
||||
hook: fn (): string => Blade::render('@livewire(\'quick-service-restart-menu\')')
|
||||
|
|
|
@ -0,0 +1,22 @@
|
|||
@foreach($jobs as $job)
|
||||
|
||||
<div class="absolute z-50 bottom-5 right-5 w-[22rem] rounded-xl text-black px-3 py-4 shadow-sm bg-white ring-1 ring-gray-950/5 dark:bg-gray-900 dark:ring-white/10">
|
||||
|
||||
<div class="w-full flex justify-between">
|
||||
<div>
|
||||
{{ $job['displayName']}}
|
||||
</div>
|
||||
<div>
|
||||
<svg xmlns="http://www.w3.org/2000/svg" class="w-4" viewBox="0 0 24 24">
|
||||
<path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2.5" d="m7 7l10 10M7 17L17 7" />
|
||||
</svg>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="flex gap-2 items-center">
|
||||
<span class="text-sm">Running...</span>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
@endforeach
|
Loading…
Reference in a new issue