fix(superadmin): stabilize knowledge base nav and docs grouping
This commit is contained in:
@@ -56,7 +56,7 @@ class TenantFeedbackResource extends Resource
|
|||||||
|
|
||||||
public static function getNavigationGroup(): UnitEnum|string|null
|
public static function getNavigationGroup(): UnitEnum|string|null
|
||||||
{
|
{
|
||||||
return __('admin.nav.feedback_support');
|
return __('admin.nav.infrastructure');
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function getEloquentQuery(): Builder
|
public static function getEloquentQuery(): Builder
|
||||||
|
|||||||
42
app/Filament/SuperAdmin/Pages/InternalDocsPage.php
Normal file
42
app/Filament/SuperAdmin/Pages/InternalDocsPage.php
Normal file
@@ -0,0 +1,42 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Filament\SuperAdmin\Pages;
|
||||||
|
|
||||||
|
use App\Filament\Clusters\RareAdmin\RareAdminCluster;
|
||||||
|
use BackedEnum;
|
||||||
|
use Filament\Pages\Page;
|
||||||
|
use UnitEnum;
|
||||||
|
|
||||||
|
class InternalDocsPage extends Page
|
||||||
|
{
|
||||||
|
protected static ?string $cluster = RareAdminCluster::class;
|
||||||
|
|
||||||
|
protected static null|string|BackedEnum $navigationIcon = 'heroicon-o-book-open';
|
||||||
|
|
||||||
|
protected static null|string|UnitEnum $navigationGroup = null;
|
||||||
|
|
||||||
|
protected static ?int $navigationSort = 18;
|
||||||
|
|
||||||
|
public static function getNavigationLabel(): string
|
||||||
|
{
|
||||||
|
return __('admin.nav.internal_docs');
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function getNavigationGroup(): UnitEnum|string|null
|
||||||
|
{
|
||||||
|
return __('admin.nav.infrastructure');
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function getNavigationUrl(): string
|
||||||
|
{
|
||||||
|
return url('/super-admin/docs');
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function getNavigationItemActiveRoutePattern(): string|array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
static::getRouteName(),
|
||||||
|
'filament.superadmin-kb.*',
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -22,12 +22,14 @@ class SuperAdminKbPanelProvider extends PanelProvider
|
|||||||
{
|
{
|
||||||
public function panel(Panel $panel): Panel
|
public function panel(Panel $panel): Panel
|
||||||
{
|
{
|
||||||
|
$knowledgeBasePath = $this->knowledgeBasePath();
|
||||||
|
|
||||||
return $panel
|
return $panel
|
||||||
->id('superadmin-kb')
|
->id('superadmin-kb')
|
||||||
->path('super-admin/docs')
|
->path('super-admin/docs')
|
||||||
->viteTheme('resources/css/filament/superadmin-kb/theme.css')
|
->viteTheme('resources/css/filament/superadmin-kb/theme.css')
|
||||||
->plugins([
|
->plugins([
|
||||||
KnowledgeBasePlugin::make(base_path('docs/superadmin-kb')),
|
KnowledgeBasePlugin::make($knowledgeBasePath),
|
||||||
])
|
])
|
||||||
->login(Login::class)
|
->login(Login::class)
|
||||||
->profile(EditProfile::class, isSimple: false)
|
->profile(EditProfile::class, isSimple: false)
|
||||||
@@ -47,4 +49,11 @@ class SuperAdminKbPanelProvider extends PanelProvider
|
|||||||
])
|
])
|
||||||
->authGuard('super_admin');
|
->authGuard('super_admin');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected function knowledgeBasePath(): string
|
||||||
|
{
|
||||||
|
$path = realpath(base_path('docs/superadmin-kb')) ?: base_path('docs/superadmin-kb');
|
||||||
|
|
||||||
|
return str_replace(['\\', '/'], DIRECTORY_SEPARATOR, $path);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -50,8 +50,7 @@ class SuperAdminPanelProvider extends PanelProvider
|
|||||||
->navigationSort(20),
|
->navigationSort(20),
|
||||||
KnowledgeBaseCompanionPlugin::make()
|
KnowledgeBaseCompanionPlugin::make()
|
||||||
->knowledgeBasePanelId('superadmin-kb')
|
->knowledgeBasePanelId('superadmin-kb')
|
||||||
->helpMenuRenderHook(PanelsRenderHook::TOPBAR_START)
|
->helpMenuRenderHook(PanelsRenderHook::TOPBAR_START),
|
||||||
->disableKnowledgeBasePanelButton(),
|
|
||||||
])
|
])
|
||||||
->navigationGroups([
|
->navigationGroups([
|
||||||
NavigationGroup::make()
|
NavigationGroup::make()
|
||||||
@@ -62,8 +61,6 @@ class SuperAdminPanelProvider extends PanelProvider
|
|||||||
->label(__('admin.nav.tenants')),
|
->label(__('admin.nav.tenants')),
|
||||||
NavigationGroup::make()
|
NavigationGroup::make()
|
||||||
->label(__('admin.nav.billing')),
|
->label(__('admin.nav.billing')),
|
||||||
NavigationGroup::make()
|
|
||||||
->label(__('admin.nav.feedback_support')),
|
|
||||||
NavigationGroup::make()
|
NavigationGroup::make()
|
||||||
->label(__('admin.nav.platform')),
|
->label(__('admin.nav.platform')),
|
||||||
NavigationGroup::make()
|
NavigationGroup::make()
|
||||||
|
|||||||
@@ -2,5 +2,4 @@
|
|||||||
title: Grundlagen
|
title: Grundlagen
|
||||||
type: group
|
type: group
|
||||||
order: 10
|
order: 10
|
||||||
icon: heroicon-o-book-open
|
|
||||||
---
|
---
|
||||||
|
|||||||
@@ -2,5 +2,4 @@
|
|||||||
title: Incidents & DR
|
title: Incidents & DR
|
||||||
type: group
|
type: group
|
||||||
order: 20
|
order: 20
|
||||||
icon: heroicon-o-exclamation-triangle
|
|
||||||
---
|
---
|
||||||
|
|||||||
@@ -2,5 +2,4 @@
|
|||||||
title: Medien & Upload
|
title: Medien & Upload
|
||||||
type: group
|
type: group
|
||||||
order: 30
|
order: 30
|
||||||
icon: heroicon-o-cloud-arrow-up
|
|
||||||
---
|
---
|
||||||
|
|||||||
@@ -2,5 +2,4 @@
|
|||||||
title: Photobooth
|
title: Photobooth
|
||||||
type: group
|
type: group
|
||||||
order: 40
|
order: 40
|
||||||
icon: heroicon-o-camera
|
|
||||||
---
|
---
|
||||||
|
|||||||
@@ -2,5 +2,4 @@
|
|||||||
title: Billing
|
title: Billing
|
||||||
type: group
|
type: group
|
||||||
order: 50
|
order: 50
|
||||||
icon: heroicon-o-credit-card
|
|
||||||
---
|
---
|
||||||
|
|||||||
@@ -2,5 +2,4 @@
|
|||||||
title: AI Operations
|
title: AI Operations
|
||||||
type: group
|
type: group
|
||||||
order: 60
|
order: 60
|
||||||
icon: heroicon-o-sparkles
|
|
||||||
---
|
---
|
||||||
|
|||||||
@@ -2,5 +2,4 @@
|
|||||||
title: DSGVO & Compliance
|
title: DSGVO & Compliance
|
||||||
type: group
|
type: group
|
||||||
order: 70
|
order: 70
|
||||||
icon: heroicon-o-shield-check
|
|
||||||
---
|
---
|
||||||
|
|||||||
@@ -2,5 +2,4 @@
|
|||||||
title: Deployment
|
title: Deployment
|
||||||
type: group
|
type: group
|
||||||
order: 80
|
order: 80
|
||||||
icon: heroicon-o-server-stack
|
|
||||||
---
|
---
|
||||||
|
|||||||
@@ -2,5 +2,4 @@
|
|||||||
title: Releases & Tests
|
title: Releases & Tests
|
||||||
type: group
|
type: group
|
||||||
order: 90
|
order: 90
|
||||||
icon: heroicon-o-rocket-launch
|
|
||||||
---
|
---
|
||||||
|
|||||||
@@ -2,5 +2,4 @@
|
|||||||
title: Monitoring & Diagramme
|
title: Monitoring & Diagramme
|
||||||
type: group
|
type: group
|
||||||
order: 100
|
order: 100
|
||||||
icon: heroicon-o-chart-bar
|
|
||||||
---
|
---
|
||||||
|
|||||||
@@ -20,6 +20,7 @@ return [
|
|||||||
'infrastructure' => 'Infrastruktur',
|
'infrastructure' => 'Infrastruktur',
|
||||||
'storage' => 'Speicher',
|
'storage' => 'Speicher',
|
||||||
'feedback_support' => 'Feedback & Support',
|
'feedback_support' => 'Feedback & Support',
|
||||||
|
'internal_docs' => 'Interne Doku',
|
||||||
'branding' => 'Branding',
|
'branding' => 'Branding',
|
||||||
'security' => 'Sicherheit',
|
'security' => 'Sicherheit',
|
||||||
],
|
],
|
||||||
|
|||||||
@@ -20,6 +20,7 @@ return [
|
|||||||
'infrastructure' => 'Infrastructure',
|
'infrastructure' => 'Infrastructure',
|
||||||
'storage' => 'Storage',
|
'storage' => 'Storage',
|
||||||
'feedback_support' => 'Feedback & Support',
|
'feedback_support' => 'Feedback & Support',
|
||||||
|
'internal_docs' => 'Internal Docs',
|
||||||
'branding' => 'Branding',
|
'branding' => 'Branding',
|
||||||
'security' => 'Security',
|
'security' => 'Security',
|
||||||
],
|
],
|
||||||
|
|||||||
@@ -89,6 +89,20 @@ class UserRoleAccessTest extends TestCase
|
|||||||
$this->assertStringStartsWith('/super-admin/docs', (string) $redirectPath);
|
$this->assertStringStartsWith('/super-admin/docs', (string) $redirectPath);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function test_super_admin_docs_panel_page_renders_after_redirect(): void
|
||||||
|
{
|
||||||
|
$user = User::factory()->create(['role' => 'super_admin']);
|
||||||
|
|
||||||
|
$response = $this
|
||||||
|
->followingRedirects()
|
||||||
|
->actingAs($user, 'super_admin')
|
||||||
|
->get('/super-admin/docs');
|
||||||
|
|
||||||
|
$response
|
||||||
|
->assertOk()
|
||||||
|
->assertSee('Grundlagen');
|
||||||
|
}
|
||||||
|
|
||||||
public function test_non_super_admin_cannot_access_super_admin_docs_panel(): void
|
public function test_non_super_admin_cannot_access_super_admin_docs_panel(): void
|
||||||
{
|
{
|
||||||
$user = User::factory()->create(['role' => 'tenant_admin']);
|
$user = User::factory()->create(['role' => 'tenant_admin']);
|
||||||
|
|||||||
@@ -39,10 +39,11 @@ class SuperAdminNavigationGroupsTest extends TestCase
|
|||||||
\App\Filament\Resources\TenantPackageResource::class => 'admin.nav.commercial',
|
\App\Filament\Resources\TenantPackageResource::class => 'admin.nav.commercial',
|
||||||
\App\Filament\Resources\Coupons\CouponResource::class => 'admin.nav.commercial',
|
\App\Filament\Resources\Coupons\CouponResource::class => 'admin.nav.commercial',
|
||||||
\App\Filament\Resources\GiftVoucherResource::class => 'admin.nav.commercial',
|
\App\Filament\Resources\GiftVoucherResource::class => 'admin.nav.commercial',
|
||||||
\App\Filament\Resources\TenantFeedbackResource::class => 'admin.nav.feedback_support',
|
\App\Filament\Resources\TenantFeedbackResource::class => 'admin.nav.infrastructure',
|
||||||
\App\Filament\Resources\InfrastructureActionLogs\InfrastructureActionLogResource::class => 'admin.nav.infrastructure',
|
\App\Filament\Resources\InfrastructureActionLogs\InfrastructureActionLogResource::class => 'admin.nav.infrastructure',
|
||||||
\App\Filament\SuperAdmin\Pages\WatermarkSettingsPage::class => 'admin.nav.branding',
|
\App\Filament\SuperAdmin\Pages\WatermarkSettingsPage::class => 'admin.nav.branding',
|
||||||
\App\Filament\SuperAdmin\Pages\DokployDeployments::class => 'admin.nav.infrastructure',
|
\App\Filament\SuperAdmin\Pages\DokployDeployments::class => 'admin.nav.infrastructure',
|
||||||
|
\App\Filament\SuperAdmin\Pages\InternalDocsPage::class => 'admin.nav.infrastructure',
|
||||||
\App\Filament\SuperAdmin\Pages\OpsHealthDashboard::class => 'admin.nav.infrastructure',
|
\App\Filament\SuperAdmin\Pages\OpsHealthDashboard::class => 'admin.nav.infrastructure',
|
||||||
\App\Filament\SuperAdmin\Pages\IntegrationsHealthDashboard::class => 'admin.nav.infrastructure',
|
\App\Filament\SuperAdmin\Pages\IntegrationsHealthDashboard::class => 'admin.nav.infrastructure',
|
||||||
\App\Filament\Clusters\DailyOps\Pages\JoinTokenAnalyticsDashboard::class => 'admin.nav.security',
|
\App\Filament\Clusters\DailyOps\Pages\JoinTokenAnalyticsDashboard::class => 'admin.nav.security',
|
||||||
@@ -82,6 +83,7 @@ class SuperAdminNavigationGroupsTest extends TestCase
|
|||||||
\App\Filament\Blog\Resources\CategoryResource::class => RareAdminCluster::class,
|
\App\Filament\Blog\Resources\CategoryResource::class => RareAdminCluster::class,
|
||||||
\App\Filament\SuperAdmin\Pages\WatermarkSettingsPage::class => RareAdminCluster::class,
|
\App\Filament\SuperAdmin\Pages\WatermarkSettingsPage::class => RareAdminCluster::class,
|
||||||
\App\Filament\SuperAdmin\Pages\DokployDeployments::class => RareAdminCluster::class,
|
\App\Filament\SuperAdmin\Pages\DokployDeployments::class => RareAdminCluster::class,
|
||||||
|
\App\Filament\SuperAdmin\Pages\InternalDocsPage::class => RareAdminCluster::class,
|
||||||
];
|
];
|
||||||
|
|
||||||
foreach ($clusterExpectations as $resourceClass => $clusterClass) {
|
foreach ($clusterExpectations as $resourceClass => $clusterClass) {
|
||||||
@@ -100,4 +102,12 @@ class SuperAdminNavigationGroupsTest extends TestCase
|
|||||||
|
|
||||||
$this->assertTrue($panel->hasTopNavigation());
|
$this->assertTrue($panel->hasTopNavigation());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function test_internal_docs_page_navigation_url_points_to_knowledge_base_panel(): void
|
||||||
|
{
|
||||||
|
$this->assertSame(
|
||||||
|
url('/super-admin/docs'),
|
||||||
|
\App\Filament\SuperAdmin\Pages\InternalDocsPage::getNavigationUrl()
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user