diff --git a/awx/ui/client/src/app.js b/awx/ui/client/src/app.js index e25d53ac51..0698a2fdbb 100644 --- a/awx/ui/client/src/app.js +++ b/awx/ui/client/src/app.js @@ -255,6 +255,16 @@ var tower = angular.module('Tower', [ }); }); }] + }, + onExit: function(){ + // close the job launch modal + // using an onExit event to handle cases where the user navs away using the url bar / back and not modal "X" + // Destroy the dialog + if($("#job-launch-modal").hasClass('ui-dialog-content')) { + $('#job-launch-modal').dialog('destroy'); + } + // Remove the directive from the page (if it's there) + $('#content-container').find('submit-job').remove(); } }). @@ -264,6 +274,16 @@ var tower = angular.module('Tower', [ controller: JobsListController, ncyBreadcrumb: { label: "JOBS" + }, + onExit: function(){ + // close the job launch modal + // using an onExit event to handle cases where the user navs away using the url bar / back and not modal "X" + // Destroy the dialog + if($("#job-launch-modal").hasClass('ui-dialog-content')) { + $('#job-launch-modal').dialog('destroy'); + } + // Remove the directive from the page (if it's there) + $('#content-container').find('submit-job').remove(); } }). diff --git a/awx/ui/client/src/job-detail/host-summary/host-summary.route.js b/awx/ui/client/src/job-detail/host-summary/host-summary.route.js index a2de70e5d4..f7722462a0 100644 --- a/awx/ui/client/src/job-detail/host-summary/host-summary.route.js +++ b/awx/ui/client/src/job-detail/host-summary/host-summary.route.js @@ -17,5 +17,15 @@ export default { }, ncyBreadcrumb: { skip: true // Never display this state in breadcrumb. + }, + onExit: function(){ + // close the job launch modal + // using an onExit event to handle cases where the user navs away using the url bar / back and not modal "X" + // Destroy the dialog + if($("#job-launch-modal").hasClass('ui-dialog-content')) { + $('#job-launch-modal').dialog('destroy'); + } + // Remove the directive from the page (if it's there) + $('#content-container').find('submit-job').remove(); } }; diff --git a/awx/ui/client/src/job-detail/job-detail.route.js b/awx/ui/client/src/job-detail/job-detail.route.js index dda2722511..bf21fb8e5a 100644 --- a/awx/ui/client/src/job-detail/job-detail.route.js +++ b/awx/ui/client/src/job-detail/job-detail.route.js @@ -30,5 +30,15 @@ export default { }] }, templateUrl: templateUrl('job-detail/job-detail'), - controller: 'JobDetailController' + controller: 'JobDetailController', + onExit: function(){ + // close the job launch modal + // using an onExit event to handle cases where the user navs away using the url bar / back and not modal "X" + // Destroy the dialog + if($("#job-launch-modal").hasClass('ui-dialog-content')) { + $('#job-launch-modal').dialog('destroy'); + } + // Remove the directive from the page (if it's there) + $('#content-container').find('submit-job').remove(); + } }; diff --git a/awx/ui/client/src/job-templates/add/job-templates-add.route.js b/awx/ui/client/src/job-templates/add/job-templates-add.route.js index d9f9a5c9d3..8218cabc32 100644 --- a/awx/ui/client/src/job-templates/add/job-templates-add.route.js +++ b/awx/ui/client/src/job-templates/add/job-templates-add.route.js @@ -14,5 +14,19 @@ export default { ncyBreadcrumb: { parent: "jobTemplates", label: "CREATE JOB TEMPLATE" + }, + onExit: function(){ + // close the job launch modal + // using an onExit event to handle cases where the user navs away using the url bar / back and not modal "X" + // Destroy the dialog + if($("#job-launch-modal").hasClass('ui-dialog-content')) { + $('#job-launch-modal').dialog('destroy'); + } + // Remove the directive from the page (if it's there) + $('#content-container').find('submit-job').remove(); + + if($("#survey-modal-dialog").hasClass('ui-dialog-content')) { + $('#survey-modal-dialog').dialog('destroy'); + } } }; diff --git a/awx/ui/client/src/job-templates/edit/job-templates-edit.route.js b/awx/ui/client/src/job-templates/edit/job-templates-edit.route.js index a9d5ff608f..78d383fa42 100644 --- a/awx/ui/client/src/job-templates/edit/job-templates-edit.route.js +++ b/awx/ui/client/src/job-templates/edit/job-templates-edit.route.js @@ -17,5 +17,19 @@ export default { ncyBreadcrumb: { parent: 'jobTemplates', label: "{{name}}" + }, + onExit: function(){ + // close the job launch modal + // using an onExit event to handle cases where the user navs away using the url bar / back and not modal "X" + // Destroy the dialog + if($("#job-launch-modal").hasClass('ui-dialog-content')) { + $('#job-launch-modal').dialog('destroy'); + } + // Remove the directive from the page (if it's there) + $('#content-container').find('submit-job').remove(); + + if($("#survey-modal-dialog").hasClass('ui-dialog-content')) { + $('#survey-modal-dialog').dialog('destroy'); + } } }; diff --git a/awx/ui/client/src/job-templates/list/job-templates-list.route.js b/awx/ui/client/src/job-templates/list/job-templates-list.route.js index deeb1982bd..6c646af729 100644 --- a/awx/ui/client/src/job-templates/list/job-templates-list.route.js +++ b/awx/ui/client/src/job-templates/list/job-templates-list.route.js @@ -17,5 +17,15 @@ export default { }, ncyBreadcrumb: { label: "JOB TEMPLATES" + }, + onExit: function(){ + // close the job launch modal + // using an onExit event to handle cases where the user navs away using the url bar / back and not modal "X" + // Destroy the dialog + if($("#job-launch-modal").hasClass('ui-dialog-content')) { + $('#job-launch-modal').dialog('destroy'); + } + // Remove the directive from the page (if it's there) + $('#content-container').find('submit-job').remove(); } }; diff --git a/awx/ui/client/src/organizations/linkout/organizations-linkout.route.js b/awx/ui/client/src/organizations/linkout/organizations-linkout.route.js index 13d51cc68f..caa8d7692f 100644 --- a/awx/ui/client/src/organizations/linkout/organizations-linkout.route.js +++ b/awx/ui/client/src/organizations/linkout/organizations-linkout.route.js @@ -121,6 +121,16 @@ export default [ features: ['FeaturesService', function(FeaturesService) { return FeaturesService.get(); }] + }, + onExit: function(){ + // close the job launch modal + // using an onExit event to handle cases where the user navs away using the url bar / back and not modal "X" + // Destroy the dialog + if($("#job-launch-modal").hasClass('ui-dialog-content')) { + $('#job-launch-modal').dialog('destroy'); + } + // Remove the directive from the page (if it's there) + $('#content-container').find('submit-job').remove(); } }, { diff --git a/awx/ui/client/src/portal-mode/portal-mode.route.js b/awx/ui/client/src/portal-mode/portal-mode.route.js index c0f7e5f3fb..6982f10620 100644 --- a/awx/ui/client/src/portal-mode/portal-mode.route.js +++ b/awx/ui/client/src/portal-mode/portal-mode.route.js @@ -24,5 +24,15 @@ export default { templateUrl: templateUrl('portal-mode/portal-mode-jobs'), controller: PortalModeJobsController } + }, + onExit: function(){ + // close the job launch modal + // using an onExit event to handle cases where the user navs away using the url bar / back and not modal "X" + // Destroy the dialog + if($("#job-launch-modal").hasClass('ui-dialog-content')) { + $('#job-launch-modal').dialog('destroy'); + } + // Remove the directive from the page (if it's there) + $('#content-container').find('submit-job').remove(); } };