Update query pagination to be stored in fields

This commit is contained in:
Andrew Kingston 2021-12-17 18:39:22 +00:00
parent 7769ba4d6a
commit bd135d65d9
1 changed files with 11 additions and 11 deletions

View File

@ -215,8 +215,8 @@
if (query && !query.fields.bodyType) { if (query && !query.fields.bodyType) {
query.fields.bodyType = "none" query.fields.bodyType = "none"
} }
if (query && !query.pagination) { if (query && !query.fields.pagination) {
query.pagination = {} query.fields.pagination = {}
} }
dynamicVariables = restUtils.variablesToObject(datasource) dynamicVariables = restUtils.variablesToObject(datasource)
}) })
@ -296,34 +296,34 @@
<div class="pagination"> <div class="pagination">
<Select <Select
label="Pagination type" label="Pagination type"
bind:value={query.pagination.type} bind:value={query.fields.pagination.type}
options={PaginationTypes} options={PaginationTypes}
placeholder="None" placeholder="None"
/> />
{#if query.pagination.type} {#if query.fields.pagination.type}
<Select <Select
label="Pagination parameters location" label="Pagination parameters location"
bind:value={query.pagination.location} bind:value={query.fields.pagination.location}
options={PaginationLocations} options={PaginationLocations}
placeholer="Choose where to send pagination parameters" placeholer="Choose where to send pagination parameters"
/> />
<Input <Input
label={query.pagination.type === "page" label={query.fields.pagination.type === "page"
? "Page number parameter" ? "Page number parameter"
: "Request cursor parameter"} : "Request cursor parameter"}
bind:value={query.pagination.pageParam} bind:value={query.fields.pagination.pageParam}
/> />
<Input <Input
label={query.pagination.type === "page" label={query.fields.pagination.type === "page"
? "Page size parameter" ? "Page size parameter"
: "Request limit parameter"} : "Request limit parameter"}
bind:value={query.pagination.sizeParam} bind:value={query.fields.pagination.sizeParam}
info="asdasd" info="asdasd"
/> />
{#if query.pagination.type === "cursor"} {#if query.fields.pagination.type === "cursor"}
<Input <Input
label="Response body parameter for cursor" label="Response body parameter for cursor"
bind:value={query.pagination.responseParam} bind:value={query.fields.pagination.responseParam}
/> />
{/if} {/if}
{/if} {/if}