mirror of
https://github.com/ansible/awx.git
synced 2026-05-05 08:27:39 -02:30
Properly pass path to error message
This commit is contained in:
committed by
Jeff Bradberry
parent
03c07c0843
commit
cc3f2e0819
@@ -39,12 +39,17 @@ function atLaunchTemplateCtrl (
|
|||||||
if (vm.template.type === 'job_template') {
|
if (vm.template.type === 'job_template') {
|
||||||
const selectedJobTemplate = jobTemplate.create();
|
const selectedJobTemplate = jobTemplate.create();
|
||||||
const preLaunchPromises = [
|
const preLaunchPromises = [
|
||||||
selectedJobTemplate.getLaunch(vm.template.id),
|
selectedJobTemplate.getLaunch(vm.template.id)
|
||||||
selectedJobTemplate.optionsLaunch(vm.template.id),
|
.catch(createErrorHandler(`/api/v2/job_templates/${vm.template.id}/launch`, 'GET')),
|
||||||
|
selectedJobTemplate.optionsLaunch(vm.template.id)
|
||||||
|
.catch(createErrorHandler(`/api/v2/job_templates/${vm.template.id}/launch`, 'OPTIONS'))
|
||||||
];
|
];
|
||||||
|
|
||||||
Promise.all(preLaunchPromises)
|
Promise.all(preLaunchPromises)
|
||||||
.then(([launchData, launchOptions]) => {
|
.then(([launchData, launchOptions]) => {
|
||||||
|
// If we don't get both of these things then one of the
|
||||||
|
// promises was rejected
|
||||||
|
if (launchData && launchOptions) {
|
||||||
if (selectedJobTemplate.canLaunchWithoutPrompt()) {
|
if (selectedJobTemplate.canLaunchWithoutPrompt()) {
|
||||||
selectedJobTemplate
|
selectedJobTemplate
|
||||||
.postLaunch({ id: vm.template.id })
|
.postLaunch({ id: vm.template.id })
|
||||||
@@ -57,7 +62,7 @@ function atLaunchTemplateCtrl (
|
|||||||
$state.go('output', { id: data.job, type: 'playbook' }, { reload: true });
|
$state.go('output', { id: data.job, type: 'playbook' }, { reload: true });
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.catch(createErrorHandler('launch job template', 'POST'));
|
.catch(createErrorHandler(`/api/v2/job_templates/${vm.template.id}/launch`, 'POST'));
|
||||||
} else {
|
} else {
|
||||||
const promptData = {
|
const promptData = {
|
||||||
launchConf: launchData.data,
|
launchConf: launchData.data,
|
||||||
@@ -80,30 +85,36 @@ function atLaunchTemplateCtrl (
|
|||||||
promptData.surveyQuestions = processed.surveyQuestions;
|
promptData.surveyQuestions = processed.surveyQuestions;
|
||||||
vm.promptData = promptData;
|
vm.promptData = promptData;
|
||||||
})
|
})
|
||||||
.catch(createErrorHandler('get survey questions', 'GET'));
|
.catch(createErrorHandler(`/api/v2/job_templates/${vm.template.id}/survey_spec`, 'GET'));
|
||||||
} else {
|
} else {
|
||||||
vm.promptData = promptData;
|
vm.promptData = promptData;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
}
|
||||||
.catch(createErrorHandler('get launch options', 'GET'));
|
});
|
||||||
} else if (vm.template.type === 'workflow_job_template') {
|
} else if (vm.template.type === 'workflow_job_template') {
|
||||||
const selectedWorkflowJobTemplate = workflowTemplate.create();
|
const selectedWorkflowJobTemplate = workflowTemplate.create();
|
||||||
const preLaunchPromises = [
|
const preLaunchPromises = [
|
||||||
selectedWorkflowJobTemplate.request('get', vm.template.id),
|
selectedWorkflowJobTemplate.request('get', vm.template.id)
|
||||||
selectedWorkflowJobTemplate.getLaunch(vm.template.id),
|
.catch(createErrorHandler(`/api/v2/workflow_job_templates/${vm.template.id}`, 'GET')),
|
||||||
selectedWorkflowJobTemplate.optionsLaunch(vm.template.id),
|
selectedWorkflowJobTemplate.getLaunch(vm.template.id)
|
||||||
|
.catch(createErrorHandler(`/api/v2/workflow_job_templates/${vm.template.id}/launch`, 'GET')),
|
||||||
|
selectedWorkflowJobTemplate.optionsLaunch(vm.template.id)
|
||||||
|
.catch(createErrorHandler(`/api/v2/workflow_job_templates/${vm.template.id}/launch`, 'OPTIONS')),
|
||||||
];
|
];
|
||||||
|
|
||||||
Promise.all(preLaunchPromises)
|
Promise.all(preLaunchPromises)
|
||||||
.then(([wfjtData, launchData, launchOptions]) => {
|
.then(([wfjtData, launchData, launchOptions]) => {
|
||||||
|
// If we don't get all of these things then one of the
|
||||||
|
// promises was rejected
|
||||||
|
if (wfjtData && launchData && launchOptions) {
|
||||||
if (selectedWorkflowJobTemplate.canLaunchWithoutPrompt()) {
|
if (selectedWorkflowJobTemplate.canLaunchWithoutPrompt()) {
|
||||||
selectedWorkflowJobTemplate
|
selectedWorkflowJobTemplate
|
||||||
.postLaunch({ id: vm.template.id })
|
.postLaunch({ id: vm.template.id })
|
||||||
.then(({ data }) => {
|
.then(({ data }) => {
|
||||||
$state.go('workflowResults', { id: data.workflow_job }, { reload: true });
|
$state.go('workflowResults', { id: data.workflow_job }, { reload: true });
|
||||||
})
|
})
|
||||||
.catch(createErrorHandler('launch workflow job template', 'POST'));
|
.catch(createErrorHandler(`/api/v2/workflow_job_templates/${vm.template.id}/launch`, 'POST'));
|
||||||
} else {
|
} else {
|
||||||
launchData.data.defaults.extra_vars = wfjtData.data.extra_vars;
|
launchData.data.defaults.extra_vars = wfjtData.data.extra_vars;
|
||||||
|
|
||||||
@@ -127,13 +138,14 @@ function atLaunchTemplateCtrl (
|
|||||||
});
|
});
|
||||||
promptData.surveyQuestions = processed.surveyQuestions;
|
promptData.surveyQuestions = processed.surveyQuestions;
|
||||||
vm.promptData = promptData;
|
vm.promptData = promptData;
|
||||||
});
|
})
|
||||||
|
.catch(createErrorHandler(`/api/v2/workflow_job_templates/${vm.template.id}/survey_spec`, 'GET'));
|
||||||
} else {
|
} else {
|
||||||
vm.promptData = promptData;
|
vm.promptData = promptData;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
}
|
||||||
.catch(createErrorHandler('get launch options', 'GET'));
|
});
|
||||||
} else {
|
} else {
|
||||||
Alert(templatesStrings.get('error.UNKNOWN'), templatesStrings.get('alert.UNKNOWN_LAUNCH'));
|
Alert(templatesStrings.get('error.UNKNOWN'), templatesStrings.get('alert.UNKNOWN_LAUNCH'));
|
||||||
}
|
}
|
||||||
@@ -168,14 +180,14 @@ function atLaunchTemplateCtrl (
|
|||||||
} else {
|
} else {
|
||||||
$state.go('output', { id: launchRes.data.job, type: 'playbook' }, { reload: true });
|
$state.go('output', { id: launchRes.data.job, type: 'playbook' }, { reload: true });
|
||||||
}
|
}
|
||||||
}).catch(createErrorHandler('launch job template', 'POST'));
|
}).catch(createErrorHandler(`/api/v2/job_templates/${vm.template.id}/launch`, 'POST'));
|
||||||
} else if (vm.promptData.templateType === 'workflow_job_template') {
|
} else if (vm.promptData.templateType === 'workflow_job_template') {
|
||||||
workflowTemplate.create().postLaunch({
|
workflowTemplate.create().postLaunch({
|
||||||
id: vm.promptData.template,
|
id: vm.promptData.template,
|
||||||
launchData: jobLaunchData
|
launchData: jobLaunchData
|
||||||
}).then((launchRes) => {
|
}).then((launchRes) => {
|
||||||
$state.go('workflowResults', { id: launchRes.data.workflow_job }, { reload: true });
|
$state.go('workflowResults', { id: launchRes.data.workflow_job }, { reload: true });
|
||||||
}).catch(createErrorHandler('launch workflow job template', 'POST'));
|
}).catch(createErrorHandler(`/api/v2/workflow_job_templates/${vm.template.id}/launch`, 'POST'));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user