Skip to content

Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS

feat: reusable ProcessesTab with per-app process views, fix clear failed runs

Adam Eivy54b1850e638a
diff --git a/.changelog/v1.25.x.md b/.changelog/v1.25.x.md
new file mode 100644
index 0000000000..bec337a78c
--- /dev/null
+++ b/.changelog/v1.25.x.md
@@ -0,0 +1,20 @@
+# Release v1.25.x - Changelog
+
+Released: YYYY-MM-DD
+
+## Overview
+
+Reusable ProcessesTab component with per-app process views and a bug fix for clearing failed AI runs.
+
+## 🎉 Features
+
+- **App Processes Tab**: Each app's detail view now has a "Processes" tab showing only that app's PM2 processes with live logs, restart/stop/start controls
+- **Reusable ProcessesTab**: Extracted process management UI into a shared component used by both the DevTools Processes page and app detail views
+
+## 🐛 Fixes
+
+- **Clear Failed Runs**: Fixed "Only filter=failed is supported" error when clicking Clear Failed on the DevTools Runs page — client was sending wrong query parameter
+
+## 🔧 Improvements
+
+- **Alphabetical app tabs**: App detail tabs are now alphabetically ordered (Automation, Documents, Git, GSD, Processes, Tasks)
diff --git a/client/src/components/apps/AppDetailView.jsx b/client/src/components/apps/AppDetailView.jsx
index 38e35a962a..34af327cde 100644
--- a/client/src/components/apps/AppDetailView.jsx
+++ b/client/src/components/apps/AppDetailView.jsx
@@ -13,6 +13,7 @@ import AutomationTab from './tabs/AutomationTab';
import DocumentsTab from './tabs/DocumentsTab';
import GitTab from './tabs/GitTab';
import GsdTab from './tabs/GsdTab';
+import ProcessesTab from './tabs/ProcessesTab';
export default function AppDetailView() {
const { appId, tab } = useParams();
@@ -111,6 +112,8 @@ export default function AppDetailView() {
return <GitTab appId={appId} appName={app.name} repoPath={app.repoPath} />;
case 'gsd':
return <GsdTab appId={appId} repoPath={app.repoPath} />;
+ case 'processes':
+ return <ProcessesTab pm2ProcessNames={app.pm2ProcessNames} />;
default:
return <OverviewTab app={app} onRefresh={fetchApp} />;
}
diff --git a/client/src/components/apps/constants.js b/client/src/components/apps/constants.js
index 35292a6d21..bf376f72e1 100644
--- a/client/src/components/apps/constants.js
+++ b/client/src/components/apps/constants.js
@@ -1,8 +1,9 @@
export const APP_DETAIL_TABS = [
{ id: 'overview', label: 'Overview' },
- { id: 'tasks', label: 'Tasks' },
{ id: 'automation', label: 'Automation' },
{ id: 'documents', label: 'Documents' },
{ id: 'git', label: 'Git' },
- { id: 'gsd', label: 'GSD' }
+ { id: 'gsd', label: 'GSD' },
+ { id: 'processes', label: 'Processes' },
+ { id: 'tasks', label: 'Tasks' },
];
diff --git a/client/src/components/apps/tabs/ProcessesTab.jsx b/client/src/components/apps/tabs/ProcessesTab.jsx
new file mode 100644
index 0000000000..5646a3f1df
--- /dev/null
+++ b/client/src/components/apps/tabs/ProcessesTab.jsx
@@ -0,0 +1,401 @@
+import { useState, useEffect, useRef, Fragment } from 'react';
+import { Maximize2, X } from 'lucide-react';
+import * as api from '../../../services/api';
+import socket from '../../../services/socket';
+import BrailleSpinner from '../../BrailleSpinner';
+
+const formatMemory = (bytes) => {
+ if (!bytes) return '0 MB';
+ return `${(bytes / 1024 / 1024).toFixed(1)} MB`;
+};
+
+const formatUptime = (ms) => {
+ if (!ms) return '-';
+ const hours = Math.floor(ms / 3600000);
+ const mins = Math.floor((ms % 3600000) / 60000);
+ if (hours > 24) {
+ return `${Math.floor(hours / 24)}d ${hours % 24}h`;
+ }
+ return `${hours}h ${mins}m`;
+};
+
+const getStatusColor = (status) => {
+ switch (status) {
+ case 'online': return 'bg-port-success';
+ case 'stopped': return 'bg-gray-500';
+ case 'errored': return 'bg-port-error';
+ default: return 'bg-port-warning';
+ }
+};
+
+export default function ProcessesTab({ pm2ProcessNames, filterFn }) {
+ const [processes, setProcesses] = useState([]);
+ const [loading, setLoading] = useState(true);
+ const [expandedProcess, setExpandedProcess] = useState(null);
+ const [logs, setLogs] = useState([]);
+ const [restarting, setRestarting] = useState({});
+ const [tailLines, setTailLines] = useState(500);
+ const [subscribed, setSubscribed] = useState(false);
+ const [fullscreen, setFullscreen] = useState(false);
+ const logsRef = useRef(null);
+ const fullscreenLogsRef = useRef(null);
+
+ const loadProcesses = async () => {
+ const data = await api.getProcessesList().catch(() => []);
+ setProcesses(data);
+ setLoading(false);
+ };
+
+ useEffect(() => {
+ loadProcesses();
+ const interval = setInterval(loadProcesses, 5000);
+ return () => clearInterval(interval);
+ }, []);
+
+ useEffect(() => {
+ if (!expandedProcess) {
+ setLogs([]);
+ setSubscribed(false);
+ return;
+ }
+
+ socket.emit('logs:subscribe', { processName: expandedProcess, lines: tailLines });
+
+ const handleLog = (data) => {
+ if (data.processName === expandedProcess) {
+ setLogs(prev => [...prev.slice(-1000), {
+ line: data.line,
+ type: data.type,
+ timestamp: data.timestamp
+ }]);
+ setTimeout(() => {
+ if (logsRef.current) {
+ logsRef.current.scrollTop = logsRef.current.scrollHeight;
+ }
+ if (fullscreenLogsRef.current) {
+ fullscreenLogsRef.current.scrollTop = fullscreenLogsRef.current.scrollHeight;
+ }
+ }, 10);
+ }
+ };
+
+ const handleSubscribed = (data) => {
+ if (data.processName === expandedProcess) {
+ setSubscribed(true);
+ }
+ };
+
+ const handleError = (data) => {
+ if (data.processName === expandedProcess) {
+ setLogs(prev => [...prev, { line: `Error: ${data.error}`, type: 'stderr', timestamp: Date.now() }]);
+ }
+ };
+
+ socket.on('logs:line', handleLog);
+ socket.on('logs:subscribed', handleSubscribed);
+ socket.on('logs:error', handleError);
+
+ return () => {
+ socket.emit('logs:unsubscribe', { processName: expandedProcess });
+ socket.off('logs:line', handleLog);
+ socket.off('logs:subscribed', handleSubscribed);
+ socket.off('logs:error', handleError);
+ };
+ }, [expandedProcess, tailLines]);
+
+ const handleRestart = async (name) => {
+ setRestarting(prev => ({ ...prev, [name]: true }));
+ await fetch('/api/commands/execute', {
+ method: 'POST',
+ headers: { 'Content-Type': 'application/json' },
+ body: JSON.stringify({ command: `pm2 restart ${name}` })
+ }).catch(() => null);
+ setTimeout(() => {
+ setRestarting(prev => ({ ...prev, [name]: false }));
+ loadProcesses();
+ }, 2000);
+ };
+
+ const handleStop = async (name) => {
+ setRestarting(prev => ({ ...prev, [name]: true }));
+ await fetch('/api/commands/execute', {
+ method: 'POST',
+ headers: { 'Content-Type': 'application/json' },
+ body: JSON.stringify({ command: `pm2 stop ${name}` })
+ }).catch(() => null);
+ setTimeout(() => {
+ setRestarting(prev => ({ ...prev, [name]: false }));
+ loadProcesses();
+ }, 2000);
+ };
+
+ const handleStart = async (name) => {
+ setRestarting(prev => ({ ...prev, [name]: true }));
+ await fetch('/api/commands/execute', {
+ method: 'POST',
+ headers: { 'Content-Type': 'application/json' },
+ body: JSON.stringify({ command: `pm2 start ${name}` })
+ }).catch(() => null);
+ setTimeout(() => {
+ setRestarting(prev => ({ ...prev, [name]: false }));
+ loadProcesses();
+ }, 2000);
+ };
+
+ const toggleExpand = (name) => {
+ setExpandedProcess(prev => prev === name ? null : name);
+ setLogs([]);
+ };
+
+ const filteredProcesses = filterFn
+ ? processes.filter(proc => filterFn(proc.name))
+ : pm2ProcessNames
+ ? processes.filter(proc => pm2ProcessNames.includes(proc.name))
+ : processes;
+
+ if (loading) {
+ return <div className="text-center py-8"><BrailleSpinner text="Loading processes" /></div>;
+ }
+
+ return (
+ <>
+ <div className="space-y-4">
+ <div className="flex justify-between items-center">
+ <p className="text-gray-500 text-sm">{filteredProcesses.length} process{filteredProcesses.length !== 1 ? 'es' : ''}</p>
+ <button
+ onClick={loadProcesses}
+ className="px-3 py-1.5 bg-port-border hover:bg-port-border/80 text-white rounded-lg transition-colors text-sm"
+ >
+ Refresh
+ </button>
+ </div>
+
+ <div className="bg-port-card border border-port-border rounded-xl overflow-hidden overflow-x-auto">
+ <table className="w-full min-w-[700px]">
+ <thead className="bg-port-border/50">
+ <tr>
+ <th className="px-4 py-3 text-left text-sm font-medium text-gray-400 w-8"></th>
+ <th className="px-4 py-3 text-left text-sm font-medium text-gray-400">Name</th>
+ <th className="px-4 py-3 text-left text-sm font-medium text-gray-400">Status</th>
+ <th className="px-4 py-3 text-left text-sm font-medium text-gray-400">PID</th>
+ <th className="px-4 py-3 text-left text-sm font-medium text-gray-400">CPU</th>
+ <th className="px-4 py-3 text-left text-sm font-medium text-gray-400">Memory</th>
+ <th className="px-4 py-3 text-left text-sm font-medium text-gray-400">Uptime</th>
+ <th className="px-4 py-3 text-left text-sm font-medium text-gray-400">Restarts</th>
+ <th className="px-4 py-3 text-right text-sm font-medium text-gray-400">Actions</th>
+ </tr>
+ </thead>
+ <tbody className="divide-y divide-port-border">
+ {filteredProcesses.map(proc => (
+ <Fragment key={proc.pm_id}>
+ <tr className="hover:bg-port-border/20">
+ <td className="px-4 py-3">
+ <button
+ onClick={() => toggleExpand(proc.name)}
+ className="text-gray-400 hover:text-white transition-transform"
+ >
+ <span className={`inline-block transition-transform ${expandedProcess === proc.name ? 'rotate-90' : ''}`}>▶</span>
+ </button>
+ </td>
+ <td className="px-4 py-3">
+ <span className="font-medium text-white">{proc.name}</span>
+ </td>
+ <td className="px-4 py-3">
+ <span className={`inline-flex items-center gap-2 px-2 py-1 rounded text-xs ${getStatusColor(proc.status)} bg-opacity-20`}>
+ <span className={`w-2 h-2 rounded-full ${getStatusColor(proc.status)}`} />
+ {proc.status}
+ </span>
+ </td>
+ <td className="px-4 py-3 text-gray-400 font-mono text-sm">{proc.pid || '-'}</td>
+ <td className="px-4 py-3 text-gray-400">{proc.cpu ? `${proc.cpu}%` : '-'}</td>
+ <td className="px-4 py-3 text-gray-400">{formatMemory(proc.memory)}</td>
+ <td className="px-4 py-3 text-gray-400">{formatUptime(proc.uptime)}</td>
+ <td className="px-4 py-3 text-gray-400">{proc.restarts}</td>
+ <td className="px-4 py-3 text-right">
+ <div className="flex justify-end gap-1">
+ {proc.status === 'online' ? (
+ <>
+ <button
+ onClick={() => handleRestart(proc.name)}
+ disabled={restarting[proc.name]}
+ className="px-2 py-1 text-xs bg-port-warning/20 text-port-warning hover:bg-port-warning/30 rounded disabled:opacity-50"
+ >
+ {restarting[proc.name] ? '...' : 'Restart'}
+ </button>
+ <button
+ onClick={() => handleStop(proc.name)}
+ disabled={restarting[proc.name]}
+ className="px-2 py-1 text-xs bg-port-error/20 text-port-error hover:bg-port-error/30 rounded disabled:opacity-50"
+ >
+ Stop
+ </button>
+ </>
+ ) : (
+ <button
+ onClick={() => handleStart(proc.name)}
+ disabled={restarting[proc.name]}
+ className="px-2 py-1 text-xs bg-port-success/20 text-port-success hover:bg-port-success/30 rounded disabled:opacity-50"
+ >
+ {restarting[proc.name] ? '...' : 'Start'}
+ </button>
+ )}
+ </div>
+ </td>
+ </tr>
+ {expandedProcess === proc.name && (
+ <tr>
+ <td colSpan={9} className="p-0">
+ <div className="bg-port-bg border-t border-port-border">
+ <div className="flex items-center justify-between px-4 py-2 border-b border-port-border">
+ <div className="flex items-center gap-3">
+ <span className="text-xs text-gray-400">Live logs for {proc.name}</span>
+ {subscribed && (
+ <span className="text-xs text-port-success">● streaming</span>
+ )}
+ </div>
+ <div className="flex items-center gap-3">
+ <div className="flex items-center gap-2">
+ <label className="text-xs text-gray-500">Tail lines:</label>
+ <select
+ value={tailLines}
+ onChange={(e) => {
+ setTailLines(Number(e.target.value));
+ setLogs([]);
+ }}
+ className="px-2 py-1 text-xs bg-port-card border border-port-border rounded text-white"
+ >
+ <option value={100}>100</option>
+ <option value={250}>250</option>
+ <option value={500}>500</option>
+ <option value={1000}>1000</option>
+ <option value={2000}>2000</option>
+ </select>
+ </div>
+ <span className="text-xs text-gray-600">{logs.length} lines</span>
+ <button
+ onClick={() => setLogs([])}
+ className="text-xs text-gray-500 hover:text-white"
+ >
+ Clear
+ </button>
+ <button
+ onClick={() => setFullscreen(true)}
+ className="text-xs text-gray-500 hover:text-white flex items-center gap-1"
+ title="Fullscreen"
+ >
+ <Maximize2 size={12} />
+ Fullscreen
+ </button>
+ </div>
+ </div>
+ <div
+ ref={logsRef}
+ className="h-[32rem] overflow-auto p-3 font-mono text-xs"
+ >
+ {logs.length === 0 ? (
+ <div className="text-gray-500">
+ {subscribed ? 'No logs yet...' : 'Connecting to log stream...'}
+ </div>
+ ) : (
+ logs.map((log, i) => (
+ <div
+ key={i}
+ className={`py-0.5 ${log.type === 'stderr' ? 'text-port-error' : 'text-gray-300'}`}
+ >
+ <span className="text-gray-600 mr-2">
+ {new Date(log.timestamp).toLocaleTimeString()}
+ </span>
+ {log.line}
+ </div>
+ ))
+ )}
+ </div>
+ </div>
+ </td>
+ </tr>
+ )}
+ </Fragment>
+ ))}
+ {filteredProcesses.length === 0 && (
+ <tr>
+ <td colSpan={9} className="px-4 py-12 text-center text-gray-500">
+ No PM2 processes found
+ </td>
+ </tr>
+ )}
+ </tbody>
+ </table>
+ </div>
+ </div>
+
+ {/* Fullscreen Log Modal */}
+ {fullscreen && expandedProcess && (
+ <div className="fixed inset-0 bg-port-bg z-50 flex flex-col">
+ <div className="flex items-center justify-between px-6 py-4 border-b border-port-border bg-port-card">
+ <div className="flex items-center gap-4">
+ <span className="text-lg font-medium text-white">Logs: {expandedProcess}</span>
+ {subscribed && (
+ <span className="text-sm text-port-success">● streaming</span>
+ )}
+ </div>
+ <div className="flex items-center gap-4">
+ <div className="flex items-center gap-2">
+ <label className="text-sm text-gray-500">Tail lines:</label>
+ <select
+ value={tailLines}
+ onChange={(e) => {
+ setTailLines(Number(e.target.value));
+ setLogs([]);
+ }}
+ className="px-2 py-1 text-sm bg-port-bg border border-port-border rounded text-white"
+ >
+ <option value={100}>100</option>
+ <option value={250}>250</option>
+ <option value={500}>500</option>
+ <option value={1000}>1000</option>
+ <option value={2000}>2000</option>
+ </select>
+ </div>
+ <span className="text-sm text-gray-600">{logs.length} lines</span>
+ <button
+ onClick={() => setLogs([])}
+ className="text-sm text-gray-500 hover:text-white"
+ >
+ Clear
+ </button>
+ <button
+ onClick={() => setFullscreen(false)}
+ className="p-2 text-gray-400 hover:text-white"
+ title="Exit fullscreen"
+ >
+ <X size={20} />
+ </button>
+ </div>
+ </div>
+ <div
+ ref={fullscreenLogsRef}
+ className="flex-1 overflow-auto p-4 font-mono text-sm"
+ >
+ {logs.length === 0 ? (
+ <div className="text-gray-500">
+ {subscribed ? 'No logs yet...' : 'Connecting to log stream...'}
+ </div>
+ ) : (
+ logs.map((log, i) => (
+ <div
+ key={i}
+ className={`py-0.5 ${log.type === 'stderr' ? 'text-port-error' : 'text-gray-300'}`}
+ >
+ <span className="text-gray-600 mr-3">
+ {new Date(log.timestamp).toLocaleTimeString()}
+ </span>
+ {log.line}
+ </div>
+ ))
+ )}
+ </div>
+ </div>
+ )}
+ </>
+ );
+}
diff --git a/client/src/pages/DevTools.jsx b/client/src/pages/DevTools.jsx
index 7fadbeda03..5d840688e6 100644
--- a/client/src/pages/DevTools.jsx
+++ b/client/src/pages/DevTools.jsx
@@ -1,6 +1,7 @@
import { useState, useEffect, useRef, Fragment } from 'react';
import { useLocation, useNavigate } from 'react-router-dom';
-import { Clock, RefreshCw, Activity, Image, X, XCircle, Cpu, MemoryStick, Terminal, Trash2, MessageSquarePlus, Info, Save, Maximize2, RotateCcw } from 'lucide-react';
+import { Clock, RefreshCw, Activity, Image, X, XCircle, Cpu, MemoryStick, Terminal, Trash2, MessageSquarePlus, Info, Save, RotateCcw } from 'lucide-react';
+import ProcessesTab from '../components/apps/tabs/ProcessesTab';
import toast from 'react-hot-toast';
import * as api from '../services/api';
import socket from '../services/socket';
@@ -1239,142 +1240,26 @@ ${prompt.trim()}`;
}
export function ProcessesPage() {
- const [processes, setProcesses] = useState([]);
const [managedProcessNames, setManagedProcessNames] = useState(new Set());
- const [loading, setLoading] = useState(true);
- const [expandedProcess, setExpandedProcess] = useState(null);
- const [logs, setLogs] = useState([]);
- const [restarting, setRestarting] = useState({});
- const [tailLines, setTailLines] = useState(500);
- const [subscribed, setSubscribed] = useState(false);
const [saving, setSaving] = useState(false);
- const [fullscreen, setFullscreen] = useState(false);
- const logsRef = useRef(null);
- const fullscreenLogsRef = useRef(null);
useEffect(() => {
- loadProcesses();
+ const loadManagedProcessNames = async () => {
+ const apps = await api.getApps().catch(() => []);
+ const names = new Set();
+ apps.forEach(app => {
+ (app.pm2ProcessNames || []).forEach(name => names.add(name));
+ });
+ setManagedProcessNames(names);
+ };
loadManagedProcessNames();
- const interval = setInterval(loadProcesses, 5000);
- return () => clearInterval(interval);
}, []);
- const loadManagedProcessNames = async () => {
- const apps = await api.getApps().catch(() => []);
- const names = new Set();
- apps.forEach(app => {
- (app.pm2ProcessNames || []).forEach(name => names.add(name));
- });
- setManagedProcessNames(names);
- };
-
const isPortOSManaged = (procName) => {
if (procName.startsWith('portos-')) return true;
return managedProcessNames.has(procName);
};
- useEffect(() => {
- if (!expandedProcess) {
- setLogs([]);
- setSubscribed(false);
- return;
- }
-
- // Subscribe to logs via socket
- socket.emit('logs:subscribe', { processName: expandedProcess, lines: tailLines });
-
- const handleLog = (data) => {
- if (data.processName === expandedProcess) {
- setLogs(prev => [...prev.slice(-1000), {
- line: data.line,
- type: data.type,
- timestamp: data.timestamp
- }]);
- setTimeout(() => {
- if (logsRef.current) {
- logsRef.current.scrollTop = logsRef.current.scrollHeight;
- }
- if (fullscreenLogsRef.current) {
- fullscreenLogsRef.current.scrollTop = fullscreenLogsRef.current.scrollHeight;
- }
- }, 10);
- }
- };
-
- const handleSubscribed = (data) => {
- if (data.processName === expandedProcess) {
- setSubscribed(true);
- }
- };
-
- const handleError = (data) => {
- if (data.processName === expandedProcess) {
- setLogs(prev => [...prev, { line: `Error: ${data.error}`, type: 'stderr', timestamp: Date.now() }]);
- }
- };
-
- socket.on('logs:line', handleLog);
- socket.on('logs:subscribed', handleSubscribed);
- socket.on('logs:error', handleError);
-
- return () => {
- socket.emit('logs:unsubscribe', { processName: expandedProcess });
- socket.off('logs:line', handleLog);
- socket.off('logs:subscribed', handleSubscribed);
- socket.off('logs:error', handleError);
- };
- }, [expandedProcess, tailLines]);
-
- const loadProcesses = async () => {
- const data = await api.getProcessesList().catch(() => []);
- setProcesses(data);
- setLoading(false);
- };
-
- const handleRestart = async (name) => {
- setRestarting(prev => ({ ...prev, [name]: true }));
- await fetch('/api/commands/execute', {
- method: 'POST',
- headers: { 'Content-Type': 'application/json' },
- body: JSON.stringify({ command: `pm2 restart ${name}` })
- }).catch(() => null);
- setTimeout(() => {
- setRestarting(prev => ({ ...prev, [name]: false }));
- loadProcesses();
- }, 2000);
- };
-
- const handleStop = async (name) => {
- setRestarting(prev => ({ ...prev, [name]: true }));
- await fetch('/api/commands/execute', {
- method: 'POST',
- headers: { 'Content-Type': 'application/json' },
- body: JSON.stringify({ command: `pm2 stop ${name}` })
- }).catch(() => null);
- setTimeout(() => {
- setRestarting(prev => ({ ...prev, [name]: false }));
- loadProcesses();
- }, 2000);
- };
-
- const handleStart = async (name) => {
- setRestarting(prev => ({ ...prev, [name]: true }));
- await fetch('/api/commands/execute', {
- method: 'POST',
- headers: { 'Content-Type': 'application/json' },
- body: JSON.stringify({ command: `pm2 start ${name}` })
- }).catch(() => null);
- setTimeout(() => {
- setRestarting(prev => ({ ...prev, [name]: false }));
- loadProcesses();
- }, 2000);
- };
-
- const toggleExpand = (name) => {
- setExpandedProcess(prev => prev === name ? null : name);
- setLogs([]);
- };
-
const handlePm2Save = async () => {
setSaving(true);
const result = await fetch('/api/commands/execute', {
@@ -1390,288 +1275,22 @@ export function ProcessesPage() {
}
};
- // Filter to only show PortOS-managed processes
- const managedProcesses = processes.filter(proc => isPortOSManaged(proc.name));
-
- const formatMemory = (bytes) => {
- if (!bytes) return '0 MB';
- return `${(bytes / 1024 / 1024).toFixed(1)} MB`;
- };
-
- const formatUptime = (ms) => {
- if (!ms) return '-';
- const hours = Math.floor(ms / 3600000);
- const mins = Math.floor((ms % 3600000) / 60000);
- if (hours > 24) {
- return `${Math.floor(hours / 24)}d ${hours % 24}h`;
- }
- return `${hours}h ${mins}m`;
- };
-
- const getStatusColor = (status) => {
- switch (status) {
- case 'online': return 'bg-port-success';
- case 'stopped': return 'bg-gray-500';
- case 'errored': return 'bg-port-error';
- default: return 'bg-port-warning';
- }
- };
-
- if (loading) {
- return <div className="text-center py-8"><BrailleSpinner text="Loading processes" /></div>;
- }
-
return (
<div className="space-y-6">
<div className="flex flex-col sm:flex-row justify-between items-start sm:items-center gap-4">
- <div>
- <h1 className="text-2xl font-bold text-white">PM2 Processes</h1>
- <p className="text-gray-500 text-sm sm:text-base">PortOS-managed processes ({managedProcesses.length} of {processes.length} total)</p>
- </div>
- <div className="flex gap-2">
- <button
- onClick={handlePm2Save}
- disabled={saving}
- className="px-3 sm:px-4 py-2 bg-port-accent hover:bg-port-accent/80 text-white rounded-lg transition-colors flex items-center gap-2 disabled:opacity-50 text-sm sm:text-base"
- >
- <Save size={16} className={saving ? 'animate-pulse' : ''} />
- <span className="hidden sm:inline">{saving ? 'Saving...' : 'PM2 Save'}</span>
- <span className="sm:hidden">{saving ? '...' : 'Save'}</span>
- </button>
- <button
- onClick={loadProcesses}
- className="px-3 sm:px-4 py-2 bg-port-border hover:bg-port-border/80 text-white rounded-lg transition-colors text-sm sm:text-base"
- >
- Refresh
- </button>
- </div>
- </div>
-
- <div className="bg-port-card border border-port-border rounded-xl overflow-hidden overflow-x-auto">
- <table className="w-full min-w-[700px]">
- <thead className="bg-port-border/50">
- <tr>
- <th className="px-4 py-3 text-left text-sm font-medium text-gray-400 w-8"></th>
- <th className="px-4 py-3 text-left text-sm font-medium text-gray-400">Name</th>
- <th className="px-4 py-3 text-left text-sm font-medium text-gray-400">Status</th>
- <th className="px-4 py-3 text-left text-sm font-medium text-gray-400">PID</th>
- <th className="px-4 py-3 text-left text-sm font-medium text-gray-400">CPU</th>
- <th className="px-4 py-3 text-left text-sm font-medium text-gray-400">Memory</th>
- <th className="px-4 py-3 text-left text-sm font-medium text-gray-400">Uptime</th>
- <th className="px-4 py-3 text-left text-sm font-medium text-gray-400">Restarts</th>
- <th className="px-4 py-3 text-right text-sm font-medium text-gray-400">Actions</th>
- </tr>
- </thead>
- <tbody className="divide-y divide-port-border">
- {managedProcesses.map(proc => (
- <Fragment key={proc.pm_id}>
- <tr className="hover:bg-port-border/20">
- <td className="px-4 py-3">
- <button
- onClick={() => toggleExpand(proc.name)}
- className="text-gray-400 hover:text-white transition-transform"
- >
- <span className={`inline-block transition-transform ${expandedProcess === proc.name ? 'rotate-90' : ''}`}>▶</span>
- </button>
- </td>
- <td className="px-4 py-3">
- <span className="font-medium text-white">{proc.name}</span>
- </td>
- <td className="px-4 py-3">
- <span className={`inline-flex items-center gap-2 px-2 py-1 rounded text-xs ${getStatusColor(proc.status)} bg-opacity-20`}>
- <span className={`w-2 h-2 rounded-full ${getStatusColor(proc.status)}`} />
- {proc.status}
- </span>
- </td>
- <td className="px-4 py-3 text-gray-400 font-mono text-sm">{proc.pid || '-'}</td>
- <td className="px-4 py-3 text-gray-400">{proc.cpu ? `${proc.cpu}%` : '-'}</td>
- <td className="px-4 py-3 text-gray-400">{formatMemory(proc.memory)}</td>
- <td className="px-4 py-3 text-gray-400">{formatUptime(proc.uptime)}</td>
- <td className="px-4 py-3 text-gray-400">{proc.restarts}</td>
- <td className="px-4 py-3 text-right">
- <div className="flex justify-end gap-1">
- {proc.status === 'online' ? (
- <>
- <button
- onClick={() => handleRestart(proc.name)}
- disabled={restarting[proc.name]}
- className="px-2 py-1 text-xs bg-port-warning/20 text-port-warning hover:bg-port-warning/30 rounded disabled:opacity-50"
- >
- {restarting[proc.name] ? '...' : 'Restart'}
- </button>
- <button
- onClick={() => handleStop(proc.name)}
- disabled={restarting[proc.name]}
- className="px-2 py-1 text-xs bg-port-error/20 text-port-error hover:bg-port-error/30 rounded disabled:opacity-50"
- >
- Stop
- </button>
- </>
- ) : (
- <button
- onClick={() => handleStart(proc.name)}
- disabled={restarting[proc.name]}
- className="px-2 py-1 text-xs bg-port-success/20 text-port-success hover:bg-port-success/30 rounded disabled:opacity-50"
- >
- {restarting[proc.name] ? '...' : 'Start'}
- </button>
- )}
- </div>
- </td>
- </tr>
- {expandedProcess === proc.name && (
- <tr>
- <td colSpan={9} className="p-0">
- <div className="bg-port-bg border-t border-port-border">
- <div className="flex items-center justify-between px-4 py-2 border-b border-port-border">
- <div className="flex items-center gap-3">
- <span className="text-xs text-gray-400">Live logs for {proc.name}</span>
- {subscribed && (
- <span className="text-xs text-port-success">● streaming</span>
- )}
- </div>
- <div className="flex items-center gap-3">
- <div className="flex items-center gap-2">
- <label className="text-xs text-gray-500">Tail lines:</label>
- <select
- value={tailLines}
- onChange={(e) => {
- setTailLines(Number(e.target.value));
- setLogs([]);
- }}
- className="px-2 py-1 text-xs bg-port-card border border-port-border rounded text-white"
- >
- <option value={100}>100</option>
- <option value={250}>250</option>
- <option value={500}>500</option>
- <option value={1000}>1000</option>
- <option value={2000}>2000</option>
- </select>
- </div>
- <span className="text-xs text-gray-600">{logs.length} lines</span>
- <button
- onClick={() => setLogs([])}
- className="text-xs text-gray-500 hover:text-white"
- >
- Clear
- </button>
- <button
- onClick={() => setFullscreen(true)}
- className="text-xs text-gray-500 hover:text-white flex items-center gap-1"
- title="Fullscreen"
- >
- <Maximize2 size={12} />
- Fullscreen
- </button>
- </div>
- </div>
- <div
- ref={logsRef}
- className="h-[32rem] overflow-auto p-3 font-mono text-xs"
- >
- {logs.length === 0 ? (
- <div className="text-gray-500">
- {subscribed ? 'No logs yet...' : 'Connecting to log stream...'}
- </div>
- ) : (
- logs.map((log, i) => (
- <div
- key={i}
- className={`py-0.5 ${log.type === 'stderr' ? 'text-port-error' : 'text-gray-300'}`}
- >
- <span className="text-gray-600 mr-2">
- {new Date(log.timestamp).toLocaleTimeString()}
- </span>
- {log.line}
- </div>
- ))
- )}
- </div>
- </div>
- </td>
- </tr>
- )}
- </Fragment>
- ))}
- {processes.length === 0 && (
- <tr>
- <td colSpan={9} className="px-4 py-12 text-center text-gray-500">
- No PM2 processes running
- </td>
- </tr>
- )}
- </tbody>
- </table>
+ <h1 className="text-2xl font-bold text-white">PM2 Processes</h1>
+ <button
+ onClick={handlePm2Save}
+ disabled={saving}
+ className="px-3 sm:px-4 py-2 bg-port-accent hover:bg-port-accent/80 text-white rounded-lg transition-colors flex items-center gap-2 disabled:opacity-50 text-sm sm:text-base"
+ >
+ <Save size={16} className={saving ? 'animate-pulse' : ''} />
+ <span className="hidden sm:inline">{saving ? 'Saving...' : 'PM2 Save'}</span>
+ <span className="sm:hidden">{saving ? '...' : 'Save'}</span>
+ </button>
</div>
- {/* Fullscreen Log Modal */}
- {fullscreen && expandedProcess && (
- <div className="fixed inset-0 bg-port-bg z-50 flex flex-col">
- <div className="flex items-center justify-between px-6 py-4 border-b border-port-border bg-port-card">
- <div className="flex items-center gap-4">
- <span className="text-lg font-medium text-white">Logs: {expandedProcess}</span>
- {subscribed && (
- <span className="text-sm text-port-success">● streaming</span>
- )}
- </div>
- <div className="flex items-center gap-4">
- <div className="flex items-center gap-2">
- <label className="text-sm text-gray-500">Tail lines:</label>
- <select
- value={tailLines}
- onChange={(e) => {
- setTailLines(Number(e.target.value));
- setLogs([]);
- }}
- className="px-2 py-1 text-sm bg-port-bg border border-port-border rounded text-white"
- >
- <option value={100}>100</option>
- <option value={250}>250</option>
- <option value={500}>500</option>
- <option value={1000}>1000</option>
- <option value={2000}>2000</option>
- </select>
- </div>
- <span className="text-sm text-gray-600">{logs.length} lines</span>
- <button
- onClick={() => setLogs([])}
- className="text-sm text-gray-500 hover:text-white"
- >
- Clear
- </button>
- <button
- onClick={() => setFullscreen(false)}
- className="p-2 text-gray-400 hover:text-white"
- title="Exit fullscreen"
- >
- <X size={20} />
- </button>
- </div>
- </div>
- <div
- ref={fullscreenLogsRef}
- className="flex-1 overflow-auto p-4 font-mono text-sm"
- >
- {logs.length === 0 ? (
- <div className="text-gray-500">
- {subscribed ? 'No logs yet...' : 'Connecting to log stream...'}
- </div>
- ) : (
- logs.map((log, i) => (
- <div
- key={i}
- className={`py-0.5 ${log.type === 'stderr' ? 'text-port-error' : 'text-gray-300'}`}
- >
- <span className="text-gray-600 mr-3">
- {new Date(log.timestamp).toLocaleTimeString()}
- </span>
- {log.line}
- </div>
- ))
- )}
- </div>
- </div>
- )}
+ <ProcessesTab filterFn={isPortOSManaged} />
</div>
);
}
diff --git a/client/src/services/api.js b/client/src/services/api.js
index 6574aae25d..a25a904034 100644
--- a/client/src/services/api.js
+++ b/client/src/services/api.js
@@ -250,7 +250,7 @@ export const getRunOutput = (id) => request(`/runs/${id}/output`);
export const getRunPrompt = (id) => request(`/runs/${id}/prompt`);
export const stopRun = (id) => request(`/runs/${id}/stop`, { method: 'POST' });
export const deleteRun = (id) => request(`/runs/${id}`, { method: 'DELETE' });
-export const deleteFailedRuns = () => request('/runs?confirm=true', { method: 'DELETE' });
+export const deleteFailedRuns = () => request('/runs?filter=failed', { method: 'DELETE' });
// History
export const getHistory = (options = {}) => {
diff --git a/package-lock.json b/package-lock.json
index 50221cf551..02d51dde48 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -1,12 +1,12 @@
{
"name": "portos",
- "version": "1.24.1",
+ "version": "1.25.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "portos",
- "version": "1.24.1",
+ "version": "1.25.0",
"license": "MIT",
"dependencies": {
"express": "^4.21.2",
diff --git a/package.json b/package.json
index 683dd188fa..52dc875230 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "portos",
- "version": "1.24.1",
+ "version": "1.25.0",
"private": true,
"description": "Local dev machine App OS portal",
"author": "Adam Eivy (@antic|@atomantic)",