From 23028fe6961ff07fc35a41354569ada96f4425ab Mon Sep 17 00:00:00 2001
From: sassanix <39465071+sassanix@users.noreply.github.com>
Date: Thu, 13 Nov 2025 09:22:59 -0400
Subject: [PATCH] Removed vite
Removed vite, and consolidated files to frontend folder
---
CHANGELOG.md | 146 +-
Dockerfile | 15 +-
frontend/{src => }/about.html | 39 +-
frontend/{src => }/auth-redirect.html | 22 +-
frontend/{public => }/auth-redirect.js | 0
frontend/{public => }/chart.js | 0
frontend/{src => }/debug-export.html | 12 +-
frontend/{src => }/favicon.ico | Bin
frontend/{public => }/file-utils.js | 0
frontend/{public => }/footer-content.js | 0
frontend/{public => }/footer-fix.js | 0
frontend/{src => }/header-fix.css | 0
frontend/{src => }/img/favicon-16x16.png | Bin
frontend/{src => }/img/favicon-32x32.png | Bin
frontend/{src => }/img/favicon-512x512.png | Bin
frontend/{src => }/index.html | 59 +-
frontend/js/components/addWarrantyForm.js | 83 +
frontend/{src => }/js/components/claims.js | 0
frontend/{src => }/js/components/editModal.js | 207 ++
frontend/{src => }/js/components/modals.js | 0
frontend/{src => }/js/components/notes.js | 0
frontend/{src => }/js/components/paperless.js | 0
frontend/{src => }/js/components/tag.js | 0
frontend/js/components/tagManager.js | 95 +
frontend/{src => }/js/components/ui.js | 0
.../{src => }/js/components/warrantyCard.js | 0
.../js/controllers/warrantyListController.js | 622 ++++++
frontend/{public => }/js/i18n.js | 0
frontend/js/index.js | 25 +
frontend/{public => }/js/lib/i18next.min.js | 0
.../lib/i18nextBrowserLanguageDetector.min.js | 0
.../js/lib/i18nextHttpBackend.min.js | 0
frontend/{src => }/js/services/apiService.js | 76 +-
frontend/{src => }/js/services/authService.js | 0
frontend/js/services/i18nAdapter.js | 20 +
frontend/{src => }/js/store.js | 0
frontend/{src => }/login.html | 30 +-
frontend/{src => }/manifest.json | 0
frontend/{src => }/mobile-header.css | 0
frontend/{public => }/mobile-menu.js | 0
frontend/package-lock.json | 1061 ----------
frontend/package.json | 19 -
frontend/{src => }/register.html | 39 +-
.../{src => }/reset-password-request.html | 37 +-
frontend/{src => }/reset-password.html | 37 +-
frontend/{public => }/script.js | 1813 +++++------------
frontend/{src => }/settings-new.html | 85 +-
frontend/{public => }/settings-new.js | 0
frontend/{public => }/settings-styles.css | 0
frontend/{src => }/status.html | 49 +-
frontend/{src => }/status.js | 57 +-
frontend/{src => }/style.css | 14 +-
frontend/{public => }/sw.js | 0
frontend/{public => }/theme-loader.js | 0
frontend/{public => }/version-checker.js | 0
frontend/vite.config.js | 35 -
56 files changed, 1954 insertions(+), 2743 deletions(-)
rename frontend/{src => }/about.html (94%)
rename frontend/{src => }/auth-redirect.html (92%)
rename frontend/{public => }/auth-redirect.js (100%)
rename frontend/{public => }/chart.js (100%)
rename frontend/{src => }/debug-export.html (96%)
rename frontend/{src => }/favicon.ico (100%)
rename frontend/{public => }/file-utils.js (100%)
rename frontend/{public => }/footer-content.js (100%)
rename frontend/{public => }/footer-fix.js (100%)
rename frontend/{src => }/header-fix.css (100%)
rename frontend/{src => }/img/favicon-16x16.png (100%)
rename frontend/{src => }/img/favicon-32x32.png (100%)
rename frontend/{src => }/img/favicon-512x512.png (100%)
rename frontend/{src => }/index.html (98%)
create mode 100644 frontend/js/components/addWarrantyForm.js
rename frontend/{src => }/js/components/claims.js (100%)
rename frontend/{src => }/js/components/editModal.js (52%)
rename frontend/{src => }/js/components/modals.js (100%)
rename frontend/{src => }/js/components/notes.js (100%)
rename frontend/{src => }/js/components/paperless.js (100%)
rename frontend/{src => }/js/components/tag.js (100%)
create mode 100644 frontend/js/components/tagManager.js
rename frontend/{src => }/js/components/ui.js (100%)
rename frontend/{src => }/js/components/warrantyCard.js (100%)
create mode 100644 frontend/js/controllers/warrantyListController.js
rename frontend/{public => }/js/i18n.js (100%)
create mode 100644 frontend/js/index.js
rename frontend/{public => }/js/lib/i18next.min.js (100%)
rename frontend/{public => }/js/lib/i18nextBrowserLanguageDetector.min.js (100%)
rename frontend/{public => }/js/lib/i18nextHttpBackend.min.js (100%)
rename frontend/{src => }/js/services/apiService.js (58%)
rename frontend/{src => }/js/services/authService.js (100%)
create mode 100644 frontend/js/services/i18nAdapter.js
rename frontend/{src => }/js/store.js (100%)
rename frontend/{src => }/login.html (94%)
rename frontend/{src => }/manifest.json (100%)
rename frontend/{src => }/mobile-header.css (100%)
rename frontend/{public => }/mobile-menu.js (100%)
delete mode 100644 frontend/package-lock.json
delete mode 100644 frontend/package.json
rename frontend/{src => }/register.html (94%)
rename frontend/{src => }/reset-password-request.html (89%)
rename frontend/{src => }/reset-password.html (93%)
rename frontend/{public => }/script.js (84%)
rename frontend/{src => }/settings-new.html (94%)
rename frontend/{public => }/settings-new.js (100%)
rename frontend/{public => }/settings-styles.css (100%)
rename frontend/{src => }/status.html (96%)
rename frontend/{src => }/status.js (97%)
rename frontend/{src => }/style.css (99%)
rename frontend/{public => }/sw.js (100%)
rename frontend/{public => }/theme-loader.js (100%)
rename frontend/{public => }/version-checker.js (100%)
delete mode 100644 frontend/vite.config.js
diff --git a/CHANGELOG.md b/CHANGELOG.md
index ce508f1..08440fa 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -2,55 +2,65 @@
## 1.0.3 - 2025-11-07
### Added
-- **Vite build tool (multi-page app) for the frontend**
- - Initialized npm in `frontend/` with `dev`, `build`, and `preview` scripts.
- - Introduced `vite.config.js` with `root: 'src'`, `outDir: '../dist'`, `publicDir: 'public'`, a development `/api` proxy, and explicit multi-page HTML inputs.
- - Restructured frontend: moved sources to `frontend/src/` and static/non-module assets to `frontend/public/`.
- - _Files: `frontend/package.json`, `frontend/vite.config.js`, `frontend/src/**/*`, `frontend/public/**/*`_
+- **Modular Entry Orchestrator and Feature Modules**
+ - Added a lean ES module entry orchestrator `index.js` that initializes auth and feature modules after `authStateReady`.
+ - Created feature-specific modules to prepare deconstruction of the monolith while preserving identical behavior:
+ - `warrantyListController.js` (list loading/filtering/rendering controller surface)
+ - `tagManager.js` (tag management: load/render/create/update/delete)
+ - `addWarrantyForm.js` (multi-step add warranty wizard surface)
+ - Wired pages to load the new module entry with `` alongside legacy `script.js` for zero-regression rollout.
+ - _Files: `frontend/js/index.js`, `frontend/js/controllers/warrantyListController.js`, `frontend/js/components/tagManager.js`, `frontend/js/components/addWarrantyForm.js`, `frontend/index.html`, `frontend/about.html`, `frontend/status.html`, `frontend/register.html`, `frontend/reset-password.html`, `frontend/reset-password-request.html`_
- **Centralized Authentication Service**
- New module `authService.js` exposes `initAuth`, `login`, `logout`, `getToken`, `getCurrentUser`, `isAuthenticated`.
- Backwards compatibility: attaches a `window.auth` facade so existing code continues to work.
- Handles header UI state, user menu/settings dropdown toggling, and dispatches a unified `authStateReady` event.
- Robustly hides “Create Account” UI when registration is disabled (with a MutationObserver to keep it hidden after other scripts mutate the DOM).
- - _Files: `frontend/src/js/services/authService.js`, `frontend/src/*.html` (module includes)_
+ - _Files: `frontend/js/services/authService.js`, `frontend/*.html` (module includes)_
- **Dedicated API Service**
- New `apiService.js` provides a `baseRequest` wrapper that injects the `Authorization` header and normalizes error handling.
- Exposes named helpers (e.g., `getWarranties`, `updateWarranty`, `deleteWarranty`, `getStatistics`, `savePreferences`) and a `window.api` shim for non-module scripts.
- Safe global `fetch` shim adds the Authorization header for `/api/...` calls when missing.
- - _Files: `frontend/src/js/services/apiService.js`, `frontend/src/*.html` (module includes)_
+ - _Files: `frontend/js/services/apiService.js`, `frontend/*.html` (module includes)_
- **Central State Management Store**
- Introduced a `store.js` module to act as a single source of truth for application data (warranties, filters, loading states), eliminating scattered global variables.
- UI updates are now driven by custom events, creating a predictable data flow.
- - _Files: `frontend/src/js/store.js`_
+ - _Files: `frontend/js/store.js`_
- **Component-Based UI Modules**
- Created a suite of new, reusable UI component modules to replace HTML string concatenation. Each is responsible for building a specific part of the UI via safe DOM manipulation.
- Modules include: `warrantyCard.js`, `tag.js`, `modals.js`, `editModal.js`, `claims.js`, `notes.js`, `paperless.js`, and `ui.js`.
- - _Files: `frontend/src/js/components/*`_
+ - _Files: `frontend/js/components/*`_
- **HTML `` for Warranty Cards**
- Added a `` to `index.html` to define the warranty card structure, separating markup from rendering logic for improved performance and maintainability.
- - _Files: `frontend/src/index.html`_
+ - _Files: `frontend/index.html`_
### Enhanced
-- **Dockerfile: multi-stage frontend build + runtime serving**
- - Added `frontend-build` stage using `node:20-alpine` to run `npm ci && npm run build`.
- - Final stage copies `frontend/dist/` to `/var/www/html` and includes `frontend/public/` assets in the build.
- - Unpinned Node digest to resolve `not found` errors on some hosts.
+- **Dockerfile: simplified static file serving**
+ - Removed build stage; frontend files are now copied directly to `/var/www/html/` for static serving.
+ - No build step required; all frontend assets are served as-is.
- _Files: `Dockerfile`_
- **HTML and asset loading**
- - Switched all page `` tag. The module imports `authService` and `apiService` rather than relying on global functions.
+ - Removed inline `onclick` handlers from the Settings HTML (notably the Delete User modal) and rewired UI interactions using `addEventListener` inside the module so handlers are module-scoped instead of being attached to `window`.
+ - Extended `frontend/js/services/apiService.js` with settings/admin endpoints consumed by the module (for example: `getUser`, `getUsers`, `updateUser`, `deleteUser`, `getSiteSettings`, `saveSiteSettings`, `getAuditTrail`, `triggerNotifications`) and preserved the `window.api` shim for backward compatibility.
+ - Fixed a porting-induced syntax/parsing issue (unbalanced brace) and removed a leftover global (`window.currentDeleteUserId`) in favor of a module-scoped `currentDeleteUserId` to avoid leaking state.
+ - The refactored module parses without syntax errors. Runtime smoke tests are planned/encouraged (see next steps) and final decommission of the legacy `script.js` will follow once runtime verification is complete.
+ - _Files: `frontend/settings-new.html`, `frontend/settings-new.js`, `frontend/js/services/apiService.js`_
## 1.0.2 - 2025-10-30
diff --git a/Dockerfile b/Dockerfile
index ef8fa08..17df14a 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -54,17 +54,6 @@ COPY backend/requirements.txt /tmp/requirements.txt
RUN pip install --no-cache-dir -r /tmp/requirements.txt
-FROM node:20-alpine AS frontend-build
-
-WORKDIR /app/frontend
-COPY frontend/package.json frontend/package-lock.json ./
-COPY frontend/vite.config.js ./
-COPY frontend/public ./public
-COPY frontend/src ./src
-
-RUN npm ci --no-audit --no-fund && npm run build
-
-
FROM python:3.13-slim-trixie@sha256:079601253d5d25ae095110937ea8cfd7403917b53b077870bccd8b026dc7c42f AS runtime
ARG NGINX_VERSION
@@ -123,8 +112,8 @@ COPY --chown=warracker:warracker backend/migrations/ ./migrations/
COPY --chown=warracker:warracker locales/ ./locales/
COPY --chown=warracker:warracker locales/ /var/www/html/locales/
-# 4. Frontend (built with Vite)
-COPY --chown=warracker:warracker --from=frontend-build /app/frontend/dist/ /var/www/html/
+# 4. Frontend (static files, no build step)
+COPY --chown=warracker:warracker frontend/ /var/www/html/
# 5. Backend (bundled in one instruction)
COPY --chown=warracker:warracker backend/ ./backend/
diff --git a/frontend/src/about.html b/frontend/about.html
similarity index 94%
rename from frontend/src/about.html
rename to frontend/about.html
index 8e0c738..bc4e990 100644
--- a/frontend/src/about.html
+++ b/frontend/about.html
@@ -7,32 +7,33 @@
About - Warracker
-
-
-
-
-
+
+
+
+
+
-
+
-
+
-
+
-
-
-
+
+
+
-
+
+
-
-
-
+
+
+
-
+