diff --git a/awx/ui/client/legacy-styles/lists.less b/awx/ui/client/legacy-styles/lists.less index 68c0df4eca..d8f3a7af0c 100644 --- a/awx/ui/client/legacy-styles/lists.less +++ b/awx/ui/client/legacy-styles/lists.less @@ -188,13 +188,14 @@ table, tbody { display: flex; } -.List-auxAction + .List-actions { - margin-left: 20px; +.List-actions { + display: flex; } .List-auxAction { align-items: center; display: flex; + margin-left: 20px; } .List-auxActionStream { diff --git a/awx/ui/client/src/activity-stream/activitystream.route.js b/awx/ui/client/src/activity-stream/activitystream.route.js index 82e85b15f0..a7e1da313f 100644 --- a/awx/ui/client/src/activity-stream/activitystream.route.js +++ b/awx/ui/client/src/activity-stream/activitystream.route.js @@ -11,6 +11,9 @@ export default { route: '/activity_stream?target&id', templateUrl: templateUrl('activity-stream/activitystream'), controller: 'activityStreamController', + data: { + activityStream: true + }, ncyBreadcrumb: { label: "ACTIVITY STREAM" }, diff --git a/awx/ui/client/src/bread-crumb/bread-crumb.block.less b/awx/ui/client/src/bread-crumb/bread-crumb.block.less index 4397e3ea9d..7ec5a6142b 100644 --- a/awx/ui/client/src/bread-crumb/bread-crumb.block.less +++ b/awx/ui/client/src/bread-crumb/bread-crumb.block.less @@ -20,7 +20,6 @@ } .BreadCrumb-menuLink { width: 58px; - border-left: 1px solid @bc-link-side; margin-left: auto; color: @bc-link-icon; flex: initial; @@ -30,8 +29,7 @@ cursor: pointer; } .BreadCrumb-menuLink:hover { - background-color: @bc-link-bg-hov; - color: @bc-link-icon; + color: @bc-link-icon-focus; } .BreadCrumb-menuLink.BreadCrumb-menuLinkActive { color: @bc-link-icon-focus; diff --git a/awx/ui/client/src/bread-crumb/bread-crumb.directive.js b/awx/ui/client/src/bread-crumb/bread-crumb.directive.js index 5c11690988..a50262e533 100644 --- a/awx/ui/client/src/bread-crumb/bread-crumb.directive.js +++ b/awx/ui/client/src/bread-crumb/bread-crumb.directive.js @@ -1,5 +1,5 @@ export default - [ 'templateUrl', '$state', 'FeaturesService', 'ProcessErrors', function(templateUrl, $state, FeaturesService, ProcessErrors) { + [ 'templateUrl', '$state', 'FeaturesService', 'ProcessErrors', 'Store', 'Empty', function(templateUrl, $state, FeaturesService, ProcessErrors, Store, Empty) { return { restrict: 'E', templateUrl: templateUrl('bread-crumb/bread-crumb'), @@ -10,23 +10,51 @@ export default scope.showActivityStreamButton = false; scope.loadingLicense = true; - scope.openActivityStream = function() { + scope.toggleActivityStream = function() { - var stateGoParams = {}; + // If the user is not already on the activity stream then they want to navigate to it + if(!scope.activityStreamActive) { + var stateGoParams = {}; - if(streamConfig && streamConfig.activityStream) { - if(streamConfig.activityStreamTarget) { - stateGoParams.target = streamConfig.activityStreamTarget; + if(streamConfig && streamConfig.activityStream) { + if(streamConfig.activityStreamTarget) { + stateGoParams.target = streamConfig.activityStreamTarget; + } + if(streamConfig.activityStreamId) { + stateGoParams.id = $state.params[streamConfig.activityStreamId]; + } } - if(streamConfig.activityStreamId) { - stateGoParams.id = $state.params[streamConfig.activityStreamId]; + + $state.go('activityStream', stateGoParams); + } + // The user is navigating away from the activity stream - take them back from whence they came + else { + // Pull the previous state out of local storage + var previousState = Store('previous_state'); + + if(previousState && !Empty(previousState.name)) { + $state.go(previousState.name, previousState.fromParams); } + else { + // If for some reason something went wrong (like local storage was wiped, etc) take the + // user back to the dashboard + $state.go('dashboard'); + } + } - $state.go('activityStream', stateGoParams); }; - scope.$on("$stateChangeSuccess", function updateActivityStreamButton(event, toState) { + scope.$on("$stateChangeSuccess", function updateActivityStreamButton(event, toState, toParams, fromState, fromParams) { + + if(fromState && !Empty(fromState.name)) { + // Go ahead and attach the from params to the state object so that it can all be stored together + fromState.fromParams = fromParams ? fromParams : {}; + + // Store the state that we're coming from in local storage to be accessed when navigating away from the + // activity stream + Store('previous_state', fromState); + } streamConfig = (toState && toState.data) ? toState.data : {}; @@ -41,13 +69,10 @@ export default FeaturesService.get() .then(function() { scope.loadingLicense = false; - if(FeaturesService.featureEnabled('activity_streams')) { - scope.showActivityStreamButton = true; - } - else { - scope.showActivityStreamButton = false; - } - scope.licenseType = FeaturesService.getLicenseInfo()['license_type']; + scope.activityStreamActive = (toState.name === 'activityStream') ? true : false; + scope.showActivityStreamButton = (FeaturesService.featureEnabled('activity_streams') || toState.name === 'activityStream') ? true : false; + var licenseInfo = FeaturesService.getLicenseInfo(); + scope.licenseType = licenseInfo.license_type; }) .catch(function (response) { ProcessErrors(null, response.data, response.status, null, { diff --git a/awx/ui/client/src/bread-crumb/bread-crumb.partial.html b/awx/ui/client/src/bread-crumb/bread-crumb.partial.html index a03f45f5e0..4d51219070 100644 --- a/awx/ui/client/src/bread-crumb/bread-crumb.partial.html +++ b/awx/ui/client/src/bread-crumb/bread-crumb.partial.html @@ -9,22 +9,9 @@ ng-class="{'BreadCrumb-menuLinkActive' : activityStreamActive}" ng-if="showActivityStreamButton" ng-hide= "loadingLicense || licenseMissing || licenseType == 'basic'" - ng-click="openActivityStream()"> + ng-click="toggleActivityStream()"> - - - - 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 111771c8e8..8b85204057 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 @@ -323,11 +323,6 @@ export default ['$location', '$compile', '$rootScope', 'SearchWidget', 'Paginate html += "\n"; } html += "
"; - if(list.toolbarAuxAction) { - html += "
"; - html += list.toolbarAuxAction; - html += "
"; - } html += "
"; html += "
"; + html += list.toolbarAuxAction; + html += "
"; + } + html += "\n
"; html += "
"; html += ""; }