feat: implement Phase 8 - Process Stdin
All checks were successful
Build and Push Docker Image to Gitea / build-and-push (push) Successful in 1m10s

Features added:
- Created stdin API route for sending input to process stdin
- Added useSendProcessStdin React Query hook
- Created StdinInput modal component with:
  - Multi-line textarea for input
  - Ctrl+Enter keyboard shortcut
  - Optional newline append
  - Character count display
  - Info banner explaining stdin functionality
- Added stdin button to ProcessCard (Terminal icon)
- Button only enabled when process is running (state === 20)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
2025-11-23 19:46:47 +01:00
parent 68ec8dd3db
commit 4aa0c49372
4 changed files with 212 additions and 1 deletions

View File

@@ -1,13 +1,14 @@
'use client';
import { useState } from 'react';
import { Play, Square, RotateCw, Activity, Zap } from 'lucide-react';
import { Play, Square, RotateCw, Activity, Zap, Terminal } from 'lucide-react';
import { Card, CardContent, CardHeader, CardTitle } from '@/components/ui/card';
import { Button } from '@/components/ui/button';
import { Badge } from '@/components/ui/badge';
import { ProcessInfo, ProcessStateCode, getProcessStateClass, formatUptime, canStartProcess, canStopProcess } from '@/lib/supervisor/types';
import { useStartProcess, useStopProcess, useRestartProcess } from '@/lib/hooks/useSupervisor';
import { SignalSender } from './SignalSender';
import { StdinInput } from './StdinInput';
import { cn } from '@/lib/utils/cn';
interface ProcessCardProps {
@@ -18,6 +19,7 @@ interface ProcessCardProps {
export function ProcessCard({ process, isSelected = false, onSelectionChange }: ProcessCardProps) {
const [showSignalModal, setShowSignalModal] = useState(false);
const [showStdinModal, setShowStdinModal] = useState(false);
const startMutation = useStartProcess();
const stopMutation = useStopProcess();
const restartMutation = useRestartProcess();
@@ -143,6 +145,15 @@ export function ProcessCard({ process, isSelected = false, onSelectionChange }:
>
<Zap className="h-4 w-4" />
</Button>
<Button
size="sm"
variant="outline"
onClick={() => setShowStdinModal(true)}
disabled={process.state !== 20}
title="Send Stdin"
>
<Terminal className="h-4 w-4" />
</Button>
</div>
{/* Description */}
@@ -157,6 +168,11 @@ export function ProcessCard({ process, isSelected = false, onSelectionChange }:
{showSignalModal && (
<SignalSender processName={fullName} onClose={() => setShowSignalModal(false)} />
)}
{/* Stdin Modal */}
{showStdinModal && (
<StdinInput processName={fullName} onClose={() => setShowStdinModal(false)} />
)}
</Card>
);
}