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

Merge pull request #3978 from mabashian/3528-workflow-launch-transition

Transition the user to the workflow details view after launch
This commit is contained in:
Michael Abashian 2016-11-11 16:16:39 -05:00 committed by GitHub
commit 887afb79f8
2 changed files with 17 additions and 4 deletions

View File

@ -112,7 +112,7 @@ export default
Rest.post(job_launch_data)
.success(function(data) {
Wait('stop');
var job = data.job || data.system_job || data.project_update || data.inventory_update || data.ad_hoc_command;
var job = data.job || data.system_job || data.project_update || data.inventory_update || data.ad_hoc_command || data.workflow_job;
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
@ -123,6 +123,9 @@ export default
if(_.has(data, 'job')) {
goToJobDetails('jobDetail');
}
else if(_.has(data, 'workflow_job')) {
goToJobDetails('workflowResults');
}
else if(_.has(data, 'ad_hoc_command')) {
goToJobDetails('adHocJobStdout');
}

View File

@ -7,10 +7,12 @@
export default ['$scope', '$rootScope', '$location', '$stateParams', 'Rest', 'Alert',
'JobTemplateList', 'Prompt', 'ClearScope', 'ProcessErrors', 'GetBasePath',
'InitiatePlaybookRun', 'Wait', '$state', '$filter', 'Dataset', 'rbacUiControlService', 'JobTemplateService',
'QuerySet',
function(
$scope, $rootScope, $location, $stateParams, Rest, Alert,
JobTemplateList, Prompt, ClearScope, ProcessErrors, GetBasePath,
InitiatePlaybookRun, Wait, $state, $filter, Dataset, rbacUiControlService, JobTemplateService
InitiatePlaybookRun, Wait, $state, $filter, Dataset, rbacUiControlService, JobTemplateService,
qs
) {
ClearScope();
@ -39,8 +41,16 @@ export default ['$scope', '$rootScope', '$location', '$stateParams', 'Rest', 'Al
}
$scope.$on(`ws-jobs`, function () {
// @issue - this is ham-fisted, expose a simple QuerySet.reload() fn that'll re-fetch dataset
$state.reload();
// @issue - this is no longer quite as ham-fisted but I'd like for someone else to take a peek
// calling $state.reload(); here was problematic when launching a job because job launch also
// attempts to transition the state and they were squashing each other.
let path = GetBasePath(list.basePath) || GetBasePath(list.name);
qs.search(path, $stateParams[`${list.iterator}_search`])
.then(function(searchResponse) {
$scope[`${list.iterator}_dataset`] = searchResponse.data;
$scope[list.name] = $scope[`${list.iterator}_dataset`].results;
});
});
$scope.addJobTemplate = function() {
$state.go('jobTemplates.add');