Files
training-software/frontend/public/app.js
Paperclip CTO 295ac1c31f feat(TRA-335): license limits, per-customer branding, frontend, Gitea CI, and deployment README
- Added OrganizationProfile model with license_user_limit choices (20/50/100/1000), company_name, brand_logo_url
- Added migration 0003_organization_profile
- Admin-only REST endpoint GET/PATCH /api/v1/accounts/organizations/{org_id}/profile/
- OrganizationProfileSerializer, OrganizationProfileAdmin, factory, and integration tests
- Static Nginx-hostable frontend under frontend/public with configurable API_BASE_URL via config.js
- frontend/nginx.conf reference server config
- .gitea/workflows/ci.yml: ruff lint, pytest with Postgres/Redis services, docker build
- README.md: English deployment guide covering env vars, Docker Compose, migration, org profile API, frontend deploy

Co-Authored-By: Paperclip <noreply@paperclip.ing>
2026-05-08 07:52:08 +02:00

39 lines
1.2 KiB
JavaScript

(function () {
const config = window.APP_CONFIG || {};
const apiBaseUrl = (config.API_BASE_URL || "").replace(/\/$/, "");
const statusEl = document.getElementById("status");
const resultEl = document.getElementById("result");
const checkButton = document.getElementById("healthcheck");
const companyNameEl = document.getElementById("company-name");
const companyLogoEl = document.getElementById("company-logo");
const params = new URLSearchParams(window.location.search);
const companyName = params.get("company") || "Training Portal";
const logoUrl = params.get("logo") || "";
companyNameEl.textContent = companyName;
if (logoUrl) {
companyLogoEl.src = logoUrl;
companyLogoEl.hidden = false;
}
if (!apiBaseUrl) {
statusEl.textContent = "Missing API_BASE_URL in config.js";
return;
}
statusEl.textContent = "Configured API: " + apiBaseUrl;
checkButton.addEventListener("click", async function () {
resultEl.textContent = "Checking…";
try {
const response = await fetch(apiBaseUrl + "/healthz/");
const text = await response.text();
resultEl.textContent = "HTTP " + response.status + "\n" + text;
} catch (error) {
resultEl.textContent = String(error);
}
});
})();