more stuff
This commit is contained in:
93
CLAUDE.md
93
CLAUDE.md
@@ -18,7 +18,13 @@ This file provides guidance to Claude Code (claude.ai/code) when working with co
|
||||
- This project uses `uv` for Python package management
|
||||
- `uv sync` - Install dependencies from pyproject.toml
|
||||
- Python 3.13+ required
|
||||
- Dependencies: PyGObject (GTK3), pystray, Pillow
|
||||
- Dependencies: PyGObject (GTK3), pystray, Pillow, PyYAML
|
||||
|
||||
### Configuration Management
|
||||
- `python init_config.py` - Initialize configuration directory with examples
|
||||
- `python data_loader.py --init` - Alternative way to create example files
|
||||
- Configuration location: `~/.vpntray/customers/`
|
||||
- Each customer gets their own YAML file (e.g., `customer_name.yaml`)
|
||||
|
||||
## Code Architecture
|
||||
|
||||
@@ -32,18 +38,23 @@ This file provides guidance to Claude Code (claude.ai/code) when working with co
|
||||
- Includes search functionality across customers, locations, and hosts
|
||||
- HeaderBar for native GNOME look and feel
|
||||
|
||||
**models.py** - Data model definitions using dataclasses
|
||||
- `Service`: Individual services (Web GUI, SSH, RDP, etc.) on hosts
|
||||
**models.py** - Data model definitions using dataclasses and enums
|
||||
- `ServiceType`: Enum for service types (SSH, Web GUI, RDP, VNC, SMB, Database, FTP)
|
||||
- `HostType`: Enum for host types (Linux, Windows, Windows Server, Proxmox, ESXi, Router, Switch)
|
||||
- `VPNType`: Enum for VPN types (OpenVPN, WireGuard, IPSec)
|
||||
- `Service`: Individual services on hosts with type-safe enums
|
||||
- `Host`: Physical/virtual machines with services and sub-hosts (VMs)
|
||||
- `Location`: Customer locations with VPN configurations and host infrastructure
|
||||
- `CustomerService`: Customer's cloud/web services (O365, CRM, etc.)
|
||||
- `Customer`: Top-level entities containing services and locations
|
||||
- Each model includes helper methods for common operations
|
||||
|
||||
**data_loader.py** - Data management layer
|
||||
- `load_customers()`: Returns comprehensive mock data with realistic infrastructure
|
||||
- `save_customers()`: Placeholder for future persistence
|
||||
- Isolates data loading logic from UI components
|
||||
**data_loader.py** - YAML-based data management layer
|
||||
- `load_customers()`: Loads customer configurations from `~/.vpntray/customers/*.yaml` files
|
||||
- `save_customer()`: Saves customer data back to YAML files
|
||||
- `initialize_example_customers()`: Creates example configuration files
|
||||
- Robust parsing with enum conversion and error handling
|
||||
- Falls back to demo data if no configuration files exist
|
||||
|
||||
**widgets/** - Modular UI components using PyGObject
|
||||
- `customer_card.py`: `ActiveCustomerCard` and `InactiveCustomerCard` classes
|
||||
@@ -51,6 +62,16 @@ This file provides guidance to Claude Code (claude.ai/code) when working with co
|
||||
- `host_item.py`: `HostItem` class for displaying hosts and their services
|
||||
- `__init__.py`: Widget exports for clean imports
|
||||
|
||||
**views/** - High-level UI view management
|
||||
- `active_view.py`: `ActiveView` class for displaying active locations
|
||||
- `inactive_view.py`: `InactiveView` class for search results (inactive locations)
|
||||
- `__init__.py`: View exports for clean imports
|
||||
|
||||
**Configuration Files**
|
||||
- `init_config.py`: Helper script to initialize user configuration
|
||||
- `example_customer.yaml`: Complete example showing YAML schema
|
||||
- User config: `~/.vpntray/customers/*.yaml` - One file per customer
|
||||
|
||||
### Key Architecture Patterns
|
||||
|
||||
**Hierarchical Data Structure**: Customer → Location → Host → Service
|
||||
@@ -77,31 +98,63 @@ This file provides guidance to Claude Code (claude.ai/code) when working with co
|
||||
- Rich mock data includes hypervisors with VMs, various service types
|
||||
|
||||
### Data Flow
|
||||
1. `data_loader.load_customers()` provides initial customer data with full infrastructure
|
||||
2. Main window loads and filters data based on search terms
|
||||
3. Widget classes create GTK components for customers, locations, and hosts
|
||||
1. `data_loader.load_customers()` loads customer configurations from YAML files in `~/.vpntray/customers/`
|
||||
2. Main window loads and filters data based on search terms (including `*` wildcard for all inactive)
|
||||
3. View classes (`ActiveView`/`InactiveView`) manage display using widget components
|
||||
4. User interactions trigger callbacks that update dataclass attributes
|
||||
5. UI re-renders to reflect state changes
|
||||
5. Changes can be persisted back to YAML files using `save_customer()`
|
||||
6. UI re-renders to reflect state changes with smooth transitions via Gtk.Stack
|
||||
|
||||
### UI Layout Structure
|
||||
- HeaderBar with title and subtitle (GNOME HIG compliance)
|
||||
- Search entry with placeholder text for filtering
|
||||
- Two-column main area with independent scrolling containers
|
||||
- Left column: Active locations with full infrastructure details
|
||||
- Right column: Inactive locations with summary cards and activation buttons
|
||||
- Search entry with placeholder text for filtering (supports `*` wildcard)
|
||||
- Single-view layout using Gtk.Stack for smooth transitions
|
||||
- **Normal mode**: Shows only active locations (full detail view)
|
||||
- **Search mode**: Shows only inactive locations matching search term (activation cards)
|
||||
- GNOME-style cards with CSS theming and proper spacing
|
||||
- System tray integration for minimize-to-tray behavior
|
||||
|
||||
### GTK3/PyGObject Specific Features
|
||||
- CSS styling for GNOME-style cards with borders, shadows, and theming
|
||||
- Native GTK widgets: HeaderBar, SearchEntry, ScrolledWindow
|
||||
- Native GTK widgets: HeaderBar, SearchEntry, ScrolledWindow, Stack
|
||||
- Smooth view transitions using Gtk.Stack with crossfade animation
|
||||
- Proper GNOME HIG compliance for spacing, margins, and layout
|
||||
- Button styling with suggested-action and destructive-action classes
|
||||
- Thread-safe system tray integration using GLib.idle_add
|
||||
|
||||
### Future Extensibility
|
||||
- Replace `load_customers()` with real data source (database, config files, API)
|
||||
- Implement actual VPN connection logic in placeholder methods
|
||||
- Add persistence through `save_customers()` implementation
|
||||
- Extend widget system for additional UI components
|
||||
- Add configuration management for VPN client integration
|
||||
- Add real-time VPN status monitoring and automatic reconnection
|
||||
- Extend YAML schema for additional VPN configuration options
|
||||
- Add import/export functionality for customer configurations
|
||||
- Implement configuration validation and error reporting
|
||||
- Add support for additional VPN clients and protocols
|
||||
- Extend widget system for additional UI components (settings, logs, etc.)
|
||||
|
||||
### YAML Configuration Schema
|
||||
Customer files in `~/.vpntray/customers/` follow this structure:
|
||||
```yaml
|
||||
name: Customer Name
|
||||
services:
|
||||
- name: Service Name
|
||||
url: https://service.url
|
||||
service_type: Service Category
|
||||
description: Optional description
|
||||
locations:
|
||||
- name: Location Name
|
||||
vpn_type: OpenVPN|WireGuard|IPSec
|
||||
vpn_config: /path/to/config/file
|
||||
active: true|false
|
||||
connected: true|false
|
||||
hosts:
|
||||
- name: Host Name
|
||||
ip_address: IP Address
|
||||
host_type: Linux|Windows|etc
|
||||
description: Optional description
|
||||
services:
|
||||
- name: Service Name
|
||||
service_type: SSH|Web GUI|RDP|etc
|
||||
port: Port Number
|
||||
sub_hosts: # Optional VMs/containers
|
||||
- # Same structure as hosts
|
||||
```
|
||||
Reference in New Issue
Block a user