53 lines
1.3 KiB
PHP
53 lines
1.3 KiB
PHP
<?php
|
|
|
|
namespace App\Filament\Resources\OperationRunResource\Pages;
|
|
|
|
use App\Filament\Resources\OperationRunResource;
|
|
use App\Models\OperationRun;
|
|
use App\Models\Tenant;
|
|
use App\Support\OperationRunLinks;
|
|
use Filament\Actions;
|
|
use Filament\Resources\Pages\ViewRecord;
|
|
use Illuminate\Support\Str;
|
|
|
|
class ViewOperationRun extends ViewRecord
|
|
{
|
|
protected static string $resource = OperationRunResource::class;
|
|
|
|
public bool $opsUxIsTabHidden = false;
|
|
|
|
protected function getHeaderActions(): array
|
|
{
|
|
$tenant = Tenant::current();
|
|
|
|
if (! $tenant instanceof Tenant) {
|
|
return [];
|
|
}
|
|
|
|
/** @var OperationRun $run */
|
|
$run = $this->getRecord();
|
|
|
|
$related = OperationRunLinks::related($run, $tenant);
|
|
|
|
$actions = [];
|
|
|
|
foreach ($related as $label => $url) {
|
|
$actions[] = Actions\Action::make(Str::slug($label, '_'))
|
|
->label($label)
|
|
->url($url)
|
|
->openUrlInNewTab();
|
|
}
|
|
|
|
if (empty($actions)) {
|
|
return [];
|
|
}
|
|
|
|
return [
|
|
Actions\ActionGroup::make($actions)
|
|
->label('Open')
|
|
->icon('heroicon-o-arrow-top-right-on-square')
|
|
->color('gray'),
|
|
];
|
|
}
|
|
}
|