Commit Graph

6 Commits

Author SHA1 Message Date
7aa08682b8 Implement smart Magic DNS copy with automatic port detection
### Magic DNS Smart Copy Features:
- **PBS servers**: Automatically append `:8007` port when copying
- **PVE servers**: Automatically append `:8006` port when copying
- **Other machines**: Copy Magic DNS address without port (existing behavior)

### UI Improvements:
- PBS servers: Blue button with `:8007` port hint
- PVE servers: Orange button with `:8006` port hint
- Enhanced tooltips with service-specific port information
- Visual distinction between different server types

### PBS Backup Server Monitoring:
- Complete PBS API integration with authentication
- Real-time backup/restore task monitoring with detailed logs
- Namespace-separated backup visualization with color coding
- Datastore usage monitoring and status tracking
- Task history with success/failure status and error details

### Technical Implementation:
- Smart port detection via JavaScript `addSmartPort()` function
- Jinja2 template logic for conditional button styling
- PBS API endpoints for comprehensive backup monitoring
- Enhanced clipboard functionality with user feedback

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-14 10:48:47 +09:00
c68ed59946 Implement Headscale machine rename functionality in FarmQ Admin
Add machine name editing feature similar to Headplane:
- REST API endpoint POST /api/machines/{id}/rename with Headscale CLI integration
- Edit button next to each machine name in the machine list
- Modal dialog with real-time Magic DNS preview
- DNS-compatible name validation (lowercase, digits, hyphens only)
- Immediate UI updates after successful rename
- Loading states and error handling

Features:
- farmq-admin/app.py: New rename API endpoint with subprocess Headscale CLI calls
- farmq-admin/templates/machines/list.html: Edit buttons, rename modal, JavaScript functions
- Real-time validation and Magic DNS preview
- Bootstrap modal with form validation
- Error handling with toast notifications

Users can now rename machines and their Magic DNS addresses directly from the web interface,
matching the functionality available in Headplane.

Tested with machine ID 2: desktop-emjd1dc ↔ desktop-emjd1dc-test 

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-13 23:38:57 +09:00
a9aa31cc4a Implement FarmQ Admin machine name display fix for Magic DNS
Fix machine management page to display proper Magic DNS names:
- Use given_name instead of hostname for machine display
- Add Magic DNS address with copy-to-clipboard functionality
- Distinguish between machine name and OS hostname like Headplane
- Enhance UI with Magic DNS information (.headscale.local)

Changes:
- farmq-admin/utils/database_new.py: Use given_name for machine_name
- farmq-admin/models/farmq_models.py: Update sync logic for given_name
- farmq-admin/templates/machines/list.html: Add Magic DNS display with copy feature
- FARMQ_ADMIN_MACHINE_NAME_FIX_PLAN.md: Complete analysis and implementation plan

Now displays:
- Machine Name: pbs-hp (Magic DNS name)
- Magic DNS: pbs-hp.headscale.local (with copy button)
- OS Hostname: proxmox-backup-server (system name)

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-13 23:28:20 +09:00
45c952258b Add node deletion functionality to FARMQ Admin
- Add DELETE API endpoint for node deletion via Headscale CLI
- Add delete buttons to both table and card views in machine list
- Implement confirmation dialog with clear warning message
- Add proper error handling and user feedback with toast messages
- Auto-refresh page after successful deletion
- Match Headplane functionality for complete node management

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-11 10:44:49 +09:00
1f0afd4cae Fix machine count display and pharmacy edit functionality
🔧 Machine Management Fixes:
- Fix duplicate machine counting (was showing 10 instead of 5)
- Update dashboard stats to use Headscale nodes instead of FARMQ profiles
- Fix JavaScript counting to only count active view (List/Card)
- Add view change listeners to update counters correctly

🏥 Pharmacy Management Fixes:
- Add API endpoint for individual pharmacy data retrieval
- Fix pharmacy edit modal to load existing data as form values
- Add proper form validation and error handling
- Implement edit vs add mode detection

📊 Database Integration:
- Improve machine counting logic using Headscale Node table
- Fix online/offline status calculation with 5-minute threshold
- Add debug logging for machine data retrieval

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-11 09:41:55 +09:00
ca61a89739 🏥 Add complete FARMQ Admin Flask application
## Features
- 한국어 Flask 관리 인터페이스 with Bootstrap 5
- Headscale과 분리된 독립 데이터베이스 구조
- 약국 관리 시스템 (pharmacy management)
- 머신 모니터링 및 상태 관리
- 실시간 대시보드 with 통계 및 알림
- Headscale 사용자명과 약국명 분리 관리

## Database Architecture
- 별도 FARMQ SQLite DB (farmq.sqlite)
- Headscale DB와 외래키 충돌 방지
- 느슨한 결합 설계 (ID 참조만 사용)

## UI Components
- 반응형 대시보드 with 실시간 통계
- 약국별 머신 상태 모니터링
- 한국어 지역화 및 사용자 친화적 인터페이스
- 머신 온라인/오프라인 상태 표시 (24시간 타임아웃)

## API Endpoints
- `/api/sync/machines` - Headscale 머신 동기화
- `/api/sync/users` - Headscale 사용자 동기화
- `/api/pharmacy/<id>/update` - 약국 정보 업데이트
- 대시보드 통계 및 알림 API

## Problem Resolution
- Fixed foreign key conflicts preventing Windows client connections
- Resolved machine online status detection with proper timeout handling
- Separated technical Headscale usernames from business pharmacy names

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-09 17:44:56 +09:00