mirror of
https://github.com/optim-enterprises-bv/vault.git
synced 2025-11-26 23:05:11 +00:00
VAULT-13220 use decorator instead of extending overview route (#19294)
This commit is contained in:
@@ -1,24 +1,14 @@
|
||||
import Route from '@ember/routing/route';
|
||||
import { inject as service } from '@ember/service';
|
||||
import { withConfig } from 'pki/decorators/check-config';
|
||||
import { hash } from 'rsvp';
|
||||
|
||||
@withConfig()
|
||||
export default class PkiOverviewRoute extends Route {
|
||||
@service secretMountPath;
|
||||
@service auth;
|
||||
@service store;
|
||||
|
||||
hasConfig() {
|
||||
// When the engine is configured, it creates a default issuer.
|
||||
// If the issuers list is empty, we know it hasn't been configured
|
||||
return (
|
||||
this.store
|
||||
.query('pki/issuer', { backend: this.secretMountPath.currentPath })
|
||||
.then(() => true)
|
||||
// this endpoint is unauthenticated, so we're not worried about permissions errors
|
||||
.catch(() => false)
|
||||
);
|
||||
}
|
||||
|
||||
async fetchAllRoles() {
|
||||
try {
|
||||
return await this.store.query('pki/role', { backend: this.secretMountPath.currentPath });
|
||||
@@ -37,7 +27,7 @@ export default class PkiOverviewRoute extends Route {
|
||||
|
||||
async model() {
|
||||
return hash({
|
||||
hasConfig: this.hasConfig(),
|
||||
hasConfig: this.shouldPromptConfig,
|
||||
engine: this.modelFor('application'),
|
||||
roles: this.fetchAllRoles(),
|
||||
issuers: this.fetchAllIssuers(),
|
||||
|
||||
Reference in New Issue
Block a user