mirror of
https://github.com/ansible/awx.git
synced 2026-01-14 03:10:42 -03:30
Fix app crash from our pagination when editing invalid things
Addresses the most important part of #1742 , next patch will be to make it so we just navigate away from the detail page if we delete the item we're on.
This commit is contained in:
parent
e11600d493
commit
0067e7006f
@ -12,11 +12,16 @@ export default ['$http', '$q', function($http, $q) {
|
||||
return $http.get(url + "?id=" + id)
|
||||
.then(function (data) {
|
||||
var queryValue, queryType;
|
||||
if (data.data.results[0].type === "user") {
|
||||
queryValue = data.data.results[0].username;
|
||||
queryType = "username";
|
||||
if (data.data.results.length) {
|
||||
if (data.data.results[0].type === "user") {
|
||||
queryValue = data.data.results[0].username;
|
||||
queryType = "username";
|
||||
} else {
|
||||
queryValue = data.data.results[0].name;
|
||||
queryType = "name";
|
||||
}
|
||||
} else {
|
||||
queryValue = data.data.results[0].name;
|
||||
queryValue = "";
|
||||
queryType = "name";
|
||||
}
|
||||
// get how many results are less than or equal to
|
||||
@ -26,7 +31,7 @@ export default ['$http', '$q', function($http, $q) {
|
||||
// divide by the page size to get what
|
||||
// page the data should be on
|
||||
var count = data.data.count;
|
||||
return Math.ceil(count/parseInt(pageSize));
|
||||
return Math.max(1, Math.ceil(count/parseInt(pageSize)));
|
||||
});
|
||||
});
|
||||
} else {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user