Added expiry changes to status page and fixes
This commit is contained in:
parent
4ea5771f97
commit
b1f266ceb1
|
@ -201,7 +201,7 @@ class Monitor extends BeanModel {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return {
|
return {
|
||||||
certExpiryDaysRemaining: "No/Bad Cert",
|
certExpiryDaysRemaining: "",
|
||||||
validCert: false
|
validCert: false
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -90,7 +90,6 @@ class StatusPage extends BeanModel {
|
||||||
* @param {StatusPage} statusPage
|
* @param {StatusPage} statusPage
|
||||||
*/
|
*/
|
||||||
static async getStatusPageData(statusPage) {
|
static async getStatusPageData(statusPage) {
|
||||||
|
|
||||||
const config = await statusPage.toPublicJSON();
|
const config = await statusPage.toPublicJSON();
|
||||||
|
|
||||||
// Incident
|
// Incident
|
||||||
|
|
|
@ -60,7 +60,7 @@
|
||||||
@click="$refs.monitorSettingDialog.show(group, monitor)"
|
@click="$refs.monitorSettingDialog.show(group, monitor)"
|
||||||
/>
|
/>
|
||||||
</span>
|
</span>
|
||||||
<p v-if="showCertificateExpiry" class="item-name"> Expiry: {{ formatExpiry(monitor) }} </p>
|
<span class="badge rounded-pill" :class=" 'bg-' + certExpiryColor(monitor)"> {{ $t("Expiry") }}: {{ formattedCertExpiryMessage(monitor) }} </span>
|
||||||
</div>
|
</div>
|
||||||
<div v-if="showTags" class="tags">
|
<div v-if="showTags" class="tags">
|
||||||
<Tag v-for="tag in monitor.element.tags" :key="tag" :item="tag" :size="'sm'" />
|
<Tag v-for="tag in monitor.element.tags" :key="tag" :item="tag" :size="'sm'" />
|
||||||
|
@ -165,13 +165,27 @@ export default {
|
||||||
* @param {Object} monitor Monitor to show expiry for
|
* @param {Object} monitor Monitor to show expiry for
|
||||||
* @returns {string}
|
* @returns {string}
|
||||||
*/
|
*/
|
||||||
formatExpiry(monitor) {
|
formattedCertExpiryMessage(monitor) {
|
||||||
if (monitor?.element?.validCert) {
|
if (monitor?.element?.validCert && monitor?.element?.certExpiryDaysRemaining) {
|
||||||
return monitor.element.certExpiryDaysRemaining + " days";
|
return monitor.element.certExpiryDaysRemaining + " " + this.$tc("day", monitor.element.certExpiryDaysRemaining);
|
||||||
|
} else if (monitor?.element?.validCert === false) {
|
||||||
|
return this.$t("noOrBadCertificate");
|
||||||
} else {
|
} else {
|
||||||
return monitor.element.certExpiryDaysRemaining;
|
return "";
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns certificate expiry based on days remaining
|
||||||
|
* @param {Object} monitor Monitor to show expiry for
|
||||||
|
* @returns {string}
|
||||||
|
*/
|
||||||
|
certExpiryColor(monitor) {
|
||||||
|
if (monitor?.element?.validCert) {
|
||||||
|
return monitor.element.certExpiryDaysRemaining > 7 ? "primary" : "danger";
|
||||||
|
}
|
||||||
|
return "danger";
|
||||||
|
},
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -755,5 +755,7 @@
|
||||||
"Group": "Group",
|
"Group": "Group",
|
||||||
"Monitor Group": "Monitor Group",
|
"Monitor Group": "Monitor Group",
|
||||||
"noGroupMonitorMsg": "Not Available. Create a Group Monitor First.",
|
"noGroupMonitorMsg": "Not Available. Create a Group Monitor First.",
|
||||||
"Close": "Close"
|
"Close": "Close",
|
||||||
|
"showCertificateExpiry": "Show Certificate Expiry",
|
||||||
|
"noOrBadCertificate": "No/Bad Certificate"
|
||||||
}
|
}
|
||||||
|
|
|
@ -39,5 +39,6 @@
|
||||||
"Reconnecting...": "पुनः कनेक्ट किया जा रहा है...",
|
"Reconnecting...": "पुनः कनेक्ट किया जा रहा है...",
|
||||||
"Down": "बंद",
|
"Down": "बंद",
|
||||||
"Passive Monitor Type": "निष्क्रिय मॉनिटर प्रकार",
|
"Passive Monitor Type": "निष्क्रिय मॉनिटर प्रकार",
|
||||||
"Status": "स्थिति"
|
"Status": "स्थिति",
|
||||||
|
"showCertificateExpiry": "प्रमाणपत्र समाप्ति दिखाएँ"
|
||||||
}
|
}
|
||||||
|
|
|
@ -57,7 +57,7 @@
|
||||||
<!-- Show certificate expiry -->
|
<!-- Show certificate expiry -->
|
||||||
<div class="my-3 form-check form-switch">
|
<div class="my-3 form-check form-switch">
|
||||||
<input id="show-certificate-expiry" v-model="config.showCertificateExpiry" class="form-check-input" type="checkbox">
|
<input id="show-certificate-expiry" v-model="config.showCertificateExpiry" class="form-check-input" type="checkbox">
|
||||||
<label class="form-check-label" for="show-certificate-expiry">{{ $t("Show Certificate Expiry") }}</label>
|
<label class="form-check-label" for="show-certificate-expiry">{{ $t("showCertificateExpiry") }}</label>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div v-if="false" class="my-3">
|
<div v-if="false" class="my-3">
|
||||||
|
|
Loading…
Reference in New Issue