From 95612186d82ed297f1af606a0133783ffcc7ee2d Mon Sep 17 00:00:00 2001 From: Susmitha Girumala Date: Tue, 20 Jul 2021 08:50:31 -0400 Subject: [PATCH 1/2] feat: View credential library details --- ui/admin/app/router.js | 5 ++ .../credential-library.js | 49 +++++++++++++++++++ .../credential-library/index.js | 3 ++ .../credential-library.hbs | 3 ++ .../credential-library/-actions.hbs | 0 .../credential-library/-header.hbs | 9 ++++ .../credential-library/-navigation.hbs | 7 +++ .../credential-library/index.hbs | 5 ++ .../credential-libraries/index.hbs | 7 ++- .../credential-library-test.js | 16 ++++++ .../credential-library/index-test.js | 16 ++++++ 11 files changed, 119 insertions(+), 1 deletion(-) create mode 100644 ui/admin/app/routes/scopes/scope/credential-stores/credential-store/credential-libraries/credential-library.js create mode 100644 ui/admin/app/routes/scopes/scope/credential-stores/credential-store/credential-libraries/credential-library/index.js create mode 100644 ui/admin/app/templates/scopes/scope/credential-stores/credential-store/credential-libraries/credential-library.hbs create mode 100644 ui/admin/app/templates/scopes/scope/credential-stores/credential-store/credential-libraries/credential-library/-actions.hbs create mode 100644 ui/admin/app/templates/scopes/scope/credential-stores/credential-store/credential-libraries/credential-library/-header.hbs create mode 100644 ui/admin/app/templates/scopes/scope/credential-stores/credential-store/credential-libraries/credential-library/-navigation.hbs create mode 100644 ui/admin/app/templates/scopes/scope/credential-stores/credential-store/credential-libraries/credential-library/index.hbs create mode 100644 ui/admin/tests/unit/routes/scopes/scope/credential-stores/credential-store/credential-libraries/credential-library-test.js create mode 100644 ui/admin/tests/unit/routes/scopes/scope/credential-stores/credential-store/credential-libraries/credential-library/index-test.js diff --git a/ui/admin/app/router.js b/ui/admin/app/router.js index 3c359e268..a1bfa1e18 100644 --- a/ui/admin/app/router.js +++ b/ui/admin/app/router.js @@ -93,6 +93,11 @@ Router.map(function () { function () { this.route('credential-libraries', function () { this.route('new'); + this.route( + 'credential-library', + { path: ':credential_library_id' }, + function () {} + ); }); } ); diff --git a/ui/admin/app/routes/scopes/scope/credential-stores/credential-store/credential-libraries/credential-library.js b/ui/admin/app/routes/scopes/scope/credential-stores/credential-store/credential-libraries/credential-library.js new file mode 100644 index 000000000..45f5953fb --- /dev/null +++ b/ui/admin/app/routes/scopes/scope/credential-stores/credential-store/credential-libraries/credential-library.js @@ -0,0 +1,49 @@ +import Route from '@ember/routing/route'; + +export default class ScopesScopeCredentialStoresCredentialStoreCredentialLibrariesCredentialLibraryRoute extends Route { + // =methods + + /** + * Load a credential-library using current credential store and its parent scope. + * @param {object} params + * @param {string} params.credential_library_id + * @return {CredentialLibraryModel} + */ + async model({ credential_library_id }) { + return this.store.findRecord('credential-library', credential_library_id, { + reload: true, + }); + } + + /** + * Renders the credential library specific templates for header, navigation, and action page sections. + * @override + */ + renderTemplate() { + super.renderTemplate(...arguments); + + this.render( + 'scopes/scope/credential-stores/credential-store/credential-libraries/credential-library/-header', + { + into: 'scopes/scope/credential-stores/credential-store', + outlet: 'header', + } + ); + + this.render( + 'scopes/scope/credential-stores/credential-store/credential-libraries/credential-library/-navigation', + { + into: 'scopes/scope/credential-stores/credential-store', + outlet: 'navigation', + } + ); + + this.render( + 'scopes/scope/credential-stores/credential-store/credential-libraries/credential-library/-actions', + { + into: 'scopes/scope/credential-stores/credential-store', + outlet: 'actions', + } + ); + } +} diff --git a/ui/admin/app/routes/scopes/scope/credential-stores/credential-store/credential-libraries/credential-library/index.js b/ui/admin/app/routes/scopes/scope/credential-stores/credential-store/credential-libraries/credential-library/index.js new file mode 100644 index 000000000..8d9b40c15 --- /dev/null +++ b/ui/admin/app/routes/scopes/scope/credential-stores/credential-store/credential-libraries/credential-library/index.js @@ -0,0 +1,3 @@ +import Route from '@ember/routing/route'; + +export default class ScopesScopeCredentialStoresCredentialStoreCredentialLibrariesCredentialLibraryIndexRoute extends Route {} diff --git a/ui/admin/app/templates/scopes/scope/credential-stores/credential-store/credential-libraries/credential-library.hbs b/ui/admin/app/templates/scopes/scope/credential-stores/credential-store/credential-libraries/credential-library.hbs new file mode 100644 index 000000000..7d32ecb0d --- /dev/null +++ b/ui/admin/app/templates/scopes/scope/credential-stores/credential-store/credential-libraries/credential-library.hbs @@ -0,0 +1,3 @@ +{{page-title @model.displayName}} + +{{outlet}} \ No newline at end of file diff --git a/ui/admin/app/templates/scopes/scope/credential-stores/credential-store/credential-libraries/credential-library/-actions.hbs b/ui/admin/app/templates/scopes/scope/credential-stores/credential-store/credential-libraries/credential-library/-actions.hbs new file mode 100644 index 000000000..e69de29bb diff --git a/ui/admin/app/templates/scopes/scope/credential-stores/credential-store/credential-libraries/credential-library/-header.hbs b/ui/admin/app/templates/scopes/scope/credential-stores/credential-store/credential-libraries/credential-library/-header.hbs new file mode 100644 index 000000000..3c2de9eef --- /dev/null +++ b/ui/admin/app/templates/scopes/scope/credential-stores/credential-store/credential-libraries/credential-library/-header.hbs @@ -0,0 +1,9 @@ +

{{t 'resources.credential-library.title'}}

+

{{t 'resources.credential-library.description'}}

+ + {{@model.id}} + \ No newline at end of file diff --git a/ui/admin/app/templates/scopes/scope/credential-stores/credential-store/credential-libraries/credential-library/-navigation.hbs b/ui/admin/app/templates/scopes/scope/credential-stores/credential-store/credential-libraries/credential-library/-navigation.hbs new file mode 100644 index 000000000..d5bb5cf63 --- /dev/null +++ b/ui/admin/app/templates/scopes/scope/credential-stores/credential-store/credential-libraries/credential-library/-navigation.hbs @@ -0,0 +1,7 @@ + + + {{t 'titles.details'}} + + \ No newline at end of file diff --git a/ui/admin/app/templates/scopes/scope/credential-stores/credential-store/credential-libraries/credential-library/index.hbs b/ui/admin/app/templates/scopes/scope/credential-stores/credential-store/credential-libraries/credential-library/index.hbs new file mode 100644 index 000000000..648221a43 --- /dev/null +++ b/ui/admin/app/templates/scopes/scope/credential-stores/credential-store/credential-libraries/credential-library/index.hbs @@ -0,0 +1,5 @@ + \ 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 index 2164989cc..cbe1ede49 100644 --- 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 @@ -11,7 +11,12 @@ {{#each @model as |credentialLibrary|}} - {{credentialLibrary.displayName}} + + {{credentialLibrary.displayName}} +

{{credentialLibrary.description}}

diff --git a/ui/admin/tests/unit/routes/scopes/scope/credential-stores/credential-store/credential-libraries/credential-library-test.js b/ui/admin/tests/unit/routes/scopes/scope/credential-stores/credential-store/credential-libraries/credential-library-test.js new file mode 100644 index 000000000..54025fe54 --- /dev/null +++ b/ui/admin/tests/unit/routes/scopes/scope/credential-stores/credential-store/credential-libraries/credential-library-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/credential-library', + function (hooks) { + setupTest(hooks); + + test('it exists', function (assert) { + let route = this.owner.lookup( + 'route:scopes/scope/credential-stores/credential-store/credential-libraries/credential-library' + ); + assert.ok(route); + }); + } +); diff --git a/ui/admin/tests/unit/routes/scopes/scope/credential-stores/credential-store/credential-libraries/credential-library/index-test.js b/ui/admin/tests/unit/routes/scopes/scope/credential-stores/credential-store/credential-libraries/credential-library/index-test.js new file mode 100644 index 000000000..1e4586a16 --- /dev/null +++ b/ui/admin/tests/unit/routes/scopes/scope/credential-stores/credential-store/credential-libraries/credential-library/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/credential-library/index', + function (hooks) { + setupTest(hooks); + + test('it exists', function (assert) { + let route = this.owner.lookup( + 'route:scopes/scope/credential-stores/credential-store/credential-libraries/credential-library/index' + ); + assert.ok(route); + }); + } +); From 027371567b5341a4de9da2146e0050280ce0b5a9 Mon Sep 17 00:00:00 2001 From: Susmitha Girumala Date: Thu, 22 Jul 2021 18:02:29 -0400 Subject: [PATCH 2/2] fix: Disable credential library view in non-edit mode --- ui/admin/app/components/form/credential-library/index.hbs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/ui/admin/app/components/form/credential-library/index.hbs b/ui/admin/app/components/form/credential-library/index.hbs index f55445503..6c396faf0 100644 --- a/ui/admin/app/components/form/credential-library/index.hbs +++ b/ui/admin/app/components/form/credential-library/index.hbs @@ -12,6 +12,7 @@ @label={{t 'form.name.label'}} @error={{@model.errors.name}} @helperText={{t 'form.name.help'}} + disabled={{@model.isSaving}} readonly={{false}} as |field| > @@ -31,7 +32,7 @@ @label={{t 'form.description.label'}} @error={{@model.errors.description}} @helperText={{t 'form.description.help'}} - @disabled={{@model.isSaving}} + disabled={{@model.isSaving}} readonly={{false}} as |field| > @@ -51,6 +52,7 @@ @label={{t 'resources.credential-library.form.vault_path.label'}} @error={{@model.errors.attributes_path}} @helperText={{t 'resources.credential-library.form.vault_path.help'}} + disabled={{@model.isSaving}} readonly={{false}} as |field| > @@ -74,6 +76,7 @@ @selectedValue={{@model.attributes.http_method}} @changed={{fn (mut @model.attributes.http_method)}} @inline={{true}} + disabled={{@model.isSaving}} as |radioGroup| > {{#each this.httpMethodOptions as |httpMethod|}} @@ -103,7 +106,7 @@ @helperText={{t 'resources.credential-library.form.http_request_body.help' }} - @disabled={{this.cannotSaveHttpRequestBody}} + disabled={{@model.isSaving}} readonly={{false}} as |field| >