Spec 077: Workspace Global Mode + context bar redundancy cleanup #94
@ -5,8 +5,10 @@
|
||||
namespace App\Filament\Pages\Operations;
|
||||
|
||||
use App\Models\OperationRun;
|
||||
use App\Models\Tenant;
|
||||
use App\Models\User;
|
||||
use App\Models\WorkspaceMembership;
|
||||
use App\Services\Auth\CapabilityResolver;
|
||||
use Filament\Actions\Action;
|
||||
use Filament\Pages\Page;
|
||||
|
||||
@ -29,13 +31,39 @@ class TenantlessOperationRunViewer extends Page
|
||||
*/
|
||||
protected function getHeaderActions(): array
|
||||
{
|
||||
return [
|
||||
$actions = [
|
||||
Action::make('refresh')
|
||||
->label('Refresh')
|
||||
->icon('heroicon-o-arrow-path')
|
||||
->color('gray')
|
||||
->url(fn (): string => url()->current()),
|
||||
];
|
||||
|
||||
if (! isset($this->run)) {
|
||||
return $actions;
|
||||
}
|
||||
|
||||
$tenant = $this->run->tenant;
|
||||
$user = auth()->user();
|
||||
|
||||
if (! $tenant instanceof Tenant || ! $user instanceof User) {
|
||||
return $actions;
|
||||
}
|
||||
|
||||
if (! app(CapabilityResolver::class)->isMember($user, $tenant)) {
|
||||
return $actions;
|
||||
}
|
||||
|
||||
$actions[] = Action::make('admin_details')
|
||||
->label('Admin details')
|
||||
->icon('heroicon-o-arrow-top-right-on-square')
|
||||
->color('gray')
|
||||
->url(fn (): string => route('filament.admin.resources.operations.view', [
|
||||
'tenant' => (int) $tenant->getKey(),
|
||||
'record' => (int) $this->run->getKey(),
|
||||
]));
|
||||
|
||||
return $actions;
|
||||
}
|
||||
|
||||
public function mount(OperationRun $run): void
|
||||
|
||||
@ -67,7 +67,8 @@
|
||||
->withSession([WorkspaceContext::SESSION_KEY => (int) $tenant->workspace_id])
|
||||
->get(route('admin.operations.view', ['run' => (int) $run->getKey()]))
|
||||
->assertOk()
|
||||
->assertSee('Operation run');
|
||||
->assertSee('Operation run')
|
||||
->assertSee('/admin/t/'.((int) $tenant->getKey()).'/operations/r/'.((int) $run->getKey()));
|
||||
|
||||
Filament::setTenant($tenant, true);
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user