From 8a65b3004282b01f59c278e3f1bd4aabf59a19fc Mon Sep 17 00:00:00 2001 From: Andrew Kingston Date: Fri, 17 Dec 2021 11:37:50 +0000 Subject: [PATCH] Add pagination tab to query UI --- .../builder/src/constants/backend/index.js | 10 ++++ .../rest/[query]/index.svelte | 47 +++++++++++++++++++ 2 files changed, 57 insertions(+) diff --git a/packages/builder/src/constants/backend/index.js b/packages/builder/src/constants/backend/index.js index 1f49b0b26f..158734ee07 100644 --- a/packages/builder/src/constants/backend/index.js +++ b/packages/builder/src/constants/backend/index.js @@ -211,3 +211,13 @@ export const RestBodyTypes = [ { name: "raw (XML)", value: "xml" }, { name: "raw (Text)", value: "text" }, ] + +export const PaginationTypes = [ + { label: "Page number based", value: "page" }, + { label: "Cursor based", value: "cursor" }, +] + +export const PaginationLocations = [ + { label: "Query parameters", value: "query" }, + { label: "Request body", value: "body" }, +] diff --git a/packages/builder/src/pages/builder/app/[application]/data/datasource/[selectedDatasource]/rest/[query]/index.svelte b/packages/builder/src/pages/builder/app/[application]/data/datasource/[selectedDatasource]/rest/[query]/index.svelte index 39d02d5dd8..5a192099ba 100644 --- a/packages/builder/src/pages/builder/app/[application]/data/datasource/[selectedDatasource]/rest/[query]/index.svelte +++ b/packages/builder/src/pages/builder/app/[application]/data/datasource/[selectedDatasource]/rest/[query]/index.svelte @@ -38,6 +38,8 @@ import { RestBodyTypes as bodyTypes, SchemaTypeOptions, + PaginationLocations, + PaginationTypes, } from "constants/backend" import JSONPreview from "components/integration/JSONPreview.svelte" import AccessLevelSelect from "components/integration/AccessLevelSelect.svelte" @@ -203,6 +205,9 @@ if (query && !query.fields.bodyType) { query.fields.bodyType = "none" } + if (query && !query.pagination) { + query.pagination = {} + } }) @@ -270,6 +275,43 @@ /> + + + {#if !$flags.queryTransformerBanner} @@ -458,4 +500,9 @@ .auth-select { width: 200px; } + .pagination { + display: grid; + grid-template-columns: 1fr 1fr; + gap: var(--spacing-m); + }