From a54b582e0dfd90e291dd88219d9a0a6cb6ee0569 Mon Sep 17 00:00:00 2001 From: mike12345567 Date: Fri, 21 May 2021 14:38:58 +0100 Subject: [PATCH] Updating UI to use the updated at. --- packages/auth/src/redis/index.js | 6 +----- packages/builder/src/components/start/AppCard.svelte | 9 ++++++++- packages/server/src/api/controllers/application.js | 2 ++ packages/server/src/utilities/redis.js | 2 +- 4 files changed, 12 insertions(+), 7 deletions(-) diff --git a/packages/auth/src/redis/index.js b/packages/auth/src/redis/index.js index 24ff11d152..78e3ea7acd 100644 --- a/packages/auth/src/redis/index.js +++ b/packages/auth/src/redis/index.js @@ -17,13 +17,9 @@ let CLIENT = env.isTest() ? new Redis(getRedisOptions()) : null function init() { return new Promise((resolve, reject) => { // testing uses a single in memory client - if (env.isTest()) { + if (env.isTest() || (CLIENT && CONNECTED)) { return resolve(CLIENT) } - // if a connection existed, close it and re-create it - if (CLIENT && CONNECTED) { - return CLIENT - } const { opts, host, port } = getRedisOptions(CLUSTERED) if (CLUSTERED) { CLIENT = new Redis.Cluster([{ host, port }], opts) diff --git a/packages/builder/src/components/start/AppCard.svelte b/packages/builder/src/components/start/AppCard.svelte index b7e593b7e2..3f38d83dac 100644 --- a/packages/builder/src/components/start/AppCard.svelte +++ b/packages/builder/src/components/start/AppCard.svelte @@ -11,6 +11,7 @@ import { gradient } from "actions" import { auth } from "stores/portal" import { AppStatus } from "constants" + import { processStringSync } from "@budibase/string-templates" export let app export let exportApp @@ -62,7 +63,13 @@
- Updated {Math.floor(1 + Math.random() * 10)} months ago + {#if app.updatedAt} + {processStringSync("Updated {{ duration time 'millisecond' }} ago", { + time: (new Date().getTime() - new Date(app.updatedAt).getTime()) + })} + {:else} + Never updated + {/if} {#if app.deployed}Published{:else}Unpublished{/if} diff --git a/packages/server/src/api/controllers/application.js b/packages/server/src/api/controllers/application.js index 69b4d8ea54..2511686bed 100644 --- a/packages/server/src/api/controllers/application.js +++ b/packages/server/src/api/controllers/application.js @@ -190,6 +190,8 @@ exports.create = async function (ctx) { url: url, template: ctx.request.body.template, instance: instance, + updatedAt: new Date().toISOString(), + createdAt: new Date().toISOString(), deployment: { type: "cloud", }, diff --git a/packages/server/src/utilities/redis.js b/packages/server/src/utilities/redis.js index 18f967e053..8e0f774f42 100644 --- a/packages/server/src/utilities/redis.js +++ b/packages/server/src/utilities/redis.js @@ -8,7 +8,7 @@ let devAppClient, debounceClient // reduces the performance hit exports.init = async () => { devAppClient = await new Client(utils.Databases.DEV_LOCKS).init() - debounceClient = await new Client(utils.Databases).init() + debounceClient = await new Client(utils.Databases.DEBOUNCE).init() } exports.doesUserHaveLock = async (devAppId, user) => {