Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UI - kv save error #6022

Merged
merged 2 commits into from
Jan 10, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 1 addition & 8 deletions ui/app/components/secret-edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
14 changes: 14 additions & 0 deletions ui/tests/integration/components/secret-edit-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {
Expand Down