Add print badges, pagination, route splitting, JWT auth fixes, and list page alignment
- Fix equipment badge barcode not rendering (loading race condition) - Fix printer QR code not rendering on initial load (same race condition) - Add model image to equipment badge via imageurl from Model table - Fix white-on-white machine number text on badge, tighten barcode spacing - Add PaginationBar component used across all list pages - Split monolithic router into per-plugin route modules - Fix 25 GET API endpoints returning 401 (jwt_required -> optional=True) - Align list page columns across Equipment, PCs, and Network pages - Add print views: EquipmentBadge, PrinterQRSingle, PrinterQRBatch, USBLabelBatch - Add PC Relationships report, migration docs, and CLAUDE.md project guide - Various plugin model, API, and frontend refinements Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
108
CLAUDE.md
Normal file
108
CLAUDE.md
Normal file
@@ -0,0 +1,108 @@
|
||||
# ShopDB Flask Project
|
||||
|
||||
## Database Configuration
|
||||
|
||||
- **Development database:** `shopdb_flask` (new schema with asset abstraction)
|
||||
- **Legacy database:** `shopdb` (Classic ASP schema - used for data migration reference only)
|
||||
- **Connection:** Configured in `.env` file
|
||||
|
||||
## Current Tasks
|
||||
|
||||
### Data Migration from Legacy Database
|
||||
|
||||
Migrate data from `shopdb` to `shopdb_flask` using the new asset-based schema.
|
||||
|
||||
**Status:** Pending
|
||||
|
||||
**Migration guide:** `migrations/DATA_MIGRATION_GUIDE.md`
|
||||
|
||||
**Tables to migrate:**
|
||||
- [ ] Reference data (vendors, models, locations, business units, subnets)
|
||||
- [ ] Equipment (machines with category='Equipment')
|
||||
- [ ] Computers/PCs (machines with pctypeid IS NOT NULL)
|
||||
- [ ] Network devices (machines with category='Network')
|
||||
- [ ] Printers (separate printers table)
|
||||
- [ ] Communications/IP addresses
|
||||
- [ ] Notifications
|
||||
- [ ] Machine relationships
|
||||
|
||||
### Plugin Architecture Verification
|
||||
|
||||
Verify all plugins follow plug-and-play architecture - can be added/removed without impacting core site or other plugins.
|
||||
|
||||
**Plugins to verify:**
|
||||
- [ ] Equipment (`plugins/equipment/`) - frontend: `views/machines/`
|
||||
- [ ] Computers (`plugins/computers/`) - frontend: `views/pcs/`
|
||||
- [ ] Printers (`plugins/printers/`) - frontend: `views/printers/`
|
||||
- [ ] Network (`plugins/network/`) - frontend: `views/network/`
|
||||
- [ ] USB (`plugins/usb/`) - frontend: `views/usb/`
|
||||
- [ ] Notifications (`plugins/notifications/`) - frontend: `views/notifications/`
|
||||
|
||||
**Architecture checks:**
|
||||
- [ ] Core API uses try/except ImportError for plugin imports (see `shopdb/core/api/assets.py` for pattern)
|
||||
- [ ] Frontend router can dynamically add/remove routes per plugin
|
||||
- [ ] Navigation menu reads from plugin `get_navigation_items()`
|
||||
- [ ] Document plugin enable/disable mechanism in app factory
|
||||
|
||||
**Each plugin must have:**
|
||||
- `models/__init__.py` - exports all models
|
||||
- `api/routes.py` - Flask Blueprint with endpoints
|
||||
- `plugin.py` - implements BasePlugin class
|
||||
- `manifest.json` - plugin metadata (name, version, dependencies)
|
||||
- No direct imports from core code (use optional imports)
|
||||
- Modular frontend components
|
||||
|
||||
## Plugin Structure
|
||||
|
||||
```
|
||||
plugins/
|
||||
{plugin_name}/
|
||||
__init__.py
|
||||
plugin.py # BasePlugin implementation
|
||||
manifest.json # Plugin metadata
|
||||
models/
|
||||
__init__.py # Export all models
|
||||
{model}.py # SQLAlchemy models
|
||||
api/
|
||||
__init__.py
|
||||
routes.py # Flask Blueprint
|
||||
```
|
||||
|
||||
## Key Files
|
||||
|
||||
- `shopdb/plugins/base.py` - BasePlugin class and PluginMeta
|
||||
- `shopdb/core/api/assets.py` - Example of optional plugin imports with try/except
|
||||
- `frontend/src/router/index.js` - Frontend routing
|
||||
- `frontend/src/components/AppSidebar.vue` - Navigation menu
|
||||
|
||||
## Migration Notes
|
||||
|
||||
See `migrations/` folder for:
|
||||
- `DATA_MIGRATION_GUIDE.md` - Complete guide for migrating from legacy shopdb to new schema
|
||||
- `MIGRATE_USB_DEVICES_FROM_EQUIPMENT.md` - USB device migration from equipment table
|
||||
- `FIX_LOCATIONONLY_EQUIPMENT_TYPES.md` - Fix for LocationOnly equipment types
|
||||
- `PRODUCTION_MIGRATION_GUIDE.md` - Production data import methods
|
||||
|
||||
## Quick Start
|
||||
|
||||
```bash
|
||||
# Start dev environment
|
||||
~/start-dev-env.sh
|
||||
|
||||
# Create/update database tables
|
||||
cd /home/camp/projects/shopdb-flask
|
||||
source venv/bin/activate
|
||||
flask db-utils create-all
|
||||
|
||||
# Seed reference data
|
||||
flask seed reference-data
|
||||
|
||||
# Restart services after changes
|
||||
pm2 restart shopdb-flask-api shopdb-flask-ui
|
||||
```
|
||||
|
||||
## Service URLs
|
||||
|
||||
- **Flask API:** http://localhost:5001
|
||||
- **Flask UI:** http://localhost:5173
|
||||
- **Legacy ASP:** http://192.168.122.151:8080
|
||||
Reference in New Issue
Block a user