Adding upgrade messaging.

This commit is contained in:
mike12345567 2022-05-18 12:03:27 +01:00
parent e61efc5474
commit 7044b22382
2 changed files with 27 additions and 5 deletions

View File

@ -1,7 +1,14 @@
<script> <script>
import { Body, Divider, Heading, Layout, notifications } from "@budibase/bbui" import {
Body,
Divider,
Heading,
Layout,
notifications,
Link,
} from "@budibase/bbui"
import { onMount } from "svelte" import { onMount } from "svelte"
import { auth, licensing } from "stores/portal" import { admin, auth, licensing } from "stores/portal"
import Usage from "components/billing/Usage.svelte" import Usage from "components/billing/Usage.svelte"
let staticUsage = [] let staticUsage = []
@ -10,6 +17,9 @@
$: quotaUsage = $licensing.quotaUsage $: quotaUsage = $licensing.quotaUsage
$: license = $auth.user?.license $: license = $auth.user?.license
$: console.log($auth.user)
const upgradeUrl = `${$admin.accountPortalUrl}/portal/upgrade`
const setMonthlyUsage = () => { const setMonthlyUsage = () => {
monthlyUsage = [] monthlyUsage = []
@ -72,7 +82,19 @@
{#if loaded} {#if loaded}
<Layout> <Layout>
<Heading>Usage</Heading> <Heading>Usage</Heading>
<Body>Get information about your current usage within Budibase.</Body> <Body
>Get information about your current usage within Budibase.
{#if $admin.cloud}
{#if $auth.user?.accountPortalAccess}
To upgrade your plan and usage limits visit your <Link
size="L"
href={upgradeUrl}>Account</Link
>.
{:else}
Contact your account holder to upgrade your usage limits.
{/if}
{/if}
</Body>
</Layout> </Layout>
<Layout gap="S"> <Layout gap="S">
<Divider size="S" /> <Divider size="S" />

View File

@ -75,8 +75,8 @@ const checkCurrentApp = ctx => {
const addSessionAttributesToUser = ctx => { const addSessionAttributesToUser = ctx => {
ctx.body.account = ctx.user.account ctx.body.account = ctx.user.account
ctx.body.license = ctx.user.license ctx.body.license = ctx.user.license
ctx.body.budibaseAccess = ctx.user.budibaseAccess ctx.body.budibaseAccess = !!ctx.user.budibaseAccess
ctx.body.accountPortalAccess = ctx.user.accountPortalAccess ctx.body.accountPortalAccess = !!ctx.user.accountPortalAccess
ctx.body.csrfToken = ctx.user.csrfToken ctx.body.csrfToken = ctx.user.csrfToken
} }