Merge pull request #2506 from JefferMarcelino/feature/hide-admin-login-link

Add toggle to optionally display admin login link on status page and fix syntax errors
This commit is contained in:
Alexander Holliday
2025-06-23 13:25:43 +08:00
committed by GitHub
10 changed files with 23 additions and 2 deletions
@@ -90,6 +90,13 @@ const Content = ({
isChecked={form.showUptimePercentage}
onChange={handleFormChange}
/>
<Checkbox
id="showAdminLoginLink"
name="showAdminLoginLink"
label={t("showAdminLoginLink")}
isChecked={form.showAdminLoginLink}
onChange={handleFormChange}
/>
</Stack>
</ConfigStack>
</Stack>
+3 -1
View File
@@ -20,7 +20,7 @@ const TAB_LIST = ["General settings", "Contents"];
const ERROR_TAB_MAPPING = [
["companyName", "url", "timezone", "color", "isPublished", "logo"],
["monitors", "showUptimePercentage", "showCharts"],
["monitors", "showUptimePercentage", "showCharts", "showAdminLoginLink"],
];
const CreateStatusPage = () => {
@@ -39,6 +39,7 @@ const CreateStatusPage = () => {
monitors: [],
showCharts: true,
showUptimePercentage: true,
showAdminLoginLink: false,
});
const [errors, setErrors] = useState({});
const [selectedMonitors, setSelectedMonitors] = useState([]);
@@ -195,6 +196,7 @@ const CreateStatusPage = () => {
logo: newLogo,
showCharts: statusPage?.showCharts ?? true,
showUptimePercentage: statusPage?.showUptimePercentage ?? true,
showAdminLoginLink: statusPage?.showAdminLoginLink ?? false,
};
});
setSelectedMonitors(statusPageMonitors);
+1 -1
View File
@@ -48,7 +48,7 @@ const PublicStatus = () => {
let link = undefined;
const isPublic = location.pathname.startsWith("/status/uptime/public");
// Public status page
if (isPublic) {
if (isPublic && statusPage && statusPage.showAdminLoginLink === true) {
sx = {
paddingTop: theme.spacing(20),
paddingLeft: "20vw",
+3
View File
@@ -871,6 +871,9 @@ class NetworkService {
if (form.showUptimePercentage !== undefined) {
fd.append("showUptimePercentage", String(form.showUptimePercentage));
}
if (form.showAdminLoginLink !== undefined) {
fd.append("showAdminLoginLink", String(form.showAdminLoginLink));
}
form.monitors &&
form.monitors.forEach((monitorId) => {
fd.append("monitors[]", monitorId);
+1
View File
@@ -277,6 +277,7 @@ const statusPageValidation = joi.object({
logo: logoImageValidation,
showUptimePercentage: joi.boolean(),
showCharts: joi.boolean(),
showAdminLoginLink: joi.boolean(),
});
const settingsValidation = joi.object({
+1
View File
@@ -316,6 +316,7 @@
"statusPageCreateTabsContentFeaturesDescription": "Show more details on the status page",
"showCharts": "Show charts",
"showUptimePercentage": "Show uptime percentage",
"showAdminLoginLink": "Show \"Administrator? Login Here\" link on the status page",
"removeLogo": "Remove Logo",
"statusPageStatus": "A public status page is not set up.",
"statusPageStatusContactAdmin": "Please contact to your administrator",
+1
View File
@@ -312,6 +312,7 @@
"statusPageCreateTabsContentFeaturesDescription": "Mostrar mais detalhes na página de status",
"showCharts": "Mostrar gráficos",
"showUptimePercentage": "Mostrar porcentagem de Uptime",
"showAdminLoginLink": "Mostrar o link \"Administrador? Efetue login aqui\" na página de status",
"removeLogo": "Remover logo",
"statusPageStatus": "Uma página de status pública não está configurada.",
"statusPageStatusContactAdmin": "Entre em contato com seu administrador",
+4
View File
@@ -70,6 +70,10 @@ const StatusPageSchema = mongoose.Schema(
type: Boolean,
default: true,
},
showAdminLoginLink: {
type: Boolean,
default: false,
},
},
{ timestamps: true }
);
@@ -153,6 +153,7 @@ const getStatusPage = async (url) => {
showCharts: 1,
showUptimePercentage: 1,
timezone: 1,
showAdminLoginLink: 1,
url: 1,
},
monitors: {
+1
View File
@@ -463,6 +463,7 @@ const createStatusPageBodyValidation = joi.object({
isPublished: joi.boolean(),
showCharts: joi.boolean().optional(),
showUptimePercentage: joi.boolean(),
showAdminLoginLink: joi.boolean().optional(),
});
const imageValidation = joi