-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
5c70155
commit 0584387
Showing
14 changed files
with
799 additions
and
262 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
/** | ||
* Copyright (c) 2023 Gitpod GmbH. All rights reserved. | ||
* Licensed under the GNU Affero General Public License (AGPL). | ||
* See License.AGPL.txt in the project root for license information. | ||
*/ | ||
|
||
import { PaginationRequest } from "@gitpod/public-api/lib/gitpod/v1/pagination_pb"; | ||
|
||
export interface ParsedPagination { | ||
offset: number; | ||
limit: number; | ||
} | ||
|
||
const MAX_PAGE_SIZE = 100; | ||
export function parsePagination( | ||
pagination: Partial<PaginationRequest> | undefined, | ||
defaultPageSize = 50, | ||
): ParsedPagination { | ||
let limit = pagination?.pageSize ?? defaultPageSize; | ||
if (limit < 1) { | ||
limit = defaultPageSize; | ||
} | ||
if (limit > MAX_PAGE_SIZE) { | ||
limit = MAX_PAGE_SIZE; | ||
} | ||
const offset = (pagination?.page ?? 0) * limit; | ||
return { | ||
offset, | ||
limit, | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -31,3 +31,5 @@ rm -rf go/experimental | |
protoc_buf_generate | ||
|
||
update_license | ||
|
||
yarn --cwd typescript build |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 24 additions & 0 deletions
24
components/public-api/go/v1/v1connect/workspace.connect.go
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
10 changes: 10 additions & 0 deletions
10
components/public-api/go/v1/v1connect/workspace.proxy.connect.go
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.