From 43faa20b443962849863d7a4d8236424dea1e1ac Mon Sep 17 00:00:00 2001 From: Michael Shanks Date: Tue, 18 Aug 2020 17:14:35 +0100 Subject: [PATCH] using BBUI inputs where possible --- .../components/userInterface/NewScreen.svelte | 94 ++++++++----------- .../ParamInputs/RecordSelector.svelte | 4 +- .../workflow/SetupPanel/SetupPanel.svelte | 26 +---- .../SetupPanel/WorkflowBlockSetup.svelte | 42 +++------ .../WorkflowList/CreateWorkflowModal.svelte | 4 +- 5 files changed, 55 insertions(+), 115 deletions(-) diff --git a/packages/builder/src/components/userInterface/NewScreen.svelte b/packages/builder/src/components/userInterface/NewScreen.svelte index 87ebeb5319..82546978a7 100644 --- a/packages/builder/src/components/userInterface/NewScreen.svelte +++ b/packages/builder/src/components/userInterface/NewScreen.svelte @@ -8,6 +8,7 @@ import UIkit from "uikit" import { isRootComponent } from "./pagesParsing/searchComponents" import { splitName } from "./pagesParsing/splitRootComponentName.js" + import { Input, Select } from "@budibase/bbui" import { find, filter, some, map, includes } from "lodash/fp" import { assign } from "lodash" @@ -21,6 +22,8 @@ let layoutComponent let screens let name = "" + let nameError = "" + let routeError let saveAttempted = false @@ -39,12 +42,27 @@ const save = () => { saveAttempted = true - const isValid = - name.length > 0 && - !screenNameExists(name) && - route.length > 0 && - !routeNameExists(route) && - layoutComponent + if (name.length === 0) { + nameError = "Name is required" + } else { + if (screenNameExists(name)) { + nameError = "This name is already taken" + } else { + nameError = "" + } + } + + if (route.length === 0) { + routeError = "Url is required" + } else { + if (routeNameExists(name)) { + routeError = "This url is already taken" + } else { + routeError = "" + } + } + + const isValid = !routeError && !nameError if (!isValid) return @@ -82,40 +100,26 @@ onOk={save} okText="Create Screen"> -
+
- -
- -
+
- -
- -
+
- -
- -
+ +
@@ -126,28 +130,4 @@ display: flex; flex-direction: column; } - - .uk-form-controls { - margin-left: 0 !important; - } - - .uk-form-label { - padding-bottom: 10px; - font-weight: 500; - font-size: 16px; - color: var(--grey-7); - } - - .uk-input { - height: 40px !important; - border-radius: 3px; - } - - .uk-select { - height: 40px !important; - font-weight: 500px; - color: var(--grey-5); - border: 1px solid var(--grey-2); - border-radius: 3px; - } diff --git a/packages/builder/src/components/workflow/SetupPanel/ParamInputs/RecordSelector.svelte b/packages/builder/src/components/workflow/SetupPanel/ParamInputs/RecordSelector.svelte index 125ef2436e..7d0dbb2c06 100644 --- a/packages/builder/src/components/workflow/SetupPanel/ParamInputs/RecordSelector.svelte +++ b/packages/builder/src/components/workflow/SetupPanel/ParamInputs/RecordSelector.svelte @@ -1,5 +1,6 @@ @@ -19,8 +20,7 @@ {#each Object.keys(value.model.schema) as field}
- - +
{/each}
diff --git a/packages/builder/src/components/workflow/SetupPanel/SetupPanel.svelte b/packages/builder/src/components/workflow/SetupPanel/SetupPanel.svelte index 16720f549f..1ddc72c4c3 100644 --- a/packages/builder/src/components/workflow/SetupPanel/SetupPanel.svelte +++ b/packages/builder/src/components/workflow/SetupPanel/SetupPanel.svelte @@ -5,7 +5,7 @@ import { notifier } from "builderStore/store/notifications" import WorkflowBlockSetup from "./WorkflowBlockSetup.svelte" import DeleteWorkflowModal from "./DeleteWorkflowModal.svelte" - import { Button } from "@budibase/bbui" + import { Button, Input } from "@budibase/bbui" const { open, close } = getContext("simple-modal") @@ -112,13 +112,7 @@
Workflow: {workflow.name}
- -
- -
+
@@ -194,28 +188,12 @@ margin-bottom: 20px; } - .budibase_input { - height: 36px; - width: 244px; - border-radius: 3px; - background-color: var(--grey-2); - border: 1px solid var(--grey-2); - text-align: left; - color: var(--ink); - font-size: 14px; - padding-left: 12px; - } - header > span { color: var(--grey-5); margin-right: 20px; cursor: pointer; } - .form { - margin-top: 12px; - } - label { font-weight: 500; font-size: 14px; diff --git a/packages/builder/src/components/workflow/SetupPanel/WorkflowBlockSetup.svelte b/packages/builder/src/components/workflow/SetupPanel/WorkflowBlockSetup.svelte index 0c527d8b4b..17f0b00ec2 100644 --- a/packages/builder/src/components/workflow/SetupPanel/WorkflowBlockSetup.svelte +++ b/packages/builder/src/components/workflow/SetupPanel/WorkflowBlockSetup.svelte @@ -3,6 +3,7 @@ import ComponentSelector from "./ParamInputs/ComponentSelector.svelte" import ModelSelector from "./ParamInputs/ModelSelector.svelte" import RecordSelector from "./ParamInputs/RecordSelector.svelte" + import { Input, TextArea, Select } from "@budibase/bbui" export let workflowBlock @@ -18,42 +19,34 @@
{#if Array.isArray(type)} - {#each type as option} {/each} - + {:else if type === 'component'} {:else if type === 'accessLevel'} - - + {:else if type === 'password'} - + {:else if type === 'number'} - + {:else if type === 'longText'} -