From 8da2e1e9b019a434d96e43b0aab46c1996b49db3 Mon Sep 17 00:00:00 2001 From: Matthew Irish Date: Thu, 10 Jan 2019 10:37:25 -0600 Subject: [PATCH] UI - kv save error (#6022) * don't prevent model save when the model is in the error state on secrets creation * add test --- ui/app/components/secret-edit.js | 9 +-------- .../integration/components/secret-edit-test.js | 14 ++++++++++++++ 2 files changed, 15 insertions(+), 8 deletions(-) diff --git a/ui/app/components/secret-edit.js b/ui/app/components/secret-edit.js index f1f1452ec5..843588dc80 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; diff --git a/ui/tests/integration/components/secret-edit-test.js b/ui/tests/integration/components/secret-edit-test.js index 1ef81b20f5..6ffa24a851 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``); + 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 = {