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

feat(components): add ui-grid loading indicator #445

Conversation

jniles
Copy link
Collaborator

@jniles jniles commented May 27, 2016

This commit adds a bhGridLoadingIndicator, a component that shows nice messages on loading states, empty states, and error states. The basic usage looks like this:

<div ui-grid="Ctrl.options">
  <bh-grid-loading-indicator
    loading-state="Ctrl.loading"
    empty-state="Ctrl.grid.data.length === 0"
    error-state="Ctrl.hasError">
  </bh-grid-loading-indicator>
</div>

The hasError state takes precedence over all other states - if this value is true, it will not show any of the other loading indicators, even if data has loaded or is loading. The message is very generic - one is expected to report the proper error using Notify.danger() or Notify.handleError().

For a real example, see the billing services module and patient registry.

Screen Shots

errorstate
Fig 1. Grid Error State

loadingstate
Fig 2. Grid Loading State

norecords
Fig 3. Empty Grid State


Thank you for contributing!

Before submitting this pull request, please verify that you have:

  • Run your code through JSHint. Check out our styleguide.
  • Run integration tests.
  • Run end-to-end tests.
  • Accurately described the changes your are making in this pull request.

For a more detailed checklist, see the official review checklist that this PR will be evaluated against.

Ensuring that the above checkboxes are completed will help speed the review process and help build a stronger application. Thanks!

This commit adds a `bhGridLoadingIndicator`, a component that shows nice
messages on loading states, empty states, and error states.  The basic
usage looks like this:
```html
<div ui-grid>
  <bh-grid-loading-indicator
    loading-state="Ctrl.loading"
    empty-state="Ctrl.grid.data.length === 0"
    error-state="Ctrl.hasError">
  </bh-grid-loading-indicator>
</div>
```

The `hasError` state takes precedence over all other states - if this
value is `true`, it will not show any of the other loading indicators,
even if data has loaded or is loading.  The message is very generic -
one is expected to report the proper error using `Notify.danger()` or
`Notify.handleError()`.

For a real example, see the billing services module and patient
registry.
@sfount
Copy link
Contributor

sfount commented May 27, 2016

Everything LGTM. The simplicity of this component might make it a good start for adding more unit tests.

@sfount sfount merged commit b944ef6 into Third-Culture-Software:master May 27, 2016
@jniles jniles deleted the component-ui-grid-loading-indicator branch May 27, 2016 09:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants