backend bug fixes

This commit is contained in:
Martin McKeaveney 2020-09-14 11:03:27 +01:00
parent f1cb475f7b
commit a72e6968e1
4 changed files with 22 additions and 8 deletions

View File

@ -12,6 +12,5 @@
</script>
<div class="bb-margin-m">
<Label small forAttr={'datepicker-label'}>{label}</Label>
<DatePicker placeholder={label} on:change={onChange} {value} />
</div>

View File

@ -71,7 +71,16 @@
}
function addFilter() {
view.filters = [...view.filters, {}]
view.filters.push({})
view.filters = view.filters
}
function isMultipleChoice(field) {
return (
viewModel.schema[field].constraints &&
viewModel.schema[field].constraints.inclusion &&
viewModel.schema[field].constraints.inclusion.length
)
}
</script>
@ -108,10 +117,18 @@
<option value={condition.key}>{condition.name}</option>
{/each}
</Select>
<Input
thin
placeholder={filter.key || fields[0]}
bind:value={filter.value} />
{#if filter.key && isMultipleChoice(filter.key)}
<Select secondary thin bind:value={filter.value}>
{#each viewModel.schema[filter.key].constraints.inclusion as option}
<option value={option}>{option}</option>
{/each}
</Select>
{:else}
<Input
thin
placeholder={filter.key || fields[0]}
bind:value={filter.value} />
{/if}
<i class="ri-close-circle-fill" on:click={() => removeFilter(idx)} />
{/each}
</div>

File diff suppressed because one or more lines are too long

View File

@ -41,7 +41,6 @@
([field, message]) => `${field} ${message}`
)
async function fetchModel() {
const FETCH_MODEL_URL = `/api/models/${model}`
const response = await _bb.api.get(FETCH_MODEL_URL)