mirror of
https://github.com/ansible/awx.git
synced 2026-03-22 11:25:08 -02:30
Turned the activity stream button into a toggle. Removed the dashboard icon that was shown when a state does not have an activity stream.
This commit is contained in:
@@ -188,13 +188,14 @@ table, tbody {
|
|||||||
display: flex;
|
display: flex;
|
||||||
}
|
}
|
||||||
|
|
||||||
.List-auxAction + .List-actions {
|
.List-actions {
|
||||||
margin-left: 20px;
|
display: flex;
|
||||||
}
|
}
|
||||||
|
|
||||||
.List-auxAction {
|
.List-auxAction {
|
||||||
align-items: center;
|
align-items: center;
|
||||||
display: flex;
|
display: flex;
|
||||||
|
margin-left: 20px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.List-auxActionStream {
|
.List-auxActionStream {
|
||||||
|
|||||||
@@ -11,6 +11,9 @@ export default {
|
|||||||
route: '/activity_stream?target&id',
|
route: '/activity_stream?target&id',
|
||||||
templateUrl: templateUrl('activity-stream/activitystream'),
|
templateUrl: templateUrl('activity-stream/activitystream'),
|
||||||
controller: 'activityStreamController',
|
controller: 'activityStreamController',
|
||||||
|
data: {
|
||||||
|
activityStream: true
|
||||||
|
},
|
||||||
ncyBreadcrumb: {
|
ncyBreadcrumb: {
|
||||||
label: "ACTIVITY STREAM"
|
label: "ACTIVITY STREAM"
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -20,7 +20,6 @@
|
|||||||
}
|
}
|
||||||
.BreadCrumb-menuLink {
|
.BreadCrumb-menuLink {
|
||||||
width: 58px;
|
width: 58px;
|
||||||
border-left: 1px solid @bc-link-side;
|
|
||||||
margin-left: auto;
|
margin-left: auto;
|
||||||
color: @bc-link-icon;
|
color: @bc-link-icon;
|
||||||
flex: initial;
|
flex: initial;
|
||||||
@@ -30,8 +29,7 @@
|
|||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
}
|
}
|
||||||
.BreadCrumb-menuLink:hover {
|
.BreadCrumb-menuLink:hover {
|
||||||
background-color: @bc-link-bg-hov;
|
color: @bc-link-icon-focus;
|
||||||
color: @bc-link-icon;
|
|
||||||
}
|
}
|
||||||
.BreadCrumb-menuLink.BreadCrumb-menuLinkActive {
|
.BreadCrumb-menuLink.BreadCrumb-menuLinkActive {
|
||||||
color: @bc-link-icon-focus;
|
color: @bc-link-icon-focus;
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
export default
|
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 {
|
return {
|
||||||
restrict: 'E',
|
restrict: 'E',
|
||||||
templateUrl: templateUrl('bread-crumb/bread-crumb'),
|
templateUrl: templateUrl('bread-crumb/bread-crumb'),
|
||||||
@@ -10,23 +10,51 @@ export default
|
|||||||
scope.showActivityStreamButton = false;
|
scope.showActivityStreamButton = false;
|
||||||
scope.loadingLicense = true;
|
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 && streamConfig.activityStream) {
|
||||||
if(streamConfig.activityStreamTarget) {
|
if(streamConfig.activityStreamTarget) {
|
||||||
stateGoParams.target = 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 : {};
|
streamConfig = (toState && toState.data) ? toState.data : {};
|
||||||
|
|
||||||
@@ -41,13 +69,10 @@ export default
|
|||||||
FeaturesService.get()
|
FeaturesService.get()
|
||||||
.then(function() {
|
.then(function() {
|
||||||
scope.loadingLicense = false;
|
scope.loadingLicense = false;
|
||||||
if(FeaturesService.featureEnabled('activity_streams')) {
|
scope.activityStreamActive = (toState.name === 'activityStream') ? true : false;
|
||||||
scope.showActivityStreamButton = true;
|
scope.showActivityStreamButton = (FeaturesService.featureEnabled('activity_streams') || toState.name === 'activityStream') ? true : false;
|
||||||
}
|
var licenseInfo = FeaturesService.getLicenseInfo();
|
||||||
else {
|
scope.licenseType = licenseInfo.license_type;
|
||||||
scope.showActivityStreamButton = false;
|
|
||||||
}
|
|
||||||
scope.licenseType = FeaturesService.getLicenseInfo()['license_type'];
|
|
||||||
})
|
})
|
||||||
.catch(function (response) {
|
.catch(function (response) {
|
||||||
ProcessErrors(null, response.data, response.status, null, {
|
ProcessErrors(null, response.data, response.status, null, {
|
||||||
|
|||||||
@@ -9,22 +9,9 @@
|
|||||||
ng-class="{'BreadCrumb-menuLinkActive' : activityStreamActive}"
|
ng-class="{'BreadCrumb-menuLinkActive' : activityStreamActive}"
|
||||||
ng-if="showActivityStreamButton"
|
ng-if="showActivityStreamButton"
|
||||||
ng-hide= "loadingLicense || licenseMissing || licenseType == 'basic'"
|
ng-hide= "loadingLicense || licenseMissing || licenseType == 'basic'"
|
||||||
ng-click="openActivityStream()">
|
ng-click="toggleActivityStream()">
|
||||||
<i class="BreadCrumb-menuLinkImage icon-activity-stream"
|
<i class="BreadCrumb-menuLinkImage icon-activity-stream"
|
||||||
alt="Activity Stream">
|
alt="Activity Stream">
|
||||||
</i>
|
</i>
|
||||||
</div>
|
</div>
|
||||||
<a class="BreadCrumb-menuLink"
|
|
||||||
id="bread_crumb_dashboard"
|
|
||||||
ui-sref="dashboard"
|
|
||||||
aw-tool-tip="View Dashboard"
|
|
||||||
data-placement="left"
|
|
||||||
data-trigger="hover"
|
|
||||||
data-container="body"
|
|
||||||
ng-hide="loadingLicense || licenseMissing || licenseType == 'basic'"
|
|
||||||
ng-if="!showActivityStreamButton">
|
|
||||||
<i class="BreadCrumb-menuLinkImage fa fa-tachometer"
|
|
||||||
alt="Dashboard">
|
|
||||||
</i>
|
|
||||||
</a>
|
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -323,11 +323,6 @@ export default ['$location', '$compile', '$rootScope', 'SearchWidget', 'Paginate
|
|||||||
html += "</button></div>\n";
|
html += "</button></div>\n";
|
||||||
}
|
}
|
||||||
html += "<div class=\"List-actionHolder\">";
|
html += "<div class=\"List-actionHolder\">";
|
||||||
if(list.toolbarAuxAction) {
|
|
||||||
html += "<div class=\"List-auxAction\">";
|
|
||||||
html += list.toolbarAuxAction;
|
|
||||||
html += "</div>";
|
|
||||||
}
|
|
||||||
html += "<div class=\"List-actions\">";
|
html += "<div class=\"List-actions\">";
|
||||||
html += "<div ng-include=\"'" +
|
html += "<div ng-include=\"'" +
|
||||||
templateUrl('shared/list-generator/list-actions') +
|
templateUrl('shared/list-generator/list-actions') +
|
||||||
@@ -337,8 +332,13 @@ export default ['$location', '$compile', '$rootScope', 'SearchWidget', 'Paginate
|
|||||||
list.actions[action] = _.defaults(list.actions[action], { dataPlacement: "top" });
|
list.actions[action] = _.defaults(list.actions[action], { dataPlacement: "top" });
|
||||||
}
|
}
|
||||||
|
|
||||||
html += "</div>\n";
|
|
||||||
html += "</div>";
|
html += "</div>";
|
||||||
|
if(list.toolbarAuxAction) {
|
||||||
|
html += "<div class=\"List-auxAction\">";
|
||||||
|
html += list.toolbarAuxAction;
|
||||||
|
html += "</div>";
|
||||||
|
}
|
||||||
|
html += "\n</div>";
|
||||||
html += "</div>";
|
html += "</div>";
|
||||||
html += "</div>";
|
html += "</div>";
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user