mirror of
https://github.com/ansible/awx.git
synced 2026-02-28 08:18:43 -03:30
Properly navigate user after jt/wfjt deletion
This commit is contained in:
@@ -113,10 +113,11 @@ export default ['$scope', '$rootScope', '$location', '$stateParams', 'Rest',
|
|||||||
body: '<div class="Prompt-bodyQuery">Are you sure you want to delete the template below?</div><div class="Prompt-bodyTarget">' + $filter('sanitize')(template.name) + '</div>',
|
body: '<div class="Prompt-bodyQuery">Are you sure you want to delete the template below?</div><div class="Prompt-bodyTarget">' + $filter('sanitize')(template.name) + '</div>',
|
||||||
action: function() {
|
action: function() {
|
||||||
|
|
||||||
function handleSuccessfulDelete() {
|
function handleSuccessfulDelete(isWorkflow) {
|
||||||
// TODO: look at this
|
let stateParamId = isWorkflow ? $state.params.workflow_job_template_id : $state.params.job_template_id;
|
||||||
if (parseInt($state.params.id) === template.id) {
|
if (parseInt(stateParamId) === template.id) {
|
||||||
$state.go("^", null, {reload: true});
|
// Move the user back to the templates list
|
||||||
|
$state.go("templates", null, {reload: true});
|
||||||
} else {
|
} else {
|
||||||
$state.go(".", null, {reload: true});
|
$state.go(".", null, {reload: true});
|
||||||
}
|
}
|
||||||
@@ -128,7 +129,7 @@ export default ['$scope', '$rootScope', '$location', '$stateParams', 'Rest',
|
|||||||
if(template.type && (template.type === 'Workflow Job Template' || template.type === 'workflow_job_template')) {
|
if(template.type && (template.type === 'Workflow Job Template' || template.type === 'workflow_job_template')) {
|
||||||
TemplatesService.deleteWorkflowJobTemplate(template.id)
|
TemplatesService.deleteWorkflowJobTemplate(template.id)
|
||||||
.then(function () {
|
.then(function () {
|
||||||
handleSuccessfulDelete();
|
handleSuccessfulDelete(true);
|
||||||
}, function (data) {
|
}, function (data) {
|
||||||
Wait('stop');
|
Wait('stop');
|
||||||
ProcessErrors($scope, data, data.status, null, { hdr: 'Error!',
|
ProcessErrors($scope, data, data.status, null, { hdr: 'Error!',
|
||||||
|
|||||||
Reference in New Issue
Block a user