add licensing work
This commit is contained in:
parent
61474707c9
commit
e38bde79ac
|
@ -7,8 +7,10 @@
|
||||||
Divider,
|
Divider,
|
||||||
Modal,
|
Modal,
|
||||||
Table,
|
Table,
|
||||||
|
Tags,
|
||||||
|
Tag,
|
||||||
} from "@budibase/bbui"
|
} from "@budibase/bbui"
|
||||||
import { environment } from "stores/portal"
|
import { environment, licensing, auth, admin } from "stores/portal"
|
||||||
import { onMount } from "svelte"
|
import { onMount } from "svelte"
|
||||||
import CreateEditVariableModal from "./_components/CreateEditVariableModal.svelte"
|
import CreateEditVariableModal from "./_components/CreateEditVariableModal.svelte"
|
||||||
import EditVariableColumn from "./_components/EditVariableColumn.svelte"
|
import EditVariableColumn from "./_components/EditVariableColumn.svelte"
|
||||||
|
@ -40,25 +42,53 @@
|
||||||
|
|
||||||
<Layout noPadding>
|
<Layout noPadding>
|
||||||
<Layout gap="XS" 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
|
<Body
|
||||||
>Add and manage environment variable for development and production</Body
|
>Add and manage environment variables for development and production</Body
|
||||||
>
|
>
|
||||||
</Layout>
|
</Layout>
|
||||||
<Divider size="S" />
|
{#if $licensing.environmentVariablesEnabled}
|
||||||
<Layout noPadding>
|
<Divider size="S" />
|
||||||
<Table
|
<Layout noPadding>
|
||||||
{schema}
|
<Table
|
||||||
data={$environment}
|
{schema}
|
||||||
allowEditColumns={false}
|
data={$environment}
|
||||||
allowEditRows={false}
|
allowEditColumns={false}
|
||||||
allowSelectRows={false}
|
allowEditRows={false}
|
||||||
{customRenderers}
|
allowSelectRows={false}
|
||||||
/>
|
{customRenderers}
|
||||||
</Layout>
|
/>
|
||||||
<div>
|
</Layout>
|
||||||
<Button on:click={modal.show} cta>Add Variable</Button>
|
<div>
|
||||||
</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>
|
</Layout>
|
||||||
|
|
||||||
<Modal bind:this={modal}>
|
<Modal bind:this={modal}>
|
||||||
|
@ -66,4 +96,11 @@
|
||||||
</Modal>
|
</Modal>
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
|
.title {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: row;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: flex-start;
|
||||||
|
gap: var(--spacing-m);
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
|
@ -26,6 +26,7 @@ export function createEnvironmentStore() {
|
||||||
async function updateVariable(data) {
|
async function updateVariable(data) {
|
||||||
await API.updateEnvironmentVariable(data)
|
await API.updateEnvironmentVariable(data)
|
||||||
}
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
subscribe,
|
subscribe,
|
||||||
loadVariables,
|
loadVariables,
|
||||||
|
|
|
@ -60,7 +60,9 @@ export const createLicensingStore = () => {
|
||||||
const backupsEnabled = license.features.includes(
|
const backupsEnabled = license.features.includes(
|
||||||
Constants.Features.BACKUPS
|
Constants.Features.BACKUPS
|
||||||
)
|
)
|
||||||
|
let environmentVariablesEnabled = license.features.includes(
|
||||||
|
Constants.Features.ENVIRONMENT_VARIABLES
|
||||||
|
)
|
||||||
store.update(state => {
|
store.update(state => {
|
||||||
return {
|
return {
|
||||||
...state,
|
...state,
|
||||||
|
@ -68,6 +70,7 @@ export const createLicensingStore = () => {
|
||||||
isFreePlan,
|
isFreePlan,
|
||||||
groupsEnabled,
|
groupsEnabled,
|
||||||
backupsEnabled,
|
backupsEnabled,
|
||||||
|
environmentVariablesEnabled,
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in New Issue