claire bontempo 1fbbf9d76b
UI: Ember-data upgrade 5.3.2 prep: use custom service instead of extending ember-data store (#28695)
* rename store to pagination, remove store extension

* initial update of service test

* remove superfluous helper

* replace store with pagination service in main app

* update kmip engine syntax

* add pagination to kmip engine

* update to pagination in config-ui engine

* update sync engine to use pagination service

* use pagination service in kv engine

* use pagination service in ldap engine

* use pagination in pki engine

* update renaming clearDataset functions

* link to jira VAULT-31721

* remove comment
2024-10-17 10:00:57 -07:00

46 lines
1.1 KiB
JavaScript

/**
* Copyright (c) HashiCorp, Inc.
* SPDX-License-Identifier: BUSL-1.1
*/
import Route from '@ember/routing/route';
import ListRoute from 'core/mixins/list-route';
import { service } from '@ember/service';
export default Route.extend(ListRoute, {
pagination: service(),
secretMountPath: service(),
credParams() {
const { role_name: role, scope_name: scope } = this.paramsFor('credentials');
return {
role,
scope,
};
},
model(params) {
const { role, scope } = this.credParams();
return this.pagination
.lazyPaginatedQuery('kmip/credential', {
role,
scope,
backend: this.secretMountPath.currentPath,
responsePath: 'data.keys',
page: params.page,
pageFilter: params.pageFilter,
})
.catch((err) => {
if (err.httpStatus === 404) {
return [];
} else {
throw err;
}
});
},
setupController(controller) {
const { role, scope } = this.credParams();
this._super(...arguments);
controller.setProperties({ role, scope });
},
});