From d38df2b9cf08a46c7a24851498c009c3b9feb9e6 Mon Sep 17 00:00:00 2001 From: Varun Patil Date: Thu, 9 May 2024 19:51:03 -0700 Subject: [PATCH] status: add timestamp --- framework/ndn-testbed-status/src/App.vue | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/framework/ndn-testbed-status/src/App.vue b/framework/ndn-testbed-status/src/App.vue index 396cf91..528db7c 100644 --- a/framework/ndn-testbed-status/src/App.vue +++ b/framework/ndn-testbed-status/src/App.vue @@ -8,6 +8,8 @@ HTTPS Revision + Status + NFD Version NLSR Version @@ -37,6 +39,8 @@ {{ router.status?.revision }} + {{ getFromNow(router.status?.timestamp) }} + {{ router.status?.nfd?.version }} {{ router.status?.nlsr?.version }} @@ -172,6 +176,13 @@ export default defineComponent({ getRevUrl(router: IRouter) { return `${TESTBED_REPO}/commit/${router.status!.revision}`; }, + + getFromNow(timestamp: number | undefined) { + if (!timestamp) return String(); + + const diff = Math.round(Date.now() / 1000 - timestamp); + return `${diff}s`; + }, }, });