mirror of
https://github.com/ansible/awx.git
synced 2024-11-01 16:51:11 +03:00
Merge pull request #2259 from mabashian/activity-stream-tooltip
Added Hide/View tooltips to the Activity Stream button
This commit is contained in:
commit
0c907655c1
@ -1,6 +1,6 @@
|
||||
export default
|
||||
['templateUrl', '$state', 'FeaturesService', 'ProcessErrors','$rootScope',
|
||||
function(templateUrl, $state, FeaturesService, ProcessErrors, $rootScope) {
|
||||
['templateUrl', '$state', 'FeaturesService', 'ProcessErrors','$rootScope', 'Store', 'Empty',
|
||||
function(templateUrl, $state, FeaturesService, ProcessErrors, $rootScope, Store, Empty) {
|
||||
return {
|
||||
restrict: 'E',
|
||||
templateUrl: templateUrl('bread-crumb/bread-crumb'),
|
||||
@ -13,22 +13,50 @@ export default
|
||||
|
||||
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];
|
||||
}
|
||||
}
|
||||
|
||||
$state.go('activityStream', stateGoParams);
|
||||
}
|
||||
if(streamConfig.activityStreamId) {
|
||||
stateGoParams.id = $state.params[streamConfig.activityStreamId];
|
||||
// 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');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
scope.$on("$stateChangeStart", 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);
|
||||
}
|
||||
|
||||
$state.go('activityStream', stateGoParams);
|
||||
};
|
||||
|
||||
scope.$on("$stateChangeStart", function updateActivityStreamButton(event, toState) {
|
||||
|
||||
streamConfig = (toState && toState.data) ? toState.data : {};
|
||||
|
||||
if(streamConfig && streamConfig.activityStream) {
|
||||
@ -42,6 +70,7 @@ export default
|
||||
if(features){
|
||||
scope.loadingLicense = false;
|
||||
scope.activityStreamActive = (toState.name === 'activityStream') ? true : false;
|
||||
scope.activityStreamTooltip = (toState.name === 'activityStream') ? 'Hide Activity Stream' : 'View Activity Stream';
|
||||
scope.showActivityStreamButton = (FeaturesService.featureEnabled('activity_streams') || toState.name ==='activityStream') ? true : false;
|
||||
}
|
||||
}
|
||||
@ -57,8 +86,9 @@ export default
|
||||
// var features = FeaturesService.get();
|
||||
if(features){
|
||||
scope.loadingLicense = false;
|
||||
scope.activityStreamActive = ($state.name === 'activityStream') ? true : false;
|
||||
scope.showActivityStreamButton = (FeaturesService.featureEnabled('activity_streams') || $state.name ==='activityStream') ? true : false;
|
||||
scope.activityStreamActive = ($state.current.name === 'activityStream') ? true : false;
|
||||
scope.activityStreamTooltip = ($state.current.name === 'activityStream') ? 'Hide Activity Stream' : 'View Activity Stream';
|
||||
scope.showActivityStreamButton = (FeaturesService.featureEnabled('activity_streams') || $state.current.name ==='activityStream') ? true : false;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -2,7 +2,8 @@
|
||||
<div ng-hide="licenseMissing" ncy-breadcrumb></div>
|
||||
<div class="BreadCrumb-menuLink"
|
||||
id="bread_crumb_activity_stream"
|
||||
aw-tool-tip="View Activity Stream"
|
||||
aw-tool-tip="{{activityStreamTooltip}}"
|
||||
data-tip-watch="activityStreamTooltip"
|
||||
data-placement="left"
|
||||
data-trigger="hover"
|
||||
data-container="body"
|
||||
|
Loading…
Reference in New Issue
Block a user