From 5ce52cad066f4bc673a11c6ed5422b0c0f41a8a5 Mon Sep 17 00:00:00 2001 From: Dean Date: Mon, 13 Mar 2023 12:33:16 +0000 Subject: [PATCH] Working commit --- packages/bbui/src/Form/Core/File.svelte | 133 +++++++ packages/bbui/src/Form/Core/index.js | 1 + packages/bbui/src/Form/File.svelte | 23 ++ packages/bbui/src/index.js | 1 + packages/builder/index.html | 10 +- .../builder/src/pages/builder/_layout.svelte | 4 + .../src/pages/builder/auth/login.svelte | 187 +++++----- .../builder/portal/settings/branding.svelte | 333 ++++++++++++++++-- .../portal/settings/organisation.svelte | 46 +-- .../builder/src/stores/portal/licensing.js | 3 + .../builder/src/stores/portal/organisation.js | 12 + packages/frontend-core/src/api/configs.js | 12 + .../src/components/TestimonialPage.svelte | 38 +- .../src/api/controllers/static/index.ts | 4 +- .../static/templates/BudibaseApp.svelte | 1 - packages/types/src/documents/global/config.ts | 14 + .../src/api/controllers/global/configs.ts | 8 + .../worker/src/constants/templates/core.hbs | 31 ++ .../worker/src/constants/templates/index.ts | 2 + packages/worker/src/utilities/email.ts | 35 +- packages/worker/src/utilities/templates.ts | 5 + 21 files changed, 721 insertions(+), 182 deletions(-) create mode 100644 packages/bbui/src/Form/Core/File.svelte create mode 100644 packages/bbui/src/Form/File.svelte create mode 100644 packages/worker/src/constants/templates/core.hbs diff --git a/packages/bbui/src/Form/Core/File.svelte b/packages/bbui/src/Form/Core/File.svelte new file mode 100644 index 0000000000..3ca749e908 --- /dev/null +++ b/packages/bbui/src/Form/Core/File.svelte @@ -0,0 +1,133 @@ + + + + +
+ {#if value} +
+ +
{value.name}
+ {#if value.size} +
+ {#if value.size <= BYTES_IN_MB} + {`${value.size / BYTES_IN_KB} KB`} + {:else} + {`${value.size / BYTES_IN_MB} MB`} + {/if} +
+ {/if} + {#if !disabled} +
+ +
+ {/if} +
+ {/if} + {title} +
+ + diff --git a/packages/bbui/src/Form/Core/index.js b/packages/bbui/src/Form/Core/index.js index 7c81cfd70b..b0edf52748 100644 --- a/packages/bbui/src/Form/Core/index.js +++ b/packages/bbui/src/Form/Core/index.js @@ -13,3 +13,4 @@ export { default as CoreDropzone } from "./Dropzone.svelte" export { default as CoreStepper } from "./Stepper.svelte" export { default as CoreRichTextField } from "./RichTextField.svelte" export { default as CoreSlider } from "./Slider.svelte" +export { default as CoreFile } from "./File.svelte" diff --git a/packages/bbui/src/Form/File.svelte b/packages/bbui/src/Form/File.svelte new file mode 100644 index 0000000000..edc096c902 --- /dev/null +++ b/packages/bbui/src/Form/File.svelte @@ -0,0 +1,23 @@ + + + + + diff --git a/packages/bbui/src/index.js b/packages/bbui/src/index.js index d7457508fd..9aa377b147 100644 --- a/packages/bbui/src/index.js +++ b/packages/bbui/src/index.js @@ -78,6 +78,7 @@ export { default as IconSideNav } from "./IconSideNav/IconSideNav.svelte" export { default as IconSideNavItem } from "./IconSideNav/IconSideNavItem.svelte" export { default as Slider } from "./Form/Slider.svelte" export { default as Accordion } from "./Accordion/Accordion.svelte" +export { default as File } from "./Form/File.svelte" // Renderers export { default as BoldRenderer } from "./Table/BoldRenderer.svelte" diff --git a/packages/builder/index.html b/packages/builder/index.html index e3383cda39..96abc8e582 100644 --- a/packages/builder/index.html +++ b/packages/builder/index.html @@ -1,17 +1,17 @@ + Budibase - - + + + \ No newline at end of file diff --git a/packages/builder/src/pages/builder/_layout.svelte b/packages/builder/src/pages/builder/_layout.svelte index 8d604e8790..086f2513b4 100644 --- a/packages/builder/src/pages/builder/_layout.svelte +++ b/packages/builder/src/pages/builder/_layout.svelte @@ -4,6 +4,7 @@ import { onMount } from "svelte" import { CookieUtils, Constants } from "@budibase/frontend-core" import { API } from "api" + import Branding from "./Branding.svelte" let loaded = false @@ -146,6 +147,9 @@ } + + + {#if loaded} {/if} diff --git a/packages/builder/src/pages/builder/auth/login.svelte b/packages/builder/src/pages/builder/auth/login.svelte index 06e09e4fee..10d01293ab 100644 --- a/packages/builder/src/pages/builder/auth/login.svelte +++ b/packages/builder/src/pages/builder/auth/login.svelte @@ -64,99 +64,106 @@ - - - - - {#if loaded} - logo - {/if} - Log in to Budibase - - - {#if loaded && ($organisation.google || $organisation.oidc)} - - - - - {/if} +{#if loaded} + + + + {#if loaded} + logo + {/if} + + {$organisation.loginHeading || "Log in to Budibase"} + + + + {#if loaded && ($organisation.google || $organisation.oidc)} + + + + + {/if} + {#if !$organisation.isSSOEnforced} + + + { + formData = { + ...formData, + username: e.detail, + } + }} + validate={() => { + let fieldError = { + username: !formData.username + ? "Please enter a valid email" + : undefined, + } + errors = handleError({ ...errors, ...fieldError }) + }} + error={errors.username} + /> + { + formData = { + ...formData, + password: e.detail, + } + }} + validate={() => { + let fieldError = { + password: !formData.password + ? "Please enter your password" + : undefined, + } + errors = handleError({ ...errors, ...fieldError }) + }} + error={errors.password} + /> + + {/if} + {#if !$organisation.isSSOEnforced} - - - { - formData = { - ...formData, - username: e.detail, - } - }} - validate={() => { - let fieldError = { - username: !formData.username - ? "Please enter a valid email" - : undefined, - } - errors = handleError({ ...errors, ...fieldError }) - }} - error={errors.username} - /> - { - formData = { - ...formData, - password: e.detail, - } - }} - validate={() => { - let fieldError = { - password: !formData.password - ? "Please enter your password" - : undefined, - } - errors = handleError({ ...errors, ...fieldError }) - }} - error={errors.password} - /> - + + + + + + + {/if} + + {#if cloud && $organisation.licenceAgreementEnabled} + + By using Budibase Cloud +
+ you are agreeing to our + + License Agreement + + {/if}
- {#if !$organisation.isSSOEnforced} - - - - - - - {/if} - - {#if cloud} - - By using Budibase Cloud -
- you are agreeing to our - - License Agreement - - - {/if} -
-
+ +{/if} diff --git a/packages/builder/src/pages/builder/portal/settings/organisation.svelte b/packages/builder/src/pages/builder/portal/settings/organisation.svelte index f96923ed3d..7816600fe6 100644 --- a/packages/builder/src/pages/builder/portal/settings/organisation.svelte +++ b/packages/builder/src/pages/builder/portal/settings/organisation.svelte @@ -28,21 +28,21 @@ company: $organisation.company, platformUrl: $organisation.platformUrl, analyticsEnabled: $organisation.analyticsEnabled, - logo: $organisation.logoUrl - ? { url: $organisation.logoUrl, type: "image", name: "Logo" } - : null, + // logo: $organisation.logoUrl + // ? { url: $organisation.logoUrl, type: "image", name: "Logo" } + // : null, }) let loading = false - async function uploadLogo(file) { - try { - let data = new FormData() - data.append("file", file) - await API.uploadLogo(data) - } catch (error) { - notifications.error("Error uploading logo") - } - } + // async function uploadLogo(file) { + // try { + // let data = new FormData() + // data.append("file", file) + // await API.uploadLogo(data) + // } catch (error) { + // notifications.error("Error uploading logo") + // } + // } async function saveConfig() { loading = true @@ -87,21 +87,7 @@ - + {#if !$admin.cloud}