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,50 +56,70 @@
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">
<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>