Create static credentials tab (#1203)
Create static credentials tab (#1203)
This commit is contained in:
1 parent
821b9b56a7
commit
b31a513ec1
8 files changed
+88
-4
No files matched your search
@@ -374,6 +374,10 @@ credential-library:
|
||||
help: The body of the HTTP request the library sends to Vault when requesting credentials. Only allowed when HTTP method is set to POST.
|
||||
types:
|
||||
vault: Vault
|
||||
static: Static
|
||||
credential:
|
||||
title: Credential
|
||||
title_plural: Credentials
|
||||
scope:
|
||||
title: Scope
|
||||
title_plural: Scopes
|
||||
|
||||
@@ -2,12 +2,19 @@
|
||||
<nav.link @route='scopes.scope.credential-stores.credential-store.index'>
|
||||
{{t 'titles.details'}}
|
||||
</nav.link>
|
||||
{{#if (can 'navigate model' @model collection='credential-libraries')}}
|
||||
|
||||
{{#if @model.isVault}}
|
||||
{{#if (can 'navigate model' @model collection='credential-libraries')}}
|
||||
<nav.link
|
||||
@route='scopes.scope.credential-stores.credential-store.credential-libraries'
|
||||
>
|
||||
{{t 'resources.credential-library.title_plural'}}
|
||||
</nav.link>
|
||||
{{/if}}
|
||||
{{else}}
|
||||
<nav.link
|
||||
@route='scopes.scope.credential-stores.credential-store.credential-libraries'
|
||||
@route='scopes.scope.credential-stores.credential-store.credentials'
|
||||
>
|
||||
{{t 'resources.credential-library.title_plural'}}
|
||||
{{t 'resources.credential.title_plural'}}
|
||||
</nav.link>
|
||||
{{/if}}
|
||||
</Rose::Nav::Tabs>
|
||||
@@ -113,6 +113,14 @@ Router.map(function () {
|
||||
function () {}
|
||||
);
|
||||
});
|
||||
this.route('credentials', function () {
|
||||
this.route('new');
|
||||
this.route(
|
||||
'credential',
|
||||
{ path: ':credential_id' },
|
||||
function () {}
|
||||
);
|
||||
});
|
||||
}
|
||||
);
|
||||
this.route('new');
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
import Route from '@ember/routing/route';
|
||||
|
||||
import { inject as service } from '@ember/service';
|
||||
|
||||
export default class ScopesScopeCredentialStoresCredentialStoreCredentialsRoute extends Route {
|
||||
// =services
|
||||
|
||||
@service can;
|
||||
@service router;
|
||||
|
||||
// =methods
|
||||
|
||||
/**
|
||||
* Loads all credentials under the current credential store.
|
||||
* @return {Promise{[CredentialModel]}}
|
||||
*/
|
||||
model() {
|
||||
const credentialStore = this.modelFor(
|
||||
'scopes.scope.credential-stores.credential-store'
|
||||
);
|
||||
const { id: credential_store_id } = credentialStore;
|
||||
if (
|
||||
this.can.can('list model', credentialStore, {
|
||||
collection: 'credentials',
|
||||
})
|
||||
) {
|
||||
return this.store.query('credential', { credential_store_id });
|
||||
}
|
||||
}
|
||||
}
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
import Route from '@ember/routing/route';
|
||||
|
||||
export default class ScopesScopeCredentialStoresCredentialStoreCredentialsIndexRoute extends Route {
|
||||
// =methods
|
||||
|
||||
setupController(controller) {
|
||||
const credentialStore = this.modelFor(
|
||||
'scopes.scope.credential-stores.credential-store'
|
||||
);
|
||||
super.setupController(...arguments);
|
||||
controller.setProperties({ credentialStore });
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
{{page-title (t 'resources.credential.title_plural')}}
|
||||
|
||||
{{outlet}}
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
{{page-title (t 'resources.credential.title_plural')}}
|
||||
|
||||
{{outlet}}
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
import { module, test } from 'qunit';
|
||||
import { setupTest } from 'ember-qunit';
|
||||
|
||||
module(
|
||||
'Unit | Route | scopes/scope/credential-stores/credential-store/credentials',
|
||||
function (hooks) {
|
||||
setupTest(hooks);
|
||||
|
||||
test('it exists', function (assert) {
|
||||
let route = this.owner.lookup(
|
||||
'route:scopes/scope/credential-stores/credential-store/credentials'
|
||||
);
|
||||
assert.ok(route);
|
||||
});
|
||||
}
|
||||
);
|
||||
Reference in new issue
Block a user