-
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
Masked input #4759
Masked input #4759
Conversation
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.
This is nice! 👍 I left some minor code style notes inline, nothing important.
One other thing: it looks like the integration test doesn't cover the displayOnly
configuration of the component, which is how it seems to be used in the app. Would it be reasonable to add tests for that, too?
ui/app/components/masked-input.js
Outdated
didRender(){ | ||
this._super(...arguments); | ||
autosize.update(this.element.querySelector('textarea')); | ||
}, |
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.
The didRender
hook is also fired on initial render. Maybe you want didUpdate
here? Component lifecycle hooks docs here
ui/app/components/masked-input.js
Outdated
onChange(){}, | ||
updateValue(e){ | ||
this.set('value', e.target.value); | ||
this.get('onChange')(); |
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.
This could be written as this.onChange()
, which might be a little easier to read.
wrap="off" | ||
placeholder="value" | ||
onfocus={{action "setFocus" true}} | ||
onblur={{action "setFocus" false}} |
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.
I think these could be {{action (mut setFocus) true}}
and …false}}
, removing the need for the action.
onfocus={{action "setFocus" true}} | ||
onblur={{action "setFocus" false}} | ||
onkeydown={{action onKeyDown}} | ||
onchange={{action updateValue}} |
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.
I think the action
helpers here are unneeded, as these attributes are already bound closure actions.
enterText: fillable('[data-test-textarea]'), | ||
toggleMasked: clickable('[data-test-button]'), | ||
focus: focusable('[data-test-textarea]'), | ||
blur: blurrable('[data-test-textarea]') |
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.
I did not know that focusable
and blurrable
were ecpo functions! Super useful.
ui/tests/acceptance/console-test.js
Outdated
andThen(() => { | ||
assert.equal(enginesPage.rows().count, numEngines + 3, 'new engines were added to the page'); | ||
}); | ||
}); |
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.
This test seems unrelated to the rest of the changes. Am I missing something?
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.
🤔 something odd going on - this is already in master https://github.com/hashicorp/vault/commits/master/ui/tests/acceptance/console-test.js
Maybe just needs a rebase? Or was rebased oddly? Uncertain at this moment.
.masked-input.masked .masked-value, | ||
.masked-input.masked .masked-input-toggle { | ||
color: $grey-light; | ||
} |
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.
Some strange indenting going on in this file
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.
Hard tabs! 🙀
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.
Default editor settings! Sorryyyyyy fix'd
position: absolute; | ||
height: auto; | ||
top: $size-6/4; | ||
bottom: $size-6/4; |
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.
Looking forward to the new spacing variables :\
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.
Yeah 😬
e9d1bae
to
20e6732
Compare
Fixes #4422
![screen shot 2018-06-13 at 4 03 32 pm](https://user-images.githubusercontent.com/3230904/41375271-89b3b5c2-6f23-11e8-86de-4a44afd0bdd6.png)
![screen shot 2018-06-13 at 4 03 45 pm](https://user-images.githubusercontent.com/3230904/41375273-89f348f4-6f23-11e8-9d74-4bef58379f28.png)
![screen shot 2018-06-13 at 4 03 57 pm](https://user-images.githubusercontent.com/3230904/41375274-8a06f110-6f23-11e8-8143-f86e3f835761.png)
![screen shot 2018-06-13 at 4 04 21 pm](https://user-images.githubusercontent.com/3230904/41375275-8a15af8e-6f23-11e8-841b-08c4ec736455.png)