From e6040371b74376516a35aec77e9344cae6f185d8 Mon Sep 17 00:00:00 2001 From: Jared Tabor Date: Tue, 5 Jan 2016 22:29:12 -0500 Subject: [PATCH] Code cleanup removing commented out code, and fixing management jobs and inventory scripts for passing objects to states --- awx/ui/client/src/controllers/Inventories.js | 2 -- .../client/src/inventory-scripts/edit/edit.route.js | 12 ++++++------ .../src/inventory-scripts/list/list.controller.js | 6 +++--- .../src/management-jobs/schedule/schedule.route.js | 11 ++++++----- 4 files changed, 15 insertions(+), 16 deletions(-) diff --git a/awx/ui/client/src/controllers/Inventories.js b/awx/ui/client/src/controllers/Inventories.js index a5f6d1861a..52869a3986 100644 --- a/awx/ui/client/src/controllers/Inventories.js +++ b/awx/ui/client/src/controllers/Inventories.js @@ -310,12 +310,10 @@ export function InventoriesList($scope, $rootScope, $location, $log, }; $scope.addInventory = function () { - // $location.path($location.path() + '/add'); $state.go('inventories.add'); }; $scope.editInventory = function (id) { - // $location.path($location.path() + '/' + id); $state.go('inventories.edit', {inventory_id: id}); }; diff --git a/awx/ui/client/src/inventory-scripts/edit/edit.route.js b/awx/ui/client/src/inventory-scripts/edit/edit.route.js index a8f3f2f015..9d419045b3 100644 --- a/awx/ui/client/src/inventory-scripts/edit/edit.route.js +++ b/awx/ui/client/src/inventory-scripts/edit/edit.route.js @@ -8,9 +8,10 @@ import {templateUrl} from '../../shared/template-url/template-url.factory'; export default { name: 'inventoryScriptsEdit', - route: '/inventory_scripts/:inventory_script', + route: '/inventory_scripts/:inventory_script_id', templateUrl: templateUrl('inventory-scripts/edit/edit'), controller: 'inventoryScriptsEditController', + params: {inventory_script: null}, resolve: { features: ['FeaturesService', function(FeaturesService) { return FeaturesService.get(); @@ -23,12 +24,11 @@ export default { 'GetBasePath', 'ProcessErrors', function($state, $stateParams, $q, rest, getBasePath, ProcessErrors) { - // if ($stateParams.inventory_script) { - // $stateParams.inventory_script = JSON.parse($stateParams.inventory_script); - // return $q.when($stateParams.inventory_script); - // } + if ($stateParams.inventory_script) { + return $q.when($stateParams.inventory_script); + } - var inventoryScriptId = $stateParams.inventory_script; + var inventoryScriptId = $stateParams.inventory_script_id; var url = getBasePath('inventory_scripts') + inventoryScriptId + '/'; rest.setUrl(url); diff --git a/awx/ui/client/src/inventory-scripts/list/list.controller.js b/awx/ui/client/src/inventory-scripts/list/list.controller.js index 7dfe558b4b..9d8bb07289 100644 --- a/awx/ui/client/src/inventory-scripts/list/list.controller.js +++ b/awx/ui/client/src/inventory-scripts/list/list.controller.js @@ -38,9 +38,9 @@ export default scope.search(list.iterator); scope.editCustomInv = function(){ - // this.inventory_script = JSON.stringify(this.inventory_script); - $state.go('inventoryScriptsEdit',{ - inventory_script: this.inventory_script.id + $state.transitionTo('inventoryScriptsEdit',{ + inventory_script_id: this.inventory_script.id, + inventory_script: this.inventory_script }); }; diff --git a/awx/ui/client/src/management-jobs/schedule/schedule.route.js b/awx/ui/client/src/management-jobs/schedule/schedule.route.js index eb2ec7a4ae..060825b075 100644 --- a/awx/ui/client/src/management-jobs/schedule/schedule.route.js +++ b/awx/ui/client/src/management-jobs/schedule/schedule.route.js @@ -8,9 +8,10 @@ import {templateUrl} from '../../shared/template-url/template-url.factory'; export default { name: 'managementJobsSchedule', - route: '/management_jobs/:management_job/schedules', + route: '/management_jobs/:management_job_id/schedules', templateUrl: templateUrl('management-jobs/schedule/schedule'), controller: 'managementJobsScheduleController', + params: {management_job: null}, resolve: { features: ['FeaturesService', function(FeaturesService) { return FeaturesService.get(); @@ -22,11 +23,11 @@ export default { 'GetBasePath', 'ProcessErrors', function($stateParams, $q, rest, getBasePath, ProcessErrors) { - // if ($route.current.hasModelKey('management_job')) { - // return $q.when($route.current.params.model.management_job); - // } + if ($stateParams.management_job) { + return $q.when($stateParams.management_job); + } - var managementJobId = $stateParams.management_job; + var managementJobId = $stateParams.management_job_id; var url = getBasePath('system_job_templates') + managementJobId + '/'; rest.setUrl(url);