From 1afeed3588ba708a2fe99730c323863eb43ffa4a Mon Sep 17 00:00:00 2001 From: Jared Tabor Date: Thu, 26 Mar 2015 10:07:25 -0400 Subject: [PATCH] fix undefined function --- awx/ui/static/js/controllers/JobTemplates.js | 34 +++++++++++--------- 1 file changed, 18 insertions(+), 16 deletions(-) diff --git a/awx/ui/static/js/controllers/JobTemplates.js b/awx/ui/static/js/controllers/JobTemplates.js index 5610037087..8279d0f61e 100644 --- a/awx/ui/static/js/controllers/JobTemplates.js +++ b/awx/ui/static/js/controllers/JobTemplates.js @@ -342,22 +342,7 @@ export function JobTemplatesAdd($scope, $rootScope, $compile, $location, $log, $ parent_scope: $scope }); - if ($routeParams.inventory_id) { - // This means that the job template form was accessed via inventory prop's - // This also means the job is a scan job. - $scope.job_type.value = 'scan'; - $scope.jobTypeChange(); - $scope.inventory = $routeParams.inventory_id; - Rest.setUrl(GetBasePath('inventory') + $routeParams.inventory_id + '/'); - Rest.get() - .success(function (data) { - $scope.inventory_name = data.name; - }) - .error(function (data, status) { - ProcessErrors($scope, data, status, form, { hdr: 'Error!', - msg: 'Failed to lookup inventory: ' + data.id + '. GET returned status: ' + status }); - }); - } + // Update playbook select whenever project value changes selectPlaybook = function (oldValue, newValue) { @@ -415,6 +400,23 @@ export function JobTemplatesAdd($scope, $rootScope, $compile, $location, $log, $ } }; + if ($routeParams.inventory_id) { + // This means that the job template form was accessed via inventory prop's + // This also means the job is a scan job. + $scope.job_type.value = 'scan'; + $scope.jobTypeChange(); + $scope.inventory = $routeParams.inventory_id; + Rest.setUrl(GetBasePath('inventory') + $routeParams.inventory_id + '/'); + Rest.get() + .success(function (data) { + $scope.inventory_name = data.name; + }) + .error(function (data, status) { + ProcessErrors($scope, data, status, form, { hdr: 'Error!', + msg: 'Failed to lookup inventory: ' + data.id + '. GET returned status: ' + status }); + }); + } + // Detect and alert user to potential SCM status issues checkSCMStatus = function (oldValue, newValue) { if (oldValue !== newValue && !Empty($scope.project)) {