-
Notifications
You must be signed in to change notification settings - Fork 90
fix(pfEmptyState): Ability for urlAction in empty state component #648
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
Conversation
test/views/empty-state.spec.js
Outdated
| expect(element.find('.blank-state-pf-helpLink').text()).toContain('For more information please see'); | ||
| expect(element.find('a').text()).toContain('pfExample'); | ||
| expect(element.find('a').prop('href')).toContain('#/api/patternfly.views.component:pfEmptyState'); | ||
| expect(element.find('.blank-state-pf-helpLink').click().length).toBe(1); |
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 a better way to test callback functions in unit tests would be:
element.find('.blank-state-pf-helpLink').click();
expect($scope.eventText).toBe('Empty State Action Executed');
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.
Gotcha! I had something similar to that initially, thanks Dave! :)
src/views/empty-state.component.js
Outdated
| * <li>.info - (string) Text for the main informational paragraph | ||
| * <li>.helpLink - (object) Contains url specific properties and actions | ||
| * <ul style='list-style-type: none'> | ||
| * <li>.label - (string) Text for label |
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.
Perhaps "Text label which appears before the urlLabel
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.
sounds good!
src/views/empty-state.component.js
Outdated
| * <li>.helpLink - (object) Contains url specific properties and actions | ||
| * <ul style='list-style-type: none'> | ||
| * <li>.label - (string) Text for label | ||
| * <li>.urlLabel - (string) Text for url label |
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.
How about: "Text for the clickable portion of the link"
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.
Still waiting on this minor fix. After these textual changes, everything LGTM.
0e55ffd to
241de6f
Compare
src/views/empty-state.component.js
Outdated
| * <ul style='list-style-type: none'> | ||
| * <li>.label - (string) Text label which appears before the | ||
| * <li>.urlLabel - (string) Text for the clickable portion of the link | ||
| * <li>.url - (string) Text for url path |
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 optional, right?
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.
Yes this is optional.
src/views/empty-state.component.js
Outdated
| * <li>.label - (string) Text label which appears before the | ||
| * <li>.urlLabel - (string) Text for the clickable portion of the link | ||
| * <li>.url - (string) Text for url path | ||
| * <li>.urlAction - (function) Function to invoke a url action when a callback method is specified. |
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 optional, right?
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.
Yes this is optional. Will make sure to note that.
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.
helpLink and it's properties are under the "config Optional configuration object" for the config param in ngDocs. Should I still note that it's optional? @jeff-phillips-18
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 would still mark them as optional for that object.
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.
Okay will do.
src/views/empty-state.component.js
Outdated
| if (ctrl.config.helpLink.urlAction) { | ||
| ctrl.config.helpLink.urlAction(); | ||
| } | ||
| }; |
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 unnecessary. You can just use ng-click="$ctrl.config.helpLink.urlAction()", if it is not defined nothing will happen, no error.
ee4d4cf to
98b6f0e
Compare
| * <li>.helpLink - (object) Contains url specific properties and actions | ||
| * <ul style='list-style-type: none'> | ||
| * <li>.label - (string) Optional text label which appears before the | ||
| * <li>.urlLabel - (string) Optional text for the clickable portion of the link |
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.
How about "...before the urlLabel"
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.
Whoops that would be helpful huh? :)
98b6f0e to
f4a3811
Compare
cdcabrera
left a comment
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.
Looks good to me, simple and to the point!
Description
Ability for pfEmptyState component config to have url action to provide a user defined callback method.
Specifically this will be helpful for this issue:
openshift/origin-web-catalog#461
Which would allow the clear applied filters function to be applied to the url link when a user clicks the link on the empty state. Currently only a url can be provided.
Rawgit
PR Checklist