From 4fcfac31373cfe4980c35e3dd99a668d33dc09e8 Mon Sep 17 00:00:00 2001 From: John Mitchell Date: Fri, 26 May 2017 11:56:14 -0400 Subject: [PATCH] updates to jshint and groups language to inventory_source --- .../sources/add/sources-add.controller.js | 11 +++--- .../sources/edit/sources-edit.controller.js | 16 ++++---- .../sources/list/sources-list.controller.js | 13 ++++--- .../sources/list/sources-list.partial.html | 4 +- .../src/inventories/sources/sources.form.js | 38 +++++++++---------- awx/ui/client/src/shared/Utilities.js | 15 ++++---- 6 files changed, 48 insertions(+), 49 deletions(-) diff --git a/awx/ui/client/src/inventories/sources/add/sources-add.controller.js b/awx/ui/client/src/inventories/sources/add/sources-add.controller.js index 471f2dda7f..870125a87d 100644 --- a/awx/ui/client/src/inventories/sources/add/sources-add.controller.js +++ b/awx/ui/client/src/inventories/sources/add/sources-add.controller.js @@ -5,13 +5,12 @@ *************************************************/ export default ['$state', '$stateParams', '$scope', 'SourcesFormDefinition', - 'ParseTypeChange', 'GenerateForm', 'inventoryData', 'GroupManageService', - 'GetChoices', 'GetBasePath', 'CreateSelect2', 'GetSourceTypeOptions', 'Empty', - 'rbacUiControlService', 'ToJSON', 'SourcesService', 'Wait', 'Rest', + 'ParseTypeChange', 'GenerateForm', 'inventoryData', 'GetChoices', 'GetBasePath', 'CreateSelect2', 'GetSourceTypeOptions', 'Empty', + 'rbacUiControlService', 'ToJSON', 'SourcesService', 'Wait', 'Rest', 'Alert', 'ProcessErrors', function($state, $stateParams, $scope, SourcesFormDefinition, ParseTypeChange, - GenerateForm, inventoryData, GroupManageService, GetChoices, + GenerateForm, inventoryData, GetChoices, GetBasePath, CreateSelect2, GetSourceTypeOptions, Empty, rbacUiControlService, - ToJSON, SourcesService, Wait, Rest) { + ToJSON, SourcesService, Wait, Rest, Alert, ProcessErrors) { let form = SourcesFormDefinition; init(); @@ -42,7 +41,7 @@ export default ['$state', '$stateParams', '$scope', 'SourcesFormDefinition', sync_inventory_file_select2(); Wait('stop'); }) - .error(function (ret,status_code) { + .error(function () { Alert('Cannot get inventory files', 'Unable to retrieve the list of inventory files for this project.', 'alert-info'); Wait('stop'); }); diff --git a/awx/ui/client/src/inventories/sources/edit/sources-edit.controller.js b/awx/ui/client/src/inventories/sources/edit/sources-edit.controller.js index db2aa6b193..0c354958cb 100644 --- a/awx/ui/client/src/inventories/sources/edit/sources-edit.controller.js +++ b/awx/ui/client/src/inventories/sources/edit/sources-edit.controller.js @@ -5,13 +5,11 @@ *************************************************/ export default ['$state', '$stateParams', '$scope', 'ParseVariableString', - 'rbacUiControlService', 'ToJSON', 'ParseTypeChange', 'GroupManageService', - 'GetChoices', 'GetBasePath', 'CreateSelect2', 'GetSourceTypeOptions', - 'inventorySourceData', 'SourcesService', 'inventoryData', 'Empty', 'Wait', 'Rest', + 'rbacUiControlService', 'ToJSON', 'ParseTypeChange', 'GetChoices', 'GetBasePath', 'CreateSelect2', 'GetSourceTypeOptions', + 'inventorySourceData', 'SourcesService', 'inventoryData', 'Empty', 'Wait', 'Rest', 'Alert', 'ProcessErrors', function($state, $stateParams, $scope, ParseVariableString, - rbacUiControlService, ToJSON,ParseTypeChange, GroupManageService, - GetChoices, GetBasePath, CreateSelect2, GetSourceTypeOptions, - inventorySourceData, SourcesService, inventoryData, Empty, Wait, Rest) { + rbacUiControlService, ToJSON,ParseTypeChange, GetChoices, GetBasePath, CreateSelect2, GetSourceTypeOptions, + inventorySourceData, SourcesService, inventoryData, Empty, Wait, Rest, Alert, ProcessErrors) { init(); @@ -31,6 +29,8 @@ export default ['$state', '$stateParams', '$scope', 'ParseVariableString', {instance_filters: inventorySourceData.instance_filters}, {inventory_script: inventorySourceData.source_script}, {verbosity: inventorySourceData.verbosity}); + + $scope.inventory_source_obj = inventorySourceData; if (inventorySourceData.credential) { $scope.credential_name = inventorySourceData.summary_fields.credential.name; } @@ -73,7 +73,7 @@ export default ['$state', '$stateParams', '$scope', 'ParseVariableString', sync_inventory_file_select2(); Wait('stop'); }) - .error(function (ret,status_code) { + .error(function () { Alert('Cannot get inventory files', 'Unable to retrieve the list of inventory files for this project.', 'alert-info'); Wait('stop'); }); @@ -104,7 +104,7 @@ export default ['$state', '$stateParams', '$scope', 'ParseVariableString', } }) .error(function (data, status) { - ProcessErrors($scope, data, status, form, { hdr: 'Error!', + ProcessErrors($scope, data, status, null, { hdr: 'Error!', msg: 'Failed to get project ' + $scope.project + '. GET returned status: ' + status }); }); } diff --git a/awx/ui/client/src/inventories/sources/list/sources-list.controller.js b/awx/ui/client/src/inventories/sources/list/sources-list.controller.js index 09f78d9980..0f54008553 100644 --- a/awx/ui/client/src/inventories/sources/list/sources-list.controller.js +++ b/awx/ui/client/src/inventories/sources/list/sources-list.controller.js @@ -5,17 +5,18 @@ *************************************************/ export default ['$scope', '$rootScope', '$state', '$stateParams', 'SourcesListDefinition', - 'InventoryUpdate', 'GroupManageService', 'CancelSourceUpdate', + 'InventoryUpdate', 'CancelSourceUpdate', 'ViewUpdateStatus', 'rbacUiControlService', 'GetBasePath', 'GetSyncStatusMsg', 'Dataset', 'Find', 'QuerySet', 'inventoryData', '$filter', 'Prompt', 'Wait', 'SourcesService', function($scope, $rootScope, $state, $stateParams, SourcesListDefinition, - InventoryUpdate, GroupManageService, CancelSourceUpdate, + InventoryUpdate, CancelSourceUpdate, ViewUpdateStatus, rbacUiControlService, GetBasePath, GetSyncStatusMsg, Dataset, Find, qs, inventoryData, $filter, Prompt, Wait, SourcesService){ let list = SourcesListDefinition; + var inventory_source; init(); @@ -24,7 +25,7 @@ $scope.canAdhoc = inventoryData.summary_fields.user_capabilities.adhoc; $scope.canAdd = false; - rbacUiControlService.canAdd(GetBasePath('inventory') + $scope.inventory_id + "/groups") + rbacUiControlService.canAdd(GetBasePath('inventory') + $scope.inventory_id + "/inventory_sources") .then(function(canAdd) { $scope.canAdd = canAdd; }); @@ -38,7 +39,7 @@ _.forEach($scope[list.name], buildStatusIndicators); $scope.$on(`ws-jobs`, function(e, data){ - var inventory_source = Find({ list: $scope.inventory_sources, key: 'id', val: data.inventory_source_id }); + inventory_source = Find({ list: $scope.inventory_sources, key: 'id', val: data.inventory_source_id }); if (inventory_source === undefined || inventory_source === null) { inventory_source = {}; @@ -101,7 +102,7 @@ Wait('start'); SourcesService.delete(inventory_source.id).then(() => { $('#prompt-modal').modal('hide'); - if (parseInt($state.params.source_id) === invnetory_source) { + if (parseInt($state.params.source_id) === inventory_source) { $state.go("sources", null, {reload: true}); } else { $state.go($state.current.name, null, {reload: true}); @@ -136,7 +137,7 @@ }); }; $scope.scheduleSource = function(id) { - // Add this group's id to the array of group id's so that it gets + // Add this inv source's id to the array of inv source id's so that it gets // added to the breadcrumb trail $state.go('inventories.edit.inventory_sources.edit.schedules', {inventory_source_id: id}, {reload: true}); }; diff --git a/awx/ui/client/src/inventories/sources/list/sources-list.partial.html b/awx/ui/client/src/inventories/sources/list/sources-list.partial.html index 1a02f3a515..03cc6ab1fd 100644 --- a/awx/ui/client/src/inventories/sources/list/sources-list.partial.html +++ b/awx/ui/client/src/inventories/sources/list/sources-list.partial.html @@ -5,7 +5,7 @@