-
Notifications
You must be signed in to change notification settings - Fork 99
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
Fix(Invetory): adding loading indicator into the inventory list #1991
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -31,6 +31,8 @@ function InventoryListController($translate, Inventory, Notify, uiGridConstants, | |
vm.filterEnabled = false; | ||
vm.gridOptions = {}; | ||
vm.gridApi = {}; | ||
vm.loading = false; | ||
|
||
|
||
// grid default options | ||
columnDefs = [ | ||
|
@@ -138,20 +140,30 @@ function InventoryListController($translate, Inventory, Notify, uiGridConstants, | |
} | ||
|
||
function runResearch(params) { | ||
|
||
if (params) { | ||
search.assignFilters(params); | ||
vm.latestViewFilters = search.latestViewFilters(); | ||
vm.hasCustomFilters = search.hasCustomFilters(); | ||
vm.parameters = JSON.stringify(params); | ||
} | ||
|
||
vm.loading = true; | ||
vm.hasError = false; | ||
|
||
Inventory.read(null, params) | ||
.then(function (rows) { | ||
vm.gridOptions.data = rows; | ||
}) | ||
.catch(Notify.handleError); | ||
.catch(Error); | ||
|
||
vm.loading = false; | ||
} | ||
|
||
function Error() { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Error is a reserved word in JavaScript. Could you name this function something else? |
||
vm.hasError = true; | ||
Notify.handleError(); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
} | ||
// research and filter data in Inventory List | ||
function research() { | ||
Inventory.openSearchModal() | ||
|
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.
Does the loading indicator work? It seems like this will not wait for the data to download.
The correct way to wait for the data to download is to use the .finally() Promise method. Like this: