environment variables ui boilerplate
This commit is contained in:
parent
30e90b2d5d
commit
7378d21fea
|
@ -0,0 +1,39 @@
|
|||
<script>
|
||||
import {
|
||||
Layout,
|
||||
Heading,
|
||||
Body,
|
||||
Button,
|
||||
Select,
|
||||
Divider,
|
||||
Modal,
|
||||
Search,
|
||||
} from "@budibase/bbui"
|
||||
|
||||
import { onMount } from "svelte"
|
||||
|
||||
onMount(async () => {
|
||||
await envVars.load()
|
||||
})
|
||||
</script>
|
||||
|
||||
<Layout noPadding>
|
||||
<Layout gap="XS" noPadding>
|
||||
<Heading size="M">Envrironment Variables</Heading>
|
||||
<Body
|
||||
>Add and manage environment variable for development and production</Body
|
||||
>
|
||||
</Layout>
|
||||
<Divider size="S" />
|
||||
<Layout noPadding>
|
||||
{#each $envVars as envVar}
|
||||
<Layout gap="XS" noPadding>
|
||||
<Heading size="S">{envVar}</Heading>
|
||||
</Layout>
|
||||
<Divider size="S" />
|
||||
{/each}
|
||||
</Layout>
|
||||
</Layout>
|
||||
|
||||
<style>
|
||||
</style>
|
|
@ -0,0 +1,20 @@
|
|||
import { writable } from "svelte/store"
|
||||
import { API } from "api"
|
||||
|
||||
export function createEnvVarsStore() {
|
||||
const { subscribe, set, update } = writable([])
|
||||
|
||||
async function load() {
|
||||
const envVars = await API.fetchEnvVars()
|
||||
|
||||
let testVars = ['blah', 'blah123']
|
||||
set(testVars)
|
||||
}
|
||||
|
||||
return {
|
||||
subscribe,
|
||||
load,
|
||||
}
|
||||
}
|
||||
|
||||
export const envVars = createEnvVarsStore()
|
|
@ -0,0 +1,11 @@
|
|||
export const buildEnvironmentVariableEndpoints = API => ({
|
||||
/**
|
||||
* Fetches a list of environment variables
|
||||
*/
|
||||
fetchEnvVars: async () => {
|
||||
return await API.get({
|
||||
url: `/api/env/variables`,
|
||||
json: false,
|
||||
})
|
||||
}
|
||||
})
|
Loading…
Reference in New Issue