diff --git a/addons/api/addon/generated/models/credential-library.js b/addons/api/addon/generated/models/credential-library.js index 895c467f9..a5f63633a 100644 --- a/addons/api/addon/generated/models/credential-library.js +++ b/addons/api/addon/generated/models/credential-library.js @@ -8,6 +8,11 @@ import { attr } from '@ember-data/model'; export default class GeneratedCredentialLibraryModel extends BaseModel { // =attributes + @attr('string', { + description: 'The type of the resource, to help differentiate schemas', + }) + type; + @attr('string', { description: 'The owning credential store ID.', }) diff --git a/addons/api/mirage/factories/credential-library.js b/addons/api/mirage/factories/credential-library.js index f1127d5ef..06d8c4f6c 100644 --- a/addons/api/mirage/factories/credential-library.js +++ b/addons/api/mirage/factories/credential-library.js @@ -1,14 +1,20 @@ import factory from '../generated/factories/credential-library'; import { random, system } from 'faker'; +const types = ['vault']; + export default factory.extend({ id: (i) => `credential-library-id-${i}`, + type: (i) => types[i % types.length], attributes() { - return { - http_method: 'GET', - http_request_body: random.word(), - path: system.directoryPath(), - }; + switch (this.type) { + case 'vault': + return { + http_method: 'GET', + http_request_body: random.word(), + path: system.directoryPath(), + }; + } }, }); diff --git a/addons/api/tests/unit/serializers/credential-library-test.js b/addons/api/tests/unit/serializers/credential-library-test.js index 4be3c76f2..885474d42 100644 --- a/addons/api/tests/unit/serializers/credential-library-test.js +++ b/addons/api/tests/unit/serializers/credential-library-test.js @@ -9,6 +9,7 @@ module('Unit | Serializer | credential library', function (hooks) { const store = this.owner.lookup('service:store'); const serializer = store.serializerFor('credential-library'); const record = store.createRecord('credential-library', { + type: 'vault', name: 'Name', description: 'Description', attributes: { @@ -20,6 +21,7 @@ module('Unit | Serializer | credential library', function (hooks) { const snapshot = record._createSnapshot(); const serializedRecord = serializer.serialize(snapshot); assert.deepEqual(serializedRecord, { + type: 'vault', credential_store_id: null, name: 'Name', description: 'Description', @@ -40,6 +42,7 @@ module('Unit | Serializer | credential library', function (hooks) { id: '1', type: 'credential-library', attributes: { + type: 'vault', name: 'Name', description: 'Description', attributes: { @@ -54,6 +57,7 @@ module('Unit | Serializer | credential library', function (hooks) { const snapshot = record._createSnapshot(); const serializedRecord = serializer.serialize(snapshot); assert.deepEqual(serializedRecord, { + type: 'vault', credential_store_id: null, name: 'Name', description: 'Description', diff --git a/addons/core/translations/resources/en-us.yaml b/addons/core/translations/resources/en-us.yaml index 0867adc93..a448c0011 100644 --- a/addons/core/translations/resources/en-us.yaml +++ b/addons/core/translations/resources/en-us.yaml @@ -288,6 +288,8 @@ credential-store: title: Welcome to Credential Stores actions: delete: Delete Credential Store + types: + vault: Vault credential-library: title: Credential Library title_plural: Credential Libraries @@ -309,3 +311,5 @@ credential-library: http_request_body: label: HTTP Method POST Request Body 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 diff --git a/addons/rose/package.json b/addons/rose/package.json index dde5784b5..6e1f5fadb 100644 --- a/addons/rose/package.json +++ b/addons/rose/package.json @@ -83,7 +83,7 @@ "prettier": "^2.2.1", "qunit": "^2.13.0", "qunit-dom": "^1.6.0", - "sass": "^1.26.5", + "sass": "^1.36.0", "sass-lint": "^1.13.1" }, "engines": { diff --git a/ui/admin/app/components/form/credential-library/index.hbs b/ui/admin/app/components/form/credential-library/index.hbs index 88154aa84..3e3add0ee 100644 --- a/ui/admin/app/components/form/credential-library/index.hbs +++ b/ui/admin/app/components/form/credential-library/index.hbs @@ -5,6 +5,14 @@ @showEditToggle={{if @model.isNew false true}} as |form| > + + + {{t 'form.id.label'}} {{t 'form.name.label'}} + {{t 'form.type.label'}} @@ -30,6 +31,13 @@ /> {{credentialLibrary.name}} + + {{t + (concat + 'resources.credential-library.types.' credentialLibrary.type + ) + }} + {{/each}} diff --git a/ui/admin/app/routes/scopes/scope/credential-stores/credential-store/credential-libraries/new.js b/ui/admin/app/routes/scopes/scope/credential-stores/credential-store/credential-libraries/new.js index d83109dda..c9ccc770c 100644 --- a/ui/admin/app/routes/scopes/scope/credential-stores/credential-store/credential-libraries/new.js +++ b/ui/admin/app/routes/scopes/scope/credential-stores/credential-store/credential-libraries/new.js @@ -8,10 +8,11 @@ export default class ScopesScopeCredentialStoresCredentialStoreCredentialLibrari * @return {CredentialLibraryModel} */ model() { - const { id: credential_store_id } = this.modelFor( + const { id: credential_store_id, type } = this.modelFor( 'scopes.scope.credential-stores.credential-store' ); return this.store.createRecord('credential-library', { + type, credential_store_id, }); } 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 cbe1ede49..e97d52411 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 @@ -4,6 +4,7 @@ {{t 'form.name.label'}} + {{t 'form.type.label'}} {{t 'form.id.label'}} @@ -19,6 +20,13 @@

{{credentialLibrary.description}}

+ + {{t + (concat + 'resources.credential-library.types.' credentialLibrary.type + ) + }} + {{credentialStore.description}}

- {{credentialStore.type}} + {{t + (concat + 'resources.credential-store.types.' credentialStore.type + ) + }} {{t 'form.name.label'}} + {{t 'form.type.label'}} {{t 'form.id.label'}} {{t 'titles.actions'}} @@ -25,6 +26,13 @@

{{credentialLibrary.description}}

+ + {{t + (concat + 'resources.credential-library.types.' credentialLibrary.type + ) + }} + =3.0.0 <4.0.0"