diff --git a/addons/core/translations/resources/en-us.yaml b/addons/core/translations/resources/en-us.yaml index 8094abf9e..259824292 100644 --- a/addons/core/translations/resources/en-us.yaml +++ b/addons/core/translations/resources/en-us.yaml @@ -267,6 +267,11 @@ target: add: title: Add Host Sets description: Select host sets to assign to this target. + credential-library: + messages: + welcome: + title: Welcome to Credential Libraries + description: No credential libraries in this target. credential-store: title: Credential Store title_plural: Credential Stores diff --git a/ui/admin/app/controllers/scopes/scope/targets/target/credential-libraries.js b/ui/admin/app/controllers/scopes/scope/targets/target/credential-libraries.js new file mode 100644 index 000000000..ff0f8c558 --- /dev/null +++ b/ui/admin/app/controllers/scopes/scope/targets/target/credential-libraries.js @@ -0,0 +1,18 @@ +import Controller from '@ember/controller'; +import { inject as service } from '@ember/service'; + +export default class ScopesScopeTargetsTargetCredentialLibrariesController extends Controller { + // =services + + @service intl; + + // =attributes + + /** + * Translated credential library breadcrumb + * @type {string} + */ + get breadCrumb() { + return this.intl.t('resources.credential-library.title_plural'); + } +} diff --git a/ui/admin/app/router.js b/ui/admin/app/router.js index a1bfa1e18..8638e4e48 100644 --- a/ui/admin/app/router.js +++ b/ui/admin/app/router.js @@ -65,6 +65,7 @@ Router.map(function () { this.route('target', { path: ':target_id' }, function () { this.route('host-sets', function () {}); this.route('add-host-sets'); + this.route('credential-libraries'); }); this.route('new'); }); diff --git a/ui/admin/app/routes/scopes/scope/targets/target/credential-libraries.js b/ui/admin/app/routes/scopes/scope/targets/target/credential-libraries.js new file mode 100644 index 000000000..792cc2aa8 --- /dev/null +++ b/ui/admin/app/routes/scopes/scope/targets/target/credential-libraries.js @@ -0,0 +1,35 @@ +import Route from '@ember/routing/route'; +import { hash, all } from 'rsvp'; + +export default class ScopesScopeTargetsTargetCredentialLibrariesRoute extends Route { + // =methods + + /** + * Loads all credential libraries under the current target + * and it's parent scope. + * @return {Promise{[CredentialLibraryModel]}} + */ + beforeModel() { + const { application_credential_library_ids: credential_library_ids } = + this.modelFor('scopes.scope.targets.target'); + return hash({ + credentialLibraries: all( + credential_library_ids.map((credential_library) => + this.store.findRecord( + 'credential-library', + credential_library.value, + { reload: true } + ) + ) + ), + }); + } + + /** + * Returns the previously loaded target instance. + * @return {TargetModel} + */ + model() { + return this.modelFor('scopes.scope.targets.target'); + } +} diff --git a/ui/admin/app/templates/scopes/scope/targets/target/-navigation.hbs b/ui/admin/app/templates/scopes/scope/targets/target/-navigation.hbs index adbeded12..be112a45a 100644 --- a/ui/admin/app/templates/scopes/scope/targets/target/-navigation.hbs +++ b/ui/admin/app/templates/scopes/scope/targets/target/-navigation.hbs @@ -5,4 +5,7 @@ {{t 'resources.host-set.title_plural'}} + + {{t 'resources.credential-library.title_plural'}} + \ No newline at end of file diff --git a/ui/admin/app/templates/scopes/scope/targets/target/credential-libraries.hbs b/ui/admin/app/templates/scopes/scope/targets/target/credential-libraries.hbs new file mode 100644 index 000000000..ebba89bff --- /dev/null +++ b/ui/admin/app/templates/scopes/scope/targets/target/credential-libraries.hbs @@ -0,0 +1,54 @@ +{{page-title (t 'resources.credential-library.title_plural')}} + +{{#if @model.credentialLibraries}} + + + + + {{t 'form.name.label'}} + {{t 'form.id.label'}} + + + + {{#each @model.credentialLibraries as |credentialLibrary|}} + + + + {{credentialLibrary.displayName}} + + {{credentialLibrary.description}} + + + + {{credentialLibrary.id}} + + + + {{/each}} + + + +{{else}} + + + + + {{t 'resources.target.credential-library.messages.welcome.description'}} + + + + +{{/if}} \ No newline at end of file diff --git a/ui/admin/tests/unit/controllers/scopes/scope/targets/target/credential-libraries-test.js b/ui/admin/tests/unit/controllers/scopes/scope/targets/target/credential-libraries-test.js new file mode 100644 index 000000000..76a26ff69 --- /dev/null +++ b/ui/admin/tests/unit/controllers/scopes/scope/targets/target/credential-libraries-test.js @@ -0,0 +1,17 @@ +import { module, test } from 'qunit'; +import { setupTest } from 'ember-qunit'; + +module( + 'Unit | Controller | scopes/scope/targets/target/credential-libraries', + function (hooks) { + setupTest(hooks); + + // TODO: Replace this with your real tests. + test('it exists', function (assert) { + let controller = this.owner.lookup( + 'controller:scopes/scope/targets/target/credential-libraries' + ); + assert.ok(controller); + }); + } +); diff --git a/ui/admin/tests/unit/routes/scopes/scope/targets/target/credential-libraries-test.js b/ui/admin/tests/unit/routes/scopes/scope/targets/target/credential-libraries-test.js new file mode 100644 index 000000000..894e3add0 --- /dev/null +++ b/ui/admin/tests/unit/routes/scopes/scope/targets/target/credential-libraries-test.js @@ -0,0 +1,16 @@ +import { module, test } from 'qunit'; +import { setupTest } from 'ember-qunit'; + +module( + 'Unit | Route | scopes/scope/targets/target/credential-libraries', + function (hooks) { + setupTest(hooks); + + test('it exists', function (assert) { + let route = this.owner.lookup( + 'route:scopes/scope/targets/target/credential-libraries' + ); + assert.ok(route); + }); + } +);
{{credentialLibrary.description}}
{{credentialLibrary.id}}