Merge pull request #1160 from Budibase/cheeks-bug-fixes

Budi Day Bug Fixes
This commit is contained in:
Andrew Kingston 2021-02-23 03:18:45 -08:00 committed by GitHub
commit abb8808add
7 changed files with 53 additions and 40 deletions

View File

@ -34,11 +34,26 @@
} }
const saveRow = async () => { const saveRow = async () => {
errors = []
// Do some basic front end validation first
if (!row.email) {
errors = [...errors, { message: "Email is required" }]
}
if (!row.password) {
errors = [...errors, { message: "Password is required" }]
}
if (!row.roleId) {
errors = [...errors, { message: "Role is required" }]
}
if (errors.length) {
return false
}
const rowResponse = await backendApi.saveRow( const rowResponse = await backendApi.saveRow(
{ ...row, tableId: table._id }, { ...row, tableId: table._id },
table._id table._id
) )
if (rowResponse.errors) { if (rowResponse.errors) {
if (Array.isArray(rowResponse.errors)) { if (Array.isArray(rowResponse.errors)) {
errors = rowResponse.errors.map(error => ({ message: error })) errors = rowResponse.errors.map(error => ({ message: error }))
@ -48,6 +63,9 @@
.flat() .flat()
} }
return false return false
} else if (rowResponse.status === 400 && rowResponse.message) {
errors = [{ message: rowResponse.message }]
return false
} }
notifier.success("User saved successfully.") notifier.success("User saved successfully.")

View File

@ -40,7 +40,7 @@
<a <a
use:linkable use:linkable
style="--linkColor: {linkColor}; --linkHoverColor: {linkHoverColor}" style="--linkColor: {linkColor}; --linkHoverColor: {linkHoverColor}"
href={linkUrl}> href={linkUrl || '/'}>
{linkText} {linkText}
</a> </a>
</div> </div>
@ -71,6 +71,7 @@
font-size: 1.25rem; font-size: 1.25rem;
font-weight: 700; font-weight: 700;
margin: 0; margin: 0;
white-space: pre-wrap;
} }
.text { .text {
@ -78,6 +79,7 @@
margin: 0; margin: 0;
font-weight: 400; font-weight: 400;
line-height: 1.5rem; line-height: 1.5rem;
white-space: pre-wrap;
} }
a { a {
@ -85,6 +87,7 @@
text-decoration: none; text-decoration: none;
color: var(--linkColor); color: var(--linkColor);
font-weight: 600; font-weight: 600;
white-space: pre-wrap;
} }
a:hover { a:hover {

View File

@ -40,7 +40,7 @@
<p class="subtext">{subtext}</p> <p class="subtext">{subtext}</p>
<a <a
style="--linkColor: {linkColor}; --linkHoverColor: {linkHoverColor}" style="--linkColor: {linkColor}; --linkHoverColor: {linkHoverColor}"
href={linkUrl}>{linkText}</a> href={linkUrl || '/'}>{linkText}</a>
</footer> </footer>
</div> </div>
</div> </div>
@ -71,6 +71,7 @@
font-size: 1rem; font-size: 1rem;
font-weight: 700; font-weight: 700;
margin: 0; margin: 0;
white-space: pre-wrap;
} }
.text { .text {
@ -78,6 +79,7 @@
margin: 0.5rem 0 0 0; margin: 0.5rem 0 0 0;
font-weight: 400; font-weight: 400;
line-height: 1.25rem; line-height: 1.25rem;
white-space: pre-wrap;
} }
footer { footer {
@ -91,6 +93,7 @@
margin: 0; margin: 0;
font-weight: 400; font-weight: 400;
color: #757575; color: #757575;
white-space: pre-wrap;
} }
a { a {
@ -99,7 +102,7 @@
color: var(--linkColor); color: var(--linkColor);
font-weight: 600; font-weight: 600;
font-size: 0.85rem; font-size: 0.85rem;
margin: 0; white-space: pre-wrap;
} }
a:hover { a:hover {

View File

@ -20,7 +20,6 @@
.container { .container {
min-width: 260px; min-width: 260px;
width: max-content; width: max-content;
max-height: 170px;
border: 1px solid var(--grey-3); border: 1px solid var(--grey-3);
border-radius: 0.3rem; border-radius: 0.3rem;
color: var(--blue); color: var(--blue);
@ -31,6 +30,7 @@
color: #9e9e9e; color: #9e9e9e;
font-weight: 500; font-weight: 500;
margin: 1rem 1.5rem 0.5rem 1.5rem; margin: 1rem 1.5rem 0.5rem 1.5rem;
white-space: pre-wrap;
} }
.value { .value {
@ -38,6 +38,7 @@
font-weight: 500; font-weight: 500;
margin: 0 1.5rem 1.5rem 1.5rem; margin: 0 1.5rem 1.5rem 1.5rem;
color: inherit; color: inherit;
white-space: pre-wrap;
} }
.label { .label {
@ -45,5 +46,6 @@
font-weight: 400; font-weight: 400;
color: #9e9e9e; color: #9e9e9e;
margin: 1rem 1.5rem; margin: 1rem 1.5rem;
white-space: pre-wrap;
} }
</style> </style>

View File

@ -4,21 +4,31 @@
const { styleable } = getContext("sdk") const { styleable } = getContext("sdk")
const component = getContext("component") const component = getContext("component")
export let className = ""
export let type export let type
export let text = "" export let text = ""
</script> </script>
{#if type === 'h1'} {#if type === 'h1'}
<h1 class={className} use:styleable={$component.styles}>{text}</h1> <h1 use:styleable={$component.styles}>{text}</h1>
{:else if type === 'h2'} {:else if type === 'h2'}
<h2 class={className} use:styleable={$component.styles}>{text}</h2> <h2 use:styleable={$component.styles}>{text}</h2>
{:else if type === 'h3'} {:else if type === 'h3'}
<h3 class={className} use:styleable={$component.styles}>{text}</h3> <h3 use:styleable={$component.styles}>{text}</h3>
{:else if type === 'h4'} {:else if type === 'h4'}
<h4 class={className} use:styleable={$component.styles}>{text}</h4> <h4 use:styleable={$component.styles}>{text}</h4>
{:else if type === 'h5'} {:else if type === 'h5'}
<h5 class={className} use:styleable={$component.styles}>{text}</h5> <h5 use:styleable={$component.styles}>{text}</h5>
{:else if type === 'h6'} {:else if type === 'h6'}
<h6 class={className} use:styleable={$component.styles}>{text}</h6> <h6 use:styleable={$component.styles}>{text}</h6>
{/if} {/if}
<style>
h1,
h2,
h3,
h4,
h5,
h6 {
white-space: pre-wrap;
}
</style>

View File

@ -50,6 +50,7 @@
.subheading { .subheading {
opacity: 0.6; opacity: 0.6;
white-space: pre-wrap;
} }
.content { .content {
@ -60,6 +61,7 @@
.heading { .heading {
font-weight: 600; font-weight: 600;
white-space: pre-wrap;
} }
.image-block { .image-block {

View File

@ -5,38 +5,13 @@
const component = getContext("component") const component = getContext("component")
export let text = "" export let text = ""
export let className = ""
export let type = ""
const isTag = tag => type === tag
</script> </script>
{#if isTag('none')} <p use:styleable={$component.styles}>{text}</p>
<span use:styleable={$component.styles}>{text}</span>
{:else if isTag('bold')}
<b class={className} use:styleable={$component.styles}>{text}</b>
{:else if isTag('strong')}
<strong class={className} use:styleable={$component.styles}>{text}</strong>
{:else if isTag('italic')}
<i class={className} use:styleable={$component.styles}>{text}</i>
{:else if isTag('emphasis')}
<em class={className} use:styleable={$component.styles}>{text}</em>
{:else if isTag('mark')}
<mark class={className} use:styleable={$component.styles}>{text}</mark>
{:else if isTag('small')}
<small class={className} use:styleable={$component.styles}>{text}</small>
{:else if isTag('del')}
<del class={className} use:styleable={$component.styles}>{text}</del>
{:else if isTag('ins')}
<ins class={className} use:styleable={$component.styles}>{text}</ins>
{:else if isTag('sub')}
<sub class={className} use:styleable={$component.styles}>{text}</sub>
{:else if isTag('sup')}
<sup class={className} use:styleable={$component.styles}>{text}</sup>
{:else}<span use:styleable={$component.styles}>{text}</span>{/if}
<style> <style>
span { p {
display: inline-block; display: inline-block;
white-space: pre-wrap;
} }
</style> </style>