Merge pull request #891 from mabashian/activity-stream-dropdown-nav

Added activity stream navigation dropdown
This commit is contained in:
Michael Abashian 2016-02-09 16:52:38 -05:00
commit dea865da26
5 changed files with 61 additions and 0 deletions

View File

@ -173,6 +173,12 @@ table, tbody {
justify-content: flex-end;
display: flex;
margin-top: -10px;
margin-left: 10px;
}
.List-auxAction {
justify-content: flex-end;
display: flex;
}
.List-buttonSubmit {

View File

@ -7,10 +7,13 @@
import activityStreamRoute from './activitystream.route';
import activityStreamController from './activitystream.controller';
import streamDropdownNav from './streamDropdownNav/stream-dropdown-nav.directive';
import streamDetailModal from './streamDetailModal/main';
export default angular.module('activityStream', [streamDetailModal.name])
.controller('activityStreamController', activityStreamController)
.directive('streamDropdownNav', streamDropdownNav)
.run(['$stateExtender', function($stateExtender) {
$stateExtender.addState(activityStreamRoute);
}]);

View File

@ -0,0 +1,46 @@
/*************************************************
* Copyright (c) 2016 Ansible, Inc.
*
* All Rights Reserved
*************************************************/
export default [function() {
return {
restrict: 'E',
scope: true,
replace: true,
template: '<select class="form-control" ng-model="streamTarget" ng-options="opt.value as opt.label for opt in options" ng-change="changeStreamTarget()"></select>',
controller: ['$scope', '$state', function($scope, $state) {
$scope.streamTarget = ($state.params && $state.params.target) ? $state.params.target : 'dashboard';
$scope.options = [
{label: 'Credentials', value: 'credential'},
{label: 'Dashboard', value: 'dashboard'},
{label: 'Hosts', value: 'host'},
{label: 'Inventories', value: 'inventory'},
{label: 'Inventory Scripts', value: 'inventory_script'},
{label: 'Job Templates', value: 'job_template'},
{label: 'Management Jobs', value: 'management_job'},
{label: 'Organizations', value: 'organization'},
{label: 'Projects', value: 'project'},
{label: 'Schedules', value: 'schedule'},
{label: 'Teams', value: 'team'},
{label: 'Users', value: 'user'}
];
$scope.changeStreamTarget = function(){
if($scope.streamTarget && $scope.streamTarget == 'dashboard') {
// Just navigate to the base activity stream
$state.go('activityStream', {}, {inherit: false, reload: true});
}
else {
// Attach the taget to the query parameters
$state.go('activityStream', {target: $scope.streamTarget});
}
}
}],
};
}];

View File

@ -19,6 +19,7 @@ export default
hover: true,
"class": "table-condensed",
searchWidgets: 3,
toolbarAuxAction: "<stream-dropdown-nav></stream-dropdown-nav>",
fields: {
timestamp: {

View File

@ -315,6 +315,11 @@ export default ['$location', '$compile', '$rootScope', 'SearchWidget', 'Paginate
}
html += "</div>";
if(list.toolbarAuxAction) {
html += "<div class=\"List-auxAction\">";
html += list.toolbarAuxAction;
html += "</div>";
}
html += "<div class=\"List-actions\">";
html += "<div class=\"list-actions\" ng-include=\"'" +
templateUrl('shared/list-generator/list-actions') +