Code cleanup

removing commented out code, and fixing management jobs and inventory scripts for passing objects to states
This commit is contained in:
Jared Tabor 2016-01-05 22:29:12 -05:00
parent 33955e3d77
commit e6040371b7
4 changed files with 15 additions and 16 deletions

View File

@ -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});
};

View File

@ -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);

View File

@ -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
});
};

View File

@ -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);