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(automations): richer template picker
Juan Denisf4b8630e3b62
diff --git a/builtin-extensions/serverkit-tramo/frontend/components/AutomationsPage.jsx b/builtin-extensions/serverkit-tramo/frontend/components/AutomationsPage.jsxindex c2704eb4..49e8c1dd 100644--- a/builtin-extensions/serverkit-tramo/frontend/components/AutomationsPage.jsx+++ b/builtin-extensions/serverkit-tramo/frontend/components/AutomationsPage.jsx@@ -2,7 +2,8 @@ import { useCallback, useEffect, useState } from 'react';import { useParams, useNavigate } from 'react-router-dom';import {Workflow, RefreshCw, Plus, Trash2, Rocket, Pencil, Play, LayoutTemplate,- Server, Power, KeyRound, CheckCircle2, X,+ Server, Power, KeyRound, CheckCircle2, X, Send, Github, MessageSquare,+ Zap, ChevronRight,} from 'lucide-react';import api from '@/services/api';import { PageTopbar, Pill } from '@/components/ds';@@ -24,6 +25,16 @@ const TABS = [];const VALID_TABS = TABS.map((t) => t.slug);+// Presentation for the starter templates (icon + accent + tags). Keyed by the+// backend template id; unknown ids fall back to a neutral card so new templates+// still render cleanly.+const TEMPLATE_META = {+ 'backup-failed-telegram': { Icon: Send, brand: 'telegram', tags: ['Backups', 'Telegram'] },+ 'nightly-health-github': { Icon: Github, brand: 'github', tags: ['Schedule', 'GitHub'] },+ 'panel-event-discord': { Icon: MessageSquare, brand: 'discord', tags: ['Events', 'Discord'] },+};+const DEFAULT_TEMPLATE_META = { Icon: Zap, brand: 'default', tags: [] };+// Run status → Pill colour.const runPill = (status) => {const kind = status === 'succeeded' || status === 'success' ? 'green'@@ -715,28 +726,58 @@ const AutomationsPage = () => {</Modal>{/* New from template modal */}- <Modal open={templateModal} onClose={() => setTemplateModal(false)} title="New from template">+ <Modal+ open={templateModal}+ onClose={() => setTemplateModal(false)}+ title="Start from a template"+ size="lg"+ footer={(+ <Button variant="outline" onClick={() => setTemplateModal(false)}>+ <X size={14} /> Close+ </Button>+ )}+ >+ <p className="tramo-tpl-intro">+ Pick a ready-made automation. You will land on the visual editor to+ customize it and add the credentials its integrations need.+ </p>{templates.length === 0 ? (<EmptyState icon={LayoutTemplate} title="No templates available" />) : (- <div className="tramo-template-list">- {templates.map((t) => (- <button- type="button"- className="tramo-template"- key={t.id}- onClick={() => handleFromTemplate(t)}- disabled={busy}- >- <span className="tramo-template__name">{t.name}</span>- {t.description && <span className="tramo-template__desc">{t.description}</span>}- </button>- ))}+ <div className="tramo-tpl-list">+ {templates.map((t) => {+ const meta = TEMPLATE_META[t.id] || DEFAULT_TEMPLATE_META;+ const { Icon } = meta;+ return (+ <button+ type="button"+ className="tramo-tpl"+ key={t.id}+ onClick={() => handleFromTemplate(t)}+ disabled={busy}+ >+ <span className={`tramo-tpl__icon tramo-tpl__icon--${meta.brand}`}>+ <Icon size={20} />+ </span>+ <span className="tramo-tpl__body">+ <span className="tramo-tpl__name">{t.name}</span>+ {t.description && (+ <span className="tramo-tpl__desc">{t.description}</span>+ )}+ {meta.tags.length > 0 && (+ <span className="tramo-tpl__tags">+ {meta.tags.map((tag) => (+ <span className="tramo-tpl__tag" key={tag}>{tag}</span>+ ))}+ </span>+ )}+ </span>+ <ChevronRight className="tramo-tpl__arrow" size={18} />+ </button>+ );+ })}</div>)}- <div className="modal-footer">- <Button variant="outline" onClick={() => setTemplateModal(false)}><X size={14} /> Close</Button>- </div></Modal>{confirmDialog && (diff --git a/builtin-extensions/serverkit-tramo/frontend/styles/tramo-automations.scss b/builtin-extensions/serverkit-tramo/frontend/styles/tramo-automations.scssindex 1d25e2a0..66b06e53 100644--- a/builtin-extensions/serverkit-tramo/frontend/styles/tramo-automations.scss+++ b/builtin-extensions/serverkit-tramo/frontend/styles/tramo-automations.scss@@ -207,43 +207,105 @@/* Template picker lives inside a <Modal>, which portals to <body> -- OUTSIDE the.tramo-page subtree -- so these rules must be top-level, not nested under.tramo-page, or they never match the portaled DOM. */-.tramo-template-list {+.tramo-tpl-intro {+ margin: 0 0 14px;+ font-size: 13px;+ line-height: 1.5;+ opacity: 0.7;+}++.tramo-tpl-list {display: flex;flex-direction: column;- gap: 8px;+ gap: 10px;}-.tramo-template {+.tramo-tpl {display: flex;- flex-direction: column;- gap: 3px;+ align-items: flex-start;+ gap: 14px;text-align: left;width: 100%;- padding: 12px 14px;- border-radius: var(--radius, 8px);- border: 1px solid var(--border, rgba(128, 128, 128, 0.3));- background: transparent;+ padding: 14px 16px;+ border-radius: 12px;+ border: 1px solid var(--border, rgba(128, 128, 128, 0.25));+ background: var(--bg-elevated, rgba(128, 128, 128, 0.04));color: inherit;cursor: pointer;- transition: border-color 0.15s ease, background 0.15s ease;+ transition: border-color 0.15s ease, background 0.15s ease, transform 0.15s ease;&:hover {- border-color: var(--accent-bright, #3b82f6);- background: rgba(128, 128, 128, 0.06);+ border-color: var(--accent-bright, #6366f1);+ background: rgba(99, 102, 241, 0.06);+ transform: translateY(-1px);}&:disabled {opacity: 0.6;cursor: not-allowed;+ transform: none;+ }++ &__icon {+ flex-shrink: 0;+ width: 42px;+ height: 42px;+ border-radius: 11px;+ display: grid;+ place-items: center;+ background: rgba(128, 128, 128, 0.16);+ color: var(--accent-bright, #6366f1);++ &--telegram { background: rgba(42, 171, 238, 0.16); color: #2aabee; }+ &--github { background: rgba(139, 92, 246, 0.16); color: #a78bfa; }+ &--discord { background: rgba(88, 101, 242, 0.16); color: #7c86f5; }+ }++ &__body {+ flex: 1;+ min-width: 0;+ display: flex;+ flex-direction: column;+ gap: 4px;}&__name {font-weight: 600;+ font-size: 14px;}&__desc {font-size: 12.5px;opacity: 0.7;+ line-height: 1.45;+ }++ &__tags {+ display: flex;+ flex-wrap: wrap;+ gap: 6px;+ margin-top: 4px;+ }++ &__tag {+ font-size: 11px;+ font-weight: 500;+ padding: 2px 9px;+ border-radius: 999px;+ background: rgba(128, 128, 128, 0.16);+ opacity: 0.9;+ }++ &__arrow {+ flex-shrink: 0;+ align-self: center;+ opacity: 0.35;+ transition: opacity 0.15s ease, transform 0.15s ease;+ }++ &:hover &__arrow {+ opacity: 0.9;+ transform: translateX(2px);}}diff --git a/frontend/src/plugins/serverkit-tramo/components/AutomationsPage.jsx b/frontend/src/plugins/serverkit-tramo/components/AutomationsPage.jsxindex c2704eb4..49e8c1dd 100644--- a/frontend/src/plugins/serverkit-tramo/components/AutomationsPage.jsx+++ b/frontend/src/plugins/serverkit-tramo/components/AutomationsPage.jsx@@ -2,7 +2,8 @@ import { useCallback, useEffect, useState } from 'react';import { useParams, useNavigate } from 'react-router-dom';import {Workflow, RefreshCw, Plus, Trash2, Rocket, Pencil, Play, LayoutTemplate,- Server, Power, KeyRound, CheckCircle2, X,+ Server, Power, KeyRound, CheckCircle2, X, Send, Github, MessageSquare,+ Zap, ChevronRight,} from 'lucide-react';import api from '@/services/api';import { PageTopbar, Pill } from '@/components/ds';@@ -24,6 +25,16 @@ const TABS = [];const VALID_TABS = TABS.map((t) => t.slug);+// Presentation for the starter templates (icon + accent + tags). Keyed by the+// backend template id; unknown ids fall back to a neutral card so new templates+// still render cleanly.+const TEMPLATE_META = {+ 'backup-failed-telegram': { Icon: Send, brand: 'telegram', tags: ['Backups', 'Telegram'] },+ 'nightly-health-github': { Icon: Github, brand: 'github', tags: ['Schedule', 'GitHub'] },+ 'panel-event-discord': { Icon: MessageSquare, brand: 'discord', tags: ['Events', 'Discord'] },+};+const DEFAULT_TEMPLATE_META = { Icon: Zap, brand: 'default', tags: [] };+// Run status → Pill colour.const runPill = (status) => {const kind = status === 'succeeded' || status === 'success' ? 'green'@@ -715,28 +726,58 @@ const AutomationsPage = () => {</Modal>{/* New from template modal */}- <Modal open={templateModal} onClose={() => setTemplateModal(false)} title="New from template">+ <Modal+ open={templateModal}+ onClose={() => setTemplateModal(false)}+ title="Start from a template"+ size="lg"+ footer={(+ <Button variant="outline" onClick={() => setTemplateModal(false)}>+ <X size={14} /> Close+ </Button>+ )}+ >+ <p className="tramo-tpl-intro">+ Pick a ready-made automation. You will land on the visual editor to+ customize it and add the credentials its integrations need.+ </p>{templates.length === 0 ? (<EmptyState icon={LayoutTemplate} title="No templates available" />) : (- <div className="tramo-template-list">- {templates.map((t) => (- <button- type="button"- className="tramo-template"- key={t.id}- onClick={() => handleFromTemplate(t)}- disabled={busy}- >- <span className="tramo-template__name">{t.name}</span>- {t.description && <span className="tramo-template__desc">{t.description}</span>}- </button>- ))}+ <div className="tramo-tpl-list">+ {templates.map((t) => {+ const meta = TEMPLATE_META[t.id] || DEFAULT_TEMPLATE_META;+ const { Icon } = meta;+ return (+ <button+ type="button"+ className="tramo-tpl"+ key={t.id}+ onClick={() => handleFromTemplate(t)}+ disabled={busy}+ >+ <span className={`tramo-tpl__icon tramo-tpl__icon--${meta.brand}`}>+ <Icon size={20} />+ </span>+ <span className="tramo-tpl__body">+ <span className="tramo-tpl__name">{t.name}</span>+ {t.description && (+ <span className="tramo-tpl__desc">{t.description}</span>+ )}+ {meta.tags.length > 0 && (+ <span className="tramo-tpl__tags">+ {meta.tags.map((tag) => (+ <span className="tramo-tpl__tag" key={tag}>{tag}</span>+ ))}+ </span>+ )}+ </span>+ <ChevronRight className="tramo-tpl__arrow" size={18} />+ </button>+ );+ })}</div>)}- <div className="modal-footer">- <Button variant="outline" onClick={() => setTemplateModal(false)}><X size={14} /> Close</Button>- </div></Modal>{confirmDialog && (diff --git a/frontend/src/plugins/serverkit-tramo/styles/tramo-automations.scss b/frontend/src/plugins/serverkit-tramo/styles/tramo-automations.scssindex 1d25e2a0..66b06e53 100644--- a/frontend/src/plugins/serverkit-tramo/styles/tramo-automations.scss+++ b/frontend/src/plugins/serverkit-tramo/styles/tramo-automations.scss@@ -207,43 +207,105 @@/* Template picker lives inside a <Modal>, which portals to <body> -- OUTSIDE the.tramo-page subtree -- so these rules must be top-level, not nested under.tramo-page, or they never match the portaled DOM. */-.tramo-template-list {+.tramo-tpl-intro {+ margin: 0 0 14px;+ font-size: 13px;+ line-height: 1.5;+ opacity: 0.7;+}++.tramo-tpl-list {display: flex;flex-direction: column;- gap: 8px;+ gap: 10px;}-.tramo-template {+.tramo-tpl {display: flex;- flex-direction: column;- gap: 3px;+ align-items: flex-start;+ gap: 14px;text-align: left;width: 100%;- padding: 12px 14px;- border-radius: var(--radius, 8px);- border: 1px solid var(--border, rgba(128, 128, 128, 0.3));- background: transparent;+ padding: 14px 16px;+ border-radius: 12px;+ border: 1px solid var(--border, rgba(128, 128, 128, 0.25));+ background: var(--bg-elevated, rgba(128, 128, 128, 0.04));color: inherit;cursor: pointer;- transition: border-color 0.15s ease, background 0.15s ease;+ transition: border-color 0.15s ease, background 0.15s ease, transform 0.15s ease;&:hover {- border-color: var(--accent-bright, #3b82f6);- background: rgba(128, 128, 128, 0.06);+ border-color: var(--accent-bright, #6366f1);+ background: rgba(99, 102, 241, 0.06);+ transform: translateY(-1px);}&:disabled {opacity: 0.6;cursor: not-allowed;+ transform: none;+ }++ &__icon {+ flex-shrink: 0;+ width: 42px;+ height: 42px;+ border-radius: 11px;+ display: grid;+ place-items: center;+ background: rgba(128, 128, 128, 0.16);+ color: var(--accent-bright, #6366f1);++ &--telegram { background: rgba(42, 171, 238, 0.16); color: #2aabee; }+ &--github { background: rgba(139, 92, 246, 0.16); color: #a78bfa; }+ &--discord { background: rgba(88, 101, 242, 0.16); color: #7c86f5; }+ }++ &__body {+ flex: 1;+ min-width: 0;+ display: flex;+ flex-direction: column;+ gap: 4px;}&__name {font-weight: 600;+ font-size: 14px;}&__desc {font-size: 12.5px;opacity: 0.7;+ line-height: 1.45;+ }++ &__tags {+ display: flex;+ flex-wrap: wrap;+ gap: 6px;+ margin-top: 4px;+ }++ &__tag {+ font-size: 11px;+ font-weight: 500;+ padding: 2px 9px;+ border-radius: 999px;+ background: rgba(128, 128, 128, 0.16);+ opacity: 0.9;+ }++ &__arrow {+ flex-shrink: 0;+ align-self: center;+ opacity: 0.35;+ transition: opacity 0.15s ease, transform 0.15s ease;+ }++ &:hover &__arrow {+ opacity: 0.9;+ transform: translateX(2px);}}