-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
Implement ember-cp-validations on KV secret engine #11785
Conversation
@message="Your policies prevent you from reading the current secret data. Saving using this form will overwrite the existing values." | ||
@class="is-marginless" | ||
data-test-v1-write-without-read | ||
{{#if (and (or @model.isNew @canEditV2Secret) @isV2 (not @model.failedServerRead))}} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixing spacing here, hence the big diff.
return; | ||
} | ||
const maxVersions = secret.get('maxVersions'); | ||
if (MAXIMUM_VERSIONS < maxVersions) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note to future onlookers: this check was moved to secret-v2 model
* @param attr=null {Object} - This is usually derived from ember model `attributes` lookup, and all members of `attr.options` are optional. | ||
* @param model=null {DS.Model} - The Ember Data model that `attr` is defined on | ||
* @param [disabled=false] {Boolean} - whether the field is disabled | ||
* @param [showHelpText=true] {Boolean} - whether to show the tooltip with help text from OpenAPI | ||
* @param [subText] {String} - Text to be displayed below the label | ||
* @param [validationMessage] {String} - AlertInline error message to be displayed if cp-validation error. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💯
@@ -56,6 +64,22 @@ module('Acceptance | secrets/secret/create', function(hooks) { | |||
assert.ok(showPage.editIsPresent, 'shows the edit button'); | |||
}); | |||
|
|||
test('it disables save when validation errors occur', async function(assert) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👏
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great work!
One PR of many to come where we'll be adding form validations to various forms in the application. This first PR tackles the KV secret engine.
In an earlier demo, I used the ember-changeset-validations library. In this, I'm using the ember-cp-validations library and I much prefer the latter. It does not modify the whole model object but instead adds to it using a mixin. It's much easier to use, and more importantly, it should be usable in new glimmer components.
Notes:
max_versions
is not saving on create. This will be addressed in another ticket.Path
Create and Edit Secret