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(ux): undo toasts for reversible deletes + cron create deep-link
Juan Denisacfce7dbeb57
diff --git a/frontend/src/components/security/IPListsTab.jsx b/frontend/src/components/security/IPListsTab.jsxindex ef927137..37ebde5c 100644--- a/frontend/src/components/security/IPListsTab.jsx+++ b/frontend/src/components/security/IPListsTab.jsx@@ -61,17 +61,31 @@ const IPListsTab = () => {}};- const handleRemove = async (ip, listType) => {+ const handleRemove = async (item, listType) => {const confirmed = await confirm({title: `Remove from ${listType}`,- message: `Are you sure you want to remove ${ip} from the ${listType}?`,+ message: `Are you sure you want to remove ${item.ip} from the ${listType}?`,confirmText: 'Remove',variant: 'warning',});if (!confirmed) return;try {- await api.removeFromIPList(ip, listType);- toast.success(`IP removed from ${listType}`);+ await api.removeFromIPList(item.ip, listType);+ toast.success(`IP removed from ${listType}`, {+ duration: 8000,+ action: {+ label: 'Undo',+ onClick: async () => {+ try {+ await api.addToIPList(item.ip, listType, item.comment || '');+ toast.success(`IP restored to ${listType}`);+ await loadLists();+ } catch (error) {+ toast.error(`Could not restore IP: ${error.message}`);+ }+ },+ },+ });await loadLists();} catch (error) {toast.error(`Failed to remove IP: ${error.message}`);@@ -115,7 +129,7 @@ const IPListsTab = () => {hideable: false,cellClassName: 'sec-rowend',render: (item) => (- <Button variant="destructive" size="sm" onClick={() => handleRemove(item.ip, listType)}>+ <Button variant="destructive" size="sm" onClick={() => handleRemove(item, listType)}>Remove</Button>),diff --git a/frontend/src/pages/CronJobs.jsx b/frontend/src/pages/CronJobs.jsxindex d74b6dda..efc2b6df 100644--- a/frontend/src/pages/CronJobs.jsx+++ b/frontend/src/pages/CronJobs.jsx@@ -3,6 +3,7 @@ import api from '../services/api';import { useToast } from '../contexts/ToastContext';import { useAuth } from '../contexts/AuthContext';import { useConfirm } from '../hooks/useConfirm';+import useFocusParam from '@/hooks/useFocusParam';import EmptyState from '../components/EmptyState';import Modal from '@/components/Modal';import {@@ -173,6 +174,8 @@ const CronJobs = () => {setEditingJob(null);setShowJobDrawer(true);};+ // Quick-create deep link: /cron?focus=create:cron opens the job drawer.+ useFocusParam('create', openCreateDrawer);const openEditDrawer = (job) => {setEditingJob(job);@@ -184,15 +187,34 @@ const CronJobs = () => {setEditingJob(null);};- const handleDeleteJob = async (jobId) => {+ const handleDeleteJob = async (job) => {const confirmed = await confirm({title: 'Delete Cron Job',message: 'Are you sure you want to delete this cron job?',});if (!confirmed) return;try {- await api.deleteCronJob(jobId);- toast.success('Cron job deleted');+ await api.deleteCronJob(job.id);+ toast.success(`Cron job "${job.name}" deleted`, {+ duration: 8000,+ action: {+ label: 'Undo',+ onClick: async () => {+ try {+ await api.createCronJob({+ name: job.name,+ command: job.command,+ schedule: job.schedule,+ description: job.description,+ });+ toast.success(`Cron job "${job.name}" restored`);+ loadData();+ } catch (err) {+ toast.error(err.message || 'Could not restore the cron job');+ }+ },+ },+ });setDrawerJob(null);loadData();} catch (err) {@@ -753,7 +775,7 @@ function CronDrawer({ job, isAdmin, running, onClose, onRefresh, onRun, onEdit,{trackingBusy ? 'Disabling…' : 'Disable run tracking'}</Button>)}- <Button variant="destructive" size="sm" onClick={() => onDelete(job.id)}>+ <Button variant="destructive" size="sm" onClick={() => onDelete(job)}><Trash2 size={14} /> Delete</Button></div>