1
0
Fork 0
mirror of synced 2024-10-02 10:08:09 +13:00

Merge pull request #10752 from Budibase/fix/overview-deployments-updating

Fix for deployment refresh in overview section
This commit is contained in:
deanhannigan 2023-05-31 15:47:16 +01:00 committed by GitHub
commit ae9b8e9f2f
2 changed files with 25 additions and 12 deletions

View file

@ -51,6 +51,26 @@
return groups.actions.getGroupAppIds(group).includes(prodAppId) return groups.actions.getGroupAppIds(group).includes(prodAppId)
}) })
const updateDeploymentString = () => {
return deployments?.length
? processStringSync(
"Last published {{ duration time 'millisecond' }} ago",
{
time:
new Date().getTime() -
new Date(deployments[0].updatedAt).getTime(),
}
)
: ""
}
// App is updating in the layout asynchronously
$: if ($store.appId?.length) {
fetchDeployments().then(resp => {
deployments = resp
})
}
$: deploymentString = updateDeploymentString(deployments)
async function fetchAppEditor(editorId) { async function fetchAppEditor(editorId) {
appEditor = await users.get(editorId) appEditor = await users.get(editorId)
} }
@ -107,19 +127,11 @@
</div> </div>
<div class="status-text"> <div class="status-text">
{#if deployments?.length} {#if isPublished}
{processStringSync( {deploymentString}
"Last published {{ duration time 'millisecond' }} ago", - <Link on:click={unpublishModal.show}>Unpublish</Link>
{
time:
new Date().getTime() -
new Date(deployments[0].updatedAt).getTime(),
}
)}
{#if isPublished}
- <Link on:click={unpublishModal.show}>Unpublish</Link>
{/if}
{/if} {/if}
{#if !deployments?.length} {#if !deployments?.length}
- -
{/if} {/if}

View file

@ -104,6 +104,7 @@ export async function fetchDeployments(ctx: any) {
} }
ctx.body = Object.values(deployments.history).reverse() ctx.body = Object.values(deployments.history).reverse()
} catch (err) { } catch (err) {
console.error(err)
ctx.body = [] ctx.body = []
} }
} }