add wip file upload

This commit is contained in:
Keviin Åberg Kultalahti 2021-05-12 14:08:44 +02:00
parent 03bd4cebb5
commit 8179b96f4d
2 changed files with 53 additions and 8 deletions

View File

@ -21,6 +21,7 @@
const schema = { const schema = {
email: {}, email: {},
status: {}, status: {},
builder: {},
// access: {}, // access: {},
// group: {} // group: {}
} }

View File

@ -1,4 +1,5 @@
<script> <script>
import { object, string } from "yup"
import { import {
Layout, Layout,
Heading, Heading,
@ -12,6 +13,7 @@
notifications, notifications,
} from "@budibase/bbui" } from "@budibase/bbui"
import { organisation } from "stores/portal" import { organisation } from "stores/portal"
import { api } from "builderStore/api"
import analytics from "analytics" import analytics from "analytics"
let analyticsDisabled = analytics.disabled() let analyticsDisabled = analytics.disabled()
@ -25,13 +27,26 @@
let loading = false let loading = false
$: company = $organisation?.company let company
$: logoUrl = $organisation.logoUrl let logoUrl
let file
async function uploadLogo() {
let data = new FormData()
data.append("files", file)
const res = await api.post("/api/admin/configs/upload/settings/logo")
}
async function saveConfig() { async function saveConfig() {
loading = true loading = true
await toggleAnalytics() await toggleAnalytics()
const res = await organisation.save({ ...$organisation, company }) console.log("company", company)
const res = await organisation.save({
company: company || $organisation?.config?.company,
// logoUrl,
// platformUrl,
})
if (res.status === 200) { if (res.status === 200) {
notifications.success("General settings saved.") notifications.success("General settings saved.")
} else { } else {
@ -59,14 +74,40 @@
<div class="fields"> <div class="fields">
<div class="field"> <div class="field">
<Label size="L">Organization name</Label> <Label size="L">Organization name</Label>
<Input thin bind:value={company} /> <Input
thin
value={$organisation?.config?.company}
on:change={e => (company = e.detail)}
/>
</div> </div>
<!-- <div class="field"> <div class="field logo">
<Label>Logo</Label> <Label size="L">Logo</Label>
<div class="file"> <div class="file">
<Dropzone /> <Dropzone
label="Select Image"
value={[file]}
on:change={e => {
file = e.detail?.[0]
}}
/>
</div>
</div>
</div>
</div>
<Divider size="S" />
<div class="analytics">
<Heading size="S">Platform</Heading>
<Body>Here you can set up general platform settings.</Body>
<div class="fields">
<div class="field">
<Label size="L">Platform URL</Label>
<Input
thin
value={$organisation?.config?.platformUrl ||
"http://localhost:10000"}
on:change={e => (company = e.detail)}
/>
</div> </div>
</div> -->
</div> </div>
</div> </div>
<Divider size="S" /> <Divider size="S" />
@ -103,6 +144,9 @@
.file { .file {
max-width: 30ch; max-width: 30ch;
} }
.logo {
align-items: start;
}
.intro { .intro {
display: grid; display: grid;
} }