add create store method and tidy up
This commit is contained in:
parent
5561f73c69
commit
295b96e8d9
|
@ -55,11 +55,6 @@
|
|||
title: "Plugins",
|
||||
href: "/builder/portal/plugins",
|
||||
},
|
||||
{
|
||||
title: "Environment",
|
||||
href: "/builder/portal/environment",
|
||||
},
|
||||
|
||||
{
|
||||
title: "Settings",
|
||||
href: "/builder/portal/settings",
|
||||
|
|
|
@ -26,6 +26,11 @@
|
|||
url={$url("./organisation")}
|
||||
active={$isActive("./organisation")}
|
||||
/>
|
||||
<SideNavItem
|
||||
text="Environment"
|
||||
url={$url("./environment")}
|
||||
active={$isActive("./environment")}
|
||||
/>
|
||||
{#if !$admin.cloud}
|
||||
<SideNavItem
|
||||
text="Version"
|
||||
|
|
|
@ -4,12 +4,9 @@
|
|||
Heading,
|
||||
Body,
|
||||
Button,
|
||||
Select,
|
||||
Divider,
|
||||
Modal,
|
||||
ModalContent,
|
||||
Search,
|
||||
Page,
|
||||
Table,
|
||||
Input,
|
||||
Checkbox,
|
||||
|
@ -42,30 +39,28 @@
|
|||
})
|
||||
</script>
|
||||
|
||||
<Page narrow>
|
||||
<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>
|
||||
<Table
|
||||
{schema}
|
||||
data={$envVars}
|
||||
allowEditColumns={false}
|
||||
allowEditRows={false}
|
||||
allowSelectRows={false}
|
||||
{customRenderers}
|
||||
/>
|
||||
</Layout>
|
||||
<div>
|
||||
<Button on:click={modal.show} cta>Add Variable</Button>
|
||||
</div>
|
||||
<Layout noPadding>
|
||||
<Layout gap="XS" noPadding>
|
||||
<Heading size="M">Envrironment Variables</Heading>
|
||||
<Body
|
||||
>Add and manage environment variable for development and production</Body
|
||||
>
|
||||
</Layout>
|
||||
</Page>
|
||||
<Divider size="S" />
|
||||
<Layout noPadding>
|
||||
<Table
|
||||
{schema}
|
||||
data={$envVars}
|
||||
allowEditColumns={false}
|
||||
allowEditRows={false}
|
||||
allowSelectRows={false}
|
||||
{customRenderers}
|
||||
/>
|
||||
</Layout>
|
||||
<div>
|
||||
<Button on:click={modal.show} cta>Add Variable</Button>
|
||||
</div>
|
||||
</Layout>
|
||||
|
||||
<Modal bind:this={modal}>
|
||||
<ModalContent title="Add new environment variable">
|
|
@ -6,16 +6,21 @@ export function createEnvVarsStore() {
|
|||
|
||||
async function load() {
|
||||
// const envVars = await API.fetchEnvVars()
|
||||
|
||||
let testVars = ['blah', 'blah123']
|
||||
const vars = testVars.map((name) => ({ name }))
|
||||
let testVars = ["blah", "blah123"]
|
||||
const vars = testVars.map(name => ({ name }))
|
||||
console.log(vars)
|
||||
set(vars)
|
||||
}
|
||||
|
||||
async function create() {
|
||||
const envVar = await API.createEnvVar()
|
||||
update(envVars => [envVar, ...envVars])
|
||||
}
|
||||
|
||||
return {
|
||||
subscribe,
|
||||
load,
|
||||
create,
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -11,4 +11,4 @@ export { groups } from "./groups"
|
|||
export { plugins } from "./plugins"
|
||||
export { backups } from "./backups"
|
||||
export { overview } from "./overview"
|
||||
export { envVars } from "./envVars"
|
||||
export { envVars } from "./envVars"
|
||||
|
|
|
@ -2,7 +2,14 @@ export const buildEnvironmentVariableEndpoints = API => ({
|
|||
/**
|
||||
* Fetches a list of environment variables
|
||||
*/
|
||||
fetchEnvVars: async () => {
|
||||
fetchVariables: async () => {
|
||||
return await API.get({
|
||||
url: `/api/env/variables`,
|
||||
json: false,
|
||||
})
|
||||
},
|
||||
|
||||
createVariable: async () => {
|
||||
return await API.get({
|
||||
url: `/api/env/variables`,
|
||||
json: false,
|
||||
|
|
Loading…
Reference in New Issue