1
0
mirror of https://github.com/ansible/awx.git synced 2024-11-01 08:21:15 +03:00

Added templates activity stream view which is a combination of JT events and WFJT events

This commit is contained in:
Michael Abashian 2016-12-05 09:45:27 -05:00
parent f0e7385f54
commit 8ec2662f2e
7 changed files with 25 additions and 10 deletions

View File

@ -16,8 +16,8 @@ export default {
value: {
// default params will not generate search tags
order_by: '-timestamp',
or__object1: null,
or__object2: null
or__object1_in: null,
or__object2_in: null
}
}
},

View File

@ -26,7 +26,9 @@ export default ['templateUrl', function(templateUrl) {
{label: 'Projects', value: 'project'},
{label: 'Schedules', value: 'schedule'},
{label: 'Teams', value: 'team'},
{label: 'Users', value: 'user'}
{label: 'Templates', value: 'template'},
{label: 'Users', value: 'user'},
{label: 'Workflow Job Templates', value: 'workflow_job_template'}
];
CreateSelect2({
@ -41,8 +43,8 @@ export default ['templateUrl', function(templateUrl) {
}
else {
let search = _.merge($stateParams.activity_search, {
or__object1: $scope.streamTarget,
or__object2: $scope.streamTarget
or__object1__in: $scope.streamTarget && $scope.streamTarget === 'template' ? 'job_template,workflow_job_template' : $scope.streamTarget,
or__object2__in: $scope.streamTarget && $scope.streamTarget === 'template' ? 'job_template,workflow_job_template' : $scope.streamTarget
});
// Attach the taget to the query parameters
$state.go('activityStream', {target: $scope.streamTarget, activity_search: search});

View File

@ -26,8 +26,8 @@ export default
if(streamConfig.activityStreamTarget) {
stateGoParams.target = streamConfig.activityStreamTarget;
stateGoParams.activity_search = {
or__object1: streamConfig.activityStreamTarget,
or__object2: streamConfig.activityStreamTarget,
or__object1__in: streamConfig.activityStreamTarget === 'template' ? 'job_template,workflow_job_template' : streamConfig.activityStreamTarget,
or__object2__in: streamConfig.activityStreamTarget === 'template' ? 'job_template,workflow_job_template' : streamConfig.activityStreamTarget,
order_by: '-timestamp',
page_size: '20',
};

View File

@ -52,6 +52,12 @@ export default
case 'host':
rtnTitle = 'HOSTS';
break;
case 'template':
rtnTitle = 'TEMPLATES';
break;
case 'workflow_job_template':
rtnTitle = 'WORKFLOW JOB TEMPLATES';
break;
}
return rtnTitle;

View File

@ -48,6 +48,9 @@ export default
case 'inventory_script':
basePathKey = 'inventory_scripts';
break;
case 'workflow_job_template':
basePathKey = 'workflow_job_templates';
break;
}
return basePathKey;

View File

@ -11,6 +11,8 @@ export default {
label: "TEMPLATES"
},
data: {
activityStream: true,
activityStreamTarget: 'template',
socket: {
"groups": {
"jobs": ["status_changed"]

View File

@ -283,11 +283,13 @@ angular.module('StreamWidget', ['RestServices', 'Utilities', 'StreamListDefiniti
else {
// We just have a type
if ($state.params.target === 'inventory_script') {
defaultUrl += '?or__object1=custom_inventory_script&or__object2=custom_inventory_script';
defaultUrl += '?or__object1__in=custom_inventory_script&or__object2__in=custom_inventory_script';
} else if ($state.params.target === 'management_job') {
defaultUrl += '?or__object1=job&or__object2=job';
defaultUrl += '?or__object1__in=job&or__object2__in=job';
} else if ($state.params.target === 'template') {
defaultUrl += '?or__object1__in=job_template,workflow_job_template&or__object2__in=job_template,workflow_job_template';
} else {
defaultUrl += '?or__object1=' + $state.params.target + '&or__object2=' + $state.params.target;
defaultUrl += '?or__object1__in=' + $state.params.target + '&or__object2__in=' + $state.params.target;
}
}
}