Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UI: HDS adoption replace <ListPagination> component #23169

Merged
merged 11 commits into from
Sep 26, 2023
Copy link
Contributor Author

Choose a reason for hiding this comment

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

image

Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,15 @@ import Controller from '@ember/controller';
import ListController from 'core/mixins/list-controller';

export default Controller.extend(ListController, {
// callback from HDS pagination to set the queryParams page
get paginationQueryParams() {
return (page) => {
return {
page,
};
};
},

actions: {
onDelete() {
this.send('reload');
Expand Down
9 changes: 9 additions & 0 deletions ui/app/controllers/vault/cluster/access/identity/index.js
Copy link
Contributor Author

Choose a reason for hiding this comment

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

image

Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,15 @@ import ListController from 'core/mixins/list-controller';
export default Controller.extend(ListController, {
flashMessages: service(),

// callback from HDS pagination to set the queryParams page
get paginationQueryParams() {
return (page) => {
return {
page,
};
};
},

actions: {
delete(model) {
const type = model.get('identityType');
Expand Down
9 changes: 9 additions & 0 deletions ui/app/controllers/vault/cluster/access/leases/list.js
Copy link
Contributor Author

Choose a reason for hiding this comment

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

image

Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,15 @@ export default Controller.extend(ListController, {
store: service(),
clusterController: controller('vault.cluster'),

// callback from HDS pagination to set the queryParams page
get paginationQueryParams() {
return (page) => {
return {
page,
};
};
},

backendCrumb: computed('clusterController.model.name', function () {
return {
label: 'leases',
Expand Down
9 changes: 9 additions & 0 deletions ui/app/controllers/vault/cluster/policies/index.js
Copy link
Contributor Author

Choose a reason for hiding this comment

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

image

Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,15 @@ export default Controller.extend({
// set via the route `loading` action
isLoading: false,

// callback from HDS pagination to set the queryParams page
get paginationQueryParams() {
return (page) => {
return {
page,
};
};
},

filterMatchesKey: computed('filter', 'model', 'model.[]', function () {
var filter = this.filter;
var content = this.model;
Expand Down
9 changes: 9 additions & 0 deletions ui/app/controllers/vault/cluster/secrets/backend/list.js
Copy link
Contributor Author

Choose a reason for hiding this comment

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

image

Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,15 @@ export default Controller.extend(ListController, BackendCrumbMixin, WithNavToNea

tab: '',

// callback from HDS pagination to set the queryParams page
get paginationQueryParams() {
return (page) => {
return {
page,
};
};
},

filterIsFolder: computed('filter', function () {
return !!keyIsFolder(this.filter);
}),
Expand Down
200 changes: 0 additions & 200 deletions ui/app/styles/components/list-pagination.scss

This file was deleted.

1 change: 0 additions & 1 deletion ui/app/styles/core.scss
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,6 @@
@import './components/license-banners';
@import './components/linked-block';
@import './components/list-item-row';
@import './components/list-pagination';
Copy link
Contributor

Choose a reason for hiding this comment

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

🎉

@import './components/loader';
@import './components/login-form';
@import './components/masked-input';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,16 @@
</div>
</LinkedBlock>
{{/each}}
{{#if (gt this.model.meta.lastPage 1)}}
<ListPagination
@page={{this.model.meta.currentPage}}
@lastPage={{this.model.meta.lastPage}}
@link="vault.cluster.access.identity.aliases.index"
/>
{{/if}}

<Hds::Pagination::Numbered
@currentPage={{this.model.meta.currentPage}}
@currentPageSize={{this.model.meta.pageSize}}
@route="vault.cluster.access.identity.aliases.index"
@showSizeSelector={{false}}
@totalItems={{this.model.meta.total}}
@queryFunction={{this.paginationQueryParams}}
/>

{{else}}
<EmptyState
@title="No {{this.identityType}} aliases yet"
Expand Down
17 changes: 10 additions & 7 deletions ui/app/templates/vault/cluster/access/identity/index.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -96,13 +96,16 @@
</div>
</LinkedBlock>
{{/each}}
{{#if (gt this.model.meta.lastPage 1)}}
<ListPagination
@page={{this.model.meta.currentPage}}
@lastPage={{this.model.meta.lastPage}}
@link="vault.cluster.access.identity.index"
/>
{{/if}}

<Hds::Pagination::Numbered
@currentPage={{this.model.meta.currentPage}}
@currentPageSize={{this.model.meta.pageSize}}
@route="vault.cluster.access.identity.index"
@showSizeSelector={{false}}
@totalItems={{this.model.meta.total}}
@queryFunction={{this.paginationQueryParams}}
/>

{{else}}
<EmptyState
@title="No {{pluralize this.identityType}} yet"
Expand Down
17 changes: 9 additions & 8 deletions ui/app/templates/vault/cluster/access/leases/list.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -102,11 +102,12 @@
{{else}}
<EmptyState @title={{this.emptyTitle}} />
{{/if}}
{{#if (gt this.model.meta.lastPage 1)}}
<ListPagination
@page={{this.model.meta.currentPage}}
@lastPage={{this.model.meta.lastPage}}
@link={{concat "vault.cluster.access.leases.list" (unless this.baseKey.id "-root")}}
@models={{compact (array (if this.baseKey.id this.baseKey.id))}}
/>
{{/if}}

<Hds::Pagination::Numbered
@currentPage={{this.model.meta.currentPage}}
@currentPageSize={{this.model.meta.pageSize}}
@route={{concat "vault.cluster.access.leases.list" (unless this.baseKey.id "-root")}}
@showSizeSelector={{false}}
@totalItems={{this.model.meta.total}}
@queryFunction={{this.paginationQueryParams}}
/>
17 changes: 10 additions & 7 deletions ui/app/templates/vault/cluster/policies/index.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -151,13 +151,16 @@
{{else}}
<EmptyState @title="No policies matching &quot;{{this.pageFilter}}&quot;" />
{{/each}}
{{#if (gt this.model.meta.lastPage 1)}}
<ListPagination
@page={{this.model.meta.currentPage}}
@lastPage={{this.model.meta.lastPage}}
@link="vault.cluster.policies.index"
/>
{{/if}}

<Hds::Pagination::Numbered
@currentPage={{this.model.meta.currentPage}}
@currentPageSize={{this.model.meta.pageSize}}
@route="vault.cluster.policies.index"
@showSizeSelector={{false}}
@totalItems={{this.model.meta.total}}
@queryFunction={{this.paginationQueryParams}}
/>

{{else}}
<EmptyState
@title="No {{uppercase this.policyType}} policies yet"
Expand Down
Loading