Files
Task_Reporter/stop-dev.sh
egg 1d5d4d447d feat: Add mobile responsive layout, open room access, and admin room management
Mobile Responsive Layout:
- Add useMediaQuery, useIsMobile, useIsTablet, useIsDesktop hooks for device detection
- Create MobileHeader component with hamburger menu and action drawer
- Create BottomToolbar for mobile navigation (Files, Members)
- Create SlidePanel component for full-screen mobile sidebars
- Update RoomDetail.tsx with mobile/desktop conditional rendering
- Update RoomList.tsx with single-column grid and touch-friendly buttons
- Add CSS custom properties for safe areas and touch targets (min 44px)
- Add mobile viewport meta tags for notched devices

Open Room Access:
- All authenticated users can view all rooms (not just their own)
- Users can join active rooms they're not members of
- Add is_member field to room responses
- Update room list API to return all rooms by default

Admin Room Management:
- Add permanent delete functionality for system admins
- Add delete confirmation dialog with room title verification
- Broadcast room deletion via WebSocket to connected users
- Add users search API for adding members

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-05 09:12:10 +08:00

255 lines
7.7 KiB
Bash
Executable File

#!/bin/bash
# ============================================================================
# Development Server Stop Script for Task Reporter
# Gracefully stops all services: Frontend, Backend, MinIO
# ============================================================================
# Colors for output
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
BLUE='\033[0;34m'
NC='\033[0m' # No Color
# Script directory (scripts are in project root)
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
PROJECT_ROOT="$SCRIPT_DIR"
# PID file locations
PID_DIR="$PROJECT_ROOT/.pids"
BACKEND_PID_FILE="$PID_DIR/backend.pid"
FRONTEND_PID_FILE="$PID_DIR/frontend.pid"
# Helper functions
print_header() {
echo -e "\n${BLUE}=== $1 ===${NC}"
}
print_ok() {
echo -e "${GREEN}[OK]${NC} $1"
}
print_error() {
echo -e "${RED}[ERROR]${NC} $1"
}
print_warn() {
echo -e "${YELLOW}[WARN]${NC} $1"
}
print_info() {
echo -e "${BLUE}[INFO]${NC} $1"
}
# Show help
show_help() {
echo "Usage: $0 [OPTIONS]"
echo ""
echo "Stops all development services for Task Reporter."
echo ""
echo "Options:"
echo " -h, --help Show this help message"
echo " --keep-minio Don't stop MinIO container"
echo " --keep-data Alias for --keep-minio"
echo ""
echo "Services stopped:"
echo " - Frontend (Vite dev server)"
echo " - Backend (uvicorn)"
echo " - MinIO (Docker container)"
}
# Parse arguments
KEEP_MINIO=false
while [[ $# -gt 0 ]]; do
case $1 in
-h|--help)
show_help
exit 0
;;
--keep-minio|--keep-data)
KEEP_MINIO=true
shift
;;
*)
echo "Unknown option: $1"
show_help
exit 1
;;
esac
done
echo -e "${BLUE}============================================${NC}"
echo -e "${BLUE} Task Reporter - Stopping Services${NC}"
echo -e "${BLUE}============================================${NC}"
# ============================================================================
# Stop Frontend
# ============================================================================
print_header "Stopping Frontend"
if [[ -f "$FRONTEND_PID_FILE" ]]; then
FRONTEND_PID=$(cat "$FRONTEND_PID_FILE")
if kill -0 "$FRONTEND_PID" 2>/dev/null; then
kill "$FRONTEND_PID" 2>/dev/null || true
# Also kill any child processes (npm spawns node)
pkill -P "$FRONTEND_PID" 2>/dev/null || true
sleep 1
# Force kill if still running
if kill -0 "$FRONTEND_PID" 2>/dev/null; then
kill -9 "$FRONTEND_PID" 2>/dev/null || true
fi
print_ok "Frontend stopped (was PID: $FRONTEND_PID)"
else
print_info "Frontend was not running"
fi
rm -f "$FRONTEND_PID_FILE"
else
# Try to find and kill vite process
VITE_PID=$(pgrep -f "vite.*frontend" 2>/dev/null | head -1)
if [[ -n "$VITE_PID" ]]; then
kill "$VITE_PID" 2>/dev/null || true
print_ok "Frontend stopped (found PID: $VITE_PID)"
else
print_info "Frontend was not running"
fi
fi
# ============================================================================
# Stop Backend
# ============================================================================
print_header "Stopping Backend"
if [[ -f "$BACKEND_PID_FILE" ]]; then
BACKEND_PID=$(cat "$BACKEND_PID_FILE")
if kill -0 "$BACKEND_PID" 2>/dev/null; then
kill "$BACKEND_PID" 2>/dev/null || true
sleep 1
# Force kill if still running
if kill -0 "$BACKEND_PID" 2>/dev/null; then
kill -9 "$BACKEND_PID" 2>/dev/null || true
fi
print_ok "Backend stopped (was PID: $BACKEND_PID)"
else
print_info "Backend was not running"
fi
rm -f "$BACKEND_PID_FILE"
else
# Try to find and kill uvicorn process
UVICORN_PID=$(pgrep -f "uvicorn app.main:app" 2>/dev/null | head -1)
if [[ -n "$UVICORN_PID" ]]; then
kill "$UVICORN_PID" 2>/dev/null || true
print_ok "Backend stopped (found PID: $UVICORN_PID)"
else
print_info "Backend was not running"
fi
fi
# ============================================================================
# Stop MinIO
# ============================================================================
if [[ "$KEEP_MINIO" == "false" ]]; then
print_header "Stopping MinIO"
cd "$PROJECT_ROOT"
if docker ps --format '{{.Names}}' | grep -q "task-reporter-minio"; then
if command -v docker-compose &> /dev/null; then
docker-compose -f docker-compose.minio.yml down
else
docker compose -f docker-compose.minio.yml down
fi
print_ok "MinIO stopped (data preserved)"
else
print_info "MinIO was not running"
fi
else
print_header "MinIO"
print_info "Keeping MinIO running (--keep-minio)"
fi
# ============================================================================
# Port Release
# ============================================================================
print_header "Port Release"
# Function to release port
release_port() {
local port=$1
local service_name=$2
# Check if port is in use
if command -v fuser &> /dev/null; then
# Use fuser if available
if fuser "$port/tcp" > /dev/null 2>&1; then
print_info "Releasing port $port ($service_name)..."
fuser -k "$port/tcp" > /dev/null 2>&1 || true
sleep 1
if ! fuser "$port/tcp" > /dev/null 2>&1; then
print_ok "Port $port released"
else
print_warn "Port $port may still be in use (TIME_WAIT state)"
fi
else
print_ok "Port $port is free"
fi
elif command -v lsof &> /dev/null; then
# Fallback to lsof
local pid=$(lsof -ti ":$port" 2>/dev/null | head -1)
if [[ -n "$pid" ]]; then
print_info "Releasing port $port ($service_name, PID: $pid)..."
kill "$pid" 2>/dev/null || true
sleep 1
if ! lsof -ti ":$port" > /dev/null 2>&1; then
print_ok "Port $port released"
else
# Force kill if still in use
kill -9 "$pid" 2>/dev/null || true
sleep 1
if ! lsof -ti ":$port" > /dev/null 2>&1; then
print_ok "Port $port force released"
else
print_warn "Port $port may still be in use (TIME_WAIT state)"
fi
fi
else
print_ok "Port $port is free"
fi
else
# Check with netstat/ss as last resort
if ss -tuln 2>/dev/null | grep -q ":$port "; then
print_warn "Port $port appears in use but no tool to release it"
else
print_ok "Port $port is free"
fi
fi
}
# Release application ports (not MinIO ports - those are managed by Docker)
release_port 8000 "Backend API"
release_port 3000 "Frontend"
# ============================================================================
# Cleanup
# ============================================================================
print_header "Cleanup"
# Remove PID directory if empty
if [[ -d "$PID_DIR" ]] && [[ -z "$(ls -A "$PID_DIR")" ]]; then
rmdir "$PID_DIR"
print_ok "Cleaned up PID directory"
fi
# ============================================================================
# Summary
# ============================================================================
print_header "Summary"
echo -e "${GREEN}All services have been stopped.${NC}"
echo ""
if [[ "$KEEP_MINIO" == "true" ]]; then
echo -e " ${YELLOW}Note:${NC} MinIO is still running (use without --keep-minio to stop)"
fi
echo -e " ${BLUE}Tip:${NC} Run ./scripts/start-dev.sh to start services again"
echo ""