mirror of
https://github.com/ansible/awx.git
synced 2026-01-12 02:19:58 -03:30
Merge pull request #2184 from jaredevantabor/stdout-actions
Adding relaunch and cancel/delete buttons to the stdout page for
This commit is contained in:
commit
ceea7fd62a
@ -107,10 +107,32 @@ export default
|
||||
Rest.post(job_launch_data)
|
||||
.success(function(data) {
|
||||
Wait('stop');
|
||||
var job = data.job || data.system_job;
|
||||
var job = data.job || data.system_job || data.project_update || data.inventory_update || data.ad_hoc_command,
|
||||
key = Object.keys(data);
|
||||
if((scope.portalMode===false || scope.$parent.portalMode===false ) && Empty(data.system_job) || (base === 'home')){
|
||||
// use $state.go with reload: true option to re-instantiate sockets in
|
||||
$state.go('jobDetail', {id: job}, {reload: true});
|
||||
|
||||
var goToJobDetails = function(state) {
|
||||
$state.go(state, {id: job}, {reload:true});
|
||||
};
|
||||
|
||||
switch(key[0]) {
|
||||
case 'job':
|
||||
goToJobDetails('jobDetail');
|
||||
break;
|
||||
case 'ad_hoc_command':
|
||||
goToJobDetails('adHocJobStdout');
|
||||
break;
|
||||
case 'system_job':
|
||||
goToJobDetails('managementJobStdout');
|
||||
break;
|
||||
case 'project_update':
|
||||
goToJobDetails('scmUpdateStdout');
|
||||
break;
|
||||
case 'inventory_update':
|
||||
goToJobDetails('inventorySyncStdout');
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(scope.clearDialog) {
|
||||
scope.clearDialog();
|
||||
|
||||
@ -107,7 +107,7 @@ export default
|
||||
ngClick: 'deleteJob(all_job.id)',
|
||||
awToolTip: 'Cancel the job',
|
||||
dataPlacement: 'top',
|
||||
ngShow: "all_job.status === 'running'|| all_job.status == 'waiting' || all_job.status == 'pending'"
|
||||
ngShow: "all_job.status === 'running'|| all_job.status === 'waiting' || all_job.status === 'pending'"
|
||||
},
|
||||
"delete": {
|
||||
mode: 'all',
|
||||
|
||||
@ -7,11 +7,11 @@
|
||||
// import listGenerator from 'tower/shared/list-generator/main';
|
||||
|
||||
export default
|
||||
[ 'Wait', '$location' , '$compile', 'CreateDialog', 'GetBasePath' ,
|
||||
[ 'Wait', '$compile', 'CreateDialog', 'GetBasePath' ,
|
||||
'SearchInit' , 'PaginateInit', 'SchedulesList', 'Rest' ,
|
||||
'ProcessErrors', 'managementJobsListObject', '$rootScope', '$state',
|
||||
'$scope', 'CreateSelect2',
|
||||
function( Wait, $location, $compile, CreateDialog, GetBasePath,
|
||||
function( Wait, $compile, CreateDialog, GetBasePath,
|
||||
SearchInit, PaginateInit, SchedulesList, Rest, ProcessErrors,
|
||||
managementJobsListObject, $rootScope, $state, $scope,
|
||||
CreateSelect2) {
|
||||
@ -129,11 +129,11 @@ export default
|
||||
|
||||
Rest.setUrl(defaultUrl);
|
||||
Rest.post(data)
|
||||
.success(function() {
|
||||
.success(function(data) {
|
||||
Wait('stop');
|
||||
$("#prompt-for-days-facts").dialog("close");
|
||||
$("#configure-tower-dialog").dialog('close');
|
||||
$location.path('/jobs/');
|
||||
$state.go('managementJobStdout', {id: data.system_job}, {reload:true});
|
||||
})
|
||||
.error(function(data, status) {
|
||||
ProcessErrors(scope, data, status, null, { hdr: 'Error!',
|
||||
@ -217,11 +217,11 @@ export default
|
||||
|
||||
Rest.setUrl(defaultUrl);
|
||||
Rest.post(data)
|
||||
.success(function() {
|
||||
.success(function(data) {
|
||||
Wait('stop');
|
||||
$("#prompt-for-days").dialog("close");
|
||||
// $("#configure-tower-dialog").dialog('close');
|
||||
$location.path('/jobs/');
|
||||
$state.go('managementJobStdout', {id: data.system_job}, {reload:true});
|
||||
})
|
||||
.error(function(data, status) {
|
||||
ProcessErrors(scope, data, status, null, { hdr: 'Error!',
|
||||
|
||||
@ -4,7 +4,14 @@
|
||||
<div class="StandardOut-leftPanel" ng-show="!stdoutFullScreen">
|
||||
<div class="Panel">
|
||||
<div class="StandardOut-panelHeader">
|
||||
RESULTS
|
||||
<div class="StandardOut-panelHeaderText">
|
||||
RESULTS
|
||||
</div>
|
||||
<div class="StandardOut-actions">
|
||||
<button id="relaunch-job-button" class="List-actionButton JobDetail-launchButton" data-placement="top" mode="all" ng-click="relaunchJob()" aw-tool-tip="Relaunch using the same parameters" data-original-title="" title=""><i class="fa fa-rocket"></i> </button>
|
||||
<button id="cancel-job-button" class="List-actionButton List-actionButton--delete JobDetail-launchButton" data-placement="top" ng-click="deleteJob()" ng-show="job.status == 'running' || job.status=='pending' " aw-tool-tip="Cancel" data-original-title="" title=""><i class="fa fa-minus-circle"></i> </button>
|
||||
<button id="delete-job-button" class="List-actionButton List-actionButton--delete JobDetail-launchButton" data-placement="top" ng-click="deleteJob()" ng-hide="job.status == 'running' || job.status == 'pending' " aw-tool-tip="Delete" data-original-title="" title=""><i class="fa fa-trash-o"></i> </button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="StandardOut-details">
|
||||
|
||||
|
||||
@ -4,7 +4,14 @@
|
||||
<div class="StandardOut-leftPanel" ng-show="!stdoutFullScreen">
|
||||
<div class="Panel">
|
||||
<div class="StandardOut-panelHeader">
|
||||
RESULTS
|
||||
<div class="StandardOut-panelHeaderText">
|
||||
RESULTS
|
||||
</div>
|
||||
<div class="StandardOut-actions">
|
||||
<button id="relaunch-job-button" class="List-actionButton JobDetail-launchButton" data-placement="top" mode="all" ng-click="relaunchJob()" aw-tool-tip="Relaunch using the same parameters" data-original-title="" title=""><i class="fa fa-rocket"></i> </button>
|
||||
<button id="cancel-job-button" class="List-actionButton List-actionButton--delete JobDetail-launchButton" data-placement="top" ng-click="deleteJob()" ng-show="job.status == 'running' || job.status=='pending' " aw-tool-tip="Cancel" data-original-title="" title=""><i class="fa fa-minus-circle"></i> </button>
|
||||
<button id="delete-job-button" class="List-actionButton List-actionButton--delete JobDetail-launchButton" data-placement="top" ng-click="deleteJob()" ng-hide="job.status == 'running' || job.status == 'pending' " aw-tool-tip="Delete" data-original-title="" title=""><i class="fa fa-trash-o"></i> </button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="StandardOut-details">
|
||||
|
||||
|
||||
@ -1,10 +1,16 @@
|
||||
<div class="tab-pane" id="jobs-stdout">
|
||||
<div ng-cloak id="htmlTemplate">
|
||||
<div class="StandardOut-container" ng-class="{'fullscreen': stdoutFullScreen}">
|
||||
<div class="StandardOut-container">
|
||||
<div class="StandardOut-leftPanel" ng-show="!stdoutFullScreen">
|
||||
<div class="Panel">
|
||||
<div class="StandardOut-panelHeader">
|
||||
RESULTS
|
||||
<div class="StandardOut-panelHeaderText">
|
||||
RESULTS
|
||||
</div>
|
||||
<div class="StandardOut-actions">
|
||||
<button id="cancel-job-button" class="List-actionButton List-actionButton--delete JobDetail-launchButton" data-placement="top" ng-click="deleteJob()" ng-show="job.status == 'running' || job.status=='pending' " aw-tool-tip="Cancel" data-original-title="" title=""><i class="fa fa-minus-circle"></i> </button>
|
||||
<button id="delete-job-button" class="List-actionButton List-actionButton--delete JobDetail-launchButton" data-placement="top" ng-click="deleteJob()" ng-hide="job.status == 'running' || job.status == 'pending' " aw-tool-tip="Delete" data-original-title="" title=""><i class="fa fa-trash-o"></i> </button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="StandardOut-details">
|
||||
|
||||
|
||||
@ -4,7 +4,14 @@
|
||||
<div class="StandardOut-leftPanel" ng-show="!stdoutFullScreen">
|
||||
<div class="Panel">
|
||||
<div class="StandardOut-panelHeader">
|
||||
RESULTS
|
||||
<div class="StandardOut-panelHeaderText">
|
||||
RESULTS
|
||||
</div>
|
||||
<div class="StandardOut-actions">
|
||||
<button id="relaunch-job-button" class="List-actionButton JobDetail-launchButton" data-placement="top" mode="all" ng-click="relaunchJob()" aw-tool-tip="Relaunch using the same parameters" data-original-title="" title=""><i class="fa fa-rocket"></i> </button>
|
||||
<button id="cancel-job-button" class="List-actionButton List-actionButton--delete JobDetail-launchButton" data-placement="top" ng-click="deleteJob()" ng-show="job.status == 'running' || job.status=='pending' " aw-tool-tip="Cancel" data-original-title="" title=""><i class="fa fa-minus-circle"></i> </button>
|
||||
<button id="delete-job-button" class="List-actionButton List-actionButton--delete JobDetail-launchButton" data-placement="top" ng-click="deleteJob()" ng-hide="job.status == 'running' || job.status == 'pending' " aw-tool-tip="Delete" data-original-title="" title=""><i class="fa fa-trash-o"></i> </button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="StandardOut-details">
|
||||
|
||||
|
||||
@ -10,8 +10,9 @@
|
||||
* @description This controller's for the standard out page that can be displayed when a job runs
|
||||
*/
|
||||
|
||||
|
||||
export function JobStdoutController ($rootScope, $scope, $state, $stateParams, ClearScope, GetBasePath, Rest, ProcessErrors, Empty, GetChoices, LookUpName, ParseTypeChange, ParseVariableString) {
|
||||
export function JobStdoutController ($rootScope, $scope, $state, $stateParams,
|
||||
ClearScope, GetBasePath, Rest, ProcessErrors, Empty, GetChoices, LookUpName,
|
||||
ParseTypeChange, ParseVariableString, RelaunchJob, DeleteJob, Wait) {
|
||||
|
||||
ClearScope();
|
||||
|
||||
@ -164,6 +165,17 @@ export function JobStdoutController ($rootScope, $scope, $state, $stateParams, C
|
||||
|
||||
}
|
||||
|
||||
if ($scope.removeDeleteFinished) {
|
||||
$scope.removeDeleteFinished();
|
||||
}
|
||||
$scope.removeDeleteFinished = $scope.$on('DeleteFinished', function(e, action) {
|
||||
Wait('stop');
|
||||
if (action !== 'cancel') {
|
||||
Wait('stop');
|
||||
$state.go('jobs');
|
||||
}
|
||||
});
|
||||
|
||||
// TODO: this is currently not used but is necessary for cases where sockets
|
||||
// are not available and a manual refresh trigger is needed.
|
||||
$scope.refresh = function(){
|
||||
@ -175,8 +187,35 @@ export function JobStdoutController ($rootScope, $scope, $state, $stateParams, C
|
||||
$scope.stdoutFullScreen = !$scope.stdoutFullScreen;
|
||||
};
|
||||
|
||||
$scope.deleteJob = function() {
|
||||
DeleteJob({
|
||||
scope: $scope,
|
||||
id: $scope.job.id,
|
||||
job: $scope.job,
|
||||
callback: 'DeleteFinished'
|
||||
});
|
||||
};
|
||||
|
||||
$scope.relaunchJob = function() {
|
||||
var typeId, job = $scope.job;
|
||||
if (job.type === 'inventory_update') {
|
||||
typeId = job.inventory_source;
|
||||
}
|
||||
else if (job.type === 'project_update') {
|
||||
typeId = job.project;
|
||||
}
|
||||
else if (job.type === 'job' || job.type === "system_job" || job.type === 'ad_hoc_command') {
|
||||
typeId = job.id;
|
||||
}
|
||||
RelaunchJob({ scope: $scope, id: typeId, type: job.type, name: job.name });
|
||||
};
|
||||
|
||||
|
||||
getJobDetails();
|
||||
|
||||
}
|
||||
|
||||
JobStdoutController.$inject = [ '$rootScope', '$scope', '$state', '$stateParams', 'ClearScope', 'GetBasePath', 'Rest', 'ProcessErrors', 'Empty', 'GetChoices', 'LookUpName', 'ParseTypeChange', 'ParseVariableString'];
|
||||
JobStdoutController.$inject = [ '$rootScope', '$scope', '$state',
|
||||
'$stateParams', 'ClearScope', 'GetBasePath', 'Rest', 'ProcessErrors',
|
||||
'Empty', 'GetChoices', 'LookUpName', 'ParseTypeChange',
|
||||
'ParseVariableString', 'RelaunchJob', 'DeleteJob', 'Wait'];
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user