Refactor: Code cleanup and localStorage consolidation

This commit includes comprehensive codebase cleanup and refactoring:

## Code Cleanup
- Remove dead TypeScript code (types/monitoring.ts - 194 lines duplicate)
- Remove unused Go functions (GetClusterNodes, MigratePassword, GetClusterHealthInfo)
- Clean up commented-out code blocks across multiple files
- Remove unused TypeScript exports (helpTextClass, private tag color helpers)
- Delete obsolete test files and components

## localStorage Consolidation
- Centralize all storage keys into STORAGE_KEYS constant
- Update 5 files to use centralized keys:
  * utils/apiClient.ts (AUTH, LEGACY_TOKEN)
  * components/Dashboard/Dashboard.tsx (GUEST_METADATA)
  * components/Docker/DockerHosts.tsx (DOCKER_METADATA)
  * App.tsx (PLATFORMS_SEEN)
  * stores/updates.ts (UPDATES)
- Benefits: Single source of truth, prevents typos, better maintainability

## Previous Work Committed
- Docker monitoring improvements and disk metrics
- Security enhancements and setup fixes
- API refactoring and cleanup
- Documentation updates
- Build system improvements

## Testing
- All frontend tests pass (29 tests)
- All Go tests pass (15 packages)
- Production build successful
- Zero breaking changes

Total: 186 files changed, 5825 insertions(+), 11602 deletions(-)
This commit is contained in:
rcourtman 2025-11-04 21:50:46 +00:00
parent 5c4be1921c
commit 6eb1a10d9b
186 changed files with 5829 additions and 11606 deletions

View file

@ -1,20 +1,24 @@
# Pulse Makefile for development
.PHONY: build run dev frontend backend all clean dev-hot lint lint-backend lint-frontend format format-backend format-frontend
.PHONY: build run dev frontend backend all clean distclean dev-hot lint lint-backend lint-frontend format format-backend format-frontend
FRONTEND_DIR := frontend-modern
FRONTEND_DIST := $(FRONTEND_DIR)/dist
FRONTEND_EMBED_DIR := internal/api/frontend-modern
# Build everything
all: frontend backend
# Build frontend only
frontend:
cd frontend-modern && npm run build
npm --prefix $(FRONTEND_DIR) run build
@echo "================================================"
@echo "Copying frontend to internal/api/ for Go embed"
@echo "This is REQUIRED - Go cannot embed external paths"
@echo "================================================"
rm -rf internal/api/frontend-modern
mkdir -p internal/api/frontend-modern
cp -r frontend-modern/dist internal/api/frontend-modern/
rm -rf $(FRONTEND_EMBED_DIR)
mkdir -p $(FRONTEND_EMBED_DIR)
cp -r $(FRONTEND_DIST) $(FRONTEND_EMBED_DIR)/
@echo "✓ Frontend copied for embedding"
# Build backend only (includes embedded frontend)
@ -38,7 +42,10 @@ dev-hot:
# Clean build artifacts
clean:
rm -f pulse
rm -rf frontend-modern/dist
rm -rf $(FRONTEND_DIST) $(FRONTEND_EMBED_DIR)
distclean: clean
./scripts/cleanup.sh
# Quick rebuild and restart for development
restart: frontend backend
@ -51,7 +58,7 @@ lint-backend:
golangci-lint run ./...
lint-frontend:
cd frontend-modern && npm run lint
npm --prefix $(FRONTEND_DIR) run lint
# Apply formatters
format: format-backend format-frontend
@ -60,4 +67,4 @@ format-backend:
gofmt -w cmd internal pkg
format-frontend:
cd frontend-modern && npm run format
npm --prefix $(FRONTEND_DIR) run format