Custom pages: флажок «скрыть шапку страницы» (миграция 0089)

- custom_pages.hide_header: платформа не рендерит заголовок (название + описание)
  над виджетом — для полноэкранных отчётов/дашбордов, без CSS-хаков из кода страницы
- UI: переключатель «Скрыть шапку страницы» в диалоге создания/редактирования
- REST create/patch принимают hideHeader; MCP create_custom_page/update_custom_page —
  параметр hide_header (виден ИИ сразу, default false)
This commit is contained in:
2026-09-30 15:42:52 +03:00
parent 06a2794090
commit 49b7732a24
7 changed files with 38 additions and 15 deletions

View File

@@ -393,7 +393,7 @@ export function registerContentRoutes(app: import("express").Express): void {
app.post('/api/custom-pages', authenticateToken, tenantIsolation, requirePermission('settings.manage'), async (req: AuthenticatedRequest, res) => {
try {
const { name, slug, description, code, formIds, icon, showInSidebar } = req.body;
const { name, slug, description, code, formIds, icon, showInSidebar, hideHeader } = req.body;
if (!name || !slug) return res.status(400).json({ error: 'name и slug обязательны' });
const page = await storage.createCustomPage({
organizationId: req.organizationId!,
@@ -405,6 +405,7 @@ export function registerContentRoutes(app: import("express").Express): void {
icon: icon ?? 'FileCode',
isActive: true,
showInSidebar: showInSidebar === true,
hideHeader: hideHeader === true,
createdBy: req.user!.id,
});
res.status(201).json({ success: true, page });
@@ -418,7 +419,7 @@ export function registerContentRoutes(app: import("express").Express): void {
app.patch('/api/custom-pages/:id', authenticateToken, tenantIsolation, requirePermission('settings.manage'), async (req: AuthenticatedRequest, res) => {
try {
const id = parseInt(req.params.id);
const { name, slug, description, code, formIds, icon, isActive, showInSidebar } = req.body;
const { name, slug, description, code, formIds, icon, isActive, showInSidebar, hideHeader } = req.body;
const updates: Record<string, any> = {};
if (name !== undefined) updates.name = name;
if (slug !== undefined) updates.slug = slug.toLowerCase().replace(/[^a-z0-9-_]/g, '-');
@@ -428,6 +429,7 @@ export function registerContentRoutes(app: import("express").Express): void {
if (icon !== undefined) updates.icon = icon;
if (isActive !== undefined) updates.isActive = isActive === true;
if (showInSidebar !== undefined) updates.showInSidebar = showInSidebar === true;
if (hideHeader !== undefined) updates.hideHeader = hideHeader === true;
const page = await storage.updateCustomPage(id, req.organizationId!, updates);
res.json({ success: true, page });
} catch (error: unknown) {