Merge pull request #12440 from Budibase/fix/pc-bug-fixes

Automations UI tweaks / fixes
This commit is contained in:
Peter Clement 2023-12-05 16:36:27 +00:00 committed by GitHub
commit 5cef7c8009
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 126 additions and 54 deletions

View File

@ -57,16 +57,11 @@
}} }}
class="buttons" class="buttons"
> >
<Icon hoverable size="M" name="Play" /> <Icon size="M" name="Play" />
<div>Run test</div> <div>Run test</div>
</div> </div>
<div class="buttons"> <div class="buttons">
<Icon <Icon disabled={!$automationStore.testResults} size="M" name="Multiple" />
disabled={!$automationStore.testResults}
hoverable
size="M"
name="Multiple"
/>
<div <div
class:disabled={!$automationStore.testResults} class:disabled={!$automationStore.testResults}
on:click={() => { on:click={() => {

View File

@ -97,6 +97,7 @@
class:typing={typing && !automationNameError} class:typing={typing && !automationNameError}
class:typing-error={automationNameError} class:typing-error={automationNameError}
class="blockSection" class="blockSection"
on:click={() => dispatch("toggle")}
> >
<div class="splitHeader"> <div class="splitHeader">
<div class="center-items"> <div class="center-items">
@ -138,7 +139,20 @@
on:input={e => { on:input={e => {
automationName = e.target.value.trim() automationName = e.target.value.trim()
}} }}
on:click={startTyping} on:click={e => {
e.stopPropagation()
startTyping()
}}
on:keydown={async e => {
if (e.key === "Enter") {
typing = false
if (automationNameError) {
automationName = stepNames[block.id] || block?.name
} else {
await saveName()
}
}
}}
on:blur={async () => { on:blur={async () => {
typing = false typing = false
if (automationNameError) { if (automationNameError) {
@ -168,7 +182,11 @@
</StatusLight> </StatusLight>
</div> </div>
<Icon <Icon
on:click={() => dispatch("toggle")} e.stopPropagation()
on:click={e => {
e.stopPropagation()
dispatch("toggle")
}}
hoverable hoverable
name={open ? "ChevronUp" : "ChevronDown"} name={open ? "ChevronUp" : "ChevronDown"}
/> />
@ -195,7 +213,10 @@
{/if} {/if}
{#if !showTestStatus} {#if !showTestStatus}
<Icon <Icon
on:click={() => dispatch("toggle")} on:click={e => {
e.stopPropagation()
dispatch("toggle")
}}
hoverable hoverable
name={open ? "ChevronUp" : "ChevronDown"} name={open ? "ChevronUp" : "ChevronDown"}
/> />

View File

@ -1,11 +1,9 @@
<script> <script>
import { import {
ModalContent, ModalContent,
Tabs,
Tab,
TextArea, TextArea,
Label,
notifications, notifications,
ActionButton,
} from "@budibase/bbui" } from "@budibase/bbui"
import { automationStore, selectedAutomation } from "builderStore" import { automationStore, selectedAutomation } from "builderStore"
import AutomationBlockSetup from "../../SetupPanel/AutomationBlockSetup.svelte" import AutomationBlockSetup from "../../SetupPanel/AutomationBlockSetup.svelte"
@ -55,50 +53,69 @@
notifications.error(error) notifications.error(error)
} }
} }
const toggle = () => {
selectedValues = !selectedValues
selectedJSON = !selectedJSON
}
let selectedValues = true
let selectedJSON = false
</script> </script>
<ModalContent <ModalContent
title="Add test data" title="Add test data"
confirmText="Test" confirmText="Run test"
size="M" size="L"
showConfirmButton={true} showConfirmButton={true}
disabled={isError} disabled={isError}
onConfirm={testAutomation} onConfirm={testAutomation}
cancelText="Cancel" cancelText="Cancel"
> >
<Tabs selected="Form" quiet> <div class="size">
<Tab icon="Form" title="Form"> <div class="options">
<div class="tab-content-padding"> <ActionButton quiet selected={selectedValues} on:click={toggle}
<AutomationBlockSetup >Use values</ActionButton
{testData} >
{schemaProperties} <ActionButton quiet selected={selectedJSON} on:click={toggle}
isTestModal >Use JSON</ActionButton
block={trigger} >
/> </div>
</div></Tab </div>
>
<Tab icon="FileJson" title="JSON"> {#if selectedValues}
<div class="tab-content-padding"> <div class="tab-content-padding">
<Label>JSON</Label> <AutomationBlockSetup
<div class="text-area-container"> {testData}
<TextArea {schemaProperties}
value={JSON.stringify($selectedAutomation.testData, null, 2)} isTestModal
error={failedParse} block={trigger}
on:change={e => parseTestJSON(e)} />
/> </div>
</div> {/if}
</div> {#if selectedJSON}
</Tab> <div class="text-area-container">
</Tabs> <TextArea
value={JSON.stringify($selectedAutomation.testData, null, 2)}
error={failedParse}
on:change={e => parseTestJSON(e)}
/>
</div>
{/if}
</ModalContent> </ModalContent>
<style> <style>
.text-area-container :global(textarea) { .text-area-container :global(textarea) {
min-height: 200px; min-height: 300px;
height: 200px; height: 300px;
} }
.tab-content-padding { .tab-content-padding {
padding: 0 var(--spacing-xl); padding: 0 var(--spacing-s);
}
.options {
display: flex;
align-items: center;
gap: 8px;
} }
</style> </style>

View File

@ -9,7 +9,7 @@
<div class="title"> <div class="title">
<div class="title-text"> <div class="title-text">
<Icon name="MultipleCheck" /> <Icon name="MultipleCheck" />
<div style="padding-left: var(--spacing-l)">Test Details</div> <div style="padding-left: var(--spacing-l); ">Test Details</div>
</div> </div>
<div style="padding-right: var(--spacing-xl)"> <div style="padding-right: var(--spacing-xl)">
<Icon <Icon
@ -40,6 +40,7 @@
display: flex; display: flex;
flex-direction: row; flex-direction: row;
align-items: center; align-items: center;
padding-top: var(--spacing-s);
} }
.title :global(h1) { .title :global(h1) {

View File

@ -1,20 +1,44 @@
<script> <script>
import AutomationList from "./AutomationList.svelte" import AutomationList from "./AutomationList.svelte"
import CreateAutomationModal from "./CreateAutomationModal.svelte" import CreateAutomationModal from "./CreateAutomationModal.svelte"
import { Modal, Button, Layout } from "@budibase/bbui" import { Modal, Icon } from "@budibase/bbui"
import Panel from "components/design/Panel.svelte" import Panel from "components/design/Panel.svelte"
export let modal export let modal
export let webhookModal export let webhookModal
</script> </script>
<Panel title="Automations" borderRight> <Panel title="Automations" borderRight noHeaderBorder titleCSS={false}>
<Layout paddingX="L" paddingY="XL" gap="S"> <span class="panel-title-content" slot="panel-title-content">
<Button cta on:click={modal.show}>Add automation</Button> <div class="header">
</Layout> <div>Automations</div>
<div on:click={modal.show} class="add-automation-button">
<Icon name="Add" />
</div>
</div>
</span>
<AutomationList /> <AutomationList />
</Panel> </Panel>
<Modal bind:this={modal}> <Modal bind:this={modal}>
<CreateAutomationModal {webhookModal} /> <CreateAutomationModal {webhookModal} />
</Modal> </Modal>
<style>
.header {
display: flex;
align-items: center;
justify-content: space-between;
gap: var(--spacing-m);
}
.add-automation-button {
margin-left: 130px;
color: var(--grey-7);
cursor: pointer;
}
.add-automation-button:hover {
color: var(--ink);
}
</style>

View File

@ -149,7 +149,6 @@
} }
const initialiseField = (field, savingColumn) => { const initialiseField = (field, savingColumn) => {
isCreating = !field isCreating = !field
if (field && !savingColumn) { if (field && !savingColumn) {
editableColumn = cloneDeep(field) editableColumn = cloneDeep(field)
originalName = editableColumn.name ? editableColumn.name + "" : null originalName = editableColumn.name ? editableColumn.name + "" : null
@ -171,7 +170,8 @@
relationshipPart2 = part2 relationshipPart2 = part2
} }
} }
} else if (!savingColumn) { }
if (!savingColumn) {
let highestNumber = 0 let highestNumber = 0
Object.keys(table.schema).forEach(columnName => { Object.keys(table.schema).forEach(columnName => {
const columnNumber = extractColumnNumber(columnName) const columnNumber = extractColumnNumber(columnName)
@ -529,8 +529,16 @@
<Layout noPadding gap="S"> <Layout noPadding gap="S">
{#if mounted} {#if mounted}
<Input <Input
value={editableColumn.name}
autofocus autofocus
bind:value={editableColumn.name} on:input={e => {
if (
!uneditable &&
!(linkEditDisabled && editableColumn.type === LINK_TYPE)
) {
editableColumn.name = e.target.value
}
}}
disabled={uneditable || disabled={uneditable ||
(linkEditDisabled && editableColumn.type === LINK_TYPE)} (linkEditDisabled && editableColumn.type === LINK_TYPE)}
error={errors?.name} error={errors?.name}

View File

@ -16,7 +16,8 @@
export let wide = false export let wide = false
export let extraWide = false export let extraWide = false
export let closeButtonIcon = "Close" export let closeButtonIcon = "Close"
export let noHeaderBorder = false
export let titleCSS = true
$: customHeaderContent = $$slots["panel-header-content"] $: customHeaderContent = $$slots["panel-header-content"]
$: customTitleContent = $$slots["panel-title-content"] $: customTitleContent = $$slots["panel-title-content"]
</script> </script>
@ -32,6 +33,7 @@
class="header" class="header"
class:custom={customHeaderContent} class:custom={customHeaderContent}
class:borderBottom={borderBottomHeader} class:borderBottom={borderBottomHeader}
class:noHeaderBorder
> >
{#if showBackButton} {#if showBackButton}
<Icon name="ArrowLeft" hoverable on:click={onClickBackButton} /> <Icon name="ArrowLeft" hoverable on:click={onClickBackButton} />
@ -41,7 +43,7 @@
<Icon name={icon} /> <Icon name={icon} />
</AbsTooltip> </AbsTooltip>
{/if} {/if}
<div class="title"> <div class:title={titleCSS}>
{#if customTitleContent} {#if customTitleContent}
<slot name="panel-title-content" /> <slot name="panel-title-content" />
{:else} {:else}
@ -106,6 +108,10 @@
padding: 0 var(--spacing-l); padding: 0 var(--spacing-l);
gap: var(--spacing-m); gap: var(--spacing-m);
} }
.noHeaderBorder {
border-bottom: none !important;
}
.header.borderBottom { .header.borderBottom {
border-bottom: var(--border-light); border-bottom: var(--border-light);
} }

View File

@ -110,7 +110,7 @@
} }
.setup { .setup {
padding-top: var(--spectrum-global-dimension-size-200); padding-top: 9px;
border-left: var(--border-light); border-left: var(--border-light);
display: flex; display: flex;
flex-direction: column; flex-direction: column;