diff --git a/awx/ui/client/legacy-styles/ansible-ui.less b/awx/ui/client/legacy-styles/ansible-ui.less index b8f9032596..8ba9c1a6cc 100644 --- a/awx/ui/client/legacy-styles/ansible-ui.less +++ b/awx/ui/client/legacy-styles/ansible-ui.less @@ -2085,3 +2085,7 @@ button.dropdown-toggle, .error.ng-hide { opacity: 0; } + +.editedRow { + border-left: 5px solid red; +} diff --git a/awx/ui/client/src/app.js b/awx/ui/client/src/app.js index 25e034ab4b..2ef538b4fc 100644 --- a/awx/ui/client/src/app.js +++ b/awx/ui/client/src/app.js @@ -966,6 +966,14 @@ var tower = angular.module('Tower', [ $rootScope.removeConfigReady(); } $rootScope.removeConfigReady = $rootScope.$on('ConfigReady', function() { + // initially set row edit indicator for crud pages + if ($location.$$path.split("/")[2]) { + var list = $location.$$path.split("/")[1]; + var id = $location.$$path.split("/")[2]; + $rootScope.listBeingEdited = list; + $rootScope.rowBeingEdited = id; + } + LoadBasePaths(); $rootScope.crumbCache = []; @@ -1048,7 +1056,19 @@ var tower = angular.module('Tower', [ },2000); }); + $rootScope.$on("$stateChangeStart", function (event, next, nextParams, prev) { + // broadcast event change if editing crud object + if ($location.$$path.split("/")[2]) { + var list = $location.$$path.split("/")[1]; + var id = $location.$$path.split("/")[2]; + + delete $rootScope.listBeingEdited + delete $rootScope.rowBeingEdited + + $rootScope.$broadcast("EditIndicatorChange", list, id); + } + // this line removes the query params attached to a route if(prev && prev.$$route && prev.$$route.name === 'systemTracking'){ 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 0784a158a4..b730704bf1 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 @@ -170,6 +170,14 @@ export default ['$location', '$compile', '$rootScope', 'SearchWidget', 'Paginate this.scope.list = list; this.scope.mode = options.mode; + // respond to changes to the edit indicator from + // the stateChangeStart event in app.js + this.scope.$on("EditIndicatorChange", function(e, list, id) { + e.targetScope.listBeingEdited = list; + e.targetScope.rowBeingEdited = id; + console.log(list, id); + }); + this.scope.isHiddenByOptions = function(options) { // If neither ngHide nor ngShow are specified we @@ -439,6 +447,7 @@ export default ['$location', '$compile', '$rootScope', 'SearchWidget', 'Paginate if (list.multiSelect) { innerTable += ", " + list.iterator + ".isSelected ? 'is-selected-row' : ''"; } + innerTable += ", rowBeingEdited === '{{ " + list.iterator + ".id }}' && listBeingEdited === '" + list.name + "' ? 'editedRow' : ''"; innerTable += "]\" "; innerTable += "id=\"{{ " + list.iterator + ".id }}\" "; innerTable += "class=\"" + list.iterator + "_class\" ";