diff --git a/awx/ui/static/js/app.js b/awx/ui/static/js/app.js index 53736eda28..ebce33322b 100644 --- a/awx/ui/static/js/app.js +++ b/awx/ui/static/js/app.js @@ -76,7 +76,6 @@ var tower = angular.module('Tower', [ 'OrganizationListDefinition', 'UserListDefinition', 'UserHelper', - 'ListGenerator', 'PromptDialog', 'ApiLoader', 'RelatedSearchHelper', diff --git a/awx/ui/static/js/controllers/Admins.js b/awx/ui/static/js/controllers/Admins.js index fe30a42444..eb64d5d98c 100644 --- a/awx/ui/static/js/controllers/Admins.js +++ b/awx/ui/static/js/controllers/Admins.js @@ -41,6 +41,6 @@ export function AdminsList($scope, $rootScope, $location, $log, $routeParams, Re LoadBreadCrumbs(); } -AdminsList.$inject = ['$scope', '$rootScope', '$location', '$log', '$routeParams', 'Rest', 'Alert', 'AdminList', 'GenerateList', +AdminsList.$inject = ['$scope', '$rootScope', '$location', '$log', '$routeParams', 'Rest', 'Alert', 'AdminList', 'generateList', 'LoadBreadCrumbs', 'Prompt', 'SearchInit', 'PaginateInit', 'ReturnToCaller', 'GetBasePath', 'SelectionInit' ]; \ No newline at end of file diff --git a/awx/ui/static/js/controllers/Credentials.js b/awx/ui/static/js/controllers/Credentials.js index bd6c0fc99a..600633359d 100644 --- a/awx/ui/static/js/controllers/Credentials.js +++ b/awx/ui/static/js/controllers/Credentials.js @@ -128,7 +128,7 @@ export function CredentialsList($scope, $rootScope, $location, $log, $routeParam }; } -CredentialsList.$inject = ['$scope', '$rootScope', '$location', '$log', '$routeParams', 'Rest', 'Alert', 'CredentialList', 'GenerateList', +CredentialsList.$inject = ['$scope', '$rootScope', '$location', '$log', '$routeParams', 'Rest', 'Alert', 'CredentialList', 'generateList', 'LoadBreadCrumbs', 'Prompt', 'SearchInit', 'PaginateInit', 'ReturnToCaller', 'ClearScope', 'ProcessErrors', 'GetBasePath', 'SelectionInit', 'GetChoices', 'Wait', 'Stream' ]; @@ -293,7 +293,7 @@ export function CredentialsAdd($scope, $rootScope, $compile, $location, $log, $r } CredentialsAdd.$inject = ['$scope', '$rootScope', '$compile', '$location', '$log', '$routeParams', 'CredentialForm', 'GenerateForm', - 'Rest', 'Alert', 'ProcessErrors', 'LoadBreadCrumbs', 'ReturnToCaller', 'ClearScope', 'GenerateList', 'SearchInit', 'PaginateInit', + 'Rest', 'Alert', 'ProcessErrors', 'LoadBreadCrumbs', 'ReturnToCaller', 'ClearScope', 'generateList', 'SearchInit', 'PaginateInit', 'LookUpInit', 'UserList', 'TeamList', 'GetBasePath', 'GetChoices', 'Empty', 'KindChange', 'OwnerChange', 'LoginMethodChange', 'FormSave' ]; diff --git a/awx/ui/static/js/controllers/Home.js b/awx/ui/static/js/controllers/Home.js index 20b4796733..73f978b026 100644 --- a/awx/ui/static/js/controllers/Home.js +++ b/awx/ui/static/js/controllers/Home.js @@ -571,7 +571,7 @@ export function HomeGroups($log, $scope, $filter, $compile, $location, $routePar } -HomeGroups.$inject = ['$log', '$scope', '$filter', '$compile', '$location', '$routeParams', 'LogViewer', 'HomeGroupList', 'GenerateList', 'ProcessErrors', 'LoadBreadCrumbs', 'ReturnToCaller', +HomeGroups.$inject = ['$log', '$scope', '$filter', '$compile', '$location', '$routeParams', 'LogViewer', 'HomeGroupList', 'generateList', 'ProcessErrors', 'LoadBreadCrumbs', 'ReturnToCaller', 'ClearScope', 'GetBasePath', 'SearchInit', 'PaginateInit', 'FormatDate', 'GetHostsStatusMsg', 'GetSyncStatusMsg', 'ViewUpdateStatus', 'Stream', 'GroupsEdit', 'Wait', 'Alert', 'Rest', 'Empty', 'InventoryUpdate', 'Find', 'GroupsCancelUpdate', 'Store', 'Socket' ]; @@ -700,7 +700,7 @@ export function HomeHosts($scope, $location, $routeParams, HomeHostList, Generat } -HomeHosts.$inject = ['$scope', '$location', '$routeParams', 'HomeHostList', 'GenerateList', 'ProcessErrors', 'LoadBreadCrumbs', 'ReturnToCaller', +HomeHosts.$inject = ['$scope', '$location', '$routeParams', 'HomeHostList', 'generateList', 'ProcessErrors', 'LoadBreadCrumbs', 'ReturnToCaller', 'ClearScope', 'GetBasePath', 'SearchInit', 'PaginateInit', 'FormatDate', 'SetStatus', 'ToggleHostEnabled', 'HostsEdit', 'Stream', 'Find', 'ShowJobSummary', 'ViewJob' ]; diff --git a/awx/ui/static/js/controllers/Inventories.js b/awx/ui/static/js/controllers/Inventories.js index e0ff5c5e4e..ba30c6c33d 100644 --- a/awx/ui/static/js/controllers/Inventories.js +++ b/awx/ui/static/js/controllers/Inventories.js @@ -362,7 +362,7 @@ export function InventoriesList($scope, $rootScope, $location, $log, $routeParam }; } -InventoriesList.$inject = ['$scope', '$rootScope', '$location', '$log', '$routeParams', '$compile', '$filter', 'Rest', 'Alert', 'InventoryList', 'GenerateList', +InventoriesList.$inject = ['$scope', '$rootScope', '$location', '$log', '$routeParams', '$compile', '$filter', 'Rest', 'Alert', 'InventoryList', 'generateList', 'LoadBreadCrumbs', 'Prompt', 'SearchInit', 'PaginateInit', 'ReturnToCaller', 'ClearScope', 'ProcessErrors', 'GetBasePath', 'Wait', 'Stream', 'EditInventoryProperties', 'Find', 'Empty', 'LogViewer' ]; @@ -472,7 +472,7 @@ export function InventoriesAdd($scope, $rootScope, $compile, $location, $log, $r } InventoriesAdd.$inject = ['$scope', '$rootScope', '$compile', '$location', '$log', '$routeParams', 'InventoryForm', 'GenerateForm', - 'Rest', 'Alert', 'ProcessErrors', 'LoadBreadCrumbs', 'ReturnToCaller', 'ClearScope', 'GenerateList', 'OrganizationList', 'SearchInit', + 'Rest', 'Alert', 'ProcessErrors', 'LoadBreadCrumbs', 'ReturnToCaller', 'ClearScope', 'generateList', 'OrganizationList', 'SearchInit', 'PaginateInit', 'LookUpInit', 'GetBasePath', 'ParseTypeChange', 'Wait', 'ToJSON' ]; @@ -504,8 +504,6 @@ export function InventoriesEdit ($log, $scope, $location, $routeParams, $compile show_failures: false }]; - /**/ - $scope.refreshHostsOnGroupRefresh = false; $scope.selected_group_id = null; @@ -1021,9 +1019,9 @@ export function InventoriesEdit ($log, $scope, $location, $routeParams, $compile }); } -InventoriesEdit.$inject = ['$log', '$scope', '$location', '$routeParams', '$compile', 'GenerateList', 'ClearScope', 'Empty', 'Wait', 'Rest', 'Alert', 'LoadBreadCrumbs', +InventoriesEdit.$inject = ['$log', '$scope', '$location', '$routeParams', '$compile', 'generateList', 'ClearScope', 'Empty', 'Wait', 'Rest', 'Alert', 'LoadBreadCrumbs', 'GetBasePath', 'ProcessErrors', 'Breadcrumbs', 'InventoryGroups', 'InjectHosts', 'Find', 'HostsReload', 'SearchInit', 'PaginateInit', 'GetSyncStatusMsg', 'GetHostsStatusMsg', 'GroupsEdit', 'InventoryUpdate', 'GroupsCancelUpdate', 'ViewUpdateStatus', 'GroupsDelete', 'Store', 'HostsEdit', 'HostsDelete', 'EditInventoryProperties', 'ToggleHostEnabled', 'Stream', 'ShowJobSummary', 'InventoryGroupsHelp', 'HelpDialog', 'ViewJob', 'WatchInventoryWindowResize', 'GetHostContainerRows', 'GetGroupContainerRows', 'GetGroupContainerHeight', 'GroupsCopy', 'HostsCopy', 'Socket' - ]; \ No newline at end of file + ]; diff --git a/awx/ui/static/js/controllers/JobEvents.js b/awx/ui/static/js/controllers/JobEvents.js index f55d1480ae..8c6253ae87 100644 --- a/awx/ui/static/js/controllers/JobEvents.js +++ b/awx/ui/static/js/controllers/JobEvents.js @@ -256,7 +256,7 @@ export function JobEventsList($sce, $filter, $scope, $rootScope, $location, $log } JobEventsList.$inject = ['$sce', '$filter', '$scope', '$rootScope', '$location', '$log', '$routeParams', 'Rest', 'Alert', 'JobEventList', - 'GenerateList', 'LoadBreadCrumbs', 'Prompt', 'SearchInit', 'PaginateInit', 'ReturnToCaller', 'ClearScope', 'ProcessErrors', + 'generateList', 'LoadBreadCrumbs', 'Prompt', 'SearchInit', 'PaginateInit', 'ReturnToCaller', 'ClearScope', 'ProcessErrors', 'GetBasePath', 'LookUpInit', 'ToggleChildren', 'FormatDate', 'EventView', 'Refresh', 'Wait' ]; diff --git a/awx/ui/static/js/controllers/JobHosts.js b/awx/ui/static/js/controllers/JobHosts.js index 399c4dba4e..cda7d54038 100644 --- a/awx/ui/static/js/controllers/JobHosts.js +++ b/awx/ui/static/js/controllers/JobHosts.js @@ -125,6 +125,6 @@ export function JobHostSummaryList($scope, $rootScope, $location, $log, $routePa } JobHostSummaryList.$inject = ['$scope', '$rootScope', '$location', '$log', '$routeParams', 'Rest', 'Alert', 'JobHostList', - 'GenerateList', 'LoadBreadCrumbs', 'Prompt', 'SearchInit', 'PaginateInit', 'ReturnToCaller', 'ClearScope', 'ProcessErrors', + 'generateList', 'LoadBreadCrumbs', 'Prompt', 'SearchInit', 'PaginateInit', 'ReturnToCaller', 'ClearScope', 'ProcessErrors', 'GetBasePath', 'Refresh', 'JobStatusToolTip', 'Wait' ]; \ No newline at end of file diff --git a/awx/ui/static/js/controllers/JobTemplates.js b/awx/ui/static/js/controllers/JobTemplates.js index 135d28e8a3..e9f59d1ad9 100644 --- a/awx/ui/static/js/controllers/JobTemplates.js +++ b/awx/ui/static/js/controllers/JobTemplates.js @@ -241,7 +241,7 @@ export function JobTemplatesList($scope, $rootScope, $location, $log, $routePara } JobTemplatesList.$inject = ['$scope', '$rootScope', '$location', '$log', '$routeParams', 'Rest', 'Alert', 'JobTemplateList', - 'GenerateList', 'LoadBreadCrumbs', 'Prompt', 'SearchInit', 'PaginateInit', 'ReturnToCaller', 'ClearScope', + 'generateList', 'LoadBreadCrumbs', 'Prompt', 'SearchInit', 'PaginateInit', 'ReturnToCaller', 'ClearScope', 'ProcessErrors', 'GetBasePath', 'JobTemplateForm', 'CredentialList', 'LookUpInit', 'PlaybookRun', 'Wait', 'Stream', 'CreateDialog' , '$compile' ]; diff --git a/awx/ui/static/js/controllers/Organizations.js b/awx/ui/static/js/controllers/Organizations.js index 1726671feb..d558bd5d30 100644 --- a/awx/ui/static/js/controllers/Organizations.js +++ b/awx/ui/static/js/controllers/Organizations.js @@ -96,7 +96,7 @@ export function OrganizationsList($routeParams, $scope, $rootScope, $location, $ } OrganizationsList.$inject = ['$routeParams', '$scope', '$rootScope', '$location', '$log', 'Rest', 'Alert', 'LoadBreadCrumbs', 'Prompt', - 'GenerateList', 'OrganizationList', 'SearchInit', 'PaginateInit', 'ClearScope', 'ProcessErrors', 'GetBasePath', 'SelectionInit', 'Wait', + 'generateList', 'OrganizationList', 'SearchInit', 'PaginateInit', 'ClearScope', 'ProcessErrors', 'GetBasePath', 'SelectionInit', 'Wait', 'Stream' ]; diff --git a/awx/ui/static/js/controllers/Permissions.js b/awx/ui/static/js/controllers/Permissions.js index 67a2bcf012..f0bb619c26 100644 --- a/awx/ui/static/js/controllers/Permissions.js +++ b/awx/ui/static/js/controllers/Permissions.js @@ -97,7 +97,7 @@ export function PermissionsList($scope, $rootScope, $location, $log, $routeParam } PermissionsList.$inject = ['$scope', '$rootScope', '$location', '$log', '$routeParams', 'Rest', 'Alert', 'PermissionList', - 'GenerateList', 'LoadBreadCrumbs', 'Prompt', 'SearchInit', 'PaginateInit', 'ReturnToCaller', + 'generateList', 'LoadBreadCrumbs', 'Prompt', 'SearchInit', 'PaginateInit', 'ReturnToCaller', 'ClearScope', 'ProcessErrors', 'GetBasePath', 'CheckAccess', 'Wait' ]; diff --git a/awx/ui/static/js/controllers/Portal.js b/awx/ui/static/js/controllers/Portal.js index 3bffa0ac54..7fc9b4bb4e 100644 --- a/awx/ui/static/js/controllers/Portal.js +++ b/awx/ui/static/js/controllers/Portal.js @@ -176,5 +176,5 @@ export function PortalController($scope, $compile, $routeParams, $rootScope, $lo } PortalController.$inject = ['$scope', '$compile', '$routeParams', '$rootScope', '$location', '$log','Wait', 'ClearScope', 'Stream', 'Rest', 'GetBasePath', 'ProcessErrors', - 'Button', 'PortalJobsWidget', 'GenerateList' , 'PortalJobTemplateList', 'SearchInit', 'PaginateInit', 'PlaybookRun' + 'Button', 'PortalJobsWidget', 'generateList' , 'PortalJobTemplateList', 'SearchInit', 'PaginateInit', 'PlaybookRun' ]; diff --git a/awx/ui/static/js/controllers/Projects.js b/awx/ui/static/js/controllers/Projects.js index fbd10bb261..82a7c05fe3 100644 --- a/awx/ui/static/js/controllers/Projects.js +++ b/awx/ui/static/js/controllers/Projects.js @@ -384,7 +384,7 @@ export function ProjectsList ($scope, $rootScope, $location, $log, $routeParams, }; } -ProjectsList.$inject = ['$scope', '$rootScope', '$location', '$log', '$routeParams', 'Rest', 'Alert', 'ProjectList', 'GenerateList', +ProjectsList.$inject = ['$scope', '$rootScope', '$location', '$log', '$routeParams', 'Rest', 'Alert', 'ProjectList', 'generateList', 'LoadBreadCrumbs', 'Prompt', 'SearchInit', 'PaginateInit', 'ReturnToCaller', 'ClearScope', 'ProcessErrors', 'GetBasePath', 'SelectionInit', 'ProjectUpdate', 'Refresh', 'Wait', 'Stream', 'GetChoices', 'Empty', 'Find', 'LogViewer', 'GetProjectIcon', 'GetProjectToolTip' diff --git a/awx/ui/static/js/controllers/Teams.js b/awx/ui/static/js/controllers/Teams.js index fccae68a36..0bbb5b35f2 100644 --- a/awx/ui/static/js/controllers/Teams.js +++ b/awx/ui/static/js/controllers/Teams.js @@ -110,7 +110,7 @@ export function TeamsList($scope, $rootScope, $location, $log, $routeParams, Res }; } -TeamsList.$inject = ['$scope', '$rootScope', '$location', '$log', '$routeParams', 'Rest', 'Alert', 'TeamList', 'GenerateList', +TeamsList.$inject = ['$scope', '$rootScope', '$location', '$log', '$routeParams', 'Rest', 'Alert', 'TeamList', 'generateList', 'LoadBreadCrumbs', 'Prompt', 'SearchInit', 'PaginateInit', 'ReturnToCaller', 'ClearScope', 'ProcessErrors', 'SetTeamListeners', 'GetBasePath', 'SelectionInit', 'Wait', 'Stream' ]; @@ -172,7 +172,7 @@ export function TeamsAdd($scope, $rootScope, $compile, $location, $log, $routePa } TeamsAdd.$inject = ['$scope', '$rootScope', '$compile', '$location', '$log', '$routeParams', 'TeamForm', 'GenerateForm', - 'Rest', 'Alert', 'ProcessErrors', 'LoadBreadCrumbs', 'ReturnToCaller', 'ClearScope', 'GenerateList', + 'Rest', 'Alert', 'ProcessErrors', 'LoadBreadCrumbs', 'ReturnToCaller', 'ClearScope', 'generateList', 'OrganizationList', 'SearchInit', 'PaginateInit', 'GetBasePath', 'LookUpInit', 'Wait' ]; diff --git a/awx/ui/static/js/controllers/Users.js b/awx/ui/static/js/controllers/Users.js index 003b65283c..8fc6934992 100644 --- a/awx/ui/static/js/controllers/Users.js +++ b/awx/ui/static/js/controllers/Users.js @@ -99,7 +99,7 @@ export function UsersList($scope, $rootScope, $location, $log, $routeParams, Res }; } -UsersList.$inject = ['$scope', '$rootScope', '$location', '$log', '$routeParams', 'Rest', 'Alert', 'UserList', 'GenerateList', +UsersList.$inject = ['$scope', '$rootScope', '$location', '$log', '$routeParams', 'Rest', 'Alert', 'UserList', 'generateList', 'LoadBreadCrumbs', 'Prompt', 'SearchInit', 'PaginateInit', 'ReturnToCaller', 'ClearScope', 'ProcessErrors', 'GetBasePath', 'SelectionInit', 'Wait', 'Stream' ]; diff --git a/awx/ui/static/js/helpers/ConfigureTower.js b/awx/ui/static/js/helpers/ConfigureTower.js index c4e3066629..898a850751 100644 --- a/awx/ui/static/js/helpers/ConfigureTower.js +++ b/awx/ui/static/js/helpers/ConfigureTower.js @@ -11,12 +11,13 @@ * */ +import listGenerator from 'tower/shared/list-generator/main'; export default - angular.module('ConfigureTowerHelper', [ 'Utilities', 'RestServices', 'SchedulesHelper', 'SearchHelper', 'PaginationHelpers', 'ListGenerator', 'ModalDialog', + angular.module('ConfigureTowerHelper', [ 'Utilities', 'RestServices', 'SchedulesHelper', 'SearchHelper', 'PaginationHelpers', listGenerator.name, 'ModalDialog', 'GeneratorHelpers']) - .factory('ConfigureTower', ['Wait', '$location' , '$compile', 'CreateDialog', 'ConfigureTowerJobsList', 'GenerateList', 'GetBasePath' , 'SearchInit' , 'PaginateInit', 'PlaybookRun', 'LoadSchedulesScope', + .factory('ConfigureTower', ['Wait', '$location' , '$compile', 'CreateDialog', 'ConfigureTowerJobsList', 'generateList', 'GetBasePath' , 'SearchInit' , 'PaginateInit', 'PlaybookRun', 'LoadSchedulesScope', 'SchedulesList', 'SchedulesControllerInit' , 'ConfigureTowerSchedule', 'Rest' , 'ProcessErrors', function(Wait, $location, $compile, CreateDialog, ConfigureTowerJobsList, GenerateList, GetBasePath, SearchInit, PaginateInit, PlaybookRun, LoadSchedulesScope, SchedulesList, SchedulesControllerInit, ConfigureTowerSchedule, Rest, ProcessErrors) { diff --git a/awx/ui/static/js/helpers/CustomInventory.js b/awx/ui/static/js/helpers/CustomInventory.js index a4f8ca16c5..6ca3ba4834 100644 --- a/awx/ui/static/js/helpers/CustomInventory.js +++ b/awx/ui/static/js/helpers/CustomInventory.js @@ -11,12 +11,13 @@ * */ +import listGenerator from 'tower/shared/list-generator/main'; export default - angular.module('CreateCustomInventoryHelper', [ 'Utilities', 'RestServices', 'SchedulesHelper', 'SearchHelper', 'PaginationHelpers', 'ListGenerator', 'ModalDialog', + angular.module('CreateCustomInventoryHelper', [ 'Utilities', 'RestServices', 'SchedulesHelper', 'SearchHelper', 'PaginationHelpers', listGenerator.name, 'ModalDialog', 'GeneratorHelpers', 'CustomInventoryFormDefinition']) - .factory('CreateCustomInventory', ['Wait', 'CreateDialog', 'CustomInventoryList', 'GenerateList', 'GetBasePath' , 'SearchInit' , 'PaginateInit', 'PlaybookRun', 'CustomInventoryAdd', + .factory('CreateCustomInventory', ['Wait', 'CreateDialog', 'CustomInventoryList', 'generateList', 'GetBasePath' , 'SearchInit' , 'PaginateInit', 'PlaybookRun', 'CustomInventoryAdd', 'SchedulesList', 'CustomInventoryEdit', 'Rest' , 'ProcessErrors', 'CustomInventoryForm', 'GenerateForm', 'Prompt', function(Wait, CreateDialog, CustomInventoryList, GenerateList, GetBasePath, SearchInit, PaginateInit, PlaybookRun, CustomInventoryAdd, SchedulesList, CustomInventoryEdit, Rest, ProcessErrors, CustomInventoryForm, GenerateForm, Prompt) { @@ -177,7 +178,7 @@ export default .factory('CustomInventoryAdd', ['$compile','SchedulerInit', 'Rest', 'Wait', 'CustomInventoryList', 'CustomInventoryForm', 'ProcessErrors', 'GetBasePath', 'Empty', 'GenerateForm', - 'SearchInit' , 'PaginateInit', 'GenerateList', 'LookUpInit', 'OrganizationList', + 'SearchInit' , 'PaginateInit', 'generateList', 'LookUpInit', 'OrganizationList', function($compile, SchedulerInit, Rest, Wait, CustomInventoryList, CustomInventoryForm, ProcessErrors, GetBasePath, Empty, GenerateForm, SearchInit, PaginateInit, GenerateList, LookUpInit, OrganizationList) { return function(params) { @@ -247,7 +248,7 @@ export default }; }]) - .factory('CustomInventoryEdit', ['$compile','CustomInventoryList', 'Rest', 'Wait', 'GenerateList', 'CustomInventoryForm', 'ProcessErrors', 'GetBasePath', 'Empty', 'GenerateForm', + .factory('CustomInventoryEdit', ['$compile','CustomInventoryList', 'Rest', 'Wait', 'generateList', 'CustomInventoryForm', 'ProcessErrors', 'GetBasePath', 'Empty', 'GenerateForm', 'SearchInit', 'PaginateInit', '$routeParams', 'OrganizationList', 'LookUpInit', function($compile, CustomInventoryList, Rest, Wait, GenerateList, CustomInventoryForm, ProcessErrors, GetBasePath, Empty, GenerateForm, SearchInit, PaginateInit, $routeParams, OrganizationList, LookUpInit) { diff --git a/awx/ui/static/js/helpers/Groups.js b/awx/ui/static/js/helpers/Groups.js index 6e817d1a5c..bfe700667b 100644 --- a/awx/ui/static/js/helpers/Groups.js +++ b/awx/ui/static/js/helpers/Groups.js @@ -14,9 +14,11 @@ * @description inventory tree widget add/edit/delete */ +import listGenerator from 'tower/shared/list-generator/main'; + export default -angular.module('GroupsHelper', [ 'RestServices', 'Utilities', 'ListGenerator', 'GroupListDefinition', 'SearchHelper', - 'PaginationHelpers', 'ListGenerator', 'AuthService', 'GroupsHelper', 'InventoryHelper', 'SelectionHelper', +angular.module('GroupsHelper', [ 'RestServices', 'Utilities', listGenerator.name, 'GroupListDefinition', 'SearchHelper', + 'PaginationHelpers', listGenerator.name, 'AuthService', 'GroupsHelper', 'InventoryHelper', 'SelectionHelper', 'JobSubmissionHelper', 'RefreshHelper', 'PromptDialog', 'CredentialsListDefinition', 'InventoryTree', 'InventoryStatusDefinition', 'VariablesHelper', 'SchedulesListDefinition', 'SourceFormDefinition', 'LogViewerHelper', 'SchedulesHelper' @@ -419,7 +421,7 @@ angular.module('GroupsHelper', [ 'RestServices', 'Utilities', 'ListGenerator', ' * Add the list of schedules to the Group Edit modal * */ -.factory('GroupsScheduleListInit', ['GroupsScheduleEdit', 'SchedulesList', 'GenerateList', 'SearchInit', 'PaginateInit', 'Rest', +.factory('GroupsScheduleListInit', ['GroupsScheduleEdit', 'SchedulesList', 'generateList', 'SearchInit', 'PaginateInit', 'Rest', 'PageRangeSetup', 'Wait', 'ProcessErrors', 'Find', 'ToggleSchedule', 'DeleteSchedule', 'GetBasePath', 'SchedulesListInit', function(GroupsScheduleEdit, SchedulesList, GenerateList, SearchInit, PaginateInit, Rest, PageRangeSetup, Wait, ProcessErrors, Find, ToggleSchedule, DeleteSchedule, GetBasePath, SchedulesListInit) { @@ -1695,7 +1697,7 @@ angular.module('GroupsHelper', [ 'RestServices', 'Utilities', 'ListGenerator', ' * TODO: Document * */ -.factory('GroupsCopy', ['$compile', 'Rest', 'ProcessErrors', 'CreateDialog', 'GetBasePath', 'Wait', 'GenerateList', 'GroupList', 'SearchInit', +.factory('GroupsCopy', ['$compile', 'Rest', 'ProcessErrors', 'CreateDialog', 'GetBasePath', 'Wait', 'generateList', 'GroupList', 'SearchInit', 'PaginateInit', 'GetRootGroups', function($compile, Rest, ProcessErrors, CreateDialog, GetBasePath, Wait, GenerateList, GroupList, SearchInit, PaginateInit, GetRootGroups) { return function(params) { diff --git a/awx/ui/static/js/helpers/Hosts.js b/awx/ui/static/js/helpers/Hosts.js index cd6a85c46e..e05a542d83 100644 --- a/awx/ui/static/js/helpers/Hosts.js +++ b/awx/ui/static/js/helpers/Hosts.js @@ -16,9 +16,11 @@ 'use strict'; +import listGenerator from 'tower/shared/list-generator/main'; + export default -angular.module('HostsHelper', [ 'RestServices', 'Utilities', 'ListGenerator', 'HostListDefinition', - 'SearchHelper', 'PaginationHelpers', 'ListGenerator', 'AuthService', 'HostsHelper', +angular.module('HostsHelper', [ 'RestServices', 'Utilities', listGenerator.name, 'HostListDefinition', + 'SearchHelper', 'PaginationHelpers', listGenerator.name, 'AuthService', 'HostsHelper', 'InventoryHelper', 'RelatedSearchHelper', 'InventoryFormDefinition', 'SelectionHelper', 'HostGroupsFormDefinition', 'VariablesHelper', 'ModalDialog', 'LogViewerHelper', 'GroupListDefinition' @@ -231,7 +233,7 @@ angular.module('HostsHelper', [ 'RestServices', 'Utilities', 'ListGenerator', 'H }; }]) -.factory('InjectHosts', ['GenerateList', 'InventoryHosts', 'HostsReload', +.factory('InjectHosts', ['generateList', 'InventoryHosts', 'HostsReload', function(GenerateList, InventoryHosts, HostsReload) { return function(params) { @@ -291,7 +293,7 @@ angular.module('HostsHelper', [ 'RestServices', 'Utilities', 'ListGenerator', 'H }; }]) -.factory('HostsList', ['$rootScope', '$location', '$log', '$routeParams', 'Rest', 'Alert', 'HostList', 'GenerateList', +.factory('HostsList', ['$rootScope', '$location', '$log', '$routeParams', 'Rest', 'Alert', 'HostList', 'generateList', 'Prompt', 'SearchInit', 'PaginateInit', 'ProcessErrors', 'GetBasePath', 'HostsAdd', 'HostsReload', 'SelectionInit', function($rootScope, $location, $log, $routeParams, Rest, Alert, HostList, GenerateList, Prompt, SearchInit, PaginateInit, ProcessErrors, GetBasePath, HostsAdd, HostsReload, SelectionInit) { @@ -771,7 +773,7 @@ angular.module('HostsHelper', [ 'RestServices', 'Utilities', 'ListGenerator', 'H }; }]) - .factory('HostsCopy', ['$compile', 'Rest', 'ProcessErrors', 'CreateDialog', 'GetBasePath', 'Wait', 'GenerateList', 'GroupList', 'SearchInit', + .factory('HostsCopy', ['$compile', 'Rest', 'ProcessErrors', 'CreateDialog', 'GetBasePath', 'Wait', 'generateList', 'GroupList', 'SearchInit', 'PaginateInit', function($compile, Rest, ProcessErrors, CreateDialog, GetBasePath, Wait, GenerateList, GroupList, SearchInit, PaginateInit) { return function(params) { diff --git a/awx/ui/static/js/helpers/Jobs.js b/awx/ui/static/js/helpers/Jobs.js index ef0cf3aad9..b7bd68c1ea 100644 --- a/awx/ui/static/js/helpers/Jobs.js +++ b/awx/ui/static/js/helpers/Jobs.js @@ -12,9 +12,11 @@ * @description routines shared by job related controllers */ +import listGenerator from 'tower/shared/list-generator/main'; + export default angular.module('JobsHelper', ['Utilities', 'RestServices', 'FormGenerator', 'JobSummaryDefinition', 'InventoryHelper', 'GeneratorHelpers', - 'JobSubmissionHelper', 'LogViewerHelper', 'SearchHelper', 'PaginationHelpers', 'ListGenerator']) + 'JobSubmissionHelper', 'LogViewerHelper', 'SearchHelper', 'PaginationHelpers', listGenerator.name]) /** * JobsControllerInit({ scope: $scope }); @@ -356,7 +358,7 @@ export default * Called from JobsList controller to load each section or list on the page * */ - .factory('LoadJobsScope', ['$routeParams', '$location', '$compile', 'SearchInit', 'PaginateInit', 'GenerateList', 'JobsControllerInit', 'JobsListUpdate', 'SearchWidget', + .factory('LoadJobsScope', ['$routeParams', '$location', '$compile', 'SearchInit', 'PaginateInit', 'generateList', 'JobsControllerInit', 'JobsListUpdate', 'SearchWidget', function($routeParams, $location, $compile, SearchInit, PaginateInit, GenerateList, JobsControllerInit, JobsListUpdate, SearchWidget) { return function(params) { var parent_scope = params.parent_scope, diff --git a/awx/ui/static/js/helpers/Lookup.js b/awx/ui/static/js/helpers/Lookup.js index d0384247ab..a476b1fd6c 100644 --- a/awx/ui/static/js/helpers/Lookup.js +++ b/awx/ui/static/js/helpers/Lookup.js @@ -22,11 +22,12 @@ * }) */ +import listGenerator from 'tower/shared/list-generator/main'; export default - angular.module('LookUpHelper', ['RestServices', 'Utilities', 'SearchHelper', 'PaginationHelpers', 'ListGenerator', 'ApiLoader', 'ModalDialog']) + angular.module('LookUpHelper', ['RestServices', 'Utilities', 'SearchHelper', 'PaginationHelpers', listGenerator.name, 'ApiLoader', 'ModalDialog']) - .factory('LookUpInit', ['Alert', 'Rest', 'GenerateList', 'SearchInit', 'PaginateInit', 'GetBasePath', 'FormatDate', 'Empty', 'CreateDialog', + .factory('LookUpInit', ['Alert', 'Rest', 'generateList', 'SearchInit', 'PaginateInit', 'GetBasePath', 'FormatDate', 'Empty', 'CreateDialog', function (Alert, Rest, GenerateList, SearchInit, PaginateInit, GetBasePath, FormatDate, Empty, CreateDialog) { return function (params) { diff --git a/awx/ui/static/js/helpers/Schedules.js b/awx/ui/static/js/helpers/Schedules.js index 40325df133..1769bbf992 100644 --- a/awx/ui/static/js/helpers/Schedules.js +++ b/awx/ui/static/js/helpers/Schedules.js @@ -11,9 +11,10 @@ * */ +import listGenerator from 'tower/shared/list-generator/main'; export default - angular.module('SchedulesHelper', [ 'Utilities', 'RestServices', 'SchedulesHelper', 'SearchHelper', 'PaginationHelpers', 'ListGenerator', 'ModalDialog', + angular.module('SchedulesHelper', [ 'Utilities', 'RestServices', 'SchedulesHelper', 'SearchHelper', 'PaginationHelpers', listGenerator.name, 'ModalDialog', 'GeneratorHelpers']) .factory('ShowSchedulerModal', ['Wait', 'CreateDialog', function(Wait, CreateDialog) { @@ -560,7 +561,7 @@ export default * Called from a controller to setup the scope for a schedules list * */ - .factory('LoadSchedulesScope', ['$compile', '$location', '$routeParams','SearchInit', 'PaginateInit', 'GenerateList', 'SchedulesControllerInit', + .factory('LoadSchedulesScope', ['$compile', '$location', '$routeParams','SearchInit', 'PaginateInit', 'generateList', 'SchedulesControllerInit', 'SchedulesListInit', 'SearchWidget', function($compile, $location, $routeParams, SearchInit, PaginateInit, GenerateList, SchedulesControllerInit, SchedulesListInit, SearchWidget) { return function(params) { diff --git a/awx/ui/static/js/helpers/Survey.js b/awx/ui/static/js/helpers/Survey.js index ed7bae3787..06984e0402 100644 --- a/awx/ui/static/js/helpers/Survey.js +++ b/awx/ui/static/js/helpers/Survey.js @@ -11,8 +11,10 @@ * */ +import listGenerator from 'tower/shared/list-generator/main'; + export default -angular.module('SurveyHelper', [ 'Utilities', 'RestServices', 'SchedulesHelper', 'SearchHelper', 'PaginationHelpers', 'ListGenerator', 'ModalDialog' , +angular.module('SurveyHelper', [ 'Utilities', 'RestServices', 'SchedulesHelper', 'SearchHelper', 'PaginationHelpers', listGenerator.name, 'ModalDialog' , 'GeneratorHelpers']) .factory('ShowSurveyModal', ['Wait', 'CreateDialog', 'Empty', '$compile' , diff --git a/awx/ui/static/js/helpers/inventory.js b/awx/ui/static/js/helpers/inventory.js index f6c44525fc..ba90eccb51 100644 --- a/awx/ui/static/js/helpers/inventory.js +++ b/awx/ui/static/js/helpers/inventory.js @@ -11,8 +11,10 @@ * (controllers/Inventories.js) */ +import listGenerator from 'tower/shared/list-generator/main'; + export default - angular.module('InventoryHelper', ['RestServices', 'Utilities', 'OrganizationListDefinition', 'ListGenerator', 'AuthService', + angular.module('InventoryHelper', ['RestServices', 'Utilities', 'OrganizationListDefinition', listGenerator.name, 'AuthService', 'InventoryHelper', 'InventoryFormDefinition', 'ParseHelper', 'SearchHelper', 'VariablesHelper', ]) diff --git a/awx/ui/static/js/helpers/teams.js b/awx/ui/static/js/helpers/teams.js index 5ad7df7bbc..7b9b7af545 100644 --- a/awx/ui/static/js/helpers/teams.js +++ b/awx/ui/static/js/helpers/teams.js @@ -9,10 +9,11 @@ * Routines shared amongst the team controllers */ +import listGenerator from 'tower/shared/list-generator/main'; export default angular.module('TeamHelper', ['RestServices', 'Utilities', 'OrganizationListDefinition', 'SearchHelper', - 'PaginationHelpers', 'ListGenerator' + 'PaginationHelpers', listGenerator.name ]) .factory('SetTeamListeners', ['Alert', 'Rest', function (Alert, Rest) { @@ -70,7 +71,7 @@ export default } ]) - .factory('TeamLookUpOrganizationInit', ['Alert', 'Rest', 'OrganizationList', 'GenerateList', 'SearchInit', 'PaginateInit', + .factory('TeamLookUpOrganizationInit', ['Alert', 'Rest', 'OrganizationList', 'generateList', 'SearchInit', 'PaginateInit', function (Alert, Rest, OrganizationList, GenerateList, SearchInit, PaginateInit) { return function (params) { diff --git a/awx/ui/static/js/lists/InventoryHosts.js b/awx/ui/static/js/lists/InventoryHosts.js index 2a54bc71b4..d1bbfa3520 100644 --- a/awx/ui/static/js/lists/InventoryHosts.js +++ b/awx/ui/static/js/lists/InventoryHosts.js @@ -22,6 +22,7 @@ export default hover: true, hasChildren: true, 'class': 'table-no-border', + multiSelect: true, fields: { name: { diff --git a/awx/ui/static/js/shared/form-generator.js b/awx/ui/static/js/shared/form-generator.js index 51bdea2871..4d27d4c918 100644 --- a/awx/ui/static/js/shared/form-generator.js +++ b/awx/ui/static/js/shared/form-generator.js @@ -133,12 +133,12 @@ */ import GeneratorHelpers from './generator-helpers'; -import ListGenerator from './list-generator'; +import listGenerator from 'tower/shared/list-generator/main'; export default -angular.module('FormGenerator', [GeneratorHelpers.name, 'Utilities', ListGenerator.name]) +angular.module('FormGenerator', [GeneratorHelpers.name, 'Utilities', listGenerator.name]) -.factory('GenerateForm', ['$rootScope', '$location', '$compile', 'GenerateList', 'SearchWidget', 'PaginateWidget', 'Attr', +.factory('GenerateForm', ['$rootScope', '$location', '$compile', 'generateList', 'SearchWidget', 'PaginateWidget', 'Attr', 'Icon', 'Column', 'NavigationLink', 'HelpCollapse', 'Button', 'DropDown', 'Empty', 'SelectIcon', 'Store', function ($rootScope, $location, $compile, GenerateList, SearchWidget, PaginateWidget, Attr, Icon, Column, NavigationLink, HelpCollapse, Button, DropDown, Empty, SelectIcon, Store) { diff --git a/awx/ui/static/js/shared/list-generator.js b/awx/ui/static/js/shared/list-generator.js deleted file mode 100644 index 6f031ba7cf..0000000000 --- a/awx/ui/static/js/shared/list-generator.js +++ /dev/null @@ -1,586 +0,0 @@ -/********************************************* - * Copyright (c) 2014 AnsibleWorks, Inc. - */ - /** - * @ngdoc function - * @name lib.ansible.function:list-generator - * @description - * #ListGenerator - * - * Use GenerateList.inject(list_object, { key:value }) to generate HTML from a list object and inject it into the DOM. Returns the $scope of the new list. - * - * Pass in a list object and a JSON object of key:value parameters. List objects are found in lists/*.js. Possible parameters include: - * - * | Parameter | Required | Description | - * | --------- | -------- | ----------- | - * | activityStream | | Used in widgets/stream.js to create the list contained within the activity stream widget. | - * | breadCrumbs | | true or false. Set to false, if breadcrumbs should not be included in the generated HTML. | - * | hdr | | Deprecated. Was used when list generator created the lookup dialog. This was moved to helpers/Lookup.js. | - * | id | | DOM element ID attribute value. Use to inject the list into a custom DOM element. Otherwise, the HTML for a list will be injected into the DOM element with an ID attribute of 'htmlTemplate'. | - * | listSize | | Bootstrap size class to apply to the grid column containing the action buttons, which generally appears to the right of the search widget. Defaults to 'col-lg-8 col-md-6 col-sm-4 col-xs-3'. | - * | mode | Yes | One of 'edit', 'lookup', 'select', or 'summary'. Generally this will be 'edit'. helpers/Lookup.js uses 'lookup' to generate the lookup dialog. The 'select' option is used in certain controllers when multiple objects are being added to a parent object. For example, building a select list of Users that can be added to an Oranization. 'summary' is no longer used. | - * | scope | | If the HTML will be injected into the DOM by list generator, pass in an optional $scope to be used in conjuction with $compile. The list will be associated with the scope value. Otherwise, the scope of the DOM element will be fetched passed to $compile. | - * | showSearch | | true or false. Set to false, if the search widget should not be included in the generated HTML. | - * | searchSize | | Bootstrap size class (e.g. col-lg-3, col-md-4, col-sm-5, etc.) to apply to the search widget. Defaults to 'col-lg-4 col-md-6 col-sm-8 col-xs-9'. | - * - * #HTML only - * - * Use the buildHTML() method to get a string containing the generated HTML for a list object. buldHTML() expects the same parameters as the inject method. For example: - * ``` - * var html = GenerateList.buildHTML({ - * mode: 'edit', - * breadCrumbs: false, - * showSearch: false - * }); - * ``` - * - * #List Objects - * - * List objects are found in lists/*.js. Any API endpoint that returns a collection or array is represented with a list object. Examples inlcude Organizations, Credentials, Inventories, etc. - * A list can have the following attributes: - * - * | Attribute | Description | - * | --------- | ----------- | - * | hover | true or false. If true, 'table-hover' class will be added to the <table> element. | - * | index | true or false. If false, the index column, which adds a sequential number to each table row starting with 1, will not be added to the table. | - * | iterator | String containing a descriptive name of a single row in the collection - inventory, organization, credential, etc. Used to generate name and ID attributes in the list HTML. | - * | name | Name of the collection. Generally matches the endpoint name - inventories, organizations, etc. Will match the $scope variable containing the array of rows comprising the collection. | - * | selectTitle | Descriptive title used when mode is 'select'. | - * | selectInstructions | Text and HTML used to create popover for help button when mode is 'select'. | - * | editTitle | Descriptive title used when mode is 'edit'. | - * - * ##Fields - * - * A list contains a fields object. Each column in the list is defined as a separate object within the fields object. A field definition may contain the following attributes: - * - * | Attribute | Description | - * | --------- | ----------- | - * | columnClass | String of CSS class names to add to the <td> elemnts of the table column. | - * | columnClick | Adds an ng-click directive to the <td> element. | - * | excludeModal | true or false. If false, the field will not be included in the generated HTML when the mode is 'lookup' | - * | key | true or false. If set to true, helpers/search.js will use the field name as the default sort order when generating the API request. | - * | noLink | true or false. If set to true this will override any 'key', 'linkTo', 'ngClick', or other option that would cause the field to be a link. Used in portal mode and custom inv. script. | - * | label | Text string used as the column header text. | - * | linkTo | Wraps the field value with an <a> element. Set to the value of the href attribute. | - * | ngClick | Wraps the field value with an <a> and adds the ng-click directive. Set to the JS expression that ng-click will evaluate. | - * | nosort | true or false. Setting to false removes the ability to sort the table by the column. | - * | searchable | true or fasel. Set to false if the field should not be included as in option in the search widget. | - * | searchOnly | true or false. Set to true if the field should be included in the search widget but not included as a column in the generated HTML <table>. | - * | searchOptions | Array of { name: 'Descriptive Name', value: 'api_value' } objects used to generate <options> for the <select> when searchType is 'select'. | - * | searchType | One of the available search types defined in helpers/search.js. | - * | sourceField | Name of the attribute within summary_fields. that the field maps to in the API response object. Used in conjunction with sourceModel. | - * | sourceModel | Name of the summary_fields object that the field maps to in the API response object. | - * - * ##Field Actions - * - * A list contains a fieldActions object. Each icon found in the Actions column is defined as an object within the feildActions object. fieldActions can have a columnClass attribute, - * which may contain a string of CSS class names to add to the action <td> element. It may also contain a label attribute, which can be set to false to suppress the Actions column header. - * - * Feld action items can have the following attributes: - * - * | Attribute | Description | - * | --------- | ----------- | - * | awToolTip | Adds the aw-tool-tip directive. Set to the value of the HTML or text to dislay in the tooltip. | - * | 'class' | Set to a string containing any CSS classes to add to the <a> element. | - * | dataPlacement | Set to the Bootstrip tooltip placement - right, left, top, bottom, etc. | - * | dataTipWatch | Set to the $scope variable that contains the text and HTML to display in the tooltip. A $scope.$watch will be added to the variable so that anytime its value changes the tooltip will change. | - * | iconClass | By default the CSS icon class is set by the SelectIcon() method in lib/ansible/generator-helpers.js. The icon is based on the action name. Use iconClass to override the default value. | - * | mode | One of 'all' or 'edit'. Will generally be 'all'. Note that field actions are not displayed when the list is in 'lookup' mode. | - * | ngClass | Adds the ng-class directive. Set to the JS expressino that ng-class will evaluate. | - * | ngShow | Adds the ng-show directive. Set to the JS expression that ng-show will evaluate. | - * - * ##Actions - * - * A list can contain an actions object. The actions object contains an object for each action button displayed in the top-right corner of the list container. An action can have the same - * attributes as an action defined in fieldAction. Both are actions. Clicking on an action evaluates the JS found in the ngClick attribute. In both cases icon is generated automatically by the SelectIcon() method in lib/ansible/generator-helpers.js. - * The real difference is that an <a> element is used to generate fieldAction items while a <button> element is used for action items. - */ - - -export default -angular.module('ListGenerator', ['GeneratorHelpers']) - .factory('GenerateList', ['$location', '$compile', '$rootScope', 'SearchWidget', 'PaginateWidget', 'Attr', 'Icon', - 'Column', 'DropDown', 'NavigationLink', 'Button', 'SelectIcon', 'Breadcrumbs', - function ($location, $compile, $rootScope, SearchWidget, PaginateWidget, Attr, Icon, Column, DropDown, NavigationLink, - Button, SelectIcon, Breadcrumbs) { - return { - - setList: function (list) { - this.list = list; - }, - - setOptions: function(options) { - this.options = options; - }, - - attr: Attr, - - icon: Icon, - - has: function (key) { - return (this.form[key] && this.form[key] !== null && this.form[key] !== undefined) ? true : false; - }, - - hide: function () { - $('#lookup-modal').modal('hide'); - }, - - button: Button, - - buildHTML: function(list, options) { - this.setList(list); - return this.build(options); - }, - - inject: function (list, options) { - // options.mode = one of edit, select or lookup - // - // Modes edit and select will inject the list as html into element #htmlTemplate. - // 'lookup' mode injects the list html into #lookup-modal-body. - // - // For options.mode == 'lookup', include the following: - // - // hdr: - // - // Inject into a custom element using options.id: - // Control breadcrumb creation with options.breadCrumbs: - // - var element; - - if (options.id) { - element = angular.element(document.getElementById(options.id)); - } else { - element = angular.element(document.getElementById('htmlTemplate')); - } - - this.setOptions(options); - this.setList(list); - element.html(this.build(options)); // Inject the html - - if (options.prepend) { - element.prepend(options.prepend); - } - - if (options.append) { - element.append(options.append); - } - - if (options.scope) { - this.scope = options.scope; - } else { - this.scope = element.scope(); - } - - $compile(element)(this.scope); - - // Reset the scope to prevent displaying old data from our last visit to this list - //this.scope[list.name] = null; - this.scope[list.iterator] = []; - - // Remove any lingering tooltip and popover
elements - $('.tooltip').each(function() { - $(this).remove(); - }); - - $('.popover').each(function() { - // remove lingering popover
. Seems to be a bug in TB3 RC1 - $(this).remove(); - }); - - try { - $('#help-modal').empty().dialog('destroy'); - } catch (e) { - //ignore any errors should the dialog not be initialized - } - - /*if (options.mode === 'lookup') { - // options should include {hdr: , action: } - this.scope.formModalActionDisabled = false; - this.scope.lookupHeader = options.hdr; - $('#lookup-modal').modal({ - backdrop: 'static', - keyboard: true - }); - $('#lookup-modal').unbind('hidden.bs.modal'); - $(document).bind('keydown', function (e) { - if (e.keyCode === 27) { - $('#lookup-modal').modal('hide'); - } - }); - }*/ - - return this.scope; - }, - - build: function (options) { - // - // Generate HTML. Do NOT call this function directly. Called by inject(). Returns an HTML - // string to be injected into the current view. - // - var html = '', - list = this.list, - base, size, action, btn, fld, cnt, field_action, fAction, itm; - - if (options.activityStream) { - // Breadcrumbs for activity stream widget - // Make the links clickable using ng-click function so we can first remove the stream widget - // before navigation - html += "
\n"; - html += "\n
\n"; - } - //else if (options.mode !== 'lookup' && (options.breadCrumbs === undefined || options.breadCrumbs)) { - else if (options.breadCrumbs) { - html += Breadcrumbs({ - list: list, - mode: options.mode - }); - } - - if (options.mode === 'edit' && list.editInstructions) { - html += "
\n"; - html += "\n"; - html += "Hint: " + list.editInstructions + "\n"; - html += "
\n"; - } - - if (options.instructions) { - html += "
" + options.instructions + "
\n"; - } - else if (list.instructions) { - html += "
" + list.instructions + "
\n"; - } - - if (options.mode !== 'lookup' && (list.well === undefined || list.well)) { - html += "
\n"; - } - - if (options.activityStream) { - // Add a title row - html += "
\n"; - html += "
\n"; - html += "
{{ streamTitle }}
\n"; - html += "
\n"; - html += "
\n"; - } - - if (options.showSearch=== undefined || options.showSearch === true) { - html += "
\n"; - if (options.searchSize) { - html += SearchWidget({ - iterator: list.iterator, - template: list, - mini: true, - size: options.searchSize, - searchWidgets: list.searchWidgets - }); - } else if (options.mode === 'summary') { - html += SearchWidget({ - iterator: list.iterator, - template: list, - mini: true, - size: 'col-lg-6' - }); - } else if (options.mode === 'lookup' || options.id !== undefined) { - html += SearchWidget({ - iterator: list.iterator, - template: list, - mini: true, - size: 'col-lg-8' - }); - } else { - html += SearchWidget({ - iterator: list.iterator, - template: list, - mini: true - }); - } - - if (options.mode !== 'lookup') { - //actions - base = $location.path().replace(/^\//, '').split('/')[0]; - html += "
\n"; - - html += "
\n"; - - // Add toolbar buttons or 'actions' - for (action in list.actions) { - if (list.actions[action].mode === 'all' || list.actions[action].mode === options.mode) { - if ((list.actions[action].basePaths === undefined) || - (list.actions[action].basePaths && list.actions[action].basePaths.indexOf(base) > -1)) { - html += this.button({ - btn: list.actions[action], - action: action, - toolbar: true - }); - } - } - } - - //select instructions - if (options.mode === 'select' && list.selectInstructions) { - btn = { - awPopOver: list.selectInstructions, - dataPlacement: 'left', - dataContainer: 'body', - 'class': 'btn-xs btn-help', - awToolTip: 'Click for help', - dataTitle: 'Help', - iconSize: 'fa-lg' - }; - //html += this.button(btn, 'select'); - html += this.button({ - btn: btn, - action: 'help', - toolbar: true - }); - } - - html += "
\n"; - html += "
\n"; - } else { - //lookup - html += "
\n"; - } - html += "
\n"; - } - - // Add a title and optionally a close button (used on Inventory->Groups) - if (options.mode !== 'lookup' && list.showTitle) { - html += "
"; - html += (options.mode === 'edit' || options.mode === 'summary') ? list.editTitle : list.addTitle; - html += "
\n"; - } - - // table header row - html += "
\n"; - if (list.index) { - html += "{{ $index + ((" + list.iterator + "_page - 1) * " + list.iterator + "_page_size) + 1 }}.\n"; - } - cnt = 2; - base = (list.base) ? list.base : list.name; - base = base.replace(/^\//, ''); - for (fld in list.fields) { - cnt++; - if ((list.fields[fld].searchOnly === undefined || list.fields[fld].searchOnly === false) && - !(options.mode === 'lookup' && list.fields[fld].excludeModal === true)) { - html += Column({ - list: list, - fld: fld, - options: options, - base: base - }); - } - } - - if (options.mode === 'select' || options.mode === 'lookup') { - if(options.input_type==="radio"){ //added by JT so that lookup forms can be either radio inputs or check box inputs - html += ""; - } - else { // its assumed that options.input_type = checkbox - html += ""; - } - } else if ((options.mode === 'edit' || options.mode === 'summary') && list.fieldActions) { - - // Row level actions - - html += ""; - - for (field_action in list.fieldActions) { - if (field_action !== 'columnClass') { - if (list.fieldActions[field_action].type && list.fieldActions[field_action].type === 'DropDown') { - html += DropDown({ - list: list, - fld: field_action, - options: options, - base: base, - type: 'fieldActions', - td: false - }); - } else { - fAction = list.fieldActions[field_action]; - html += ""; - } else { - html += SelectIcon({ - action: field_action - }); - } - //html += (fAction.label) ? " " + list.fieldActions[field_action].label + - // "" : ""; - html += ""; - } - } - } - html += "\n"; - } - html += "\n"; - - // Message for when a collection is empty - html += "\n"; - html += "
No records matched your search.
\n"; - html += "\n"; - - // Message for loading - html += "\n"; - html += "
Loading...
\n"; - html += "\n"; - - // End List - html += "\n"; - html += "\n"; - html += "
\n"; - - if (options.mode === 'select' && (options.selectButton === undefined || options.selectButton)) { - html += "
\n"; - html += " \n"; - html += "
\n"; - } - - if (options.mode !== 'lookup' && (list.well === undefined || list.well === true)) { - html += "
\n"; //well - } - - if (options.mode === 'lookup' || (options.id && options.id === "form-modal-body")) { - html += PaginateWidget({ - set: list.name, - iterator: list.iterator - }); - } else { - html += PaginateWidget({ - set: list.name, - iterator: list.iterator - }); - } - - return html; - }, - - buildHeader: function(options) { - var list = this.list, - fld, html; - - if (options === undefined) { - options = this.options; - } - - html = "\n"; - html += "\n"; - if (list.index) { - html += "#\n"; - } - for (fld in list.fields) { - if ((list.fields[fld].searchOnly === undefined || list.fields[fld].searchOnly === false) && - !(options.mode === 'lookup' && list.fields[fld].excludeModal === true)) { - html += ""; - } - html += "\n"; - } - } - if (options.mode === 'select' || options.mode === 'lookup') { - html += "Select"; - } else if (options.mode === 'edit' && list.fieldActions) { - html += ""; - html += (list.fieldActions.label === undefined || list.fieldActions.label) ? "Actions" : ""; - html += "\n"; - } - html += "\n"; - html += "\n"; - return html; - } - }; - }]); diff --git a/awx/ui/static/js/shared/list-generator/list-generator.factory.js b/awx/ui/static/js/shared/list-generator/list-generator.factory.js new file mode 100644 index 0000000000..f88c4d2c6a --- /dev/null +++ b/awx/ui/static/js/shared/list-generator/list-generator.factory.js @@ -0,0 +1,486 @@ +export default ['$location', '$compile', '$rootScope', 'SearchWidget', 'PaginateWidget', 'Attr', 'Icon', + 'Column', 'DropDown', 'NavigationLink', 'Button', 'SelectIcon', 'Breadcrumbs', + function ($location, $compile, $rootScope, SearchWidget, PaginateWidget, Attr, Icon, Column, DropDown, NavigationLink, + Button, SelectIcon, Breadcrumbs) { + return { + + setList: function (list) { + this.list = list; + }, + + setOptions: function(options) { + this.options = options; + }, + + attr: Attr, + + icon: Icon, + + has: function (key) { + return (this.form[key] && this.form[key] !== null && this.form[key] !== undefined) ? true : false; + }, + + hide: function () { + $('#lookup-modal').modal('hide'); + }, + + button: Button, + + buildHTML: function(list, options) { + this.setList(list); + return this.build(options); + }, + + inject: function (list, options) { + // options.mode = one of edit, select or lookup + // + // Modes edit and select will inject the list as html into element #htmlTemplate. + // 'lookup' mode injects the list html into #lookup-modal-body. + // + // For options.mode == 'lookup', include the following: + // + // hdr: + // + // Inject into a custom element using options.id: + // Control breadcrumb creation with options.breadCrumbs: + // + var element; + + if (options.id) { + element = angular.element(document.getElementById(options.id)); + } else { + element = angular.element(document.getElementById('htmlTemplate')); + } + + this.setOptions(options); + this.setList(list); + element.html(this.build(options)); // Inject the html + + if (options.prepend) { + element.prepend(options.prepend); + } + + if (options.append) { + element.append(options.append); + } + + if (options.scope) { + this.scope = options.scope; + } else { + this.scope = element.scope(); + } + + this.scope.list = list; + + $compile(element)(this.scope); + + // Reset the scope to prevent displaying old data from our last visit to this list + //this.scope[list.name] = null; + this.scope[list.iterator] = []; + + // Remove any lingering tooltip and popover
elements + $('.tooltip').each(function() { + $(this).remove(); + }); + + $('.popover').each(function() { + // remove lingering popover
. Seems to be a bug in TB3 RC1 + $(this).remove(); + }); + + try { + $('#help-modal').empty().dialog('destroy'); + } catch (e) { + //ignore any errors should the dialog not be initialized + } + + /*if (options.mode === 'lookup') { + // options should include {hdr: , action: } + this.scope.formModalActionDisabled = false; + this.scope.lookupHeader = options.hdr; + $('#lookup-modal').modal({ + backdrop: 'static', + keyboard: true + }); + $('#lookup-modal').unbind('hidden.bs.modal'); + $(document).bind('keydown', function (e) { + if (e.keyCode === 27) { + $('#lookup-modal').modal('hide'); + } + }); + }*/ + + return this.scope; + }, + + build: function (options) { + // + // Generate HTML. Do NOT call this function directly. Called by inject(). Returns an HTML + // string to be injected into the current view. + // + var html = '', + list = this.list, + base, size, action, btn, fld, cnt, field_action, fAction, itm; + + if (options.activityStream) { + // Breadcrumbs for activity stream widget + // Make the links clickable using ng-click function so we can first remove the stream widget + // before navigation + html += "
\n"; + html += "\n
\n"; + } + //else if (options.mode !== 'lookup' && (options.breadCrumbs === undefined || options.breadCrumbs)) { + else if (options.breadCrumbs) { + html += Breadcrumbs({ + list: list, + mode: options.mode + }); + } + + if (options.mode === 'edit' && list.editInstructions) { + html += "
\n"; + html += "\n"; + html += "Hint: " + list.editInstructions + "\n"; + html += "
\n"; + } + + if (options.instructions) { + html += "
" + options.instructions + "
\n"; + } + else if (list.instructions) { + html += "
" + list.instructions + "
\n"; + } + + if (options.mode !== 'lookup' && (list.well === undefined || list.well)) { + html += "
\n"; + } + + if (options.activityStream) { + // Add a title row + html += "
\n"; + html += "
\n"; + html += "
{{ streamTitle }}
\n"; + html += "
\n"; + html += "
\n"; + } + + if (options.showSearch=== undefined || options.showSearch === true) { + html += "
\n"; + if (options.searchSize) { + html += SearchWidget({ + iterator: list.iterator, + template: list, + mini: true, + size: options.searchSize, + searchWidgets: list.searchWidgets + }); + } else if (options.mode === 'summary') { + html += SearchWidget({ + iterator: list.iterator, + template: list, + mini: true, + size: 'col-lg-6' + }); + } else if (options.mode === 'lookup' || options.id !== undefined) { + html += SearchWidget({ + iterator: list.iterator, + template: list, + mini: true, + size: 'col-lg-8' + }); + } else { + html += SearchWidget({ + iterator: list.iterator, + template: list, + mini: true + }); + } + + if (options.mode !== 'lookup') { + //actions + base = $location.path().replace(/^\//, '').split('/')[0]; + html += "
\n"; + + html += "
\n"; + + // Add toolbar buttons or 'actions' + for (action in list.actions) { + if (list.actions[action].mode === 'all' || list.actions[action].mode === options.mode) { + if ((list.actions[action].basePaths === undefined) || + (list.actions[action].basePaths && list.actions[action].basePaths.indexOf(base) > -1)) { + html += this.button({ + btn: list.actions[action], + action: action, + toolbar: true + }); + } + } + } + + //select instructions + if (options.mode === 'select' && list.selectInstructions) { + btn = { + awPopOver: list.selectInstructions, + dataPlacement: 'left', + dataContainer: 'body', + 'class': 'btn-xs btn-help', + awToolTip: 'Click for help', + dataTitle: 'Help', + iconSize: 'fa-lg' + }; + //html += this.button(btn, 'select'); + html += this.button({ + btn: btn, + action: 'help', + toolbar: true + }); + } + + html += "
\n"; + html += "
\n"; + } else { + //lookup + html += "
\n"; + } + html += "
\n"; + } + + // Add a title and optionally a close button (used on Inventory->Groups) + if (options.mode !== 'lookup' && list.showTitle) { + html += "
"; + html += (options.mode === 'edit' || options.mode === 'summary') ? list.editTitle : list.addTitle; + html += "
\n"; + } + + // table header row + html += "
\n"; + if (list.index) { + html += "{{ $index + ((" + list.iterator + "_page - 1) * " + list.iterator + "_page_size) + 1 }}.\n"; + } + cnt = 2; + base = (list.base) ? list.base : list.name; + base = base.replace(/^\//, ''); + for (fld in list.fields) { + cnt++; + if ((list.fields[fld].searchOnly === undefined || list.fields[fld].searchOnly === false) && + !(options.mode === 'lookup' && list.fields[fld].excludeModal === true)) { + html += Column({ + list: list, + fld: fld, + options: options, + base: base + }); + } + } + + if (options.mode === 'select' || options.mode === 'lookup') { + if(options.input_type==="radio"){ //added by JT so that lookup forms can be either radio inputs or check box inputs + html += ""; + } + else { // its assumed that options.input_type = checkbox + html += ""; + } + } else if ((options.mode === 'edit' || options.mode === 'summary') && list.fieldActions) { + + // Row level actions + + html += ""; + + for (field_action in list.fieldActions) { + if (field_action !== 'columnClass') { + if (list.fieldActions[field_action].type && list.fieldActions[field_action].type === 'DropDown') { + html += DropDown({ + list: list, + fld: field_action, + options: options, + base: base, + type: 'fieldActions', + td: false + }); + } else { + fAction = list.fieldActions[field_action]; + html += ""; + } else { + html += SelectIcon({ + action: field_action + }); + } + //html += (fAction.label) ? " " + list.fieldActions[field_action].label + + // "" : ""; + html += ""; + } + } + } + html += "\n"; + } + html += "\n"; + + // Message for when a collection is empty + html += "\n"; + html += "
No records matched your search.
\n"; + html += "\n"; + + // Message for loading + html += "\n"; + html += "
Loading...
\n"; + html += "\n"; + + // End List + html += "\n"; + html += "\n"; + html += "
\n"; + + if (options.mode === 'select' && (options.selectButton === undefined || options.selectButton)) { + html += "
\n"; + html += " \n"; + html += "
\n"; + } + + if (options.mode !== 'lookup' && (list.well === undefined || list.well === true)) { + html += "
\n"; //well + } + + if (options.mode === 'lookup' || (options.id && options.id === "form-modal-body")) { + html += PaginateWidget({ + set: list.name, + iterator: list.iterator + }); + } else { + html += PaginateWidget({ + set: list.name, + iterator: list.iterator + }); + } + + return html; + }, + + buildHeader: function(options) { + var list = this.list, + fld, html; + + if (options === undefined) { + options = this.options; + } + + html = "\n"; + html += "\n"; + if (list.index) { + html += "#\n"; + } + for (fld in list.fields) { + if ((list.fields[fld].searchOnly === undefined || list.fields[fld].searchOnly === false) && + !(options.mode === 'lookup' && list.fields[fld].excludeModal === true)) { + html += ""; + } + html += "\n"; + } + } + if (options.mode === 'select' || options.mode === 'lookup') { + html += "Select"; + } else if (options.mode === 'edit' && list.fieldActions) { + html += ""; + html += (list.fieldActions.label === undefined || list.fieldActions.label) ? "Actions" : ""; + html += "\n"; + } + html += "\n"; + html += "\n"; + return html; + } + }; + }]; diff --git a/awx/ui/static/js/shared/list-generator/main.js b/awx/ui/static/js/shared/list-generator/main.js new file mode 100644 index 0000000000..dba9519d25 --- /dev/null +++ b/awx/ui/static/js/shared/list-generator/main.js @@ -0,0 +1,5 @@ +import generateList from './list-generator.factory'; + +export default + angular.module('listGenerator', []) + .factory('generateList', generateList); diff --git a/awx/ui/static/js/shared/main.js b/awx/ui/static/js/shared/main.js new file mode 100644 index 0000000000..84883eaf97 --- /dev/null +++ b/awx/ui/static/js/shared/main.js @@ -0,0 +1,4 @@ +import listGenerator from './list-generator/main'; + +export default + angular.module('shared', [listGenerator.name]); diff --git a/awx/ui/static/js/widgets/Stream.js b/awx/ui/static/js/widgets/Stream.js index df4aad864d..afa564c2cd 100644 --- a/awx/ui/static/js/widgets/Stream.js +++ b/awx/ui/static/js/widgets/Stream.js @@ -11,10 +11,11 @@ * */ +import listGenerator from 'tower/shared/list-generator/main'; angular.module('StreamWidget', ['RestServices', 'Utilities', 'StreamListDefinition', 'SearchHelper', 'PaginationHelpers', - 'RefreshHelper', 'ListGenerator', 'StreamWidget', 'AuthService', + 'RefreshHelper', listGenerator.name, 'StreamWidget', 'AuthService', ]) .factory('setStreamHeight', [ @@ -331,7 +332,7 @@ angular.module('StreamWidget', ['RestServices', 'Utilities', 'StreamListDefiniti ]) .factory('Stream', ['$rootScope', '$location', 'Rest', 'GetBasePath', 'ProcessErrors', 'Wait', 'StreamList', 'SearchInit', - 'PaginateInit', 'GenerateList', 'FormatDate', 'ShowStream', 'HideStream', 'BuildDescription', 'FixUrl', 'BuildUrl', + 'PaginateInit', 'generateList', 'FormatDate', 'ShowStream', 'HideStream', 'BuildDescription', 'FixUrl', 'BuildUrl', 'ShowDetail', 'StreamBreadCrumbs', 'setStreamHeight', 'Find', 'Store', function ($rootScope, $location, Rest, GetBasePath, ProcessErrors, Wait, StreamList, SearchInit, PaginateInit, GenerateList, FormatDate, ShowStream, HideStream, BuildDescription, FixUrl, BuildUrl, ShowDetail, StreamBreadCrumbs, setStreamHeight,