3120 persist admin value

This commit is contained in:
Craig Lawson committed 2026-01-10 21:29:15 +00:00
1 parent fb3795bd70
commit ab4cc80628
5 files changed
+17 -12

No files matched your search

+5 -5
View File
@@ -80,11 +80,6 @@ const Settings = () => {
const handleChange = async (e) => {
const { name, value, checked } = e.target;
// Special case for showURL until handled properly in the backend
if (name === "showURL") {
dispatch(setShowURL(value));
return;
}
let newValue;
if (
name === "systemEmailIgnoreTLS" ||
@@ -167,6 +162,11 @@ const Settings = () => {
}
setSettingsData(newSettingsData);
// Update Redux immediately for UI feedback
if (name === "showURL") {
dispatch(setShowURL(newValue ?? value));
}
};
const handleSave = () => {
@@ -57,6 +57,10 @@ class SettingsController {
};
updateAppSettings = async (req: Request, res: Response, next: NextFunction) => {
// Diagnostics: capture inbound payload
// eslint-disable-next-line no-console
console.log("=== SETTINGS CONTROLLER REQUEST BODY ===", req.body);
await updateAppSettingsBodyValidation.validateAsync(req.body);
const updatedSettings = await this.db.settingsModule.updateAppSettings(req.body);
+6 -6
View File
@@ -217,7 +217,7 @@ class StatusPageModule {
showUptimePercentage: 1,
timezone: 1,
showAdminLoginLink: 1,
url: { $cond: [{ $eq: ["$statusPage.showMonitorUrl", true] }, "$monitors.url", "$$REMOVE"] },
url: 1,
},
monitors: {
_id: 1,
@@ -261,12 +261,12 @@ class StatusPageModule {
const { statusPage, monitors } = statusPageQuery[0];
const appSettings = await this.AppSettings.findOne({ singleton: true }).lean();
const showURL = appSettings?.showURL === true;
const showURL = appSettings?.showURL === true || appSettings?.showURL === "true";
const normalizedMonitors = monitors.map((monitor) => {
const normalizedChecks = this.NormalizeData(monitor.checks, 10, 100);
if (showURL !== true) {
const { url, ...rest } = monitor;
const normalizedMonitors = monitors.map((monitor) => {
const normalizedChecks = this.NormalizeData(monitor.checks, 10, 100);
if (showURL !== true) {
const { url, port, secret, notifications, ...rest } = monitor;
return { ...rest, checks: normalizedChecks };
}
return { ...monitor, checks: normalizedChecks };
@@ -60,6 +60,7 @@ class SettingsService {
await this.AppSettings.create({});
settings = await this.AppSettings.findOne({ singleton: true }).select("-__v -_id -createdAt -updatedAt -singleton").lean();
}
return settings;
}
}
+1 -1
View File
@@ -413,7 +413,7 @@ const updateAppSettingsBodyValidation = joi.object({
pagespeedApiKey: joi.string().allow(""),
language: joi.string().allow(""),
timezone: joi.string().allow(""),
// showURL: joi.bool().required(),
showURL: joi.bool().optional(),
systemEmailHost: joi.string().allow(""),
systemEmailPort: joi.number().allow(""),
systemEmailAddress: joi.string().allow(""),