mirror of
https://github.com/ansible/awx.git
synced 2026-03-01 08:48:46 -03:30
Merge pull request #3155 from mabashian/3057-adhoc-relaunch-password
Fixed adhoc relaunch logic to match normal adhoc launch logic
This commit is contained in:
@@ -55,9 +55,9 @@ export default
|
|||||||
// Submit request to run an adhoc comamand
|
// Submit request to run an adhoc comamand
|
||||||
.factory('AdhocRun', ['$location','$stateParams', 'LaunchJob',
|
.factory('AdhocRun', ['$location','$stateParams', 'LaunchJob',
|
||||||
'PromptForPasswords', 'Rest', 'GetBasePath', 'Alert', 'ProcessErrors',
|
'PromptForPasswords', 'Rest', 'GetBasePath', 'Alert', 'ProcessErrors',
|
||||||
'Wait', 'Empty', 'CreateLaunchDialog',
|
'Wait', 'Empty', 'CreateLaunchDialog', '$state',
|
||||||
function ($location, $stateParams, LaunchJob, PromptForPasswords,
|
function ($location, $stateParams, LaunchJob, PromptForPasswords,
|
||||||
Rest, GetBasePath, Alert, ProcessErrors, Wait, Empty, CreateLaunchDialog) {
|
Rest, GetBasePath, Alert, ProcessErrors, Wait, Empty, CreateLaunchDialog, $state) {
|
||||||
return function (params) {
|
return function (params) {
|
||||||
var id = params.project_id,
|
var id = params.project_id,
|
||||||
scope = params.scope.$new(),
|
scope = params.scope.$new(),
|
||||||
@@ -87,25 +87,31 @@ export default
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
if (scope.removeAdhocLaunchFinished) {
|
|
||||||
scope.removeAdhocLaunchFinished();
|
|
||||||
}
|
|
||||||
scope.removeAdhocLaunchFinished = scope.$on('AdhocLaunchFinished',
|
|
||||||
function(e, data) {
|
|
||||||
$location.path('/ad_hoc_commands/' + data.id);
|
|
||||||
});
|
|
||||||
|
|
||||||
if (scope.removeStartAdhocRun) {
|
if (scope.removeStartAdhocRun) {
|
||||||
scope.removeStartAdhocRun();
|
scope.removeStartAdhocRun();
|
||||||
}
|
}
|
||||||
|
|
||||||
scope.removeStartAdhocRun = scope.$on('StartAdhocRun', function() {
|
scope.removeStartAdhocRun = scope.$on('StartAdhocRun', function() {
|
||||||
LaunchJob({
|
var password,
|
||||||
scope: scope,
|
postData={};
|
||||||
url: url,
|
for (password in scope.passwords) {
|
||||||
callback: 'AdhocLaunchFinished' // send to the adhoc
|
postData[scope.passwords[password]] = scope[
|
||||||
// standard out page
|
scope.passwords[password]
|
||||||
});
|
];
|
||||||
|
}
|
||||||
|
// Re-launch the adhoc job
|
||||||
|
Rest.setUrl(url);
|
||||||
|
Rest.post(postData)
|
||||||
|
.success(function (data) {
|
||||||
|
Wait('stop');
|
||||||
|
$state.go('adHocJobStdout', {id: data.id});
|
||||||
|
})
|
||||||
|
.error(function (data, status) {
|
||||||
|
ProcessErrors(scope, data, status, {
|
||||||
|
hdr: 'Error!',
|
||||||
|
msg: 'Failed to launch adhoc command. POST ' +
|
||||||
|
'returned status: ' + status });
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
// start routine only if passwords need to be prompted
|
// start routine only if passwords need to be prompted
|
||||||
|
|||||||
@@ -242,7 +242,7 @@ function adhocController($q, $scope, $location, $stateParams,
|
|||||||
Rest.post(data)
|
Rest.post(data)
|
||||||
.success(function (data) {
|
.success(function (data) {
|
||||||
Wait('stop');
|
Wait('stop');
|
||||||
$location.path("/ad_hoc_commands/" + data.id);
|
$state.go('adHocJobStdout', {id: data.id});
|
||||||
})
|
})
|
||||||
.error(function (data, status) {
|
.error(function (data, status) {
|
||||||
ProcessErrors($scope, data, status, adhocForm, {
|
ProcessErrors($scope, data, status, adhocForm, {
|
||||||
|
|||||||
Reference in New Issue
Block a user