From 2212c7dd9ec5819e28cda502cf824ddea9ac99c5 Mon Sep 17 00:00:00 2001 From: Susmitha Girumala Date: Sun, 18 Jul 2021 12:34:33 -0400 Subject: [PATCH] feat: List credential libraries in a credential store --- addons/core/translations/resources/en-us.yaml | 8 ++++ ui/admin/app/router.js | 4 +- .../credential-store/credential-libraries.js | 16 +++++++ .../credential-libraries/index.js | 3 ++ .../credential-store/-navigation.hbs | 5 +++ .../credential-store/credential-libraries.hbs | 3 ++ .../credential-libraries/index.hbs | 44 +++++++++++++++++++ .../credential-libraries-test.js | 16 +++++++ .../credential-libraries/index-test.js | 16 +++++++ 9 files changed, 114 insertions(+), 1 deletion(-) create mode 100644 ui/admin/app/routes/scopes/scope/credential-stores/credential-store/credential-libraries.js create mode 100644 ui/admin/app/routes/scopes/scope/credential-stores/credential-store/credential-libraries/index.js create mode 100644 ui/admin/app/templates/scopes/scope/credential-stores/credential-store/credential-libraries.hbs create mode 100644 ui/admin/app/templates/scopes/scope/credential-stores/credential-store/credential-libraries/index.hbs create mode 100644 ui/admin/tests/unit/routes/scopes/scope/credential-stores/credential-store/credential-libraries-test.js create mode 100644 ui/admin/tests/unit/routes/scopes/scope/credential-stores/credential-store/credential-libraries/index-test.js diff --git a/addons/core/translations/resources/en-us.yaml b/addons/core/translations/resources/en-us.yaml index 2c9712a67..cc9fed978 100644 --- a/addons/core/translations/resources/en-us.yaml +++ b/addons/core/translations/resources/en-us.yaml @@ -271,3 +271,11 @@ credential-store: title: Credential Store title_plural: Credential Stores description: A credential stores is a collection of credentials and credential libraries. +credential-library: + title: Credential Library + title_plural: Credential Libraries + description: A credential library is a resource that provides credentials. + messages: + none: + title: No Credential Libraries Available + description: No Credential Libraries available in this credential store. \ No newline at end of file diff --git a/ui/admin/app/router.js b/ui/admin/app/router.js index 665582957..4012791b2 100644 --- a/ui/admin/app/router.js +++ b/ui/admin/app/router.js @@ -90,7 +90,9 @@ Router.map(function () { this.route( 'credential-store', { path: ':credential_store_id' }, - function () {} + function () { + this.route('credential-libraries', function () {}); + } ); this.route('new'); }); diff --git a/ui/admin/app/routes/scopes/scope/credential-stores/credential-store/credential-libraries.js b/ui/admin/app/routes/scopes/scope/credential-stores/credential-store/credential-libraries.js new file mode 100644 index 000000000..7c8ade755 --- /dev/null +++ b/ui/admin/app/routes/scopes/scope/credential-stores/credential-store/credential-libraries.js @@ -0,0 +1,16 @@ +import Route from '@ember/routing/route'; + +export default class ScopesScopeCredentialStoresCredentialStoreCredentialLibrariesRoute extends Route { + // =methods + + /** + * Loads all credential libraries under the current credential store. + * @return {Promise{[CredentialLibraryModel]}} + */ + model() { + const { id: credential_store_id } = this.modelFor( + 'scopes.scope.credential-stores.credential-store' + ); + return this.store.query('credential-library', { credential_store_id }); + } +} diff --git a/ui/admin/app/routes/scopes/scope/credential-stores/credential-store/credential-libraries/index.js b/ui/admin/app/routes/scopes/scope/credential-stores/credential-store/credential-libraries/index.js new file mode 100644 index 000000000..5b017ab54 --- /dev/null +++ b/ui/admin/app/routes/scopes/scope/credential-stores/credential-store/credential-libraries/index.js @@ -0,0 +1,3 @@ +import Route from '@ember/routing/route'; + +export default class ScopesScopeCredentialStoresCredentialStoreCredentialLibrariesIndexRoute extends Route {} diff --git a/ui/admin/app/templates/scopes/scope/credential-stores/credential-store/-navigation.hbs b/ui/admin/app/templates/scopes/scope/credential-stores/credential-store/-navigation.hbs index 86b9cf585..1fedd07d3 100644 --- a/ui/admin/app/templates/scopes/scope/credential-stores/credential-store/-navigation.hbs +++ b/ui/admin/app/templates/scopes/scope/credential-stores/credential-store/-navigation.hbs @@ -2,4 +2,9 @@ {{t 'titles.details'}} + + {{t 'resources.credential-library.title_plural'}} + \ No newline at end of file diff --git a/ui/admin/app/templates/scopes/scope/credential-stores/credential-store/credential-libraries.hbs b/ui/admin/app/templates/scopes/scope/credential-stores/credential-store/credential-libraries.hbs new file mode 100644 index 000000000..75899503d --- /dev/null +++ b/ui/admin/app/templates/scopes/scope/credential-stores/credential-store/credential-libraries.hbs @@ -0,0 +1,3 @@ +{{page-title (t 'resources.credential-library.title_plural')}} + +{{outlet}} \ No newline at end of file diff --git a/ui/admin/app/templates/scopes/scope/credential-stores/credential-store/credential-libraries/index.hbs b/ui/admin/app/templates/scopes/scope/credential-stores/credential-store/credential-libraries/index.hbs new file mode 100644 index 000000000..403a2175a --- /dev/null +++ b/ui/admin/app/templates/scopes/scope/credential-stores/credential-store/credential-libraries/index.hbs @@ -0,0 +1,44 @@ +{{#if @model}} + + + + + {{t 'form.name.label'}} + {{t 'form.id.label'}} + + + + {{#each @model as |credentialLibrary|}} + + + {{credentialLibrary.displayName}} +

{{credentialLibrary.description}}

+
+ + + {{credentialLibrary.id}} + + +
+ {{/each}} +
+
+ +{{else}} + + + + + {{t 'resources.credential-library.messages.none.description'}} + + + + +{{/if}} \ No newline at end of file diff --git a/ui/admin/tests/unit/routes/scopes/scope/credential-stores/credential-store/credential-libraries-test.js b/ui/admin/tests/unit/routes/scopes/scope/credential-stores/credential-store/credential-libraries-test.js new file mode 100644 index 000000000..80b64d780 --- /dev/null +++ b/ui/admin/tests/unit/routes/scopes/scope/credential-stores/credential-store/credential-libraries-test.js @@ -0,0 +1,16 @@ +import { module, test } from 'qunit'; +import { setupTest } from 'ember-qunit'; + +module( + 'Unit | Route | scopes/scope/credential-stores/credential-store/credential-libraries', + function (hooks) { + setupTest(hooks); + + test('it exists', function (assert) { + let route = this.owner.lookup( + 'route:scopes/scope/credential-stores/credential-store/credential-libraries' + ); + assert.ok(route); + }); + } +); diff --git a/ui/admin/tests/unit/routes/scopes/scope/credential-stores/credential-store/credential-libraries/index-test.js b/ui/admin/tests/unit/routes/scopes/scope/credential-stores/credential-store/credential-libraries/index-test.js new file mode 100644 index 000000000..9ee1756fe --- /dev/null +++ b/ui/admin/tests/unit/routes/scopes/scope/credential-stores/credential-store/credential-libraries/index-test.js @@ -0,0 +1,16 @@ +import { module, test } from 'qunit'; +import { setupTest } from 'ember-qunit'; + +module( + 'Unit | Route | scopes/scope/credential-stores/credential-store/credential-libraries/index', + function (hooks) { + setupTest(hooks); + + test('it exists', function (assert) { + let route = this.owner.lookup( + 'route:scopes/scope/credential-stores/credential-store/credential-libraries/index' + ); + assert.ok(route); + }); + } +);