-
Notifications
You must be signed in to change notification settings - Fork 99
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(components): add ui-grid loading indicator (#445)
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.
- Loading branch information
Showing
8 changed files
with
100 additions
and
84 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
angular.module('bhima.components') | ||
.component('bhGridLoadingIndicator', { | ||
bindings: { | ||
loadingState: '<', | ||
emptyState: '<', | ||
errorState: '<' | ||
}, | ||
templateUrl : 'partials/templates/bhGridLoadingIndicator.tmpl.html', | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 23 additions & 0 deletions
23
client/src/partials/templates/bhGridLoadingIndicator.tmpl.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
<div class="grid-msg-overlay" ng-show="!$ctrl.errorState && ($ctrl.loadingState || $ctrl.emptyState)"> | ||
|
||
<!-- indicate that the grid is loading --> | ||
<div class="msg" ng-show="$ctrl.loadingState"> | ||
<span><span class="fa fa-spinner fa-spin"></span> {{ "TABLE.COLUMNS.LOADING" | translate }}</span> | ||
</div> | ||
|
||
<!-- indicate that there is no data for the requested query --> | ||
<div class="msg" ng-show="!$ctrl.loadingState && $ctrl.emptyState"> | ||
<span class="text-info"> | ||
<span class="fa fa-info-circle"></span> {{ "TABLE.COLUMNS.EMPTY" | translate }} | ||
</span> | ||
</div> | ||
</div> | ||
|
||
<div class="grid-msg-overlay" ng-show="$ctrl.errorState"> | ||
<!-- indicate that some error occurred --> | ||
<div class="msg" ng-show="$ctrl.errorState"> | ||
<span class="text-danger"> | ||
<span class="fa fa-warning"></span> {{ "ERRORS.UNKNOWN" | translate }} | ||
</span> | ||
</div> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters