Merge branch 'main' into chore-update-sass

This commit is contained in:
Carlos Alcaide Corvo authored and GitHub committed 2021-07-28 07:46:38 -07:00
commit 0b145fac47
10 files changed
+63 -7

No files matched your search

@@ -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.',
})
@@ -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(),
};
}
},
});
@@ -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',
@@ -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
@@ -5,6 +5,14 @@
@showEditToggle={{if @model.isNew false true}}
as |form|
>
<form.input
@value={{@model.type}}
@label={{t 'form.type.label'}}
readonly={{true}}
@disabled={{true}}
/>
<form.input
@name='name'
@type='name'
@@ -17,6 +17,7 @@
<header.row as |row|>
<row.headerCell>{{t 'form.id.label'}}</row.headerCell>
<row.headerCell>{{t 'form.name.label'}}</row.headerCell>
<row.headerCell>{{t 'form.type.label'}}</row.headerCell>
</header.row>
</table.header>
<table.body as |body|>
@@ -30,6 +31,13 @@
/>
</row.headerCell>
<row.cell>{{credentialLibrary.name}}</row.cell>
<row.cell>
<Rose::Badge>{{t
(concat
'resources.credential-library.types.' credentialLibrary.type
)
}}</Rose::Badge>
</row.cell>
</body.row>
{{/each}}
</table.body>
@@ -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,
});
}
@@ -4,6 +4,7 @@
<table.header as |header|>
<header.row as |row|>
<row.headerCell>{{t 'form.name.label'}}</row.headerCell>
<row.headerCell>{{t 'form.type.label'}}</row.headerCell>
<row.headerCell>{{t 'form.id.label'}}</row.headerCell>
</header.row>
</table.header>
@@ -19,6 +20,13 @@
</LinkTo>
<p>{{credentialLibrary.description}}</p>
</row.headerCell>
<row.cell>
<Rose::Badge>{{t
(concat
'resources.credential-library.types.' credentialLibrary.type
)
}}</Rose::Badge>
</row.cell>
<row.cell>
<Copyable
@text={{credentialLibrary.id}}
@@ -48,7 +48,11 @@
<p>{{credentialStore.description}}</p>
</row.headerCell>
<row.cell>
<Rose::Badge>{{credentialStore.type}}</Rose::Badge>
<Rose::Badge>{{t
(concat
'resources.credential-store.types.' credentialStore.type
)
}}</Rose::Badge>
</row.cell>
<row.cell>
<Copyable
@@ -6,6 +6,7 @@
<table.header as |header|>
<header.row as |row|>
<row.headerCell>{{t 'form.name.label'}}</row.headerCell>
<row.headerCell>{{t 'form.type.label'}}</row.headerCell>
<row.headerCell>{{t 'form.id.label'}}</row.headerCell>
<row.headerCell>{{t 'titles.actions'}}</row.headerCell>
</header.row>
@@ -25,6 +26,13 @@
</LinkTo>
<p>{{credentialLibrary.description}}</p>
</row.headerCell>
<row.cell>
<Rose::Badge>{{t
(concat
'resources.credential-library.types.' credentialLibrary.type
)
}}</Rose::Badge>
</row.cell>
<row.cell>
<Copyable
@text={{credentialLibrary.id}}