Skip to content

Commit

Permalink
CC-6362: pass route info to pagination (#65)
Browse files Browse the repository at this point in the history
* Add model/models/replace to Cut::List::Pagination

* Fix docs pagination query parameters
  • Loading branch information
WenInCode committed Sep 13, 2023
1 parent 6c25544 commit 19cecc9
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 7 deletions.
6 changes: 6 additions & 0 deletions .changeset/tall-windows-allow.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
'@hashicorp/consul-ui-toolkit': minor
---

Add model/models/replace to `Cut::List::Pagination`
Update type for replace & query
5 changes: 4 additions & 1 deletion documentation/app/routes/components/list.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,10 @@ import { v4 as uuidv4 } from 'uuid';

export default class ListRoute extends Route {
queryParams = {
page: {
nextPage: {
refreshModel: true,
},
previousPage: {
refreshModel: true,
},
pageSize: {
Expand Down
12 changes: 6 additions & 6 deletions toolkit/src/components/cut/list-item/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ export interface ListItemSignature {
isHrefExternal?: boolean;
route?: string;
isRouteExternal?: boolean;
query?: object;
replace?: string;
query?: unknown;
replace?: boolean;
model?: string | unknown;
models?: string[] | unknown[];
onClick(): void;
Expand All @@ -23,8 +23,8 @@ export interface ServiceInstanceListItemSignature {
isHrefExternal?: boolean;
route?: string;
isRouteExternal?: boolean;
query?: object;
replace?: string;
query?: unknown;
replace?: boolean;
model?: string | unknown;
models?: string[] | unknown[];
onClick(): void;
Expand All @@ -41,8 +41,8 @@ export interface ServiceListItemSignature {
isHrefExternal?: boolean;
route?: string;
isRouteExternal?: boolean;
query?: object;
replace?: string;
query?: unknown;
replace?: boolean;
model?: string | unknown;
models?: string[] | unknown[];
onClick(): void;
Expand Down
3 changes: 3 additions & 0 deletions toolkit/src/components/cut/list/pagination.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@
@showLabels={{true}}
@queryFunction={{this.queryFunction}}
@route={{or @route this.router.currentRouteName}}
@model={{@model}}
@models={{@models}}
@replace={{@replace}}
@isDisabledPrev={{not @prevCursor}}
@isDisabledNext={{not @nextCursor}}
/>
Expand Down
3 changes: 3 additions & 0 deletions toolkit/src/components/cut/list/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ export interface PaginationSignature {
prevCursor?: string;
pageSizes?: number[];
currentPageSize?: number;
model?: string | unknown;
models?: string[] | unknown[];
replace?: boolean;
queryFunction?: (page: string) => {
[key: string]: string | number | unknown;
};
Expand Down

1 comment on commit 19cecc9

@vercel
Copy link

@vercel vercel bot commented on 19cecc9 Sep 13, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.