From 2dafa205b9e4f071f81278c76ee82da5f5a477f9 Mon Sep 17 00:00:00 2001 From: Matthew Irish <matthew@hashicorp.com> Date: Wed, 9 Jan 2019 21:20:56 -0600 Subject: [PATCH 1/2] don't prevent model save when the model is in the error state on secrets creation --- ui/app/components/secret-edit.js | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/ui/app/components/secret-edit.js b/ui/app/components/secret-edit.js index f1f1452ec5bf..843588dc80f8 100644 --- a/ui/app/components/secret-edit.js +++ b/ui/app/components/secret-edit.js @@ -134,14 +134,7 @@ export default Component.extend(FocusOnInsertMixin, WithNavToNearestAncestor, { requestInFlight: or('model.isLoading', 'model.isReloading', 'model.isSaving'), - buttonDisabled: or( - 'requestInFlight', - 'model.isFolder', - 'model.isError', - 'model.flagsIsInvalid', - 'hasLintError', - 'error' - ), + buttonDisabled: or('requestInFlight', 'model.isFolder', 'model.flagsIsInvalid', 'hasLintError', 'error'), modelForData: computed('isV2', 'model', function() { return this.isV2 ? this.model.belongsTo('selectedVersion').value() : this.model; From e9d06acdc3e4de13b64dba9931a3b5bfb57a9678 Mon Sep 17 00:00:00 2001 From: Matthew Irish <matthew@hashicorp.com> Date: Wed, 9 Jan 2019 21:51:06 -0600 Subject: [PATCH 2/2] add test --- .../integration/components/secret-edit-test.js | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/ui/tests/integration/components/secret-edit-test.js b/ui/tests/integration/components/secret-edit-test.js index 1ef81b20f529..6ffa24a851a4 100644 --- a/ui/tests/integration/components/secret-edit-test.js +++ b/ui/tests/integration/components/secret-edit-test.js @@ -69,6 +69,20 @@ module('Integration | Component | secret edit', function(hooks) { assert.dom('[data-test-error]').includesText('Vault expects data to be formatted as an JSON object'); }); + test('it allows saving when the model isError', async function(assert) { + this.set('mode', 'create'); + this.set('model', { + isError: true, + secretData: { + int: '2', + null: 'null', + float: '1.234', + }, + }); + await render(hbs`<SecretEdit @mode={{mode}} @model={{model}} />`); + assert.dom('[data-test-secret-save]').isNotDisabled(); + }); + test('it shows an error when editing and the data is not an object', async function(assert) { this.set('mode', 'edit'); capabilities = {