Updating UI to use the updated at.

This commit is contained in:
mike12345567 2021-05-21 14:38:58 +01:00
parent 3b81989250
commit 4653471412
4 changed files with 12 additions and 7 deletions

View File

@ -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)

View File

@ -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 @@
</div>
<div class="status">
<Body size="S">
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}
</Body>
<StatusLight active={app.deployed} neutral={!app.deployed}>
{#if app.deployed}Published{:else}Unpublished{/if}

View File

@ -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",
},

View File

@ -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) => {