ServerKit is a lightweight, modern server control panel for managing web applications, databases, and services on your VPS or dedicated server. Built with Python/Flask backend and React frontend.
Python astracloudflarecontrol-panelcyberpaneldnsfablehosting-control-panelhosting-panelkimi-k3server-managementserverkitubuntu-web-panelwebserver
feat: add dismissible system notices for common misconfigurations
Juan Denis0f4e5821da39
diff --git a/backend/app/api/system.py b/backend/app/api/system.pyindex 81e6e386..6cdcd40e 100644--- a/backend/app/api/system.py+++ b/backend/app/api/system.py@@ -7,6 +7,8 @@ from flask_jwt_extended import jwt_required, get_jwt_identityfrom app.models import Userfrom app.services.system_service import SystemServicefrom app.services.resource_tier_service import ResourceTierService+from app.services.site_domain_service import SiteDomainService+from app.utils.domain import is_valid_canonical_domain# Cache for update check (to avoid hitting GitHub API too often)_update_cache = {@@ -214,6 +216,69 @@ def health_check():}), 200+@system_bp.route('/notices', methods=['GET'])+@jwt_required()+def get_system_notices():+ """Return dismissible system notices for common misconfigurations."""+ current_user_id = get_jwt_identity()+ user = User.query.get(current_user_id)++ if not user or not user.is_admin:+ return jsonify({'error': 'Admin access required'}), 403++ notices = []+ canonical_domain = (SiteDomainService.panel_origin() or '').replace('https://', '').replace('http://', '')+ base_domain = SiteDomainService.base_domain()+ server_ip = SiteDomainService.server_ip()+ https_enabled = SiteDomainService.https_enabled()++ if not canonical_domain or not is_valid_canonical_domain(canonical_domain):+ notices.append({+ 'id': 'missing_canonical_domain',+ 'level': 'warning',+ 'title': 'Canonical domain not configured',+ 'message': 'Set the panel\'s canonical domain so install commands, agents, and app URLs point to the right place.',+ 'action_label': 'Fix in Settings',+ 'action_path': '/settings/site',+ 'setting_key': 'canonical_domain',+ })++ if not base_domain:+ notices.append({+ 'id': 'missing_sites_base_domain',+ 'level': 'warning',+ 'title': 'Managed sites base domain not set',+ 'message': 'New sites will fall back to localhost:<port>. Add a base domain to publish sites at <name>.<domain>.',+ 'action_label': 'Fix in Settings',+ 'action_path': '/settings/site',+ 'setting_key': 'sites_base_domain',+ })++ if not server_ip:+ notices.append({+ 'id': 'missing_server_public_ip',+ 'level': 'info',+ 'title': 'Server public IP not configured',+ 'message': 'Set the server public IP so ServerKit can auto-create DNS records for managed sites and custom domains.',+ 'action_label': 'Fix in Settings',+ 'action_path': '/settings/site',+ 'setting_key': 'server_public_ip',+ })++ if base_domain and server_ip and not https_enabled:+ notices.append({+ 'id': 'managed_sites_https_not_setup',+ 'level': 'info',+ 'title': 'Managed sites HTTPS is not set up',+ 'message': f'Wildcard HTTPS for *.{base_domain} is not active. Set it up so published sites serve HTTPS.',+ 'action_label': 'Set up wildcard HTTPS',+ 'action_path': '/settings/site',+ 'setting_key': 'sites_https_enabled',+ })++ return jsonify({'notices': notices}), 200++@system_bp.route('/resource-tier', methods=['GET'])@jwt_required()def get_resource_tier():diff --git a/frontend/src/components/SystemNotices.jsx b/frontend/src/components/SystemNotices.jsxnew file mode 100644index 00000000..0ea94dec--- /dev/null+++ b/frontend/src/components/SystemNotices.jsx@@ -0,0 +1,118 @@+import { useEffect, useState, useCallback } from 'react';+import { useNavigate } from 'react-router-dom';+import { AlertTriangle, Info, X, Settings, ExternalLink } from 'lucide-react';+import api from '../services/api';+import { Button } from '@/components/ui/button';++const STORAGE_KEY = 'serverkit_dismissed_notices';++const ICONS = {+ warning: AlertTriangle,+ info: Info,+ error: AlertTriangle,+};++function getDismissed() {+ try {+ const raw = localStorage.getItem(STORAGE_KEY);+ return raw ? JSON.parse(raw) : [];+ } catch {+ return [];+ }+}++function setDismissed(ids) {+ try {+ localStorage.setItem(STORAGE_KEY, JSON.stringify(ids));+ } catch {+ // ignore+ }+}++export default function SystemNotices() {+ const navigate = useNavigate();+ const [notices, setNotices] = useState([]);+ const [loading, setLoading] = useState(true);+ const [dismissed, setDismissedState] = useState(getDismissed);++ const load = useCallback(async () => {+ try {+ const data = await api.getSystemNotices();+ setNotices(data?.notices || []);+ } catch (err) {+ // Non-admin or endpoint error — hide silently.+ setNotices([]);+ } finally {+ setLoading(false);+ }+ }, []);++ useEffect(() => {+ load();+ }, [load]);++ const handleDismiss = (id) => {+ const next = [...dismissed, id];+ setDismissedState(next);+ setDismissed(next);+ };++ const handleAction = (notice) => {+ if (notice.action_path?.startsWith('http')) {+ window.open(notice.action_path, '_blank', 'noopener,noreferrer');+ } else if (notice.action_path) {+ navigate(notice.action_path);+ }+ };++ if (loading || notices.length === 0) return null;++ const visible = notices.filter((n) => !dismissed.includes(n.id));+ if (visible.length === 0) return null;++ return (+ <div className="system-notices" role="region" aria-label="System notices">+ {visible.map((notice) => {+ const Icon = ICONS[notice.level] || Info;+ return (+ <div+ key={notice.id}+ className={`system-notice system-notice--${notice.level}`}+ role="alert"+ >+ <span className="system-notice__icon" aria-hidden="true">+ <Icon size={18} />+ </span>+ <div className="system-notice__body">+ <div className="system-notice__title">{notice.title}</div>+ <div className="system-notice__message">{notice.message}</div>+ </div>+ <div className="system-notice__actions">+ <Button+ variant="ghost"+ size="sm"+ className="system-notice__action"+ onClick={() => handleAction(notice)}+ >+ {notice.action_label || 'Fix'}+ {notice.action_path?.startsWith('http') ? (+ <ExternalLink size={13} />+ ) : (+ <Settings size={13} />+ )}+ </Button>+ <button+ type="button"+ className="system-notice__dismiss"+ onClick={() => handleDismiss(notice.id)}+ aria-label={`Dismiss ${notice.title}`}+ >+ <X size={16} />+ </button>+ </div>+ </div>+ );+ })}+ </div>+ );+}diff --git a/frontend/src/layouts/DashboardLayout.jsx b/frontend/src/layouts/DashboardLayout.jsxindex fb4ffddf..59dce960 100644--- a/frontend/src/layouts/DashboardLayout.jsx+++ b/frontend/src/layouts/DashboardLayout.jsx@@ -11,6 +11,7 @@ import PluginLoader from '../plugins/PluginLoader';import { refreshContributions, useContributions } from '../plugins/contributions';import useMediaQuery from '../hooks/useMediaQuery';import api from '../services/api';+import SystemNotices from '../components/SystemNotices';const FULL_PAGE_ROUTES = ['/workflow', '/files', '/docker'];@@ -95,6 +96,7 @@ const DashboardLayout = () => {/>)}<main className={`main-content${isFullPageRoute ? ' main-content--full-page' : ''}`}>+ {!isFullPageRoute && <SystemNotices />}<Outlet /></main><CommandPalette open={paletteOpen} onClose={() => setPaletteOpen(false)} />diff --git a/frontend/src/services/api/system.js b/frontend/src/services/api/system.jsindex 9c65644c..4dc7641a 100644--- a/frontend/src/services/api/system.js+++ b/frontend/src/services/api/system.js@@ -46,6 +46,10 @@ export async function getAdminStats() {return this.request('/admin/stats');}+export async function getSystemNotices() {+ return this.request('/system/notices');+}+// Managed-sites domain & HTTPS (Phase 5)export async function getSitesHttpsStatus() {return this.request('/admin/sites-https/status');diff --git a/frontend/src/styles/components/_system-notices.scss b/frontend/src/styles/components/_system-notices.scssnew file mode 100644index 00000000..c0db71e4--- /dev/null+++ b/frontend/src/styles/components/_system-notices.scss@@ -0,0 +1,134 @@+// ============================================+// SYSTEM NOTICES+// Dismissible admin-only banners that surface common misconfigurations+// with one-click links to the relevant settings page.+// ============================================++.system-notices {+ display: flex;+ flex-direction: column;+ gap: $space-3;+ margin-bottom: $space-6;+}++.system-notice {+ display: flex;+ align-items: flex-start;+ gap: $space-3;+ padding: $space-3 $space-4;+ border-radius: $radius-md;+ border: 1px solid transparent;+ font-size: $font-size-sm;+ line-height: 1.5;+ background: $bg-card;++ &__icon {+ flex-shrink: 0;+ margin-top: 1px;+ }++ &__body {+ flex: 1;+ min-width: 0;+ }++ &__title {+ font-weight: $font-weight-semibold;+ color: $text-primary;+ }++ &__message {+ color: $text-secondary;+ margin-top: 2px;+ }++ &__actions {+ display: flex;+ align-items: center;+ gap: $space-2;+ flex-shrink: 0;+ }++ &__action {+ height: auto;+ min-width: 0;+ padding: $space-1 $space-2;+ font-size: $font-size-sm;+ gap: $space-1;+ }++ &__dismiss {+ display: inline-flex;+ align-items: center;+ justify-content: center;+ width: 28px;+ height: 28px;+ border: none;+ background: transparent;+ color: inherit;+ opacity: 0.6;+ cursor: pointer;+ border-radius: $radius-sm;+ transition: opacity $transition-fast, background $transition-fast;++ &:hover {+ opacity: 1;+ background: rgba(255, 255, 255, 0.08);+ }+ }++ &--warning {+ background: $warning-bg;+ border-color: $warning-border;+ color: $warning;++ .system-notice__title,+ .system-notice__message {+ color: $warning;+ }++ .system-notice__icon {+ color: $warning;+ }+ }++ &--info {+ background: $info-bg;+ border-color: $info-border;+ color: $info;++ .system-notice__title,+ .system-notice__message {+ color: $info;+ }++ .system-notice__icon {+ color: $info;+ }+ }++ &--error {+ background: $danger-bg;+ border-color: $danger-border;+ color: $danger;++ .system-notice__title,+ .system-notice__message {+ color: $danger;+ }++ .system-notice__icon {+ color: $danger;+ }+ }++ @media (max-width: $breakpoint-md) {+ flex-wrap: wrap;++ &__actions {+ width: 100%;+ justify-content: flex-end;+ margin-top: $space-2;+ }+ }+}diff --git a/frontend/src/styles/main.scss b/frontend/src/styles/main.scssindex 8428acd5..78c0bd0e 100644--- a/frontend/src/styles/main.scss+++ b/frontend/src/styles/main.scss@@ -67,6 +67,7 @@@import 'components/_ai-assistant';@import 'components/_ui';@import 'components/_design-system'; // redesign shared primitives (sk-* namespace)+@import 'components/_system-notices';// --------------------------------------------// 5. PAGE-SPECIFIC STYLES