Disabling edit/add options for environment variables when encryption key is not found.
This commit is contained in:
parent
3b219dc4ef
commit
a6a42f4d2e
|
@ -18,26 +18,32 @@
|
||||||
|
|
||||||
let modal
|
let modal
|
||||||
|
|
||||||
const schema = {
|
|
||||||
name: {
|
|
||||||
width: "2fr",
|
|
||||||
},
|
|
||||||
edit: {
|
|
||||||
width: "auto",
|
|
||||||
borderLeft: true,
|
|
||||||
displayName: "",
|
|
||||||
},
|
|
||||||
}
|
|
||||||
|
|
||||||
const customRenderers = [{ column: "edit", component: EditVariableColumn }]
|
const customRenderers = [{ column: "edit", component: EditVariableColumn }]
|
||||||
|
|
||||||
$: encryptionKeyAvailable = $environment.status?.encryptionKeyAvailable
|
$: noEncryptionKey = $environment.status?.encryptionKeyAvailable === false
|
||||||
|
$: schema = buildSchema(noEncryptionKey)
|
||||||
|
|
||||||
onMount(async () => {
|
onMount(async () => {
|
||||||
await environment.checkStatus()
|
await environment.checkStatus()
|
||||||
await environment.loadVariables()
|
await environment.loadVariables()
|
||||||
})
|
})
|
||||||
|
|
||||||
|
const buildSchema = noEncryptionKey => {
|
||||||
|
const schema = {
|
||||||
|
name: {
|
||||||
|
width: "2fr",
|
||||||
|
},
|
||||||
|
}
|
||||||
|
if (!noEncryptionKey) {
|
||||||
|
schema.edit = {
|
||||||
|
width: "auto",
|
||||||
|
borderLeft: true,
|
||||||
|
displayName: "",
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return schema
|
||||||
|
}
|
||||||
|
|
||||||
const save = data => {
|
const save = data => {
|
||||||
environment.createVariable(data)
|
environment.createVariable(data)
|
||||||
modal.hide()
|
modal.hide()
|
||||||
|
@ -58,8 +64,8 @@
|
||||||
>Add and manage environment variables for development and production</Body
|
>Add and manage environment variables for development and production</Body
|
||||||
>
|
>
|
||||||
</Layout>
|
</Layout>
|
||||||
{#if $licensing.environmentVariablesEnabled}
|
{#if !$licensing.environmentVariablesEnabled}
|
||||||
{#if encryptionKeyAvailable === false}
|
{#if noEncryptionKey}
|
||||||
<InlineAlert
|
<InlineAlert
|
||||||
message="Your Budibase installation does not have a key for encryption, please update your app service's environment variables to contain an 'ENCRYPTION_KEY' value."
|
message="Your Budibase installation does not have a key for encryption, please update your app service's environment variables to contain an 'ENCRYPTION_KEY' value."
|
||||||
header="No encryption key found"
|
header="No encryption key found"
|
||||||
|
@ -78,7 +84,9 @@
|
||||||
/>
|
/>
|
||||||
</Layout>
|
</Layout>
|
||||||
<div>
|
<div>
|
||||||
<Button on:click={modal.show} cta>Add Variable</Button>
|
<Button on:click={modal.show} cta disabled={noEncryptionKey}
|
||||||
|
>Add Variable</Button
|
||||||
|
>
|
||||||
</div>
|
</div>
|
||||||
{:else}
|
{:else}
|
||||||
<div class="buttons">
|
<div class="buttons">
|
||||||
|
|
Loading…
Reference in New Issue