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

Job templates

Added ability to launch a job from th job template detail page.
This commit is contained in:
Chris Houseknecht 2014-07-30 14:05:45 -04:00
parent da6f07dd64
commit 2485f86471
2 changed files with 19 additions and 4 deletions

View File

@ -340,7 +340,8 @@ function JobTemplatesEdit($scope, $rootScope, $compile, $location, $log, $routeP
Alert, ProcessErrors, LoadBreadCrumbs, RelatedSearchInit, RelatedPaginateInit, ReturnToCaller, ClearScope, InventoryList,
CredentialList, ProjectList, LookUpInit, GetBasePath, md5Setup, ParseTypeChange, JobStatusToolTip, FormatDate,
Wait, Stream, Empty, Prompt, ParseVariableString, ToJSON, SchedulesControllerInit, JobsControllerInit, JobsListUpdate,
GetChoices, SchedulesListInit, SchedulesList, CallbackHelpInit) {
GetChoices, SchedulesListInit, SchedulesList, CallbackHelpInit, PlaybookRun)
{
ClearScope();
@ -577,8 +578,8 @@ function JobTemplatesEdit($scope, $rootScope, $compile, $location, $log, $routeP
}
$scope.removeLoadJobs = $scope.$on('LoadJobs', function() {
// Retrieve detail record and prepopulate the form
Rest.setUrl(defaultUrl + ':id/');
Rest.get({ params: { id: id } })
Rest.setUrl(defaultUrl + id);
Rest.get()
.success(function (data) {
var fld, i;
LoadBreadCrumbs({ path: '/job_templates/' + id, title: data.name });
@ -788,6 +789,14 @@ function JobTemplatesEdit($scope, $rootScope, $compile, $location, $log, $routeP
$location.path('/' + set + '/' + id);
};
// Launch a job using the selected template
$scope.launch = function() {
PlaybookRun({
scope: $scope,
id: id
});
};
// Related set: Delete button
$scope['delete'] = function (set, itm_id, name, title) {
$rootScope.flashMessage = null;
@ -824,5 +833,5 @@ JobTemplatesEdit.$inject = ['$scope', '$rootScope', '$compile', '$location', '$l
'ReturnToCaller', 'ClearScope', 'InventoryList', 'CredentialList', 'ProjectList', 'LookUpInit',
'GetBasePath', 'md5Setup', 'ParseTypeChange', 'JobStatusToolTip', 'FormatDate', 'Wait', 'Stream', 'Empty', 'Prompt',
'ParseVariableString', 'ToJSON', 'SchedulesControllerInit', 'JobsControllerInit', 'JobsListUpdate', 'GetChoices',
'SchedulesListInit', 'SchedulesList', 'CallbackHelpInit'
'SchedulesListInit', 'SchedulesList', 'CallbackHelpInit', 'PlaybookRun'
];

View File

@ -26,6 +26,12 @@ angular.module('JobTemplateFormDefinition', ['SchedulesListDefinition', 'Complet
collapseOpen: true, //Always open first panel
actions: {
submit: {
ngClick: 'launch()',
awToolTip: 'Start a job using this template',
dataPlacement: 'top',
mode: 'edit'
},
stream: {
'class': "btn-primary btn-xs activity-btn",
ngClick: "showActivity()",