Enrich the upgradable version property when fetching the app package

This commit is contained in:
Dean 2023-04-25 12:16:02 +01:00
parent 5b4b3b6fd1
commit f3be917da1
5 changed files with 11 additions and 13 deletions

View File

@ -134,6 +134,7 @@ export const getFrontendStore = () => {
previousTopNavPath: {}, previousTopNavPath: {},
version: application.version, version: application.version,
revertableVersion: application.revertableVersion, revertableVersion: application.revertableVersion,
upgradableVersion: application.upgradableVersion,
navigation: application.navigation || {}, navigation: application.navigation || {},
usedPlugins: application.usedPlugins || [], usedPlugins: application.usedPlugins || [],
})) }))

View File

@ -9,7 +9,6 @@
} from "@budibase/bbui" } from "@budibase/bbui"
import { store } from "builderStore" import { store } from "builderStore"
import { API } from "api" import { API } from "api"
import clientPackage from "@budibase/client/package.json"
export function show() { export function show() {
updateModal.show() updateModal.show()
@ -25,9 +24,9 @@
$: appId = $store.appId $: appId = $store.appId
$: updateAvailable = $: updateAvailable =
clientPackage.version && $store.upgradableVersion &&
$store.version && $store.version &&
clientPackage.version !== $store.version $store.upgradableVersion !== $store.version
$: revertAvailable = $store.revertableVersion != null $: revertAvailable = $store.revertableVersion != null
const refreshAppPackage = async () => { const refreshAppPackage = async () => {
@ -46,7 +45,7 @@
// Don't wait for the async refresh, since this causes modal flashing // Don't wait for the async refresh, since this causes modal flashing
refreshAppPackage() refreshAppPackage()
notifications.success( notifications.success(
`App updated successfully to version ${clientPackage.version}` `App updated successfully to version ${$store.upgradableVersion}`
) )
} catch (err) { } catch (err) {
notifications.error(`Error updating app: ${err}`) notifications.error(`Error updating app: ${err}`)
@ -91,7 +90,7 @@
{#if updateAvailable} {#if updateAvailable}
<Body size="S"> <Body size="S">
This app is currently using version <b>{$store.version}</b>, but version This app is currently using version <b>{$store.version}</b>, but version
<b>{clientPackage.version}</b> is available. Updates can contain new features, <b>{$store.upgradableVersion}</b> is available. Updates can contain new features,
performance improvements and bug fixes. performance improvements and bug fixes.
</Body> </Body>
{:else} {:else}

View File

@ -13,7 +13,6 @@
notifications, notifications,
} from "@budibase/bbui" } from "@budibase/bbui"
import { store } from "builderStore" import { store } from "builderStore"
import clientPackage from "@budibase/client/package.json"
import { processStringSync } from "@budibase/string-templates" import { processStringSync } from "@budibase/string-templates"
import { users, auth, apps, groups, overview } from "stores/portal" import { users, auth, apps, groups, overview } from "stores/portal"
import { fetchData } from "@budibase/frontend-core" import { fetchData } from "@budibase/frontend-core"
@ -40,7 +39,7 @@
}, },
}, },
}) })
$: updateAvailable = clientPackage.version !== $store.version $: updateAvailable = $store.upgradableVersion !== $store.version
$: isPublished = app?.status === AppStatus.DEPLOYED $: isPublished = app?.status === AppStatus.DEPLOYED
$: appEditorId = !app?.updatedBy ? $auth.user._id : app?.updatedBy $: appEditorId = !app?.updatedBy ? $auth.user._id : app?.updatedBy
$: appEditorText = appEditor?.firstName || appEditor?.email $: appEditorText = appEditor?.firstName || appEditor?.email
@ -172,8 +171,8 @@
<Heading size="XS">{$store.version}</Heading> <Heading size="XS">{$store.version}</Heading>
{#if updateAvailable} {#if updateAvailable}
<div class="version-status"> <div class="version-status">
New version <strong>{clientPackage.version}</strong> is available New version <strong>{$store.upgradableVersion}</strong> is
- available -
<Link <Link
on:click={() => { on:click={() => {
$goto("./version") $goto("./version")

View File

@ -1,12 +1,11 @@
<script> <script>
import { Layout, Heading, Body, Divider, Button } from "@budibase/bbui" import { Layout, Heading, Body, Divider, Button } from "@budibase/bbui"
import { store } from "builderStore" import { store } from "builderStore"
import clientPackage from "@budibase/client/package.json"
import VersionModal from "components/deploy/VersionModal.svelte" import VersionModal from "components/deploy/VersionModal.svelte"
let versionModal let versionModal
$: updateAvailable = clientPackage.version !== $store.version $: updateAvailable = $store.upgradableVersion !== $store.version
</script> </script>
<Layout noPadding> <Layout noPadding>
@ -18,7 +17,7 @@
{#if updateAvailable} {#if updateAvailable}
<Body> <Body>
The app is currently using version <strong>{$store.version}</strong> The app is currently using version <strong>{$store.version}</strong>
but version <strong>{clientPackage.version}</strong> is available. but version <strong>{$store.upgradableVersion}</strong> is available.
<br /> <br />
Updates can contain new features, performance improvements and bug fixes. Updates can contain new features, performance improvements and bug fixes.
</Body> </Body>

View File

@ -223,7 +223,7 @@ export async function fetchAppPackage(ctx: UserCtx) {
) )
ctx.body = { ctx.body = {
application, application : {...application, upgradableVersion : envCore.VERSION},
screens, screens,
layouts, layouts,
clientLibPath, clientLibPath,