update run test modal

This commit is contained in:
Peter Clement 2023-11-24 11:11:59 +00:00
parent b1d4a572e7
commit 17d02af668
1 changed files with 50 additions and 29 deletions

View File

@ -6,6 +6,7 @@
TextArea, TextArea,
Label, 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,19 +56,37 @@
notifications.error(error) notifications.error(error)
} }
} }
const toggle = () => {
selectedValues = !selectedValues
selectedJSON = !selectedJSON
console.log(selectedJSON)
}
let selectedValues = true
let selectedJSON = false
</script> </script>
<ModalContent <ModalContent
title="Add test data" title="Add test data"
confirmText="Test" confirmText="TeRun testst"
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">
<ActionButton quiet selected={selectedValues} on:click={toggle}
>Use values</ActionButton
>
<ActionButton quiet selected={selectedJSON} on:click={toggle}
>Use JSON</ActionButton
>
</div>
</div>
{#if selectedValues}
<div class="tab-content-padding"> <div class="tab-content-padding">
<AutomationBlockSetup <AutomationBlockSetup
{testData} {testData}
@ -75,11 +94,9 @@
isTestModal isTestModal
block={trigger} block={trigger}
/> />
</div></Tab </div>
> {/if}
<Tab icon="FileJson" title="JSON"> {#if selectedJSON}
<div class="tab-content-padding">
<Label>JSON</Label>
<div class="text-area-container"> <div class="text-area-container">
<TextArea <TextArea
value={JSON.stringify($selectedAutomation.testData, null, 2)} value={JSON.stringify($selectedAutomation.testData, null, 2)}
@ -87,18 +104,22 @@
on:change={e => parseTestJSON(e)} on:change={e => parseTestJSON(e)}
/> />
</div> </div>
</div> {/if}
</Tab>
</Tabs>
</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>