mirror of
https://github.com/ansible/awx.git
synced 2026-03-01 00:38:45 -03:30
Job templates
Added ability to launch a job from th job template detail page.
This commit is contained in:
@@ -340,7 +340,8 @@ function JobTemplatesEdit($scope, $rootScope, $compile, $location, $log, $routeP
|
|||||||
Alert, ProcessErrors, LoadBreadCrumbs, RelatedSearchInit, RelatedPaginateInit, ReturnToCaller, ClearScope, InventoryList,
|
Alert, ProcessErrors, LoadBreadCrumbs, RelatedSearchInit, RelatedPaginateInit, ReturnToCaller, ClearScope, InventoryList,
|
||||||
CredentialList, ProjectList, LookUpInit, GetBasePath, md5Setup, ParseTypeChange, JobStatusToolTip, FormatDate,
|
CredentialList, ProjectList, LookUpInit, GetBasePath, md5Setup, ParseTypeChange, JobStatusToolTip, FormatDate,
|
||||||
Wait, Stream, Empty, Prompt, ParseVariableString, ToJSON, SchedulesControllerInit, JobsControllerInit, JobsListUpdate,
|
Wait, Stream, Empty, Prompt, ParseVariableString, ToJSON, SchedulesControllerInit, JobsControllerInit, JobsListUpdate,
|
||||||
GetChoices, SchedulesListInit, SchedulesList, CallbackHelpInit) {
|
GetChoices, SchedulesListInit, SchedulesList, CallbackHelpInit, PlaybookRun)
|
||||||
|
{
|
||||||
|
|
||||||
ClearScope();
|
ClearScope();
|
||||||
|
|
||||||
@@ -577,8 +578,8 @@ function JobTemplatesEdit($scope, $rootScope, $compile, $location, $log, $routeP
|
|||||||
}
|
}
|
||||||
$scope.removeLoadJobs = $scope.$on('LoadJobs', function() {
|
$scope.removeLoadJobs = $scope.$on('LoadJobs', function() {
|
||||||
// Retrieve detail record and prepopulate the form
|
// Retrieve detail record and prepopulate the form
|
||||||
Rest.setUrl(defaultUrl + ':id/');
|
Rest.setUrl(defaultUrl + id);
|
||||||
Rest.get({ params: { id: id } })
|
Rest.get()
|
||||||
.success(function (data) {
|
.success(function (data) {
|
||||||
var fld, i;
|
var fld, i;
|
||||||
LoadBreadCrumbs({ path: '/job_templates/' + id, title: data.name });
|
LoadBreadCrumbs({ path: '/job_templates/' + id, title: data.name });
|
||||||
@@ -788,6 +789,14 @@ function JobTemplatesEdit($scope, $rootScope, $compile, $location, $log, $routeP
|
|||||||
$location.path('/' + set + '/' + id);
|
$location.path('/' + set + '/' + id);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// Launch a job using the selected template
|
||||||
|
$scope.launch = function() {
|
||||||
|
PlaybookRun({
|
||||||
|
scope: $scope,
|
||||||
|
id: id
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
// Related set: Delete button
|
// Related set: Delete button
|
||||||
$scope['delete'] = function (set, itm_id, name, title) {
|
$scope['delete'] = function (set, itm_id, name, title) {
|
||||||
$rootScope.flashMessage = null;
|
$rootScope.flashMessage = null;
|
||||||
@@ -824,5 +833,5 @@ JobTemplatesEdit.$inject = ['$scope', '$rootScope', '$compile', '$location', '$l
|
|||||||
'ReturnToCaller', 'ClearScope', 'InventoryList', 'CredentialList', 'ProjectList', 'LookUpInit',
|
'ReturnToCaller', 'ClearScope', 'InventoryList', 'CredentialList', 'ProjectList', 'LookUpInit',
|
||||||
'GetBasePath', 'md5Setup', 'ParseTypeChange', 'JobStatusToolTip', 'FormatDate', 'Wait', 'Stream', 'Empty', 'Prompt',
|
'GetBasePath', 'md5Setup', 'ParseTypeChange', 'JobStatusToolTip', 'FormatDate', 'Wait', 'Stream', 'Empty', 'Prompt',
|
||||||
'ParseVariableString', 'ToJSON', 'SchedulesControllerInit', 'JobsControllerInit', 'JobsListUpdate', 'GetChoices',
|
'ParseVariableString', 'ToJSON', 'SchedulesControllerInit', 'JobsControllerInit', 'JobsListUpdate', 'GetChoices',
|
||||||
'SchedulesListInit', 'SchedulesList', 'CallbackHelpInit'
|
'SchedulesListInit', 'SchedulesList', 'CallbackHelpInit', 'PlaybookRun'
|
||||||
];
|
];
|
||||||
@@ -26,6 +26,12 @@ angular.module('JobTemplateFormDefinition', ['SchedulesListDefinition', 'Complet
|
|||||||
collapseOpen: true, //Always open first panel
|
collapseOpen: true, //Always open first panel
|
||||||
|
|
||||||
actions: {
|
actions: {
|
||||||
|
submit: {
|
||||||
|
ngClick: 'launch()',
|
||||||
|
awToolTip: 'Start a job using this template',
|
||||||
|
dataPlacement: 'top',
|
||||||
|
mode: 'edit'
|
||||||
|
},
|
||||||
stream: {
|
stream: {
|
||||||
'class': "btn-primary btn-xs activity-btn",
|
'class': "btn-primary btn-xs activity-btn",
|
||||||
ngClick: "showActivity()",
|
ngClick: "showActivity()",
|
||||||
|
|||||||
Reference in New Issue
Block a user