From bf3e9dccd2f07d69a56475bc70fd15328f8e8999 Mon Sep 17 00:00:00 2001 From: LouisLam Date: Mon, 26 Jul 2021 22:53:07 +0800 Subject: [PATCH] improve the ui of cert info --- src/components/Datetime.vue | 15 +++++++++++++-- src/pages/Details.vue | 27 ++++++++++++++++++++++++--- 2 files changed, 37 insertions(+), 5 deletions(-) diff --git a/src/components/Datetime.vue b/src/components/Datetime.vue index e84c877b..3e551659 100644 --- a/src/components/Datetime.vue +++ b/src/components/Datetime.vue @@ -14,12 +14,23 @@ dayjs.extend(relativeTime) export default { props: { value: String, + dateOnly: { + type: Boolean, + default: false, + }, }, computed: { displayText() { - let format = "YYYY-MM-DD HH:mm:ss"; - return dayjs.utc(this.value).tz(this.$root.timezone).format(format) + if (this.value !== undefined && this.value !== "") { + let format = "YYYY-MM-DD HH:mm:ss"; + if (this.dateOnly) { + format = "YYYY-MM-DD"; + } + return dayjs.utc(this.value).tz(this.$root.timezone).format(format); + } else { + return ""; + } }, } } diff --git a/src/pages/Details.vue b/src/pages/Details.vue index 6d93df39..cc447bf4 100644 --- a/src/pages/Details.vue +++ b/src/pages/Details.vue @@ -51,10 +51,18 @@

(30-day)

+ +
+

CertExp.

+

()

+ + {{certInfo.daysRemaining}} days + +
-
+

Certificate Info

@@ -66,7 +74,7 @@ Valid To: - {{ certInfo.validTo ? new Date(certInfo.validTo).toLocaleString() : "" }} + Days Remaining: @@ -154,6 +162,7 @@ export default { page: 1, perPage: 25, heartBeatList: [], + toggleCertInfoBox: false, } }, computed: { @@ -216,10 +225,14 @@ export default { if (this.$root.certInfoList[this.monitor.id]) { return this.$root.certInfoList[this.monitor.id] } else { - return { } + return null } }, + showCertInfoBox() { + return this.certInfo != null && this.toggleCertInfoBox; + }, + displayedRecords() { const startIndex = this.perPage * (this.page - 1); const endIndex = startIndex + this.perPage; @@ -308,4 +321,12 @@ table { font-size: 13px; color: #AAA; } + +.stats { + padding: 10px; + + .col { + margin: 20px 0; + } +}