1
0
Fork 0
mirror of synced 2024-06-22 04:10:54 +12:00

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() { function init() {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
// testing uses a single in memory client // testing uses a single in memory client
if (env.isTest()) { if (env.isTest() || (CLIENT && CONNECTED)) {
return resolve(CLIENT) return resolve(CLIENT)
} }
// if a connection existed, close it and re-create it
if (CLIENT && CONNECTED) {
return CLIENT
}
const { opts, host, port } = getRedisOptions(CLUSTERED) const { opts, host, port } = getRedisOptions(CLUSTERED)
if (CLUSTERED) { if (CLUSTERED) {
CLIENT = new Redis.Cluster([{ host, port }], opts) CLIENT = new Redis.Cluster([{ host, port }], opts)

View file

@ -11,6 +11,7 @@
import { gradient } from "actions" import { gradient } from "actions"
import { auth } from "stores/portal" import { auth } from "stores/portal"
import { AppStatus } from "constants" import { AppStatus } from "constants"
import { processStringSync } from "@budibase/string-templates"
export let app export let app
export let exportApp export let exportApp
@ -62,7 +63,13 @@
</div> </div>
<div class="status"> <div class="status">
<Body size="S"> <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> </Body>
<StatusLight active={app.deployed} neutral={!app.deployed}> <StatusLight active={app.deployed} neutral={!app.deployed}>
{#if app.deployed}Published{:else}Unpublished{/if} {#if app.deployed}Published{:else}Unpublished{/if}

View file

@ -190,6 +190,8 @@ exports.create = async function (ctx) {
url: url, url: url,
template: ctx.request.body.template, template: ctx.request.body.template,
instance: instance, instance: instance,
updatedAt: new Date().toISOString(),
createdAt: new Date().toISOString(),
deployment: { deployment: {
type: "cloud", type: "cloud",
}, },

View file

@ -8,7 +8,7 @@ let devAppClient, debounceClient
// reduces the performance hit // reduces the performance hit
exports.init = async () => { exports.init = async () => {
devAppClient = await new Client(utils.Databases.DEV_LOCKS).init() 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) => { exports.doesUserHaveLock = async (devAppId, user) => {