From e07c2643ee5540825501253f1e568bd7339af2d2 Mon Sep 17 00:00:00 2001 From: John Mitchell Date: Fri, 22 Jan 2016 10:12:17 -0500 Subject: [PATCH] Various sprint 1 ui fixes The edit button for the row of the item you are currently editing now stays selected Projects edit's now refresh correctly The pagination service now supports queries for users (use username instead of just name) --- awx/ui/client/legacy-styles/lists.less | 5 +++++ awx/ui/client/src/controllers/Projects.js | 14 +++++++------- awx/ui/client/src/controllers/Users.js | 5 +++++ .../list-generator/list-generator.factory.js | 3 +++ .../src/shared/pagination/pagination.service.js | 11 +++++++++-- 5 files changed, 29 insertions(+), 9 deletions(-) diff --git a/awx/ui/client/legacy-styles/lists.less b/awx/ui/client/legacy-styles/lists.less index 11b1a6dcd7..7d2a990831 100644 --- a/awx/ui/client/legacy-styles/lists.less +++ b/awx/ui/client/legacy-styles/lists.less @@ -246,3 +246,8 @@ table, tbody { background-color: @list-no-items-bg; color: @list-no-items-txt; } + +.List-editButton--selected { + background-color: @list-actn-bg-hov !important; + color: @list-actn-icn-hov; +} diff --git a/awx/ui/client/src/controllers/Projects.js b/awx/ui/client/src/controllers/Projects.js index 6c1ab1d857..8cef0c282f 100644 --- a/awx/ui/client/src/controllers/Projects.js +++ b/awx/ui/client/src/controllers/Projects.js @@ -112,7 +112,7 @@ export function ProjectsList ($scope, $rootScope, $location, $log, $stateParams, if ($scope.removeChoicesHere) { $scope.removeChoicesHere(); } - $scope.removeChoicesHere = $scope.$on('choicesCompleteProject', function () { + $scope.removeChoicesHere = $scope.$on('choicesCompleteProjectList', function () { var opt; list.fields.scm_type.searchOptions = $scope.project_scm_type_options; @@ -164,13 +164,13 @@ export function ProjectsList ($scope, $rootScope, $location, $log, $stateParams, $scope.search(list.iterator); }); - if ($scope.removeChoicesReady) { - $scope.removeChoicesReady(); + if ($scope.removeChoicesReadyList) { + $scope.removeChoicesReadyList(); } - $scope.removeChoicesReady = $scope.$on('choicesReadyProject', function () { + $scope.removeChoicesReadyList = $scope.$on('choicesReadyProjectList', function () { choiceCount++; if (choiceCount === 2) { - $scope.$emit('choicesCompleteProject'); + $scope.$emit('choicesCompleteProjectList'); } }); @@ -180,7 +180,7 @@ export function ProjectsList ($scope, $rootScope, $location, $log, $stateParams, url: defaultUrl, field: 'status', variable: 'project_status_options', - callback: 'choicesReadyProject' + callback: 'choicesReadyProjectList' }); // Load the list of options for Kind @@ -189,7 +189,7 @@ export function ProjectsList ($scope, $rootScope, $location, $log, $stateParams, url: defaultUrl, field: 'scm_type', variable: 'project_scm_type_options', - callback: 'choicesReadyProject' + callback: 'choicesReadyProjectList' }); $scope.showActivity = function () { diff --git a/awx/ui/client/src/controllers/Users.js b/awx/ui/client/src/controllers/Users.js index a01e330806..b57ec32124 100644 --- a/awx/ui/client/src/controllers/Users.js +++ b/awx/ui/client/src/controllers/Users.js @@ -265,6 +265,11 @@ export function UsersEdit($scope, $rootScope, $compile, $location, $log, if ($scope.removePostRefresh) { $scope.removePostRefresh(); } + $scope.removePostRefresh = $scope.$on('PostRefresh', function () { + // Cleanup after a delete + Wait('stop'); + $('#prompt-modal').modal('hide'); + }); $scope.PermissionAddAllowed = false; diff --git a/awx/ui/client/src/shared/list-generator/list-generator.factory.js b/awx/ui/client/src/shared/list-generator/list-generator.factory.js index 08bc157bab..cb5528a3cd 100644 --- a/awx/ui/client/src/shared/list-generator/list-generator.factory.js +++ b/awx/ui/client/src/shared/list-generator/list-generator.factory.js @@ -501,6 +501,9 @@ export default ['$location', '$compile', '$rootScope', 'SearchWidget', 'Paginate innerTable += (field_action === 'delete') ? "List-actionButton--delete" : ""; innerTable += (field_action === 'cancel') ? "cancel red-txt" : ""; innerTable += "\" "; + // debugger; + // rowBeingEdited === '{{ " + list.iterator + ".id }}' && listBeingEdited === '" + list.name + "' ? 'List-tableRow--selected' : ''"; + innerTable += (field_action === 'edit') ? "ng-class=\"[rowBeingEdited === '{{ " + list.iterator + ".id }}' && listBeingEdited === '" + list.name + "' ? 'List-editButton--selected' : '']\"" : ""; innerTable += (fAction.awPopOver) ? "aw-pop-over=\"" + fAction.awPopOver + "\" " : ""; innerTable += (fAction.dataPlacement) ? Attr(fAction, 'dataPlacement') : ""; innerTable += (fAction.dataTitle) ? Attr(fAction, 'dataTitle') : ""; diff --git a/awx/ui/client/src/shared/pagination/pagination.service.js b/awx/ui/client/src/shared/pagination/pagination.service.js index 96cdfb4c3e..76261566d0 100644 --- a/awx/ui/client/src/shared/pagination/pagination.service.js +++ b/awx/ui/client/src/shared/pagination/pagination.service.js @@ -10,10 +10,17 @@ export default ['$http', function($http) { // get the name of the object return $http.get(url + "?id=" + id) .then(function (data) { - var name = data.data.results[0].name; + var queryValue, queryType; + if (data.data.results[0].type === "user") { + queryValue = data.data.results[0].username; + queryType = "username"; + } else { + queryValue = data.data.results[0].name; + queryType = "name"; + } // get how many results are less than or equal to // the name - return $http.get(url + "?name__lte=" + name) + return $http.get(url + "?" + queryType + "__lte=" + queryValue) .then(function (data) { // divide by the page size to get what // page the data should be on