1
0
Fork 0
mirror of synced 2024-08-27 07:51:37 +12:00

add licensing work

This commit is contained in:
Peter Clement 2023-01-17 10:13:49 +00:00
parent 61474707c9
commit e38bde79ac
3 changed files with 59 additions and 18 deletions

View file

@ -7,8 +7,10 @@
Divider,
Modal,
Table,
Tags,
Tag,
} from "@budibase/bbui"
import { environment } from "stores/portal"
import { environment, licensing, auth, admin } from "stores/portal"
import { onMount } from "svelte"
import CreateEditVariableModal from "./_components/CreateEditVariableModal.svelte"
import EditVariableColumn from "./_components/EditVariableColumn.svelte"
@ -40,25 +42,53 @@
<Layout noPadding>
<Layout gap="XS" noPadding>
<Heading size="M">Envrironment Variables</Heading>
<div class="title">
<Heading size="M">Envrironment Variables</Heading>
{#if !$licensing.environmentVariablesEnabled}
<Tags>
<Tag icon="LockClosed">Pro plan</Tag>
</Tags>
{/if}
</div>
<Body
>Add and manage environment variable for development and production</Body
>Add and manage environment variables for development and production</Body
>
</Layout>
<Divider size="S" />
<Layout noPadding>
<Table
{schema}
data={$environment}
allowEditColumns={false}
allowEditRows={false}
allowSelectRows={false}
{customRenderers}
/>
</Layout>
<div>
<Button on:click={modal.show} cta>Add Variable</Button>
</div>
{#if $licensing.environmentVariablesEnabled}
<Divider size="S" />
<Layout noPadding>
<Table
{schema}
data={$environment}
allowEditColumns={false}
allowEditRows={false}
allowSelectRows={false}
{customRenderers}
/>
</Layout>
<div>
<Button on:click={modal.show} cta>Add Variable</Button>
</div>
{:else}
<div>
<Button
primary
disabled={!$auth.accountPortalAccess && $admin.cloud}
on:click={$licensing.goToUpgradePage()}
>
Upgrade
</Button>
<!--Show the view plans button-->
<Button
secondary
on:click={() => {
window.open("https://budibase.com/pricing/", "_blank")
}}
>
View Plans
</Button>
</div>
{/if}
</Layout>
<Modal bind:this={modal}>
@ -66,4 +96,11 @@
</Modal>
<style>
.title {
display: flex;
flex-direction: row;
align-items: center;
justify-content: flex-start;
gap: var(--spacing-m);
}
</style>

View file

@ -26,6 +26,7 @@ export function createEnvironmentStore() {
async function updateVariable(data) {
await API.updateEnvironmentVariable(data)
}
return {
subscribe,
loadVariables,

View file

@ -60,7 +60,9 @@ export const createLicensingStore = () => {
const backupsEnabled = license.features.includes(
Constants.Features.BACKUPS
)
let environmentVariablesEnabled = license.features.includes(
Constants.Features.ENVIRONMENT_VARIABLES
)
store.update(state => {
return {
...state,
@ -68,6 +70,7 @@ export const createLicensingStore = () => {
isFreePlan,
groupsEnabled,
backupsEnabled,
environmentVariablesEnabled,
}
})
},