fix: Treat credential library attributes as an object

This commit is contained in:
Susmitha Girumala committed 2021-07-19 12:05:40 -04:00
1 parent 45fc58fe75
commit 98e14a642f
5 files changed
+13 -35

No files matched your search

+1
View File
@@ -484,6 +484,7 @@ export default function () {
const attrs = this.normalizedRequestAttrs();
const credentialStore = credentialStores.find(attrs.credentialStoreId);
attrs.scopeId = credentialStore.scope.id;
console.log(attrs);
return credentialLibraries.create(attrs);
}
);
@@ -47,7 +47,7 @@
<form.input
@name='vault_path'
@type='text'
@value={{@model.attributes_path}}
@value={{@model.attributes.path}}
@label={{t 'form.vault_path.label'}}
@error={{@model.errors.name}}
@helperText={{t 'form.vault_path.help'}}
@@ -65,8 +65,8 @@
<form.radioGroup
@name='http_method'
@selectedValue={{@model.attributes_http_method}}
@changed={{fn (mut @model.attributes_http_method)}}
@selectedValue={{@model.attributes.http_method}}
@changed={{fn (mut @model.attributes.http_method)}}
as |radioGroup|
>
{{#each this.httpMethods as |httpMethod|}}
@@ -78,7 +78,7 @@
<form.textarea
@name='http_request_body'
@type='text'
@value={{@model.attributes_http_request_body}}
@value={{@model.attributes.http_request_body}}
@label={{t 'form.http_request_body.label'}}
@error={{@model.errors.description}}
@helperText={{t 'form.http_request_body.help'}}
@@ -13,8 +13,8 @@ export default class FormCredentialLibraryIndexComponent extends Component {
* Only allow HTTP request body field if http_method is set to POST.
* @type {boolean}
*/
@computed('args.model.attributes_http_method')
@computed('args.model.attributes.http_method')
get isHttpRequestBodyAllowed() {
return this.args.model.attributes_http_method?.match(/post/i);
return this.args.model.attributes.http_method?.match(/post/i);
}
}
@@ -38,6 +38,12 @@
<message.description>
{{t 'resources.credential-library.messages.none.description'}}
</message.description>
<message.link
@route='scopes.scope.credential-stores.credential-store.credential-libraries.new'
>
<Rose::Icon @name='plus-circle-outline' />
{{t 'titles.new'}}
</message.link>
</Rose::Message>
</Rose::Layout::Centered>
@@ -1,29 +0,0 @@
import { module, test } from 'qunit';
import { setupRenderingTest } from 'ember-qunit';
import { render } from '@ember/test-helpers';
import { hbs } from 'ember-cli-htmlbars';
module(
'Integration | Component | form/credential-library/index',
function (hooks) {
setupRenderingTest(hooks);
test('it renders', async function (assert) {
// Set any properties with this.set('myProperty', 'value');
// Handle any actions with this.set('myAction', function(val) { ... });
await render(hbs`<Form::CredentialLibrary::Index />`);
assert.equal(this.element.textContent.trim(), '');
// Template block usage:
await render(hbs`
<Form::CredentialLibrary::Index>
template block text
</Form::CredentialLibrary::Index>
`);
assert.equal(this.element.textContent.trim(), 'template block text');
});
}
);