Added a complete Admin UI for managing platform modules:
API endpoints (app/api/v1/admin/modules.py):
- GET /modules - List all available modules
- GET /modules/platforms/{id} - Get platform modules
- PUT /modules/platforms/{id} - Update enabled modules
- POST /modules/platforms/{id}/enable - Enable a module
- POST /modules/platforms/{id}/disable - Disable a module
- POST /modules/platforms/{id}/enable-all - Enable all
- POST /modules/platforms/{id}/disable-optional - Core only
Admin UI:
- New page route: /admin/platforms/{code}/modules
- Template: platform-modules.html
- JavaScript: platform-modules.js
- Link added to platform-detail.html Super Admin section
Features:
- Toggle modules on/off with dependency resolution
- Enable all / Core only bulk actions
- Visual dependency indicators
- Separate sections for core vs optional modules
- Feature list preview per module
Also includes require_menu_access updates to page routes from Phase 2.
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
302 lines
17 KiB
HTML
302 lines
17 KiB
HTML
{# app/templates/admin/platform-detail.html #}
|
|
{% extends "admin/base.html" %}
|
|
{% from 'shared/macros/alerts.html' import loading_state, error_state %}
|
|
{% from 'shared/macros/headers.html' import page_header %}
|
|
|
|
{% block title %}Platform Details{% endblock %}
|
|
|
|
{% block alpine_data %}platformDetail(){% endblock %}
|
|
|
|
{% block content %}
|
|
<!-- Header with Back Button -->
|
|
<div class="flex items-center justify-between my-6">
|
|
<div class="flex items-center">
|
|
<a href="/admin/platforms" class="mr-4 p-2 rounded-lg hover:bg-gray-100 dark:hover:bg-gray-700 transition-colors">
|
|
<span x-html="$icon('arrow-left', 'w-5 h-5 text-gray-600 dark:text-gray-400')"></span>
|
|
</a>
|
|
<div>
|
|
<div class="flex items-center">
|
|
<span x-html="$icon(getPlatformIcon(platformCode), 'w-8 h-8 text-purple-600 dark:text-purple-400 mr-3')"></span>
|
|
<h2 class="text-2xl font-semibold text-gray-700 dark:text-gray-200" x-text="platform?.name || 'Loading...'"></h2>
|
|
<code class="ml-3 text-sm bg-gray-100 dark:bg-gray-700 px-2 py-1 rounded" x-text="platformCode"></code>
|
|
</div>
|
|
<p class="text-sm text-gray-600 dark:text-gray-400 mt-1" x-text="platform?.description || ''"></p>
|
|
</div>
|
|
</div>
|
|
<div class="flex items-center gap-2">
|
|
<!-- Status Badges -->
|
|
<span
|
|
x-show="platform?.is_active"
|
|
class="inline-flex items-center px-3 py-1 text-xs font-semibold rounded-full bg-green-100 text-green-800 dark:bg-green-900 dark:text-green-200">
|
|
Active
|
|
</span>
|
|
<span
|
|
x-show="!platform?.is_active"
|
|
class="inline-flex items-center px-3 py-1 text-xs font-semibold rounded-full bg-red-100 text-red-800 dark:bg-red-900 dark:text-red-200">
|
|
Inactive
|
|
</span>
|
|
</div>
|
|
</div>
|
|
|
|
{{ loading_state('Loading platform details...') }}
|
|
{{ error_state('Error loading platform') }}
|
|
|
|
<!-- Main Content -->
|
|
<div x-show="!loading && platform" class="space-y-6">
|
|
|
|
<!-- Quick Actions -->
|
|
<div class="bg-white dark:bg-gray-800 rounded-lg shadow-md p-6">
|
|
<h3 class="text-lg font-semibold text-gray-900 dark:text-white mb-4">Quick Actions</h3>
|
|
<div class="grid grid-cols-1 md:grid-cols-4 gap-4">
|
|
<!-- Edit Settings -->
|
|
<a :href="`/admin/platforms/${platformCode}/edit`"
|
|
class="flex items-center p-4 bg-purple-50 dark:bg-purple-900/20 rounded-lg hover:bg-purple-100 dark:hover:bg-purple-900/40 transition-colors">
|
|
<span x-html="$icon('cog', 'w-8 h-8 text-purple-600 dark:text-purple-400')"></span>
|
|
<div class="ml-3">
|
|
<p class="font-semibold text-gray-900 dark:text-white">Edit Settings</p>
|
|
<p class="text-sm text-gray-600 dark:text-gray-400">Branding, domain, languages</p>
|
|
</div>
|
|
</a>
|
|
|
|
<!-- Edit Homepage -->
|
|
<a :href="`/admin/content-pages?platform_code=${platformCode}&slug=home`"
|
|
class="flex items-center p-4 bg-blue-50 dark:bg-blue-900/20 rounded-lg hover:bg-blue-100 dark:hover:bg-blue-900/40 transition-colors">
|
|
<span x-html="$icon('home', 'w-8 h-8 text-blue-600 dark:text-blue-400')"></span>
|
|
<div class="ml-3">
|
|
<p class="font-semibold text-gray-900 dark:text-white">Edit Homepage</p>
|
|
<p class="text-sm text-gray-600 dark:text-gray-400">Platform landing page</p>
|
|
</div>
|
|
</a>
|
|
|
|
<!-- Manage Pages -->
|
|
<a :href="`/admin/content-pages?platform_code=${platformCode}`"
|
|
class="flex items-center p-4 bg-teal-50 dark:bg-teal-900/20 rounded-lg hover:bg-teal-100 dark:hover:bg-teal-900/40 transition-colors">
|
|
<span x-html="$icon('document-text', 'w-8 h-8 text-teal-600 dark:text-teal-400')"></span>
|
|
<div class="ml-3">
|
|
<p class="font-semibold text-gray-900 dark:text-white">Manage Pages</p>
|
|
<p class="text-sm text-gray-600 dark:text-gray-400">All content pages</p>
|
|
</div>
|
|
</a>
|
|
|
|
<!-- View Platform -->
|
|
<a :href="getPlatformUrl()" target="_blank"
|
|
class="flex items-center p-4 bg-gray-50 dark:bg-gray-700/50 rounded-lg hover:bg-gray-100 dark:hover:bg-gray-700 transition-colors">
|
|
<span x-html="$icon('external-link', 'w-8 h-8 text-gray-600 dark:text-gray-400')"></span>
|
|
<div class="ml-3">
|
|
<p class="font-semibold text-gray-900 dark:text-white">View Platform</p>
|
|
<p class="text-sm text-gray-600 dark:text-gray-400">Open in new tab</p>
|
|
</div>
|
|
</a>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Super Admin Actions (Menu Configuration) -->
|
|
<div x-show="isSuperAdmin" class="bg-white dark:bg-gray-800 rounded-lg shadow-md p-6">
|
|
<h3 class="text-lg font-semibold text-gray-900 dark:text-white mb-4">
|
|
<span class="inline-flex items-center">
|
|
Super Admin
|
|
<span class="ml-2 px-2 py-0.5 text-xs font-medium rounded bg-purple-100 text-purple-800 dark:bg-purple-900 dark:text-purple-200">Admin Only</span>
|
|
</span>
|
|
</h3>
|
|
<div class="grid grid-cols-1 md:grid-cols-4 gap-4">
|
|
<!-- Module Configuration -->
|
|
<a :href="`/admin/platforms/${platformCode}/modules`"
|
|
class="flex items-center p-4 bg-green-50 dark:bg-green-900/20 rounded-lg hover:bg-green-100 dark:hover:bg-green-900/40 transition-colors">
|
|
<span x-html="$icon('puzzle', 'w-8 h-8 text-green-600 dark:text-green-400')"></span>
|
|
<div class="ml-3">
|
|
<p class="font-semibold text-gray-900 dark:text-white">Module Configuration</p>
|
|
<p class="text-sm text-gray-600 dark:text-gray-400">Enable/disable features</p>
|
|
</div>
|
|
</a>
|
|
|
|
<!-- Menu Configuration -->
|
|
<a :href="`/admin/platforms/${platformCode}/menu-config`"
|
|
class="flex items-center p-4 bg-amber-50 dark:bg-amber-900/20 rounded-lg hover:bg-amber-100 dark:hover:bg-amber-900/40 transition-colors">
|
|
<span x-html="$icon('view-grid', 'w-8 h-8 text-amber-600 dark:text-amber-400')"></span>
|
|
<div class="ml-3">
|
|
<p class="font-semibold text-gray-900 dark:text-white">Menu Configuration</p>
|
|
<p class="text-sm text-gray-600 dark:text-gray-400">Admin & vendor menus</p>
|
|
</div>
|
|
</a>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Stats Grid -->
|
|
<div class="grid grid-cols-1 md:grid-cols-4 gap-6">
|
|
<!-- Vendors -->
|
|
<div class="bg-white dark:bg-gray-800 rounded-lg shadow-md p-6">
|
|
<div class="flex items-center justify-between">
|
|
<div>
|
|
<p class="text-sm text-gray-500 dark:text-gray-400">Vendors</p>
|
|
<p class="text-3xl font-bold text-purple-600 dark:text-purple-400" x-text="platform?.vendor_count || 0"></p>
|
|
</div>
|
|
<div class="p-3 bg-purple-100 dark:bg-purple-900/50 rounded-full">
|
|
<span x-html="$icon('building-storefront', 'w-6 h-6 text-purple-600 dark:text-purple-400')"></span>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Marketing Pages -->
|
|
<div class="bg-white dark:bg-gray-800 rounded-lg shadow-md p-6">
|
|
<div class="flex items-center justify-between">
|
|
<div>
|
|
<p class="text-sm text-gray-500 dark:text-gray-400">Marketing Pages</p>
|
|
<p class="text-3xl font-bold text-blue-600 dark:text-blue-400" x-text="platform?.platform_pages_count || 0"></p>
|
|
</div>
|
|
<div class="p-3 bg-blue-100 dark:bg-blue-900/50 rounded-full">
|
|
<span x-html="$icon('megaphone', 'w-6 h-6 text-blue-600 dark:text-blue-400')"></span>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Vendor Defaults -->
|
|
<div class="bg-white dark:bg-gray-800 rounded-lg shadow-md p-6">
|
|
<div class="flex items-center justify-between">
|
|
<div>
|
|
<p class="text-sm text-gray-500 dark:text-gray-400">Vendor Defaults</p>
|
|
<p class="text-3xl font-bold text-teal-600 dark:text-teal-400" x-text="platform?.vendor_defaults_count || 0"></p>
|
|
</div>
|
|
<div class="p-3 bg-teal-100 dark:bg-teal-900/50 rounded-full">
|
|
<span x-html="$icon('document-duplicate', 'w-6 h-6 text-teal-600 dark:text-teal-400')"></span>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Language -->
|
|
<div class="bg-white dark:bg-gray-800 rounded-lg shadow-md p-6">
|
|
<div class="flex items-center justify-between">
|
|
<div>
|
|
<p class="text-sm text-gray-500 dark:text-gray-400">Default Language</p>
|
|
<p class="text-3xl font-bold text-gray-700 dark:text-gray-300" x-text="platform?.default_language?.toUpperCase() || '—'"></p>
|
|
</div>
|
|
<div class="p-3 bg-gray-100 dark:bg-gray-700 rounded-full">
|
|
<span x-html="$icon('language', 'w-6 h-6 text-gray-600 dark:text-gray-400')"></span>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Platform Configuration -->
|
|
<div class="grid grid-cols-1 md:grid-cols-2 gap-6">
|
|
<!-- Routing Info -->
|
|
<div class="bg-white dark:bg-gray-800 rounded-lg shadow-md p-6">
|
|
<h3 class="text-lg font-semibold text-gray-900 dark:text-white mb-4">Routing Configuration</h3>
|
|
<div class="space-y-3">
|
|
<div class="flex justify-between items-center py-2 border-b border-gray-200 dark:border-gray-700">
|
|
<span class="text-gray-600 dark:text-gray-400">Production Domain</span>
|
|
<code x-show="platform?.domain" class="text-sm bg-gray-100 dark:bg-gray-700 px-2 py-1 rounded" x-text="platform?.domain"></code>
|
|
<span x-show="!platform?.domain" class="text-gray-400 dark:text-gray-500 text-sm">Not configured</span>
|
|
</div>
|
|
<div class="flex justify-between items-center py-2 border-b border-gray-200 dark:border-gray-700">
|
|
<span class="text-gray-600 dark:text-gray-400">Dev Path Prefix</span>
|
|
<code x-show="platform?.path_prefix" class="text-sm bg-gray-100 dark:bg-gray-700 px-2 py-1 rounded" x-text="`/platforms/${platform?.path_prefix}/`"></code>
|
|
<span x-show="!platform?.path_prefix" class="text-gray-400 dark:text-gray-500 text-sm">Root path</span>
|
|
</div>
|
|
<div class="flex justify-between items-center py-2">
|
|
<span class="text-gray-600 dark:text-gray-400">Supported Languages</span>
|
|
<div class="flex gap-1">
|
|
<template x-for="lang in (platform?.supported_languages || [])" :key="lang">
|
|
<span class="text-xs bg-gray-100 dark:bg-gray-700 px-2 py-1 rounded" x-text="lang.toUpperCase()"></span>
|
|
</template>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Branding -->
|
|
<div class="bg-white dark:bg-gray-800 rounded-lg shadow-md p-6">
|
|
<h3 class="text-lg font-semibold text-gray-900 dark:text-white mb-4">Branding</h3>
|
|
<div class="space-y-3">
|
|
<div class="flex justify-between items-center py-2 border-b border-gray-200 dark:border-gray-700">
|
|
<span class="text-gray-600 dark:text-gray-400">Logo</span>
|
|
<template x-if="platform?.logo">
|
|
<img :src="platform.logo" alt="Logo" class="h-8 max-w-32 object-contain">
|
|
</template>
|
|
<span x-show="!platform?.logo" class="text-gray-400 dark:text-gray-500 text-sm">Not configured</span>
|
|
</div>
|
|
<div class="flex justify-between items-center py-2 border-b border-gray-200 dark:border-gray-700">
|
|
<span class="text-gray-600 dark:text-gray-400">Logo (Dark)</span>
|
|
<template x-if="platform?.logo_dark">
|
|
<img :src="platform.logo_dark" alt="Logo Dark" class="h-8 max-w-32 object-contain bg-gray-800 rounded p-1">
|
|
</template>
|
|
<span x-show="!platform?.logo_dark" class="text-gray-400 dark:text-gray-500 text-sm">Not configured</span>
|
|
</div>
|
|
<div class="flex justify-between items-center py-2">
|
|
<span class="text-gray-600 dark:text-gray-400">Favicon</span>
|
|
<template x-if="platform?.favicon">
|
|
<img :src="platform.favicon" alt="Favicon" class="h-6 w-6 object-contain">
|
|
</template>
|
|
<span x-show="!platform?.favicon" class="text-gray-400 dark:text-gray-500 text-sm">Not configured</span>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Recent Pages -->
|
|
<div class="bg-white dark:bg-gray-800 rounded-lg shadow-md overflow-hidden">
|
|
<div class="p-6 border-b border-gray-200 dark:border-gray-700 flex justify-between items-center">
|
|
<h3 class="text-lg font-semibold text-gray-900 dark:text-white">Recent Content Pages</h3>
|
|
<a :href="`/admin/content-pages?platform_code=${platformCode}`"
|
|
class="text-sm text-purple-600 hover:text-purple-700 dark:text-purple-400 dark:hover:text-purple-300">
|
|
View All →
|
|
</a>
|
|
</div>
|
|
<div x-show="recentPages.length > 0">
|
|
<table class="w-full">
|
|
<thead class="bg-gray-50 dark:bg-gray-700/50">
|
|
<tr>
|
|
<th class="px-6 py-3 text-left text-xs font-medium text-gray-500 dark:text-gray-400 uppercase">Title</th>
|
|
<th class="px-6 py-3 text-left text-xs font-medium text-gray-500 dark:text-gray-400 uppercase">Slug</th>
|
|
<th class="px-6 py-3 text-left text-xs font-medium text-gray-500 dark:text-gray-400 uppercase">Type</th>
|
|
<th class="px-6 py-3 text-left text-xs font-medium text-gray-500 dark:text-gray-400 uppercase">Status</th>
|
|
<th class="px-6 py-3 text-left text-xs font-medium text-gray-500 dark:text-gray-400 uppercase">Updated</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody class="divide-y divide-gray-200 dark:divide-gray-700">
|
|
<template x-for="page in recentPages" :key="page.id">
|
|
<tr class="hover:bg-gray-50 dark:hover:bg-gray-700/50">
|
|
<td class="px-6 py-4">
|
|
<a :href="`/admin/content-pages/${page.id}/edit`"
|
|
class="text-gray-900 dark:text-white hover:text-purple-600 dark:hover:text-purple-400 font-medium"
|
|
x-text="page.title"></a>
|
|
</td>
|
|
<td class="px-6 py-4">
|
|
<code class="text-sm bg-gray-100 dark:bg-gray-700 px-2 py-0.5 rounded" x-text="page.slug"></code>
|
|
</td>
|
|
<td class="px-6 py-4">
|
|
<span class="px-2 py-1 text-xs font-semibold rounded-full"
|
|
:class="getPageTypeBadgeClass(page)"
|
|
x-text="getPageTypeLabel(page)"></span>
|
|
</td>
|
|
<td class="px-6 py-4">
|
|
<span x-show="page.is_published" class="px-2 py-1 text-xs font-semibold rounded-full bg-green-100 text-green-800 dark:bg-green-900 dark:text-green-200">Published</span>
|
|
<span x-show="!page.is_published" class="px-2 py-1 text-xs font-semibold rounded-full bg-yellow-100 text-yellow-800 dark:bg-yellow-900 dark:text-yellow-200">Draft</span>
|
|
</td>
|
|
<td class="px-6 py-4 text-sm text-gray-500 dark:text-gray-400" x-text="formatDate(page.updated_at)"></td>
|
|
</tr>
|
|
</template>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
<div x-show="recentPages.length === 0" class="p-6 text-center text-gray-500 dark:text-gray-400">
|
|
<span x-html="$icon('document-text', 'w-12 h-12 mx-auto mb-2 opacity-50')"></span>
|
|
<p>No content pages yet.</p>
|
|
<a :href="`/admin/content-pages/create?platform_code=${platformCode}`"
|
|
class="inline-block mt-2 text-purple-600 hover:text-purple-700 dark:text-purple-400">
|
|
Create your first page →
|
|
</a>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Timestamps -->
|
|
<div class="text-sm text-gray-500 dark:text-gray-400">
|
|
<p>Created: <span x-text="formatDate(platform?.created_at)"></span></p>
|
|
<p>Last Updated: <span x-text="formatDate(platform?.updated_at)"></span></p>
|
|
</div>
|
|
</div>
|
|
{% endblock %}
|
|
|
|
{% block extra_scripts %}
|
|
<script src="/static/admin/js/platform-detail.js"></script>
|
|
{% endblock %}
|