From 3b4d40a6c35e8158ec4886530eabd9e09a61a207 Mon Sep 17 00:00:00 2001 From: John Mitchell Date: Wed, 1 Mar 2017 16:29:21 -0500 Subject: [PATCH 01/18] update credentials --- awx/ui/client/src/app.js | 3 +- .../add/credentials-add.controller.js | 13 ++-- .../credentials.form.js} | 6 +- .../credentials.list.js} | 6 +- .../edit/credentials-edit.controller.js | 18 ++--- .../list/credentials-list.controller.js | 11 ++- awx/ui/client/src/credentials/main.js | 4 + .../src/credentials/ownerList.partial.html | 37 ++++++--- awx/ui/client/src/forms.js | 2 - awx/ui/client/src/lists.js | 6 +- awx/ui/client/src/lists/CloudCredentials.js | 77 ------------------- 11 files changed, 57 insertions(+), 126 deletions(-) rename awx/ui/client/src/{forms/Credentials.js => credentials/credentials.form.js} (99%) rename awx/ui/client/src/{lists/Credentials.js => credentials/credentials.list.js} (95%) delete mode 100644 awx/ui/client/src/lists/CloudCredentials.js diff --git a/awx/ui/client/src/app.js b/awx/ui/client/src/app.js index a298b634bd..0830b0e651 100644 --- a/awx/ui/client/src/app.js +++ b/awx/ui/client/src/app.js @@ -140,8 +140,7 @@ var tower = angular.module('Tower', [ 'GroupListDefinition', 'TeamsListDefinition', 'TeamFormDefinition', - 'CredentialsListDefinition', - 'CredentialFormDefinition', + 'TeamHelper', 'TemplatesListDefinition', 'PortalJobTemplatesListDefinition', 'JobTemplateFormDefinition', diff --git a/awx/ui/client/src/credentials/add/credentials-add.controller.js b/awx/ui/client/src/credentials/add/credentials-add.controller.js index 5671128323..e6daef660f 100644 --- a/awx/ui/client/src/credentials/add/credentials-add.controller.js +++ b/awx/ui/client/src/credentials/add/credentials-add.controller.js @@ -4,14 +4,13 @@ * All Rights Reserved *************************************************/ -export default ['$scope', '$rootScope', '$compile', '$location', - '$log', '$stateParams', 'CredentialForm', 'GenerateForm', 'Rest', 'Alert', - 'ProcessErrors', 'ClearScope', 'GetBasePath', 'GetChoices', 'Empty', 'KindChange', 'BecomeMethodChange', +export default ['$scope', '$rootScope', '$stateParams', 'CredentialForm', + 'GenerateForm', 'Rest', 'ProcessErrors', 'ClearScope', 'GetBasePath', + 'GetChoices', 'Empty', 'KindChange', 'BecomeMethodChange', 'OwnerChange', 'CredentialFormSave', '$state', 'CreateSelect2', 'i18n', - function($scope, $rootScope, $compile, $location, $log, - $stateParams, CredentialForm, GenerateForm, Rest, Alert, ProcessErrors, - ClearScope, GetBasePath, GetChoices, Empty, KindChange, BecomeMethodChange, - OwnerChange, CredentialFormSave, $state, CreateSelect2, i18n) { + function($scope, $rootScope, $stateParams, CredentialForm, GenerateForm, + Rest, ProcessErrors, ClearScope, GetBasePath, GetChoices, Empty, KindChange, + BecomeMethodChange, OwnerChange, CredentialFormSave, $state, CreateSelect2, i18n) { ClearScope(); diff --git a/awx/ui/client/src/forms/Credentials.js b/awx/ui/client/src/credentials/credentials.form.js similarity index 99% rename from awx/ui/client/src/forms/Credentials.js rename to awx/ui/client/src/credentials/credentials.form.js index 89af5ea7b9..d2a201fdd1 100644 --- a/awx/ui/client/src/forms/Credentials.js +++ b/awx/ui/client/src/credentials/credentials.form.js @@ -10,9 +10,7 @@ * @description This form is for adding/editing a Credential */ -export default - angular.module('CredentialFormDefinition', []) - .factory('CredentialForm', ['i18n', function(i18n) { +export default ['i18n', function(i18n) { return { addTitle: i18n._('CREATE CREDENTIAL'), //Legend in add mode @@ -474,4 +472,4 @@ export default } } } - };}]); + };}]; diff --git a/awx/ui/client/src/lists/Credentials.js b/awx/ui/client/src/credentials/credentials.list.js similarity index 95% rename from awx/ui/client/src/lists/Credentials.js rename to awx/ui/client/src/credentials/credentials.list.js index 152e182b35..dcbe4db556 100644 --- a/awx/ui/client/src/lists/Credentials.js +++ b/awx/ui/client/src/credentials/credentials.list.js @@ -7,9 +7,7 @@ -export default - angular.module('CredentialsListDefinition', []) - .factory('CredentialList', ['i18n', function(i18n) { +export default ['i18n', function(i18n) { return { name: 'credentials', @@ -95,4 +93,4 @@ export default ngShow: 'credential.summary_fields.user_capabilities.delete' } } - };}]); + };}]; diff --git a/awx/ui/client/src/credentials/edit/credentials-edit.controller.js b/awx/ui/client/src/credentials/edit/credentials-edit.controller.js index 9073b80bdb..2f1d04a0b8 100644 --- a/awx/ui/client/src/credentials/edit/credentials-edit.controller.js +++ b/awx/ui/client/src/credentials/edit/credentials-edit.controller.js @@ -4,15 +4,15 @@ * All Rights Reserved *************************************************/ -export default ['$scope', '$rootScope', '$compile', '$location', - '$log', '$stateParams', 'CredentialForm', 'Rest', 'Alert', - 'ProcessErrors', 'ClearScope', 'Prompt', 'GetBasePath', 'GetChoices', - 'KindChange', 'BecomeMethodChange', 'Empty', 'OwnerChange', - 'CredentialFormSave', 'Wait', '$state', 'CreateSelect2', 'Authorization', 'i18n', - function($scope, $rootScope, $compile, $location, $log, - $stateParams, CredentialForm, Rest, Alert, ProcessErrors, ClearScope, Prompt, - GetBasePath, GetChoices, KindChange, BecomeMethodChange, Empty, OwnerChange, CredentialFormSave, Wait, - $state, CreateSelect2, Authorization, i18n) { +export default ['$scope', '$rootScope', '$location', '$stateParams', + 'CredentialForm', 'Rest', 'ProcessErrors', 'ClearScope', 'Prompt', + 'GetBasePath', 'GetChoices', 'KindChange', 'BecomeMethodChange', 'Empty', + 'OwnerChange', 'Wait', '$state', 'CreateSelect2', + 'Authorization', 'i18n', 'CredentialFormSave', + function($scope, $rootScope, $location, $stateParams, CredentialForm, Rest, + ProcessErrors, ClearScope, Prompt, GetBasePath, GetChoices, KindChange, + BecomeMethodChange, Empty, OwnerChange, Wait, $state, + CreateSelect2, Authorization, i18n, CredentialFormSave) { ClearScope(); diff --git a/awx/ui/client/src/credentials/list/credentials-list.controller.js b/awx/ui/client/src/credentials/list/credentials-list.controller.js index 6f420f2cd9..b8bc553a2a 100644 --- a/awx/ui/client/src/credentials/list/credentials-list.controller.js +++ b/awx/ui/client/src/credentials/list/credentials-list.controller.js @@ -4,12 +4,11 @@ * All Rights Reserved *************************************************/ -export default ['$scope', '$rootScope', '$location', '$log', - '$stateParams', 'Rest', 'Alert', 'CredentialList', 'Prompt', 'ClearScope', - 'ProcessErrors', 'GetBasePath', 'Wait', '$state', '$filter', 'rbacUiControlService', 'Dataset', 'i18n', - function($scope, $rootScope, $location, $log, - $stateParams, Rest, Alert, CredentialList, Prompt, ClearScope, - ProcessErrors, GetBasePath, Wait, $state, $filter, rbacUiControlService, Dataset, +export default ['$scope', 'Rest', 'CredentialList', 'Prompt', 'ClearScope', + 'ProcessErrors', 'GetBasePath', 'Wait', '$state', '$filter', + 'rbacUiControlService', 'Dataset', 'i18n', + function($scope, Rest, CredentialList, Prompt, ClearScope, ProcessErrors, + GetBasePath, Wait, $state, $filter, rbacUiControlService, Dataset, i18n) { ClearScope(); diff --git a/awx/ui/client/src/credentials/main.js b/awx/ui/client/src/credentials/main.js index e4bb2f6f2d..0dfe1d8d5d 100644 --- a/awx/ui/client/src/credentials/main.js +++ b/awx/ui/client/src/credentials/main.js @@ -12,6 +12,8 @@ import BecomeMethodChange from './factories/become-method-change.factory'; import CredentialFormSave from './factories/credential-form-save.factory'; import KindChange from './factories/kind-change.factory'; import OwnerChange from './factories/owner-change.factory'; +import CredentialList from './credentials.list'; +import CredentialForm from './credentials.form'; import { N_ } from '../i18n'; export default @@ -24,6 +26,8 @@ export default .controller('CredentialsList', CredentialsList) .controller('CredentialsAdd', CredentialsAdd) .controller('CredentialsEdit', CredentialsEdit) + .factory('CredentialList', CredentialList) + .factory('CredentialForm', CredentialForm) .config(['$stateProvider', 'stateDefinitionsProvider', function($stateProvider, stateDefinitionsProvider) { let stateDefinitions = stateDefinitionsProvider.$get(); diff --git a/awx/ui/client/src/credentials/ownerList.partial.html b/awx/ui/client/src/credentials/ownerList.partial.html index 5c73ac4d15..a0faea839b 100644 --- a/awx/ui/client/src/credentials/ownerList.partial.html +++ b/awx/ui/client/src/credentials/ownerList.partial.html @@ -1,12 +1,29 @@ -
- diff --git a/awx/ui/client/src/forms.js b/awx/ui/client/src/forms.js index f51be2d458..83de6838c2 100644 --- a/awx/ui/client/src/forms.js +++ b/awx/ui/client/src/forms.js @@ -5,7 +5,6 @@ *************************************************/ import ActivityDetail from "./forms/ActivityDetail"; -import Credentials from "./forms/Credentials"; import EventsViewer from "./forms/EventsViewer"; import Groups from "./forms/Groups"; import HostGroups from "./forms/HostGroups"; @@ -27,7 +26,6 @@ import Workflows from "./forms/Workflows"; export { ActivityDetail, - Credentials, EventsViewer, Groups, HostGroups, diff --git a/awx/ui/client/src/lists.js b/awx/ui/client/src/lists.js index ffe7da6d55..dc2e952485 100644 --- a/awx/ui/client/src/lists.js +++ b/awx/ui/client/src/lists.js @@ -4,10 +4,8 @@ * All Rights Reserved *************************************************/ -import CloudCredentials from "./lists/CloudCredentials"; import CompletedJobs from "./lists/CompletedJobs"; import AllJobs from "./lists/AllJobs"; -import Credentials from "./lists/Credentials"; import Groups from "./lists/Groups"; import Hosts from "./lists/Hosts"; import Inventories from "./lists/Inventories"; @@ -28,10 +26,8 @@ import Templates from "./lists/Templates"; import Users from "./lists/Users"; export - { CloudCredentials, - CompletedJobs, + { CompletedJobs, AllJobs, - Credentials, Groups, Hosts, Inventories, diff --git a/awx/ui/client/src/lists/CloudCredentials.js b/awx/ui/client/src/lists/CloudCredentials.js deleted file mode 100644 index 0010390436..0000000000 --- a/awx/ui/client/src/lists/CloudCredentials.js +++ /dev/null @@ -1,77 +0,0 @@ -/************************************************* - * Copyright (c) 2015 Ansible, Inc. - * - * All Rights Reserved - *************************************************/ - - - - -export default - angular.module('CloudCredentialsListDefinition', []) - .value('CloudCredentialList', { - - name: 'cloudcredentials', - iterator: 'cloudcredential', - selectTitle: 'Add Cloud Credentials', - editTitle: 'CLOUD CREDENTIALS', - selectInstructions: '

Select existing credentials by clicking each credential or checking the related checkbox. When finished, click the blue ' + - 'Select button, located bottom right.

Create a brand new credential by clicking the button.

', - index: false, - hover: true, - - fields: { - name: { - key: true, - label: 'Name' - }, - description: { - label: 'Description', - excludeModal: false - }, - team: { - label: 'Team', - ngBind: 'credential.team_name', - sourceModel: 'team', - sourceField: 'name', - excludeModal: true - }, - user: { - label: 'User', - ngBind: 'credential.user_username', - sourceModel: 'user', - sourceField: 'username', - excludeModal: true - } - }, - - actions: { - add: { - mode: 'all', // One of: edit, select, all - ngClick: 'addCredential()', - awToolTip: 'Create a new credential', - actionClass: 'btn btn-sm List-buttonSubmit', - buttonContent: '+ ADD' - } - }, - - fieldActions: { - edit: { - ngClick: "editCredential(credential.id)", - icon: 'fa-edit', - label: 'Edit', - "class": 'btn-sm', - awToolTip: 'Edit credential', - dataPlacement: 'top' - }, - - "delete": { - ngClick: "deleteCredential(credential.id, credential.name)", - icon: 'fa-trash-o', - label: 'Delete', - "class": 'btn-sm', - awToolTip: 'Delete credential', - dataPlacement: 'top' - } - } - }); From f74f866b81a02976338f0a9947f72f09dbae837d Mon Sep 17 00:00:00 2001 From: John Mitchell Date: Thu, 2 Mar 2017 10:49:58 -0500 Subject: [PATCH 02/18] remove TeamHelper from messed up merge conflict fix --- awx/ui/client/src/app.js | 1 - 1 file changed, 1 deletion(-) diff --git a/awx/ui/client/src/app.js b/awx/ui/client/src/app.js index 0830b0e651..095f216f59 100644 --- a/awx/ui/client/src/app.js +++ b/awx/ui/client/src/app.js @@ -140,7 +140,6 @@ var tower = angular.module('Tower', [ 'GroupListDefinition', 'TeamsListDefinition', 'TeamFormDefinition', - 'TeamHelper', 'TemplatesListDefinition', 'PortalJobTemplatesListDefinition', 'JobTemplateFormDefinition', From 8688e3c6a10ea1dfd2995e14d9aac020937442e5 Mon Sep 17 00:00:00 2001 From: John Mitchell Date: Thu, 2 Mar 2017 11:00:19 -0500 Subject: [PATCH 03/18] cleanup teams --- awx/ui/client/src/app.js | 2 -- awx/ui/client/src/forms.js | 2 -- awx/ui/client/src/lists.js | 2 -- awx/ui/client/src/teams/add/teams-add.controller.js | 8 ++++---- awx/ui/client/src/teams/edit/teams-edit.controller.js | 5 ++--- awx/ui/client/src/teams/list/teams-list.controller.js | 9 ++++----- awx/ui/client/src/teams/main.js | 4 ++++ .../client/src/{forms/Teams.js => teams/teams.form.js} | 6 ++---- .../client/src/{lists/Teams.js => teams/teams.list.js} | 6 ++---- 9 files changed, 18 insertions(+), 26 deletions(-) rename awx/ui/client/src/{forms/Teams.js => teams/teams.form.js} (97%) rename awx/ui/client/src/{lists/Teams.js => teams/teams.list.js} (95%) diff --git a/awx/ui/client/src/app.js b/awx/ui/client/src/app.js index 095f216f59..89221d272f 100644 --- a/awx/ui/client/src/app.js +++ b/awx/ui/client/src/app.js @@ -138,8 +138,6 @@ var tower = angular.module('Tower', [ 'HostListDefinition', 'GroupFormDefinition', 'GroupListDefinition', - 'TeamsListDefinition', - 'TeamFormDefinition', 'TemplatesListDefinition', 'PortalJobTemplatesListDefinition', 'JobTemplateFormDefinition', diff --git a/awx/ui/client/src/forms.js b/awx/ui/client/src/forms.js index 83de6838c2..5442dd5e17 100644 --- a/awx/ui/client/src/forms.js +++ b/awx/ui/client/src/forms.js @@ -18,7 +18,6 @@ import JobVarsPrompt from "./forms/JobVarsPrompt"; import LogViewerOptions from "./forms/LogViewerOptions"; import LogViewerStatus from "./forms/LogViewerStatus"; import Organizations from "./forms/Organizations"; -import Teams from "./forms/Teams"; import Users from "./forms/Users"; import WorkflowMaker from "./forms/WorkflowMaker"; import Workflows from "./forms/Workflows"; @@ -39,7 +38,6 @@ export LogViewerOptions, LogViewerStatus, Organizations, - Teams, Users, WorkflowMaker, Workflows diff --git a/awx/ui/client/src/lists.js b/awx/ui/client/src/lists.js index dc2e952485..db2007a4c8 100644 --- a/awx/ui/client/src/lists.js +++ b/awx/ui/client/src/lists.js @@ -21,7 +21,6 @@ import PortalJobs from "./lists/PortalJobs"; import ScheduledJobs from "./lists/ScheduledJobs"; import Schedules from "./lists/Schedules"; import Streams from "./lists/Streams"; -import Teams from "./lists/Teams"; import Templates from "./lists/Templates"; import Users from "./lists/Users"; @@ -43,7 +42,6 @@ export ScheduledJobs, Schedules, Streams, - Teams, Templates, Users }; diff --git a/awx/ui/client/src/teams/add/teams-add.controller.js b/awx/ui/client/src/teams/add/teams-add.controller.js index f91df286bc..6204565958 100644 --- a/awx/ui/client/src/teams/add/teams-add.controller.js +++ b/awx/ui/client/src/teams/add/teams-add.controller.js @@ -4,10 +4,10 @@ * All Rights Reserved *************************************************/ -export default ['$scope', '$rootScope', '$stateParams', 'TeamForm', 'GenerateForm', - 'Rest', 'Alert', 'ProcessErrors', 'ClearScope', 'GetBasePath', 'Wait', '$state', - function($scope, $rootScope, $stateParams, TeamForm, GenerateForm, Rest, Alert, ProcessErrors, - ClearScope, GetBasePath, Wait, $state) { +export default ['$scope', '$rootScope', 'TeamForm', 'GenerateForm', 'Rest', + 'Alert', 'ProcessErrors', 'ClearScope', 'GetBasePath', 'Wait', '$state', + function($scope, $rootScope, TeamForm, GenerateForm, Rest, Alert, + ProcessErrors, ClearScope, GetBasePath, Wait, $state) { ClearScope('htmlTemplate'); //Garbage collection. Don't leave behind any listeners/watchers from the prior //$scope. diff --git a/awx/ui/client/src/teams/edit/teams-edit.controller.js b/awx/ui/client/src/teams/edit/teams-edit.controller.js index c4b1d1fa4c..6587311c7d 100644 --- a/awx/ui/client/src/teams/edit/teams-edit.controller.js +++ b/awx/ui/client/src/teams/edit/teams-edit.controller.js @@ -6,9 +6,8 @@ export default ['$scope', '$rootScope', '$stateParams', 'TeamForm', 'Rest', 'ProcessErrors', 'ClearScope', 'GetBasePath', 'Wait', '$state', - function($scope, $rootScope, $stateParams, - TeamForm, Rest, ProcessErrors, ClearScope, GetBasePath, Wait, $state) { - + function($scope, $rootScope, $stateParams, TeamForm, Rest, ProcessErrors, + ClearScope, GetBasePath, Wait, $state) { ClearScope(); var form = TeamForm, diff --git a/awx/ui/client/src/teams/list/teams-list.controller.js b/awx/ui/client/src/teams/list/teams-list.controller.js index a4793de0ec..1477452358 100644 --- a/awx/ui/client/src/teams/list/teams-list.controller.js +++ b/awx/ui/client/src/teams/list/teams-list.controller.js @@ -4,11 +4,10 @@ * All Rights Reserved *************************************************/ -export default ['$scope', '$rootScope', '$log', - '$stateParams', 'Rest', 'Alert', 'TeamList', 'Prompt', 'ClearScope', - 'ProcessErrors', 'GetBasePath', 'Wait', '$state', '$filter', 'rbacUiControlService', 'Dataset', - function($scope, $rootScope, $log, $stateParams, - Rest, Alert, TeamList, Prompt, ClearScope, ProcessErrors, +export default ['$scope', 'Rest', 'TeamList', 'Prompt', 'ClearScope', + 'ProcessErrors', 'GetBasePath', 'Wait', '$state', '$filter', + 'rbacUiControlService', 'Dataset', + function($scope, Rest, TeamList, Prompt, ClearScope, ProcessErrors, GetBasePath, Wait, $state, $filter, rbacUiControlService, Dataset) { ClearScope(); diff --git a/awx/ui/client/src/teams/main.js b/awx/ui/client/src/teams/main.js index cd800ddb11..258af14dda 100644 --- a/awx/ui/client/src/teams/main.js +++ b/awx/ui/client/src/teams/main.js @@ -7,6 +7,8 @@ import TeamsList from './list/teams-list.controller'; import TeamsAdd from './add/teams-add.controller'; import TeamsEdit from './edit/teams-edit.controller'; +import TeamList from './teams.list'; +import TeamForm from './teams.form'; import { N_ } from '../i18n'; export default @@ -14,6 +16,8 @@ angular.module('Teams', []) .controller('TeamsList', TeamsList) .controller('TeamsAdd', TeamsAdd) .controller('TeamsEdit', TeamsEdit) + .factory('TeamList', TeamList) + .factory('TeamForm', TeamForm) .config(['$stateProvider', 'stateDefinitionsProvider', function($stateProvider, stateDefinitionsProvider) { let stateDefinitions = stateDefinitionsProvider.$get(); diff --git a/awx/ui/client/src/forms/Teams.js b/awx/ui/client/src/teams/teams.form.js similarity index 97% rename from awx/ui/client/src/forms/Teams.js rename to awx/ui/client/src/teams/teams.form.js index 7b883ab834..2a3e97fcfa 100644 --- a/awx/ui/client/src/forms/Teams.js +++ b/awx/ui/client/src/teams/teams.form.js @@ -10,9 +10,7 @@ * @description This form is for adding/editing teams */ -export default - angular.module('TeamFormDefinition', []) - .factory('TeamForm', ['i18n', function(i18n) { +export default ['i18n', function(i18n) { return { addTitle: i18n._('NEW TEAM'), //Legend in add mode @@ -162,4 +160,4 @@ export default } } }, - };}]); //InventoryForm + };}]; diff --git a/awx/ui/client/src/lists/Teams.js b/awx/ui/client/src/teams/teams.list.js similarity index 95% rename from awx/ui/client/src/lists/Teams.js rename to awx/ui/client/src/teams/teams.list.js index ea8bce2419..551d07f37c 100644 --- a/awx/ui/client/src/lists/Teams.js +++ b/awx/ui/client/src/teams/teams.list.js @@ -5,9 +5,7 @@ *************************************************/ -export default - angular.module('TeamsListDefinition', []) - .factory('TeamList', ['i18n', function(i18n) { +export default ['i18n', function(i18n) { return { name: 'teams', @@ -83,4 +81,4 @@ export default ngShow: 'team.summary_fields.user_capabilities.delete' } } - };}]); + };}]; From a548aa72e078036d3c02c47278ce5e3519dea83d Mon Sep 17 00:00:00 2001 From: John Mitchell Date: Thu, 2 Mar 2017 11:09:17 -0500 Subject: [PATCH 04/18] cleanup users --- awx/ui/client/src/app.js | 2 -- awx/ui/client/src/forms.js | 2 -- awx/ui/client/src/lists.js | 4 +--- awx/ui/client/src/users/add/users-add.controller.js | 11 +++++------ .../client/src/users/edit/users-edit.controller.js | 9 ++++----- .../client/src/users/list/users-list.controller.js | 12 ++++++------ awx/ui/client/src/users/main.js | 4 ++++ .../src/{forms/Users.js => users/users.form.js} | 6 ++---- .../src/{lists/Users.js => users/users.list.js} | 6 ++---- 9 files changed, 24 insertions(+), 32 deletions(-) rename awx/ui/client/src/{forms/Users.js => users/users.form.js} (98%) rename awx/ui/client/src/{lists/Users.js => users/users.list.js} (96%) diff --git a/awx/ui/client/src/app.js b/awx/ui/client/src/app.js index 89221d272f..63f0e2cdae 100644 --- a/awx/ui/client/src/app.js +++ b/awx/ui/client/src/app.js @@ -124,10 +124,8 @@ var tower = angular.module('Tower', [ //'templates', 'Utilities', 'OrganizationFormDefinition', - 'UserFormDefinition', 'OrganizationListDefinition', 'templates', - 'UserListDefinition', 'PromptDialog', 'AWDirectives', 'InventoriesListDefinition', diff --git a/awx/ui/client/src/forms.js b/awx/ui/client/src/forms.js index 5442dd5e17..f57b55861a 100644 --- a/awx/ui/client/src/forms.js +++ b/awx/ui/client/src/forms.js @@ -18,7 +18,6 @@ import JobVarsPrompt from "./forms/JobVarsPrompt"; import LogViewerOptions from "./forms/LogViewerOptions"; import LogViewerStatus from "./forms/LogViewerStatus"; import Organizations from "./forms/Organizations"; -import Users from "./forms/Users"; import WorkflowMaker from "./forms/WorkflowMaker"; import Workflows from "./forms/Workflows"; @@ -38,7 +37,6 @@ export LogViewerOptions, LogViewerStatus, Organizations, - Users, WorkflowMaker, Workflows }; diff --git a/awx/ui/client/src/lists.js b/awx/ui/client/src/lists.js index db2007a4c8..272ad2f55c 100644 --- a/awx/ui/client/src/lists.js +++ b/awx/ui/client/src/lists.js @@ -22,7 +22,6 @@ import ScheduledJobs from "./lists/ScheduledJobs"; import Schedules from "./lists/Schedules"; import Streams from "./lists/Streams"; import Templates from "./lists/Templates"; -import Users from "./lists/Users"; export { CompletedJobs, @@ -42,6 +41,5 @@ export ScheduledJobs, Schedules, Streams, - Templates, - Users + Templates }; diff --git a/awx/ui/client/src/users/add/users-add.controller.js b/awx/ui/client/src/users/add/users-add.controller.js index 6f7b8b75b3..3263b6d545 100644 --- a/awx/ui/client/src/users/add/users-add.controller.js +++ b/awx/ui/client/src/users/add/users-add.controller.js @@ -12,13 +12,12 @@ const user_type_options = [ { type: 'system_administrator', label: N_('System Administrator') }, ]; -export default ['$scope', '$rootScope', '$stateParams', 'UserForm', 'GenerateForm', - 'Rest', 'Alert', 'ProcessErrors', 'ReturnToCaller', 'ClearScope', 'GetBasePath', +export default ['$scope', '$rootScope', 'UserForm', 'GenerateForm', 'Rest', + 'Alert', 'ProcessErrors', 'ReturnToCaller', 'ClearScope', 'GetBasePath', 'Wait', 'CreateSelect2', '$state', '$location', 'i18n', - function($scope, $rootScope, $stateParams, UserForm, - GenerateForm, Rest, Alert, ProcessErrors, ReturnToCaller, ClearScope, - GetBasePath, Wait, CreateSelect2, $state, $location, i18n) { - + function($scope, $rootScope, UserForm, GenerateForm, Rest, Alert, + ProcessErrors, ReturnToCaller, ClearScope, GetBasePath, Wait, CreateSelect2, + $state, $location, i18n) { ClearScope(); var defaultUrl = GetBasePath('organizations'), diff --git a/awx/ui/client/src/users/edit/users-edit.controller.js b/awx/ui/client/src/users/edit/users-edit.controller.js index a1255398ed..864ba4ce71 100644 --- a/awx/ui/client/src/users/edit/users-edit.controller.js +++ b/awx/ui/client/src/users/edit/users-edit.controller.js @@ -12,11 +12,10 @@ const user_type_options = [ { type: 'system_administrator', label: N_('System Administrator') }, ]; -export default ['$scope', '$rootScope', '$location', - '$stateParams', 'UserForm', 'Rest', 'ProcessErrors', 'ClearScope', 'GetBasePath', - 'Wait', 'CreateSelect2', '$state', 'i18n', - function($scope, $rootScope, $location, - $stateParams, UserForm, Rest, ProcessErrors, +export default ['$scope', '$rootScope', '$stateParams', 'UserForm', 'Rest', + 'ProcessErrors', 'ClearScope', 'GetBasePath', 'Wait', 'CreateSelect2', + '$state', 'i18n', + function($scope, $rootScope, $stateParams, UserForm, Rest, ProcessErrors, ClearScope, GetBasePath, Wait, CreateSelect2, $state, i18n) { for (var i = 0; i < user_type_options.length; i++) { diff --git a/awx/ui/client/src/users/list/users-list.controller.js b/awx/ui/client/src/users/list/users-list.controller.js index 437690da83..3eb05edb83 100644 --- a/awx/ui/client/src/users/list/users-list.controller.js +++ b/awx/ui/client/src/users/list/users-list.controller.js @@ -12,12 +12,12 @@ const user_type_options = [ { type: 'system_administrator', label: N_('System Administrator') }, ]; -export default ['$scope', '$rootScope', '$stateParams', - 'Rest', 'Alert', 'UserList', 'Prompt', 'ClearScope', 'ProcessErrors', 'GetBasePath', - 'Wait', '$state', '$filter', 'rbacUiControlService', 'Dataset', 'i18n', - function($scope, $rootScope, $stateParams, - Rest, Alert, UserList, Prompt, ClearScope, ProcessErrors, GetBasePath, - Wait, $state, $filter, rbacUiControlService, Dataset, i18n) { +export default ['$scope', '$rootScope', 'Rest', 'UserList', 'Prompt', + 'ClearScope', 'ProcessErrors', 'GetBasePath', 'Wait', '$state', '$filter', + 'rbacUiControlService', 'Dataset', 'i18n', + function($scope, $rootScope, Rest, UserList, Prompt, ClearScope, + ProcessErrors, GetBasePath, Wait, $state, $filter, rbacUiControlService, + Dataset, i18n) { for (var i = 0; i < user_type_options.length; i++) { user_type_options[i].label = i18n._(user_type_options[i].label); diff --git a/awx/ui/client/src/users/main.js b/awx/ui/client/src/users/main.js index 1d978a091b..436c614788 100644 --- a/awx/ui/client/src/users/main.js +++ b/awx/ui/client/src/users/main.js @@ -7,6 +7,8 @@ import UsersList from './list/users-list.controller'; import UsersAdd from './add/users-add.controller'; import UsersEdit from './edit/users-edit.controller'; +import UserForm from './users.form'; +import UserList from './users.list'; import { N_ } from '../i18n'; export default @@ -14,6 +16,8 @@ angular.module('Users', []) .controller('UsersList', UsersList) .controller('UsersAdd', UsersAdd) .controller('UsersEdit', UsersEdit) + .factory('UserForm', UserForm) + .factory('UserList', UserList) .config(['$stateProvider', 'stateDefinitionsProvider', function($stateProvider, stateDefinitionsProvider) { let stateDefinitions = stateDefinitionsProvider.$get(); diff --git a/awx/ui/client/src/forms/Users.js b/awx/ui/client/src/users/users.form.js similarity index 98% rename from awx/ui/client/src/forms/Users.js rename to awx/ui/client/src/users/users.form.js index 0b4f366443..c1a7946a6e 100644 --- a/awx/ui/client/src/forms/Users.js +++ b/awx/ui/client/src/users/users.form.js @@ -10,9 +10,7 @@ * @description This form is for adding/editing users */ -export default - angular.module('UserFormDefinition', []) - .factory('UserForm', ['i18n', function(i18n) { +export default ['i18n', function(i18n) { return { addTitle: i18n._('NEW USER'), @@ -229,4 +227,4 @@ export default } } - };}]); + };}]; diff --git a/awx/ui/client/src/lists/Users.js b/awx/ui/client/src/users/users.list.js similarity index 96% rename from awx/ui/client/src/lists/Users.js rename to awx/ui/client/src/users/users.list.js index 6f9e8ecbe6..c53eb79887 100644 --- a/awx/ui/client/src/lists/Users.js +++ b/awx/ui/client/src/users/users.list.js @@ -5,9 +5,7 @@ *************************************************/ -export default - angular.module('UserListDefinition', []) - .factory('UserList', ['i18n', function(i18n) { +export default ['i18n', function(i18n) { return { name: 'users', @@ -87,4 +85,4 @@ export default ngShow: 'user.summary_fields.user_capabilities.delete' } } - };}]); + };}]; From a6c57fc060d1e6c70452427114aa9609f5b3a1f8 Mon Sep 17 00:00:00 2001 From: John Mitchell Date: Thu, 2 Mar 2017 11:29:52 -0500 Subject: [PATCH 05/18] cleanup schedules --- awx/ui/client/src/app.js | 7 ++----- awx/ui/client/src/lists.js | 2 -- awx/ui/client/src/projects/projects.form.js | 1 - awx/ui/client/src/scheduler/main.js | 2 ++ .../{lists/Schedules.js => scheduler/schedules.list.js} | 6 ++---- 5 files changed, 6 insertions(+), 12 deletions(-) rename awx/ui/client/src/{lists/Schedules.js => scheduler/schedules.list.js} (96%) diff --git a/awx/ui/client/src/app.js b/awx/ui/client/src/app.js index 63f0e2cdae..f1ba64379a 100644 --- a/awx/ui/client/src/app.js +++ b/awx/ui/client/src/app.js @@ -100,7 +100,6 @@ var tower = angular.module('Tower', [ inventories.name, inventoryScripts.name, organizations.name, - //permissions.name, managementJobs.name, setupMenu.name, mainMenu.name, @@ -121,7 +120,8 @@ var tower = angular.module('Tower', [ teams.name, users.name, projects.name, - //'templates', + scheduler.name, + 'Utilities', 'OrganizationFormDefinition', 'OrganizationListDefinition', @@ -145,9 +145,7 @@ var tower = angular.module('Tower', [ 'HostGroupsFormDefinition', 'StreamListDefinition', 'ActivityDetailDefinition', - 'SchedulesListDefinition', 'ScheduledJobsDefinition', - //'Timezones', 'JobsListDefinition', 'LogViewerStatusDefinition', 'LogViewerOptionsDefinition', @@ -155,7 +153,6 @@ var tower = angular.module('Tower', [ 'PortalJobsListDefinition', 'features', 'pendolytics', - scheduler.name, 'WorkflowFormDefinition', 'InventorySourcesListDefinition', 'WorkflowMakerFormDefinition' diff --git a/awx/ui/client/src/lists.js b/awx/ui/client/src/lists.js index 272ad2f55c..ae0d894a9d 100644 --- a/awx/ui/client/src/lists.js +++ b/awx/ui/client/src/lists.js @@ -19,7 +19,6 @@ import Organizations from "./lists/Organizations"; import PortalJobTemplates from "./lists/PortalJobTemplates"; import PortalJobs from "./lists/PortalJobs"; import ScheduledJobs from "./lists/ScheduledJobs"; -import Schedules from "./lists/Schedules"; import Streams from "./lists/Streams"; import Templates from "./lists/Templates"; @@ -39,7 +38,6 @@ export PortalJobTemplates, PortalJobs, ScheduledJobs, - Schedules, Streams, Templates }; diff --git a/awx/ui/client/src/projects/projects.form.js b/awx/ui/client/src/projects/projects.form.js index ed73564f8d..578e723c88 100644 --- a/awx/ui/client/src/projects/projects.form.js +++ b/awx/ui/client/src/projects/projects.form.js @@ -13,7 +13,6 @@ export default ['i18n', 'NotificationsList', function(i18n, NotificationsList) { return function() { var projectsFormObj = { - addTitle: i18n._('NEW PROJECT'), editTitle: '{{ name }}', name: 'project', diff --git a/awx/ui/client/src/scheduler/main.js b/awx/ui/client/src/scheduler/main.js index 4536261d0c..298176eb27 100644 --- a/awx/ui/client/src/scheduler/main.js +++ b/awx/ui/client/src/scheduler/main.js @@ -16,6 +16,7 @@ import EditSchedule from './factories/edit-schedule.factory'; import RRuleToAPI from './factories/r-rule-to-api.factory'; import SchedulePost from './factories/schedule-post.factory'; import ToggleSchedule from './factories/toggle-schedule.factory'; +import SchedulesList from './schedules.list'; export default angular.module('scheduler', []) @@ -28,6 +29,7 @@ export default .factory('RRuleToAPI', RRuleToAPI) .factory('SchedulePost', SchedulePost) .factory('ToggleSchedule', ToggleSchedule) + .factory('SchedulesList', SchedulesList) .directive('schedulerDatePicker', schedulerDatePicker) .run(['$stateExtender', function($stateExtender) { // Inventory sync schedule states registered in: awx/ui/client/src/inventories/manage/groups/main.js diff --git a/awx/ui/client/src/lists/Schedules.js b/awx/ui/client/src/scheduler/schedules.list.js similarity index 96% rename from awx/ui/client/src/lists/Schedules.js rename to awx/ui/client/src/scheduler/schedules.list.js index 126650b5b4..5bf3341962 100644 --- a/awx/ui/client/src/lists/Schedules.js +++ b/awx/ui/client/src/scheduler/schedules.list.js @@ -5,9 +5,7 @@ *************************************************/ -export default - angular.module('SchedulesListDefinition', []) - .factory('SchedulesList', ['i18n', function(i18n) { +export default ['i18n', function(i18n) { return { name: 'schedules', @@ -97,4 +95,4 @@ export default ngShow: 'schedule.summary_fields.user_capabilities.delete' } } - };}]); + };}]; From e784dba61243701938d6e8c54062bf3274fe05ec Mon Sep 17 00:00:00 2001 From: John Mitchell Date: Thu, 2 Mar 2017 12:54:54 -0500 Subject: [PATCH 06/18] cleanup activity stream --- .../activity-detail.form.js} | 6 +- .../activitystream.controller.js | 70 ++--- .../activity-stream/activitystream.route.js | 12 +- .../factories/build-anchor.factory.js | 147 ++++++----- .../factories/build-description.factory.js | 245 +++++++++--------- .../factories/show-detail.factory.js | 55 ++-- .../factories/stream.factory.js | 89 ++++--- .../get-target-title.factory.js | 89 ++++--- awx/ui/client/src/activity-stream/main.js | 4 + .../model-to-base-path-key.factory.js | 87 +++---- .../streams.list.js} | 6 +- awx/ui/client/src/app.js | 2 - awx/ui/client/src/forms.js | 4 +- awx/ui/client/src/lists.js | 2 - 14 files changed, 404 insertions(+), 414 deletions(-) rename awx/ui/client/src/{forms/ActivityDetail.js => activity-stream/activity-detail.form.js} (89%) rename awx/ui/client/src/{lists/Streams.js => activity-stream/streams.list.js} (95%) diff --git a/awx/ui/client/src/forms/ActivityDetail.js b/awx/ui/client/src/activity-stream/activity-detail.form.js similarity index 89% rename from awx/ui/client/src/forms/ActivityDetail.js rename to awx/ui/client/src/activity-stream/activity-detail.form.js index 3c80f5b263..50ac02a570 100644 --- a/awx/ui/client/src/forms/ActivityDetail.js +++ b/awx/ui/client/src/activity-stream/activity-detail.form.js @@ -16,9 +16,7 @@ * @description This form is for activity detail modal that can be shown on most pages. */ -export default - angular.module('ActivityDetailDefinition', []) - .factory('ActivityDetailForm', ['i18n', function(i18n) { +export default ['i18n', function(i18n) { return { name: 'activity', @@ -48,4 +46,4 @@ export default } } - };}]); //Form + };}]; diff --git a/awx/ui/client/src/activity-stream/activitystream.controller.js b/awx/ui/client/src/activity-stream/activitystream.controller.js index ada72d572c..b7333b0bab 100644 --- a/awx/ui/client/src/activity-stream/activitystream.controller.js +++ b/awx/ui/client/src/activity-stream/activitystream.controller.js @@ -9,45 +9,47 @@ * @name controllers.function:Activity Stream * @description This controller controls the activity stream. */ -function activityStreamController($scope, $state, subTitle, Stream, GetTargetTitle, list, Dataset) { +export default ['$scope', '$state', 'subTitle', 'Stream', 'GetTargetTitle', + 'StreamList', 'Dataset', + function activityStreamController($scope, $state, subTitle, Stream, + GetTargetTitle, list, Dataset) { - init(); - initOmitSmartTags(); + init(); + initOmitSmartTags(); - function init() { - // search init - $scope.list = list; - $scope[`${list.iterator}_dataset`] = Dataset.data; - $scope[list.name] = $scope[`${list.iterator}_dataset`].results; + function init() { + // search init + $scope.list = list; + $scope[`${list.iterator}_dataset`] = Dataset.data; + $scope[list.name] = $scope[`${list.iterator}_dataset`].results; - // subTitle is passed in via a resolve on the route. If there is no subtitle - // generated in the resolve then we go get the targets generic title. + // subTitle is passed in via a resolve on the route. If there is no subtitle + // generated in the resolve then we go get the targets generic title. - // Get the streams sub-title based on the target. This scope variable is leveraged - // when we define the activity stream list. Specifically it is included in the list - // title. - $scope.streamSubTitle = subTitle ? subTitle : GetTargetTitle($state.params.target); + // Get the streams sub-title based on the target. This scope variable is leveraged + // when we define the activity stream list. Specifically it is included in the list + // title. + $scope.streamSubTitle = subTitle ? subTitle : GetTargetTitle($state.params.target); - // Open the stream - Stream({ - scope: $scope - }); - } + // Open the stream + Stream({ + scope: $scope + }); + } - // Specification of smart-tags omission from the UI is done in the route/state init. - // A limitation is that this specficiation is static and the key for which to be omitted from - // the smart-tags must be known at that time. - // In the case of activity stream, we won't to dynamically ommit the resource for which we are - // displaying the activity stream for. i.e. 'project', 'credential', etc. - function initOmitSmartTags() { - let defaults, route = _.find($state.$current.path, (step) => { - return step.params.hasOwnProperty('activity_search'); - }); - if (route && $state.params.target !== undefined) { - defaults = route.params.activity_search.config.value; - defaults[$state.params.target] = null; + // Specification of smart-tags omission from the UI is done in the route/state init. + // A limitation is that this specficiation is static and the key for which to be omitted from + // the smart-tags must be known at that time. + // In the case of activity stream, we won't to dynamically ommit the resource for which we are + // displaying the activity stream for. i.e. 'project', 'credential', etc. + function initOmitSmartTags() { + let defaults, route = _.find($state.$current.path, (step) => { + return step.params.hasOwnProperty('activity_search'); + }); + if (route && $state.params.target !== undefined) { + defaults = route.params.activity_search.config.value; + defaults[$state.params.target] = null; + } } } -} - -export default ['$scope', '$state', 'subTitle', 'Stream', 'GetTargetTitle', 'StreamList', 'Dataset', activityStreamController]; +]; diff --git a/awx/ui/client/src/activity-stream/activitystream.route.js b/awx/ui/client/src/activity-stream/activitystream.route.js index 5b99ce55bd..22ef581bc6 100644 --- a/awx/ui/client/src/activity-stream/activitystream.route.js +++ b/awx/ui/client/src/activity-stream/activitystream.route.js @@ -60,8 +60,8 @@ export default { return qs.search(path, stateParams); } ], - features: ['FeaturesService', 'ProcessErrors', '$state', '$rootScope', - function(FeaturesService, ProcessErrors, $state, $rootScope) { + features: ['FeaturesService', '$state', '$rootScope', + function(FeaturesService, $state, $rootScope) { var features = FeaturesService.get(); if (features) { if (FeaturesService.featureEnabled('activity_streams')) { @@ -81,12 +81,10 @@ export default { }); } ], - subTitle: ['$stateParams', - 'Rest', - 'ModelToBasePathKey', - 'GetBasePath', + subTitle: ['$stateParams', 'Rest', 'ModelToBasePathKey', 'GetBasePath', 'ProcessErrors', - function($stateParams, rest, ModelToBasePathKey, getBasePath, ProcessErrors) { + function($stateParams, rest, ModelToBasePathKey, getBasePath, + ProcessErrors) { // If we have a target and an ID then we want to go grab the name of the object // that we're examining with the activity stream. This name will be used in the // subtitle. diff --git a/awx/ui/client/src/activity-stream/factories/build-anchor.factory.js b/awx/ui/client/src/activity-stream/factories/build-anchor.factory.js index 80ba348b41..f3ccd0b9b0 100644 --- a/awx/ui/client/src/activity-stream/factories/build-anchor.factory.js +++ b/awx/ui/client/src/activity-stream/factories/build-anchor.factory.js @@ -1,78 +1,77 @@ -export default - function BuildAnchor($log, $filter) { - // Returns a full resource_name HTML string if link can be derived from supplied context - // returns name of resource if activity stream object doesn't contain enough data to build a UI url - // arguments are: a summary_field object, a resource type, an activity stream object - return function (obj, resource, activity) { - var url = '/#/'; - // try/except pattern asserts that: - // if we encounter a case where a UI url can't or shouldn't be generated, just supply the name of the resource - try { - // catch-all case to avoid generating urls if a resource has been deleted - // if a resource still exists, it'll be serialized in the activity's summary_fields - if (!activity.summary_fields[resource]){ - throw {name : 'ResourceDeleted', message: 'The referenced resource no longer exists'}; - } - switch (resource) { - case 'custom_inventory_script': - url += 'inventory_scripts/' + obj.id + '/'; - break; - case 'group': - if (activity.operation === 'create' || activity.operation === 'delete'){ - // the API formats the changes.inventory field as str 'myInventoryName-PrimaryKey' - var inventory_id = _.last(activity.changes.inventory.split('-')); - url += 'inventories/' + inventory_id + '/manage?group=' + activity.changes.id; - } - else { - url += 'inventories/' + activity.summary_fields.inventory[0].id + '/manage?group=' + (activity.changes.id || activity.changes.object1_pk); - } - break; - case 'host': - url += 'home/hosts/' + obj.id; - break; - case 'job': - url += 'jobs/' + obj.id; - break; - case 'inventory': - url += 'inventories/' + obj.id + '/'; - break; - case 'schedule': - // schedule urls depend on the resource they're associated with - if (activity.summary_fields.job_template){ - url += 'job_templates/' + activity.summary_fields.job_template.id + '/schedules/' + obj.id; - } - else if (activity.summary_fields.project){ - url += 'projects/' + activity.summary_fields.project.id + '/schedules/' + obj.id; - } - else if (activity.summary_fields.system_job_template){ - url += 'management_jobs/' + activity.summary_fields.system_job_template.id + '/schedules/edit/' + obj.id; - } - // urls for inventory sync schedules currently depend on having an inventory id and group id - else { - throw {name : 'NotImplementedError', message : 'activity.summary_fields to build this url not implemented yet'}; - } - break; - case 'notification_template': - url += `notification_templates/${obj.id}`; - break; - case 'role': - throw {name : 'NotImplementedError', message : 'role object management is not consolidated to a single UI view'}; - case 'job_template': - url += `templates/job_template/${obj.id}`; - break; - case 'workflow_job_template': - url += `templates/workflow_job_template/${obj.id}`; - break; - default: - url += resource + 's/' + obj.id + '/'; - } - return ' ' + $filter('sanitize')(obj.name || obj.username) + ' '; +export default function BuildAnchor($log, $filter) { + // Returns a full resource_name HTML string if link can be derived from supplied context + // returns name of resource if activity stream object doesn't contain enough data to build a UI url + // arguments are: a summary_field object, a resource type, an activity stream object + return function (obj, resource, activity) { + var url = '/#/'; + // try/except pattern asserts that: + // if we encounter a case where a UI url can't or shouldn't be generated, just supply the name of the resource + try { + // catch-all case to avoid generating urls if a resource has been deleted + // if a resource still exists, it'll be serialized in the activity's summary_fields + if (!activity.summary_fields[resource]){ + throw {name : 'ResourceDeleted', message: 'The referenced resource no longer exists'}; } - catch(err){ - $log.debug(err); - return ' ' + $filter('sanitize')(obj.name || obj.username || '') + ' '; + switch (resource) { + case 'custom_inventory_script': + url += 'inventory_scripts/' + obj.id + '/'; + break; + case 'group': + if (activity.operation === 'create' || activity.operation === 'delete'){ + // the API formats the changes.inventory field as str 'myInventoryName-PrimaryKey' + var inventory_id = _.last(activity.changes.inventory.split('-')); + url += 'inventories/' + inventory_id + '/manage?group=' + activity.changes.id; + } + else { + url += 'inventories/' + activity.summary_fields.inventory[0].id + '/manage?group=' + (activity.changes.id || activity.changes.object1_pk); + } + break; + case 'host': + url += 'home/hosts/' + obj.id; + break; + case 'job': + url += 'jobs/' + obj.id; + break; + case 'inventory': + url += 'inventories/' + obj.id + '/'; + break; + case 'schedule': + // schedule urls depend on the resource they're associated with + if (activity.summary_fields.job_template){ + url += 'job_templates/' + activity.summary_fields.job_template.id + '/schedules/' + obj.id; + } + else if (activity.summary_fields.project){ + url += 'projects/' + activity.summary_fields.project.id + '/schedules/' + obj.id; + } + else if (activity.summary_fields.system_job_template){ + url += 'management_jobs/' + activity.summary_fields.system_job_template.id + '/schedules/edit/' + obj.id; + } + // urls for inventory sync schedules currently depend on having an inventory id and group id + else { + throw {name : 'NotImplementedError', message : 'activity.summary_fields to build this url not implemented yet'}; + } + break; + case 'notification_template': + url += `notification_templates/${obj.id}`; + break; + case 'role': + throw {name : 'NotImplementedError', message : 'role object management is not consolidated to a single UI view'}; + case 'job_template': + url += `templates/job_template/${obj.id}`; + break; + case 'workflow_job_template': + url += `templates/workflow_job_template/${obj.id}`; + break; + default: + url += resource + 's/' + obj.id + '/'; } - }; - } + return ' ' + $filter('sanitize')(obj.name || obj.username) + ' '; + } + catch(err){ + $log.debug(err); + return ' ' + $filter('sanitize')(obj.name || obj.username || '') + ' '; + } + }; +} BuildAnchor.$inject = ['$log', '$filter']; diff --git a/awx/ui/client/src/activity-stream/factories/build-description.factory.js b/awx/ui/client/src/activity-stream/factories/build-description.factory.js index ecd596dda2..967ff8bb5a 100644 --- a/awx/ui/client/src/activity-stream/factories/build-description.factory.js +++ b/awx/ui/client/src/activity-stream/factories/build-description.factory.js @@ -1,126 +1,125 @@ -export default - function BuildDescription(BuildAnchor, $log, i18n) { - return function (activity) { +export default function BuildDescription(BuildAnchor, $log, i18n) { + return function (activity) { - var pastTense = function(operation){ - return (/e$/.test(activity.operation)) ? operation + 'd ' : operation + 'ed '; - }; - // convenience method to see if dis+association operation involves 2 groups - // the group cases are slightly different because groups can be dis+associated into each other - var isGroupRelationship = function(activity){ - return activity.object1 === 'group' && activity.object2 === 'group' && activity.summary_fields.group.length > 1; - }; - - // Activity stream objects will outlive the resources they reference - // in that case, summary_fields will not be available - show generic error text instead - try { - activity.description = pastTense(activity.operation); - switch(activity.object_association){ - // explicit role dis+associations - case 'role': - // object1 field is resource targeted by the dis+association - // object2 field is the resource the role is inherited from - // summary_field.role[0] contains ref info about the role - switch(activity.operation){ - // expected outcome: "disassociated role_name from " - case 'disassociate': - if (isGroupRelationship(activity)){ - activity.description += BuildAnchor(activity.summary_fields.group[1], activity.object2, activity) + activity.summary_fields.role[0].role_field + - ' from ' + BuildAnchor(activity.summary_fields.group[0], activity.object1, activity); - } - else{ - activity.description += BuildAnchor(activity.summary_fields[activity.object2][0], activity.object2, activity) + activity.summary_fields.role[0].role_field + - ' from ' + BuildAnchor(activity.summary_fields[activity.object1][0], activity.object1, activity); - } - break; - // expected outcome: "associated role_name to " - case 'associate': - if (isGroupRelationship(activity)){ - activity.description += BuildAnchor(activity.summary_fields.group[1], activity.object2, activity) + activity.summary_fields.role[0].role_field + - ' to ' + BuildAnchor(activity.summary_fields.group[0], activity.object1, activity); - } - else{ - activity.description += BuildAnchor(activity.summary_fields[activity.object2][0], activity.object2, activity) + activity.summary_fields.role[0].role_field + - ' to ' + BuildAnchor(activity.summary_fields[activity.object1][0], activity.object1, activity); - } - break; - } - break; - // inherited role dis+associations (logic identical to case 'role') - case 'parents': - // object1 field is resource targeted by the dis+association - // object2 field is the resource the role is inherited from - // summary_field.role[0] contains ref info about the role - switch(activity.operation){ - // expected outcome: "disassociated role_name from " - case 'disassociate': - if (isGroupRelationship(activity)){ - activity.description += activity.object2 + BuildAnchor(activity.summary_fields.group[1], activity.object2, activity) + - 'from ' + activity.object1 + BuildAnchor(activity.summary_fields.group[0], activity.object1, activity); - } - else{ - activity.description += BuildAnchor(activity.summary_fields[activity.object2][0], activity.object2, activity) + activity.summary_fields.role[0].role_field + - ' from ' + BuildAnchor(activity.summary_fields[activity.object1][0], activity.object1, activity); - } - break; - // expected outcome: "associated role_name to " - case 'associate': - if (isGroupRelationship(activity)){ - activity.description += activity.object1 + BuildAnchor(activity.summary_fields.group[0], activity.object1, activity) + - 'to ' + activity.object2 + BuildAnchor(activity.summary_fields.group[1], activity.object2, activity); - } - else{ - activity.description += BuildAnchor(activity.summary_fields[activity.object2][0], activity.object2, activity) + activity.summary_fields.role[0].role_field + - ' to ' + BuildAnchor(activity.summary_fields[activity.object1][0], activity.object1, activity); - } - break; - } - break; - // CRUD operations / resource on resource dis+associations - default: - switch(activity.operation){ - // expected outcome: "disassociated from " - case 'disassociate' : - if (isGroupRelationship(activity)){ - activity.description += activity.object2 + BuildAnchor(activity.summary_fields.group[1], activity.object2, activity) + - 'from ' + activity.object1 + BuildAnchor(activity.summary_fields.group[0], activity.object1, activity); - } - else { - activity.description += activity.object2 + BuildAnchor(activity.summary_fields[activity.object2][0], activity.object2, activity) + - 'from ' + activity.object1 + BuildAnchor(activity.summary_fields[activity.object1][0], activity.object1, activity); - } - break; - // expected outcome "associated to " - case 'associate': - // groups are the only resource that can be associated/disassociated into each other - if (isGroupRelationship(activity)){ - activity.description += activity.object1 + BuildAnchor(activity.summary_fields.group[0], activity.object1, activity) + - 'to ' + activity.object2 + BuildAnchor(activity.summary_fields.group[1], activity.object2, activity); - } - else { - activity.description += activity.object1 + BuildAnchor(activity.summary_fields[activity.object1][0], activity.object1, activity) + - 'to ' + activity.object2 + BuildAnchor(activity.summary_fields[activity.object2][0], activity.object2, activity); - } - break; - case 'delete': - activity.description += activity.object1 + BuildAnchor(activity.changes, activity.object1, activity); - break; - // expected outcome: "operation " - case 'update': - activity.description += activity.object1 + BuildAnchor(activity.summary_fields[activity.object1][0], activity.object1, activity); - break; - case 'create': - activity.description += activity.object1 + BuildAnchor(activity.changes, activity.object1, activity); - break; - } - break; - } - } - catch(err){ - $log.debug(err); - activity.description = i18n._('Event summary not available'); - } + var pastTense = function(operation){ + return (/e$/.test(activity.operation)) ? operation + 'd ' : operation + 'ed '; + }; + // convenience method to see if dis+association operation involves 2 groups + // the group cases are slightly different because groups can be dis+associated into each other + var isGroupRelationship = function(activity){ + return activity.object1 === 'group' && activity.object2 === 'group' && activity.summary_fields.group.length > 1; }; - } - BuildDescription.$inject = ['BuildAnchor', '$log', 'i18n']; + // Activity stream objects will outlive the resources they reference + // in that case, summary_fields will not be available - show generic error text instead + try { + activity.description = pastTense(activity.operation); + switch(activity.object_association){ + // explicit role dis+associations + case 'role': + // object1 field is resource targeted by the dis+association + // object2 field is the resource the role is inherited from + // summary_field.role[0] contains ref info about the role + switch(activity.operation){ + // expected outcome: "disassociated role_name from " + case 'disassociate': + if (isGroupRelationship(activity)){ + activity.description += BuildAnchor(activity.summary_fields.group[1], activity.object2, activity) + activity.summary_fields.role[0].role_field + + ' from ' + BuildAnchor(activity.summary_fields.group[0], activity.object1, activity); + } + else{ + activity.description += BuildAnchor(activity.summary_fields[activity.object2][0], activity.object2, activity) + activity.summary_fields.role[0].role_field + + ' from ' + BuildAnchor(activity.summary_fields[activity.object1][0], activity.object1, activity); + } + break; + // expected outcome: "associated role_name to " + case 'associate': + if (isGroupRelationship(activity)){ + activity.description += BuildAnchor(activity.summary_fields.group[1], activity.object2, activity) + activity.summary_fields.role[0].role_field + + ' to ' + BuildAnchor(activity.summary_fields.group[0], activity.object1, activity); + } + else{ + activity.description += BuildAnchor(activity.summary_fields[activity.object2][0], activity.object2, activity) + activity.summary_fields.role[0].role_field + + ' to ' + BuildAnchor(activity.summary_fields[activity.object1][0], activity.object1, activity); + } + break; + } + break; + // inherited role dis+associations (logic identical to case 'role') + case 'parents': + // object1 field is resource targeted by the dis+association + // object2 field is the resource the role is inherited from + // summary_field.role[0] contains ref info about the role + switch(activity.operation){ + // expected outcome: "disassociated role_name from " + case 'disassociate': + if (isGroupRelationship(activity)){ + activity.description += activity.object2 + BuildAnchor(activity.summary_fields.group[1], activity.object2, activity) + + 'from ' + activity.object1 + BuildAnchor(activity.summary_fields.group[0], activity.object1, activity); + } + else{ + activity.description += BuildAnchor(activity.summary_fields[activity.object2][0], activity.object2, activity) + activity.summary_fields.role[0].role_field + + ' from ' + BuildAnchor(activity.summary_fields[activity.object1][0], activity.object1, activity); + } + break; + // expected outcome: "associated role_name to " + case 'associate': + if (isGroupRelationship(activity)){ + activity.description += activity.object1 + BuildAnchor(activity.summary_fields.group[0], activity.object1, activity) + + 'to ' + activity.object2 + BuildAnchor(activity.summary_fields.group[1], activity.object2, activity); + } + else{ + activity.description += BuildAnchor(activity.summary_fields[activity.object2][0], activity.object2, activity) + activity.summary_fields.role[0].role_field + + ' to ' + BuildAnchor(activity.summary_fields[activity.object1][0], activity.object1, activity); + } + break; + } + break; + // CRUD operations / resource on resource dis+associations + default: + switch(activity.operation){ + // expected outcome: "disassociated from " + case 'disassociate' : + if (isGroupRelationship(activity)){ + activity.description += activity.object2 + BuildAnchor(activity.summary_fields.group[1], activity.object2, activity) + + 'from ' + activity.object1 + BuildAnchor(activity.summary_fields.group[0], activity.object1, activity); + } + else { + activity.description += activity.object2 + BuildAnchor(activity.summary_fields[activity.object2][0], activity.object2, activity) + + 'from ' + activity.object1 + BuildAnchor(activity.summary_fields[activity.object1][0], activity.object1, activity); + } + break; + // expected outcome "associated to " + case 'associate': + // groups are the only resource that can be associated/disassociated into each other + if (isGroupRelationship(activity)){ + activity.description += activity.object1 + BuildAnchor(activity.summary_fields.group[0], activity.object1, activity) + + 'to ' + activity.object2 + BuildAnchor(activity.summary_fields.group[1], activity.object2, activity); + } + else { + activity.description += activity.object1 + BuildAnchor(activity.summary_fields[activity.object1][0], activity.object1, activity) + + 'to ' + activity.object2 + BuildAnchor(activity.summary_fields[activity.object2][0], activity.object2, activity); + } + break; + case 'delete': + activity.description += activity.object1 + BuildAnchor(activity.changes, activity.object1, activity); + break; + // expected outcome: "operation " + case 'update': + activity.description += activity.object1 + BuildAnchor(activity.summary_fields[activity.object1][0], activity.object1, activity); + break; + case 'create': + activity.description += activity.object1 + BuildAnchor(activity.changes, activity.object1, activity); + break; + } + break; + } + } + catch(err){ + $log.debug(err); + activity.description = i18n._('Event summary not available'); + } + }; + } + +BuildDescription.$inject = ['BuildAnchor', '$log', 'i18n']; diff --git a/awx/ui/client/src/activity-stream/factories/show-detail.factory.js b/awx/ui/client/src/activity-stream/factories/show-detail.factory.js index fde935e108..f705534db0 100644 --- a/awx/ui/client/src/activity-stream/factories/show-detail.factory.js +++ b/awx/ui/client/src/activity-stream/factories/show-detail.factory.js @@ -1,39 +1,40 @@ -export default - function ShowDetail($filter, $rootScope, Rest, Alert, GenerateForm, ProcessErrors, GetBasePath, FormatDate, ActivityDetailForm, Empty, Find) { - return function (params, scope) { +export default function ShowDetail($filter, $rootScope, Rest, Alert, +GenerateForm, ProcessErrors, GetBasePath, FormatDate, ActivityDetailForm, +Empty, Find) { + return function (params, scope) { - var activity_id = params.activity_id, - activity = Find({ list: params.scope.activities, key: 'id', val: activity_id }), - element; + var activity_id = params.activity_id, + activity = Find({ list: params.scope.activities, key: 'id', val: activity_id }), + element; - if (activity) { + if (activity) { - // Grab our element out of the dom - element = angular.element(document.getElementById('stream-detail-modal')); + // Grab our element out of the dom + element = angular.element(document.getElementById('stream-detail-modal')); - // Grab the modal's scope so that we can set a few variables - scope = element.scope(); + // Grab the modal's scope so that we can set a few variables + scope = element.scope(); - scope.changes = activity.changes; - scope.user = ((activity.summary_fields.actor) ? activity.summary_fields.actor.username : 'system') + - ' on ' + $filter('longDate')(activity.timestamp); - scope.operation = activity.description; - scope.header = "Event " + activity.id; + scope.changes = activity.changes; + scope.user = ((activity.summary_fields.actor) ? activity.summary_fields.actor.username : 'system') + + ' on ' + $filter('longDate')(activity.timestamp); + scope.operation = activity.description; + scope.header = "Event " + activity.id; - // Open the modal - $('#stream-detail-modal').modal({ - show: true, - backdrop: 'static', - keyboard: true - }); + // Open the modal + $('#stream-detail-modal').modal({ + show: true, + backdrop: 'static', + keyboard: true + }); - if (!scope.$$phase) { - scope.$digest(); - } + if (!scope.$$phase) { + scope.$digest(); } + } - }; - } + }; + } ShowDetail.$inject = ['$filter', '$rootScope', 'Rest', 'Alert', 'GenerateForm', 'ProcessErrors', 'GetBasePath', 'FormatDate', 'ActivityDetailForm', 'Empty', 'Find']; diff --git a/awx/ui/client/src/activity-stream/factories/stream.factory.js b/awx/ui/client/src/activity-stream/factories/stream.factory.js index b3725fc2aa..bb7f92fb16 100644 --- a/awx/ui/client/src/activity-stream/factories/stream.factory.js +++ b/awx/ui/client/src/activity-stream/factories/stream.factory.js @@ -1,53 +1,52 @@ -export default - function Stream($rootScope, $location, $state, Rest, GetBasePath, ProcessErrors, - Wait, StreamList, GenerateList, FormatDate, - BuildDescription, ShowDetail) { - return function (params) { +export default function Stream($rootScope, $location, $state, Rest, GetBasePath, +ProcessErrors, Wait, StreamList, GenerateList, FormatDate, BuildDescription, +ShowDetail) { + return function (params) { - var scope = params.scope; + var scope = params.scope; - $rootScope.flashMessage = null; + $rootScope.flashMessage = null; - // descriptive title describing what AS is showing - scope.streamTitle = (params && params.title) ? params.title : null; - - scope.refreshStream = function () { - $state.go('.', null, {reload: true}); - }; - - scope.showDetail = function (id) { - ShowDetail({ - scope: scope, - activity_id: id - }); - }; - - if(scope.activities && scope.activities.length > 0) { - buildUserAndDescription(); - } - - scope.$watch('activities', function(){ - // Watch for future update to scope.activities (like page change, column sort, search, etc) - buildUserAndDescription(); - }); - - function buildUserAndDescription(){ - scope.activities.forEach(function(activity, i) { - // build activity.user - if (scope.activities[i].summary_fields.actor) { - scope.activities[i].user = "" + - scope.activities[i].summary_fields.actor.username + ""; - } else { - scope.activities[i].user = 'system'; - } - // build description column / action text - BuildDescription(scope.activities[i]); - - }); - } + // descriptive title describing what AS is showing + scope.streamTitle = (params && params.title) ? params.title : null; + scope.refreshStream = function () { + $state.go('.', null, {reload: true}); }; - } + + scope.showDetail = function (id) { + ShowDetail({ + scope: scope, + activity_id: id + }); + }; + + if(scope.activities && scope.activities.length > 0) { + buildUserAndDescription(); + } + + scope.$watch('activities', function(){ + // Watch for future update to scope.activities (like page change, column sort, search, etc) + buildUserAndDescription(); + }); + + function buildUserAndDescription(){ + scope.activities.forEach(function(activity, i) { + // build activity.user + if (scope.activities[i].summary_fields.actor) { + scope.activities[i].user = "" + + scope.activities[i].summary_fields.actor.username + ""; + } else { + scope.activities[i].user = 'system'; + } + // build description column / action text + BuildDescription(scope.activities[i]); + + }); + } + + }; + } Stream.$inject = ['$rootScope', '$location', '$state', 'Rest', 'GetBasePath', 'ProcessErrors', 'Wait', 'StreamList', 'generateList', 'FormatDate', 'BuildDescription', diff --git a/awx/ui/client/src/activity-stream/get-target-title.factory.js b/awx/ui/client/src/activity-stream/get-target-title.factory.js index 85c6c7a80b..543b6acdb3 100644 --- a/awx/ui/client/src/activity-stream/get-target-title.factory.js +++ b/awx/ui/client/src/activity-stream/get-target-title.factory.js @@ -1,51 +1,50 @@ -export default - function GetTargetTitle(i18n) { - return function (target) { +export default function GetTargetTitle(i18n) { + return function (target) { - var rtnTitle = i18n._('ALL ACTIVITY'); + var rtnTitle = i18n._('ALL ACTIVITY'); - switch(target) { - case 'project': - rtnTitle = i18n._('PROJECTS'); - break; - case 'inventory': - rtnTitle = i18n._('INVENTORIES'); - break; - case 'credential': - rtnTitle = i18n._('CREDENTIALS'); - break; - case 'user': - rtnTitle = i18n._('USERS'); - break; - case 'team': - rtnTitle = i18n._('TEAMS'); - break; - case 'notification_template': - rtnTitle = i18n._('NOTIFICATION TEMPLATES'); - break; - case 'organization': - rtnTitle = i18n._('ORGANIZATIONS'); - break; - case 'job': - rtnTitle = i18n._('JOBS'); - break; - case 'custom_inventory_script': - rtnTitle = i18n._('INVENTORY SCRIPTS'); - break; - case 'schedule': - rtnTitle = i18n._('SCHEDULES'); - break; - case 'host': - rtnTitle = i18n._('HOSTS'); - break; - case 'template': - rtnTitle = i18n._('TEMPLATES'); - break; - } + switch(target) { + case 'project': + rtnTitle = i18n._('PROJECTS'); + break; + case 'inventory': + rtnTitle = i18n._('INVENTORIES'); + break; + case 'credential': + rtnTitle = i18n._('CREDENTIALS'); + break; + case 'user': + rtnTitle = i18n._('USERS'); + break; + case 'team': + rtnTitle = i18n._('TEAMS'); + break; + case 'notification_template': + rtnTitle = i18n._('NOTIFICATION TEMPLATES'); + break; + case 'organization': + rtnTitle = i18n._('ORGANIZATIONS'); + break; + case 'job': + rtnTitle = i18n._('JOBS'); + break; + case 'custom_inventory_script': + rtnTitle = i18n._('INVENTORY SCRIPTS'); + break; + case 'schedule': + rtnTitle = i18n._('SCHEDULES'); + break; + case 'host': + rtnTitle = i18n._('HOSTS'); + break; + case 'template': + rtnTitle = i18n._('TEMPLATES'); + break; + } - return rtnTitle; + return rtnTitle; - }; - } + }; +} GetTargetTitle.$inject = ['i18n']; diff --git a/awx/ui/client/src/activity-stream/main.js b/awx/ui/client/src/activity-stream/main.js index 3cb93e3003..b1e625e2d7 100644 --- a/awx/ui/client/src/activity-stream/main.js +++ b/awx/ui/client/src/activity-stream/main.js @@ -14,6 +14,8 @@ import ShowDetail from './factories/show-detail.factory'; import Stream from './factories/stream.factory'; import GetTargetTitle from './get-target-title.factory'; import ModelToBasePathKey from './model-to-base-path-key.factory'; +import ActivityDetailForm from './activity-detail.form'; +import StreamList from './streams.list'; export default angular.module('activityStream', [streamDetailModal.name]) .controller('activityStreamController', activityStreamController) @@ -24,6 +26,8 @@ export default angular.module('activityStream', [streamDetailModal.name]) .factory('Stream', Stream) .factory('GetTargetTitle', GetTargetTitle) .factory('ModelToBasePathKey', ModelToBasePathKey) + .factory('ActivityDetailForm', ActivityDetailForm) + .factory('StreamList', StreamList) .run(['$stateExtender', function($stateExtender) { $stateExtender.addState(activityStreamRoute); }]); diff --git a/awx/ui/client/src/activity-stream/model-to-base-path-key.factory.js b/awx/ui/client/src/activity-stream/model-to-base-path-key.factory.js index bc6cfe74b8..ebad019b02 100644 --- a/awx/ui/client/src/activity-stream/model-to-base-path-key.factory.js +++ b/awx/ui/client/src/activity-stream/model-to-base-path-key.factory.js @@ -10,50 +10,49 @@ * @description Helper functions to convert singular/plural versions of our models to the opposite */ -export default - function ModelToBasePathKey() { - return function(model) { - // This function takes in the singular model string and returns the key needed - // to get the base path from $rootScope/local storage. +export default function ModelToBasePathKey() { + return function(model) { + // This function takes in the singular model string and returns the key needed + // to get the base path from $rootScope/local storage. - var basePathKey; + var basePathKey; - switch(model) { - case 'project': - basePathKey = 'projects'; - break; - case 'inventory': - basePathKey = 'inventory'; - break; - case 'job_template': - basePathKey = 'job_templates'; - break; - case 'credential': - basePathKey = 'credentials'; - break; - case 'user': - basePathKey = 'users'; - break; - case 'team': - basePathKey = 'teams'; - break; - case 'notification_template': - basePathKey = 'notification_templates'; - break; - case 'organization': - basePathKey = 'organizations'; - break; - case 'management_job': - basePathKey = 'management_jobs'; - break; - case 'custom_inventory_script': - basePathKey = 'inventory_scripts'; - break; - case 'workflow_job_template': - basePathKey = 'workflow_job_templates'; - break; - } + switch(model) { + case 'project': + basePathKey = 'projects'; + break; + case 'inventory': + basePathKey = 'inventory'; + break; + case 'job_template': + basePathKey = 'job_templates'; + break; + case 'credential': + basePathKey = 'credentials'; + break; + case 'user': + basePathKey = 'users'; + break; + case 'team': + basePathKey = 'teams'; + break; + case 'notification_template': + basePathKey = 'notification_templates'; + break; + case 'organization': + basePathKey = 'organizations'; + break; + case 'management_job': + basePathKey = 'management_jobs'; + break; + case 'custom_inventory_script': + basePathKey = 'inventory_scripts'; + break; + case 'workflow_job_template': + basePathKey = 'workflow_job_templates'; + break; + } - return basePathKey; - }; - } + return basePathKey; + }; +} diff --git a/awx/ui/client/src/lists/Streams.js b/awx/ui/client/src/activity-stream/streams.list.js similarity index 95% rename from awx/ui/client/src/lists/Streams.js rename to awx/ui/client/src/activity-stream/streams.list.js index 12ae770ee8..e1699741e6 100644 --- a/awx/ui/client/src/lists/Streams.js +++ b/awx/ui/client/src/activity-stream/streams.list.js @@ -5,9 +5,7 @@ *************************************************/ -export default - angular.module('StreamListDefinition', []) - .factory('StreamList', ['i18n', function(i18n) { +export default ['i18n', function(i18n) { return { name: 'activities', @@ -72,4 +70,4 @@ export default } } - };}]); + };}]; diff --git a/awx/ui/client/src/app.js b/awx/ui/client/src/app.js index f1ba64379a..f8c29d59f9 100644 --- a/awx/ui/client/src/app.js +++ b/awx/ui/client/src/app.js @@ -143,8 +143,6 @@ var tower = angular.module('Tower', [ 'AllJobsDefinition', 'JobSummaryDefinition', 'HostGroupsFormDefinition', - 'StreamListDefinition', - 'ActivityDetailDefinition', 'ScheduledJobsDefinition', 'JobsListDefinition', 'LogViewerStatusDefinition', diff --git a/awx/ui/client/src/forms.js b/awx/ui/client/src/forms.js index f57b55861a..d364903d08 100644 --- a/awx/ui/client/src/forms.js +++ b/awx/ui/client/src/forms.js @@ -4,7 +4,6 @@ * All Rights Reserved *************************************************/ -import ActivityDetail from "./forms/ActivityDetail"; import EventsViewer from "./forms/EventsViewer"; import Groups from "./forms/Groups"; import HostGroups from "./forms/HostGroups"; @@ -23,8 +22,7 @@ import Workflows from "./forms/Workflows"; export - { ActivityDetail, - EventsViewer, + { EventsViewer, Groups, HostGroups, Hosts, diff --git a/awx/ui/client/src/lists.js b/awx/ui/client/src/lists.js index ae0d894a9d..cec15358fd 100644 --- a/awx/ui/client/src/lists.js +++ b/awx/ui/client/src/lists.js @@ -19,7 +19,6 @@ import Organizations from "./lists/Organizations"; import PortalJobTemplates from "./lists/PortalJobTemplates"; import PortalJobs from "./lists/PortalJobs"; import ScheduledJobs from "./lists/ScheduledJobs"; -import Streams from "./lists/Streams"; import Templates from "./lists/Templates"; export @@ -38,6 +37,5 @@ export PortalJobTemplates, PortalJobs, ScheduledJobs, - Streams, Templates }; From 9bc217ec8d2e34c094c3f5d67b0743eff8b4aebb Mon Sep 17 00:00:00 2001 From: John Mitchell Date: Thu, 2 Mar 2017 15:16:33 -0500 Subject: [PATCH 07/18] cleanup workflows --- awx/ui/client/src/app.js | 4 +- awx/ui/client/src/forms.js | 5 --- awx/ui/client/src/templates/main.js | 2 + .../workflows.form.js} | 35 ++++++++--------- .../add-workflow/workflow-add.controller.js | 16 ++++---- .../edit-workflow/workflow-edit.controller.js | 21 +++++----- .../workflow-chart.directive.js | 2 +- .../workflows/workflow-maker/main.js | 2 + .../workflow-maker.controller.js | 12 ++---- .../workflow-maker/workflow-maker.form.js} | 38 ++++++++----------- .../workflow-results.controller.js | 33 +++------------- 11 files changed, 62 insertions(+), 108 deletions(-) rename awx/ui/client/src/{forms/Workflows.js => templates/workflows.form.js} (90%) rename awx/ui/client/src/{forms/WorkflowMaker.js => templates/workflows/workflow-maker/workflow-maker.form.js} (90%) diff --git a/awx/ui/client/src/app.js b/awx/ui/client/src/app.js index f8c29d59f9..6d81793495 100644 --- a/awx/ui/client/src/app.js +++ b/awx/ui/client/src/app.js @@ -151,12 +151,10 @@ var tower = angular.module('Tower', [ 'PortalJobsListDefinition', 'features', 'pendolytics', - 'WorkflowFormDefinition', 'InventorySourcesListDefinition', - 'WorkflowMakerFormDefinition' ]) -.constant('AngularScheduler.partials', urlPrefix + 'lib/angular-scheduler/lib/') + .constant('AngularScheduler.partials', urlPrefix + 'lib/angular-scheduler/lib/') .constant('AngularScheduler.useTimezone', true) .constant('AngularScheduler.showUTCField', true) .constant('$timezones.definitions.location', urlPrefix + 'lib/angular-tz-extensions/tz/data') diff --git a/awx/ui/client/src/forms.js b/awx/ui/client/src/forms.js index d364903d08..c73f80b13e 100644 --- a/awx/ui/client/src/forms.js +++ b/awx/ui/client/src/forms.js @@ -17,9 +17,6 @@ import JobVarsPrompt from "./forms/JobVarsPrompt"; import LogViewerOptions from "./forms/LogViewerOptions"; import LogViewerStatus from "./forms/LogViewerStatus"; import Organizations from "./forms/Organizations"; -import WorkflowMaker from "./forms/WorkflowMaker"; -import Workflows from "./forms/Workflows"; - export { EventsViewer, @@ -35,6 +32,4 @@ export LogViewerOptions, LogViewerStatus, Organizations, - WorkflowMaker, - Workflows }; diff --git a/awx/ui/client/src/templates/main.js b/awx/ui/client/src/templates/main.js index abab0576b9..a537a6a08f 100644 --- a/awx/ui/client/src/templates/main.js +++ b/awx/ui/client/src/templates/main.js @@ -20,6 +20,7 @@ import workflowService from './workflows/workflow.service'; import templateCopyService from './copy-template/template-copy.service'; import CallbackHelpInit from './job_templates/factories/callback-help-init.factory'; import md5Setup from './job_templates/factories/md-5-setup.factory'; +import WorkflowForm from './workflows.form'; export default angular.module('templates', [surveyMaker.name, templatesList.name, jobTemplatesAdd.name, @@ -31,6 +32,7 @@ angular.module('templates', [surveyMaker.name, templatesList.name, jobTemplatesA .service('TemplateCopyService', templateCopyService) .factory('CallbackHelpInit', CallbackHelpInit) .factory('md5Setup', md5Setup) + .factory('WorkflowForm', WorkflowForm) .config(['$stateProvider', 'stateDefinitionsProvider', '$stateExtenderProvider', function($stateProvider, stateDefinitionsProvider, $stateExtenderProvider) { let stateTree, addJobTemplate, editJobTemplate, addWorkflow, editWorkflow, diff --git a/awx/ui/client/src/forms/Workflows.js b/awx/ui/client/src/templates/workflows.form.js similarity index 90% rename from awx/ui/client/src/forms/Workflows.js rename to awx/ui/client/src/templates/workflows.form.js index 821a3ab072..4906dfae75 100644 --- a/awx/ui/client/src/forms/Workflows.js +++ b/awx/ui/client/src/templates/workflows.form.js @@ -10,11 +10,9 @@ * @description This form is for adding/editing a Workflow */ -export default - angular.module('WorkflowFormDefinition', []) - - .factory('WorkflowFormObject', ['i18n', function(i18n) { - return { +export default ['NotificationsList', 'i18n', function(NotificationsList, i18n) { + return function() { + var WorkflowFormObject = { addTitle: i18n._('NEW WORKFLOW JOB TEMPLATE'), editTitle: '{{ name }}', @@ -190,21 +188,18 @@ export default class: 'Form-primaryButton' } } - };}]) + }; - .factory('WorkflowForm', ['WorkflowFormObject', 'NotificationsList', - function(WorkflowFormObject, NotificationsList) { - return function() { - var itm; + var itm; - for (itm in WorkflowFormObject.related) { - if (WorkflowFormObject.related[itm].include === "NotificationsList") { - WorkflowFormObject.related[itm] = _.clone(NotificationsList); - WorkflowFormObject.related[itm].ngClick = "$state.go('templates.editWorkflowJobTemplate.notifications')"; - WorkflowFormObject.related[itm].generateList = true; // tell form generator to call list generator and inject a list - } - } + for (itm in WorkflowFormObject.related) { + if (WorkflowFormObject.related[itm].include === "NotificationsList") { + WorkflowFormObject.related[itm] = _.clone(NotificationsList); + WorkflowFormObject.related[itm].ngClick = "$state.go('templates.editWorkflowJobTemplate.notifications')"; + WorkflowFormObject.related[itm].generateList = true; // tell form generator to call list generator and inject a list + } + } - return WorkflowFormObject; - }; - }]); + return WorkflowFormObject; + }; +}]; diff --git a/awx/ui/client/src/templates/workflows/add-workflow/workflow-add.controller.js b/awx/ui/client/src/templates/workflows/add-workflow/workflow-add.controller.js index 036ff6b21f..be496f559e 100644 --- a/awx/ui/client/src/templates/workflows/add-workflow/workflow-add.controller.js +++ b/awx/ui/client/src/templates/workflows/add-workflow/workflow-add.controller.js @@ -4,15 +4,13 @@ * All Rights Reserved *************************************************/ - export default - [ '$scope', 'WorkflowForm', 'GenerateForm', 'Alert', 'ProcessErrors', 'ClearScope', - 'Wait', '$state', 'CreateSelect2', 'TemplatesService', 'ToJSON', - 'ParseTypeChange', 'OrganizationList', '$q', 'Rest', 'GetBasePath', - function( - $scope, WorkflowForm, GenerateForm, Alert, ProcessErrors, ClearScope, - Wait, $state, CreateSelect2, TemplatesService, ToJSON, - ParseTypeChange, OrganizationList, $q, Rest, GetBasePath - ) { +export default [ + '$scope', 'WorkflowForm', 'GenerateForm', 'Alert', 'ProcessErrors', + 'ClearScope', 'Wait', '$state', 'CreateSelect2', 'TemplatesService', + 'ToJSON', 'ParseTypeChange', '$q', 'Rest', 'GetBasePath', + function($scope, WorkflowForm, GenerateForm, Alert, ProcessErrors, + ClearScope, Wait, $state, CreateSelect2, TemplatesService, ToJSON, + ParseTypeChange, $q, Rest, GetBasePath) { Rest.setUrl(GetBasePath('workflow_job_templates')); Rest.options() diff --git a/awx/ui/client/src/templates/workflows/edit-workflow/workflow-edit.controller.js b/awx/ui/client/src/templates/workflows/edit-workflow/workflow-edit.controller.js index e8fba017c8..2c27864f88 100644 --- a/awx/ui/client/src/templates/workflows/edit-workflow/workflow-edit.controller.js +++ b/awx/ui/client/src/templates/workflows/edit-workflow/workflow-edit.controller.js @@ -4,18 +4,15 @@ * All Rights Reserved *************************************************/ - export default - [ '$scope', '$stateParams', 'WorkflowForm', 'GenerateForm', 'Alert', 'ProcessErrors', - 'ClearScope', 'GetBasePath', '$q', 'ParseTypeChange', 'Wait', 'Empty', - 'ToJSON', 'initSurvey', '$state', 'CreateSelect2', 'ParseVariableString', - 'TemplatesService', 'OrganizationList', 'Rest', 'WorkflowService', 'ToggleNotification', 'OrgAdminLookup', - function( - $scope, $stateParams, WorkflowForm, GenerateForm, Alert, ProcessErrors, - ClearScope, GetBasePath, $q, ParseTypeChange, Wait, Empty, - ToJSON, SurveyControllerInit, $state, CreateSelect2, ParseVariableString, - TemplatesService, OrganizationList, Rest, WorkflowService, ToggleNotification, OrgAdminLookup - ) { - +export default [ + '$scope', '$stateParams', 'WorkflowForm', 'GenerateForm', 'Alert', + 'ProcessErrors', 'ClearScope', 'GetBasePath', '$q', 'ParseTypeChange', + 'Wait', 'Empty', 'ToJSON', 'initSurvey', '$state', 'CreateSelect2', + 'ParseVariableString', 'TemplatesService', 'Rest', 'ToggleNotification', + function($scope, $stateParams, WorkflowForm, GenerateForm, Alert, + ProcessErrors, ClearScope, GetBasePath, $q, ParseTypeChange, Wait, Empty, + ToJSON, SurveyControllerInit, $state, CreateSelect2, ParseVariableString, + TemplatesService, Rest, ToggleNotification) { ClearScope(); $scope.$watch('workflow_job_template_obj.summary_fields.user_capabilities.edit', function(val) { diff --git a/awx/ui/client/src/templates/workflows/workflow-chart/workflow-chart.directive.js b/awx/ui/client/src/templates/workflows/workflow-chart/workflow-chart.directive.js index 72cb0e1887..b11786adc6 100644 --- a/awx/ui/client/src/templates/workflows/workflow-chart/workflow-chart.directive.js +++ b/awx/ui/client/src/templates/workflows/workflow-chart/workflow-chart.directive.js @@ -4,7 +4,7 @@ * All Rights Reserved *************************************************/ -export default [ '$state','moment', '$timeout', '$window', +export default ['$state','moment', '$timeout', '$window', function($state, moment, $timeout, $window) { return { diff --git a/awx/ui/client/src/templates/workflows/workflow-maker/main.js b/awx/ui/client/src/templates/workflows/workflow-maker/main.js index 821dfe18aa..4cca4bf693 100644 --- a/awx/ui/client/src/templates/workflows/workflow-maker/main.js +++ b/awx/ui/client/src/templates/workflows/workflow-maker/main.js @@ -1,9 +1,11 @@ import workflowMaker from './workflow-maker.directive'; import WorkflowMakerController from './workflow-maker.controller'; +import WorkflowMakerForm from './workflow-maker.form'; export default angular.module('templates.workflowMaker', []) // In order to test this controller I had to expose it at the module level // like so. Is this correct? Is there a better pattern for doing this? .controller('WorkflowMakerController', WorkflowMakerController) + .factory('WorkflowMakerForm', WorkflowMakerForm) .directive('workflowMaker', workflowMaker); diff --git a/awx/ui/client/src/templates/workflows/workflow-maker/workflow-maker.controller.js b/awx/ui/client/src/templates/workflows/workflow-maker/workflow-maker.controller.js index 7fcf27cc6c..4e239edc42 100644 --- a/awx/ui/client/src/templates/workflows/workflow-maker/workflow-maker.controller.js +++ b/awx/ui/client/src/templates/workflows/workflow-maker/workflow-maker.controller.js @@ -4,14 +4,10 @@ * All Rights Reserved *************************************************/ -export default ['$scope', 'WorkflowService', 'generateList', 'TemplateList', 'ProjectList', - 'GetBasePath', 'Wait', 'TemplatesService', '$state', - 'ProcessErrors', 'InventorySourcesList', 'CreateSelect2', 'WorkflowMakerForm', - 'GenerateForm', 'InventoryList', 'CredentialList', '$q', - function($scope, WorkflowService, GenerateList, TemplateList, ProjectList, - GetBasePath, Wait, TemplatesService, $state, - ProcessErrors, InventorySourcesList, CreateSelect2, WorkflowMakerForm, - GenerateForm, InventoryList, CredentialList, $q) { +export default ['$scope', 'WorkflowService', 'GetBasePath', 'TemplatesService', + '$state', 'ProcessErrors', 'CreateSelect2', 'WorkflowMakerForm', '$q', + function($scope, WorkflowService, GetBasePath, TemplatesService, $state, + ProcessErrors, CreateSelect2, WorkflowMakerForm, $q) { let form = WorkflowMakerForm(); diff --git a/awx/ui/client/src/forms/WorkflowMaker.js b/awx/ui/client/src/templates/workflows/workflow-maker/workflow-maker.form.js similarity index 90% rename from awx/ui/client/src/forms/WorkflowMaker.js rename to awx/ui/client/src/templates/workflows/workflow-maker/workflow-maker.form.js index a911e85678..6e4074bb20 100644 --- a/awx/ui/client/src/forms/WorkflowMaker.js +++ b/awx/ui/client/src/templates/workflows/workflow-maker/workflow-maker.form.js @@ -10,16 +10,9 @@ * @description This form is for adding/editing a Job Template */ -// export default -// angular.module('WorkflowMakerFormDefinition', []) -// -// .value ('WorkflowMakerFormObject', { - -export default - angular.module('WorkflowMakerFormDefinition', []) - - .factory('WorkflowMakerFormObject', ['i18n', function(i18n) { - return { +export default ['NotificationsList', 'i18n', function(NotificationsList, i18n) { + return function() { + var WorkflowMakerFormObject = { addTitle: '', editTitle: '', @@ -176,16 +169,15 @@ export default ngShow: '(workflowJobTemplateObj.summary_fields.user_capabilities.edit || canAddWorkflowJobTemplate)' } } - };}]) - .factory('WorkflowMakerForm', ['WorkflowMakerFormObject', 'NotificationsList', function(WorkflowMakerFormObject, NotificationsList) { - return function() { - var itm; - for (itm in WorkflowMakerFormObject.related) { - if (WorkflowMakerFormObject.related[itm].include === "NotificationsList") { - WorkflowMakerFormObject.related[itm] = NotificationsList; - WorkflowMakerFormObject.related[itm].generateList = true; // tell form generator to call list generator and inject a list - } - } - return WorkflowMakerFormObject; - }; - }]); + }; + + var itm; + for (itm in WorkflowMakerFormObject.related) { + if (WorkflowMakerFormObject.related[itm].include === "NotificationsList") { + WorkflowMakerFormObject.related[itm] = NotificationsList; + WorkflowMakerFormObject.related[itm].generateList = true; // tell form generator to call list generator and inject a list + } + } + return WorkflowMakerFormObject; + }; +}]; diff --git a/awx/ui/client/src/workflow-results/workflow-results.controller.js b/awx/ui/client/src/workflow-results/workflow-results.controller.js index cd4ae42a20..8a20e8c57d 100644 --- a/awx/ui/client/src/workflow-results/workflow-results.controller.js +++ b/awx/ui/client/src/workflow-results/workflow-results.controller.js @@ -1,30 +1,9 @@ -export default ['workflowData', - 'workflowResultsService', - 'workflowDataOptions', - 'jobLabels', - 'workflowNodes', - '$scope', - 'ParseTypeChange', - 'ParseVariableString', - 'WorkflowService', - 'count', - '$state', - 'i18n', - 'moment', - function(workflowData, - workflowResultsService, - workflowDataOptions, - jobLabels, - workflowNodes, - $scope, - ParseTypeChange, - ParseVariableString, - WorkflowService, - count, - $state, - i18n, - moment - ) { +export default ['workflowData', 'workflowResultsService', 'workflowDataOptions', + 'jobLabels', 'workflowNodes', '$scope', 'ParseTypeChange', + 'ParseVariableString', 'WorkflowService', 'count', '$state', 'i18n', + 'moment', function(workflowData, workflowResultsService, + workflowDataOptions, jobLabels, workflowNodes, $scope, ParseTypeChange, + ParseVariableString, WorkflowService, count, $state, i18n, moment) { var runTimeElapsedTimer = null; var getTowerLinks = function() { From b3e7102e022e8317eaf124ec88ef7a551bc7f6e8 Mon Sep 17 00:00:00 2001 From: John Mitchell Date: Thu, 2 Mar 2017 15:47:42 -0500 Subject: [PATCH 08/18] cleanup orgs --- awx/ui/client/src/forms.js | 2 - awx/ui/client/src/lists.js | 2 - awx/ui/client/src/lists/Organizations.js | 65 -------------- .../add/organizations-add.controller.js | 4 +- .../edit/organizations-edit.controller.js | 11 ++- .../linkout/addUsers/addUsers.controller.js | 12 +-- .../linkout/addUsers/addUsers.directive.js | 84 +++++++++---------- .../organizations-admins.controller.js | 12 ++- .../organizations-job-templates.controller.js | 15 ++-- .../organizations-projects.controller.js | 17 ++-- .../organizations-teams.controller.js | 13 +-- .../organizations-users.controller.js | 9 +- awx/ui/client/src/organizations/main.js | 4 + .../organizations.form.js} | 33 ++++---- .../src/organizations/organizations.list.js | 66 +++++++++++++++ 15 files changed, 168 insertions(+), 181 deletions(-) delete mode 100644 awx/ui/client/src/lists/Organizations.js rename awx/ui/client/src/{forms/Organizations.js => organizations/organizations.form.js} (80%) create mode 100644 awx/ui/client/src/organizations/organizations.list.js diff --git a/awx/ui/client/src/forms.js b/awx/ui/client/src/forms.js index c73f80b13e..baf1b4fd05 100644 --- a/awx/ui/client/src/forms.js +++ b/awx/ui/client/src/forms.js @@ -16,7 +16,6 @@ import JobTemplates from "./forms/JobTemplates"; import JobVarsPrompt from "./forms/JobVarsPrompt"; import LogViewerOptions from "./forms/LogViewerOptions"; import LogViewerStatus from "./forms/LogViewerStatus"; -import Organizations from "./forms/Organizations"; export { EventsViewer, @@ -31,5 +30,4 @@ export JobVarsPrompt, LogViewerOptions, LogViewerStatus, - Organizations, }; diff --git a/awx/ui/client/src/lists.js b/awx/ui/client/src/lists.js index cec15358fd..d06b16c9dc 100644 --- a/awx/ui/client/src/lists.js +++ b/awx/ui/client/src/lists.js @@ -15,7 +15,6 @@ import InventorySources from "./lists/InventorySources"; import JobEvents from "./lists/JobEvents"; import JobHosts from "./lists/JobHosts"; import Jobs from "./lists/Jobs"; -import Organizations from "./lists/Organizations"; import PortalJobTemplates from "./lists/PortalJobTemplates"; import PortalJobs from "./lists/PortalJobs"; import ScheduledJobs from "./lists/ScheduledJobs"; @@ -33,7 +32,6 @@ export JobEvents, JobHosts, Jobs, - Organizations, PortalJobTemplates, PortalJobs, ScheduledJobs, diff --git a/awx/ui/client/src/lists/Organizations.js b/awx/ui/client/src/lists/Organizations.js deleted file mode 100644 index b0eff989c6..0000000000 --- a/awx/ui/client/src/lists/Organizations.js +++ /dev/null @@ -1,65 +0,0 @@ -/************************************************* - * Copyright (c) 2015 Ansible, Inc. - * - * All Rights Reserved - *************************************************/ - - -export default - angular.module('OrganizationListDefinition', []) - .value('OrganizationList', { - - name: 'organizations', - iterator: 'organization', - selectTitle: 'Add Organizations', - selectInstructions: '

Select existing organizations by clicking each organization or checking the related checkbox. When finished, ' + - 'click the blue Select button, located bottom right.

Create a new organization by clicking the ' + - ' button.

', - editTitle: 'ORGANIZATIONS', - hover: true, - index: false, - - fields: { - name: { - key: true, - label: 'Name', - columnClass: 'col-lg-4 col-md-6 col-sm-8 col-xs-8' - }, - description: { - label: 'Description', - columnClass: 'hidden-sm hidden-xs', - excludeModal: true - } - }, - - actions: { - add: { - mode: 'all', // One of: edit, select, all - ngClick: 'addOrganization()', - awToolTip: 'Create a new organization', - awFeature: 'multiple_organizations', - actionClass: 'btn List-buttonSubmit', - buttonContent: '+ ADD' - } - }, - - fieldActions: { - edit: { - label: 'Edit', - ngClick: "editOrganization(organization.id)", - icon: 'icon-edit', - "class": 'btn-xs btn-default', - awToolTip: 'Edit organization', - dataPlacement: 'top' - }, - - "delete": { - label: 'Delete', - ngClick: "deleteOrganization(organization.id, organization.name)", - icon: 'icon-trash', - "class": 'btn-xs btn-danger', - awToolTip: 'Delete organization', - dataPlacement: 'top' - } - } - }); diff --git a/awx/ui/client/src/organizations/add/organizations-add.controller.js b/awx/ui/client/src/organizations/add/organizations-add.controller.js index 220ba636a5..8224bd5d4c 100644 --- a/awx/ui/client/src/organizations/add/organizations-add.controller.js +++ b/awx/ui/client/src/organizations/add/organizations-add.controller.js @@ -8,8 +8,8 @@ export default ['$scope', '$rootScope', '$location', '$stateParams', 'OrganizationForm', 'GenerateForm', 'Rest', 'Alert', 'ProcessErrors', 'ClearScope', 'GetBasePath', 'Wait','$state', function($scope, $rootScope, $location, $stateParams, OrganizationForm, - GenerateForm, Rest, Alert, ProcessErrors, - ClearScope, GetBasePath, Wait, $state) { + GenerateForm, Rest, Alert, ProcessErrors, ClearScope, GetBasePath, Wait, + $state) { Rest.setUrl(GetBasePath('organizations')); Rest.options() diff --git a/awx/ui/client/src/organizations/edit/organizations-edit.controller.js b/awx/ui/client/src/organizations/edit/organizations-edit.controller.js index b6ecfae2a4..bb88975235 100644 --- a/awx/ui/client/src/organizations/edit/organizations-edit.controller.js +++ b/awx/ui/client/src/organizations/edit/organizations-edit.controller.js @@ -4,12 +4,11 @@ * All Rights Reserved *************************************************/ -export default ['$scope', '$rootScope', '$location', '$log', '$stateParams', - 'OrganizationForm', 'Rest', 'Alert', 'ProcessErrors', 'Prompt', 'ClearScope', - 'GetBasePath', 'Wait', '$state', 'ToggleNotification', - function($scope, $rootScope, $location, $log, $stateParams, - OrganizationForm, Rest, Alert, ProcessErrors, Prompt, ClearScope, - GetBasePath, Wait, $state, ToggleNotification) { +export default ['$scope', '$location', '$stateParams', 'OrganizationForm', + 'Rest', 'ProcessErrors', 'Prompt', 'ClearScope', 'GetBasePath', 'Wait', + '$state', 'ToggleNotification', function($scope, $location, $stateParams, + OrganizationForm, Rest, ProcessErrors, Prompt, ClearScope, GetBasePath, + Wait, $state, ToggleNotification) { ClearScope(); diff --git a/awx/ui/client/src/organizations/linkout/addUsers/addUsers.controller.js b/awx/ui/client/src/organizations/linkout/addUsers/addUsers.controller.js index 5db0ffeac2..6be109865a 100644 --- a/awx/ui/client/src/organizations/linkout/addUsers/addUsers.controller.js +++ b/awx/ui/client/src/organizations/linkout/addUsers/addUsers.controller.js @@ -11,11 +11,13 @@ * Controller for handling permissions adding */ -export default ['$scope', '$rootScope', 'ProcessErrors', 'GetBasePath', 'generateList', -'templateUrl', '$state', 'Rest', '$q', 'Wait', '$window', 'QuerySet', 'UserList', -function($scope, $rootScope, ProcessErrors, GetBasePath, generateList, - templateUrl, $state, Rest, $q, Wait, $window, qs, UserList) { - $scope.$on("linkLists", function() { +export default ['$scope', '$rootScope', 'ProcessErrors', 'GetBasePath', + 'generateList', '$state', 'Rest', '$q', 'Wait', '$window', 'QuerySet', + 'UserList', + function($scope, $rootScope, ProcessErrors, GetBasePath, generateList, + $state, Rest, $q, Wait, $window, qs, UserList) { + + $scope.$on("linkLists", function() { if ($state.current.name.split(".")[1] === "users") { $scope.addType = "Users"; diff --git a/awx/ui/client/src/organizations/linkout/addUsers/addUsers.directive.js b/awx/ui/client/src/organizations/linkout/addUsers/addUsers.directive.js index 65c721be17..83bd03f8e8 100644 --- a/awx/ui/client/src/organizations/linkout/addUsers/addUsers.directive.js +++ b/awx/ui/client/src/organizations/linkout/addUsers/addUsers.directive.js @@ -6,56 +6,56 @@ /* jshint unused: vars */ import addUsers from './addUsers.controller'; -export default - ['Wait', 'templateUrl', '$state', '$view', '$compile', function(Wait, templateUrl, $state, $view, $compile) { - return { - restrict: 'E', - scope: { - addUsersType: '@' - }, - controller: addUsers, - templateUrl: templateUrl('organizations/linkout/addUsers/addUsers'), - link: function(scope, element, attrs, ctrl) { +export default ['Wait', 'templateUrl', '$compile', function(Wait, templateUrl, + $compile) { + return { + restrict: 'E', + scope: { + addUsersType: '@' + }, + controller: addUsers, + templateUrl: templateUrl('organizations/linkout/addUsers/addUsers'), + link: function(scope, element, attrs, ctrl) { - $("body").addClass("is-modalOpen"); + $("body").addClass("is-modalOpen"); - $("body").append(element); + $("body").append(element); - Wait('start'); + Wait('start'); - scope.$broadcast("linkLists"); + scope.$broadcast("linkLists"); - setTimeout(function() { - $('#add-users-modal').modal("show"); - }, 200); + setTimeout(function() { + $('#add-users-modal').modal("show"); + }, 200); - $('.modal[aria-hidden=false]').each(function () { - if ($(this).attr('id') !== 'add-users-modal') { - $(this).modal('hide'); - } - }); + $('.modal[aria-hidden=false]').each(function () { + if ($(this).attr('id') !== 'add-users-modal') { + $(this).modal('hide'); + } + }); - scope.closeModal = function() { - $("body").removeClass("is-modalOpen"); - $('#add-users-modal').on('hidden.bs.modal', - function () { - $('.AddUsers').remove(); - }); - $('#add-users-modal').modal('hide'); - }; + scope.closeModal = function() { + $("body").removeClass("is-modalOpen"); + $('#add-users-modal').on('hidden.bs.modal', + function () { + $('.AddUsers').remove(); + }); + $('#add-users-modal').modal('hide'); + }; - scope.$on('closeUsersModal', function() { - scope.closeModal(); - }); + scope.$on('closeUsersModal', function() { + scope.closeModal(); + }); - scope.compileList = function(html) { - $('#add-users-list').append($compile(html)(scope)); - }; + scope.compileList = function(html) { + $('#add-users-list').append($compile(html)(scope)); + }; - Wait('stop'); + Wait('stop'); - window.scrollTo(0,0); - } - }; - } - ]; + window.scrollTo(0,0); + } + }; + } +]; diff --git a/awx/ui/client/src/organizations/linkout/controllers/organizations-admins.controller.js b/awx/ui/client/src/organizations/linkout/controllers/organizations-admins.controller.js index ad232d443c..a19d081083 100644 --- a/awx/ui/client/src/organizations/linkout/controllers/organizations-admins.controller.js +++ b/awx/ui/client/src/organizations/linkout/controllers/organizations-admins.controller.js @@ -4,13 +4,11 @@ * All Rights Reserved *************************************************/ -export default ['$stateParams', '$scope', 'UserList', 'Rest', '$state', - 'generateList', '$compile', 'Wait', 'OrgAdminList', - 'OrgAdminsDataset', - 'Prompt', 'ProcessErrors', 'GetBasePath', '$filter', - function($stateParams, $scope, UserList, Rest, $state, GenerateList, - $compile, Wait, OrgAdminList, OrgAdminsDataset, Prompt, ProcessErrors, - GetBasePath, $filter) { +export default ['$stateParams', '$scope', 'Rest', '$state', '$compile', 'Wait', + 'OrgAdminList', 'OrgAdminsDataset', 'Prompt', 'ProcessErrors', + 'GetBasePath', '$filter', + function($stateParams, $scope, Rest, $state, $compile, Wait, OrgAdminList, + OrgAdminsDataset, Prompt, ProcessErrors, GetBasePath, $filter) { var orgBase = GetBasePath('organizations'); diff --git a/awx/ui/client/src/organizations/linkout/controllers/organizations-job-templates.controller.js b/awx/ui/client/src/organizations/linkout/controllers/organizations-job-templates.controller.js index 3f81b1550b..79b58beeae 100644 --- a/awx/ui/client/src/organizations/linkout/controllers/organizations-job-templates.controller.js +++ b/awx/ui/client/src/organizations/linkout/controllers/organizations-job-templates.controller.js @@ -4,15 +4,12 @@ * All Rights Reserved *************************************************/ -export default ['$scope', '$rootScope', '$location', '$log', - '$stateParams', 'Rest', 'Alert', 'Prompt', 'ReturnToCaller', 'ClearScope', 'ProcessErrors', - 'GetBasePath', 'JobTemplateForm', 'InitiatePlaybookRun', 'Wait', 'TemplateCopyService', - '$compile', '$state', 'OrgJobTemplateList', 'OrgJobTemplateDataset', 'QuerySet', - function($scope, $rootScope, $location, $log, - $stateParams, Rest, Alert, Prompt, ReturnToCaller, ClearScope, ProcessErrors, - GetBasePath, JobTemplateForm, InitiatePlaybookRun, Wait, TemplateCopyService, - $compile, $state, OrgJobTemplateList, Dataset, qs) { - +export default ['$scope', '$rootScope', '$stateParams', 'Rest', 'ProcessErrors', + 'GetBasePath', 'InitiatePlaybookRun', 'Wait', 'TemplateCopyService', + '$state', 'OrgJobTemplateList', 'OrgJobTemplateDataset', 'QuerySet', + function($scope, $rootScope, $stateParams, Rest, ProcessErrors, GetBasePath, + InitiatePlaybookRun, Wait, TemplateCopyService, $state, OrgJobTemplateList, + Dataset, qs) { var list = OrgJobTemplateList, orgBase = GetBasePath('organizations'); diff --git a/awx/ui/client/src/organizations/linkout/controllers/organizations-projects.controller.js b/awx/ui/client/src/organizations/linkout/controllers/organizations-projects.controller.js index 5f112f47c0..e1bc8e72eb 100644 --- a/awx/ui/client/src/organizations/linkout/controllers/organizations-projects.controller.js +++ b/awx/ui/client/src/organizations/linkout/controllers/organizations-projects.controller.js @@ -4,15 +4,14 @@ * All Rights Reserved *************************************************/ -export default ['$scope', '$rootScope', '$location', '$log', - '$stateParams', 'Rest', 'Alert', 'Prompt', - 'ReturnToCaller', 'ClearScope', 'OrgProjectList', 'OrgProjectDataset', - 'ProcessErrors', 'GetBasePath', 'ProjectUpdate', - 'Wait', 'GetChoices', 'Empty', 'Find', 'GetProjectIcon', 'GetProjectToolTip', '$filter', '$state', - function($scope, $rootScope, $location, $log, $stateParams, Rest, Alert, Prompt, - ReturnToCaller, ClearScope, OrgProjectList, Dataset, - ProcessErrors, GetBasePath, ProjectUpdate, - Wait, GetChoices, Empty, Find, GetProjectIcon, GetProjectToolTip, $filter, $state) { +export default ['$scope', '$rootScope', '$log', '$stateParams', 'Rest', 'Alert', + 'OrgProjectList', 'OrgProjectDataset', 'ProcessErrors', 'GetBasePath', + 'ProjectUpdate', 'Wait', 'GetChoices', 'Empty', 'Find', 'GetProjectIcon', + 'GetProjectToolTip', '$filter', '$state', + function($scope, $rootScope, $log, $stateParams, Rest, Alert, + OrgProjectList, Dataset, ProcessErrors, GetBasePath, ProjectUpdate, + Wait, GetChoices, Empty, Find, GetProjectIcon, GetProjectToolTip, $filter, + $state) { var list = OrgProjectList, projUrl, diff --git a/awx/ui/client/src/organizations/linkout/controllers/organizations-teams.controller.js b/awx/ui/client/src/organizations/linkout/controllers/organizations-teams.controller.js index 3589328bb3..b9f2f9b5b2 100644 --- a/awx/ui/client/src/organizations/linkout/controllers/organizations-teams.controller.js +++ b/awx/ui/client/src/organizations/linkout/controllers/organizations-teams.controller.js @@ -4,15 +4,10 @@ * All Rights Reserved *************************************************/ -export default ['$scope', '$rootScope', '$location', '$log', '$stateParams', 'OrgTeamList', - 'Rest', 'Alert', 'Prompt', 'OrgTeamsDataset', 'ReturnToCaller', 'ClearScope', - 'ProcessErrors', 'GetBasePath', - 'Wait', '$state', - function($scope, $rootScope, $location, $log, $stateParams, OrgTeamList, - Rest, Alert, Prompt, Dataset, ReturnToCaller, ClearScope, - ProcessErrors, GetBasePath, - Wait, $state) { - +export default ['$scope', '$stateParams', 'OrgTeamList', 'Rest', + 'OrgTeamsDataset', 'GetBasePath', 'Wait', '$state', + function($scope, $stateParams, OrgTeamList, Rest, Dataset, GetBasePath, + Wait, $state) { var list = OrgTeamList, orgBase = GetBasePath('organizations'); diff --git a/awx/ui/client/src/organizations/linkout/controllers/organizations-users.controller.js b/awx/ui/client/src/organizations/linkout/controllers/organizations-users.controller.js index eca7c86729..9949381906 100644 --- a/awx/ui/client/src/organizations/linkout/controllers/organizations-users.controller.js +++ b/awx/ui/client/src/organizations/linkout/controllers/organizations-users.controller.js @@ -5,11 +5,10 @@ *************************************************/ export default ['$stateParams', '$scope', 'OrgUserList','Rest', '$state', - 'generateList', '$compile', 'Wait', 'OrgUsersDataset', - 'Prompt', 'ProcessErrors', 'GetBasePath', '$filter', - function($stateParams, $scope, OrgUserList, Rest, $state, GenerateList, - $compile, Wait, OrgUsersDataset, Prompt, ProcessErrors, - GetBasePath, $filter) { + '$compile', 'Wait', 'OrgUsersDataset', 'Prompt', 'ProcessErrors', + 'GetBasePath', '$filter', + function($stateParams, $scope, OrgUserList, Rest, $state, $compile, Wait, + OrgUsersDataset, Prompt, ProcessErrors, GetBasePath, $filter) { var orgBase = GetBasePath('organizations'); diff --git a/awx/ui/client/src/organizations/main.js b/awx/ui/client/src/organizations/main.js index 076c89d1aa..3871049e97 100644 --- a/awx/ui/client/src/organizations/main.js +++ b/awx/ui/client/src/organizations/main.js @@ -10,6 +10,8 @@ import OrganizationsAdd from './add/organizations-add.controller'; import OrganizationsEdit from './edit/organizations-edit.controller'; import organizationsLinkout from './linkout/main'; import OrganizationsLinkoutStates from './linkout/organizations-linkout.route'; +import OrganizationForm from './organizations.form'; +import OrganizationList from './organizations.list'; import { N_ } from '../i18n'; @@ -20,6 +22,8 @@ angular.module('Organizations', [ .controller('OrganizationsList', OrganizationsList) .controller('OrganizationsAdd', OrganizationsAdd) .controller('OrganizationsEdit', OrganizationsEdit) + .factory('OrganizationForm', OrganizationForm) + .factory('OrganizationList', OrganizationList) .config(['$stateProvider', 'stateDefinitionsProvider', '$stateExtenderProvider', function($stateProvider, stateDefinitionsProvider, $stateExtenderProvider) { let stateExtender = $stateExtenderProvider.$get(), diff --git a/awx/ui/client/src/forms/Organizations.js b/awx/ui/client/src/organizations/organizations.form.js similarity index 80% rename from awx/ui/client/src/forms/Organizations.js rename to awx/ui/client/src/organizations/organizations.form.js index 49ce02afa9..da2b61fa6a 100644 --- a/awx/ui/client/src/forms/Organizations.js +++ b/awx/ui/client/src/organizations/organizations.form.js @@ -10,10 +10,10 @@ * @description This form is for adding/editing an organization */ -export default - angular.module('OrganizationFormDefinition', []) - .factory('OrganizationFormObject', ['i18n', function(i18n) { - return { +export default ['NotificationsList', 'i18n', + function(NotificationsList, i18n) { + return function() { + var OrganizationFormObject = { addTitle: i18n._('NEW ORGANIZATION'), //Title in add mode editTitle: '{{ name }}', //Title in edit mode @@ -98,18 +98,15 @@ export default } } - };}]) + }; - .factory('OrganizationForm', ['OrganizationFormObject', 'NotificationsList', - function(OrganizationFormObject, NotificationsList) { - return function() { - var itm; - for (itm in OrganizationFormObject.related) { - if (OrganizationFormObject.related[itm].include === "NotificationsList") { - OrganizationFormObject.related[itm] = NotificationsList; - OrganizationFormObject.related[itm].generateList = true; // tell form generator to call list generator and inject a list - } - } - return OrganizationFormObject; - }; - }]); + var itm; + for (itm in OrganizationFormObject.related) { + if (OrganizationFormObject.related[itm].include === "NotificationsList") { + OrganizationFormObject.related[itm] = NotificationsList; + OrganizationFormObject.related[itm].generateList = true; // tell form generator to call list generator and inject a list + } + } + return OrganizationFormObject; + }; +}]; diff --git a/awx/ui/client/src/organizations/organizations.list.js b/awx/ui/client/src/organizations/organizations.list.js new file mode 100644 index 0000000000..8c9042a6da --- /dev/null +++ b/awx/ui/client/src/organizations/organizations.list.js @@ -0,0 +1,66 @@ +/************************************************* + * Copyright (c) 2015 Ansible, Inc. + * + * All Rights Reserved + *************************************************/ + + +export default [function() { + return function() { + return { + name: 'organizations', + iterator: 'organization', + selectTitle: 'Add Organizations', + selectInstructions: '

Select existing organizations by clicking each organization or checking the related checkbox. When finished, ' + + 'click the blue Select button, located bottom right.

Create a new organization by clicking the ' + + ' button.

', + editTitle: 'Organizations', + hover: true, + index: false, + + fields: { + name: { + key: true, + label: 'Name', + columnClass: 'col-lg-4 col-md-6 col-sm-8 col-xs-8' + }, + description: { + label: 'Description', + columnClass: 'hidden-sm hidden-xs', + excludeModal: true + } + }, + + actions: { + add: { + mode: 'all', // One of: edit, select, all + ngClick: 'addOrganization()', + awToolTip: 'Create a new organization', + awFeature: 'multiple_organizations', + actionClass: 'btn List-buttonSubmit', + buttonContent: '+ ADD' + } + }, + + fieldActions: { + edit: { + label: 'Edit', + ngClick: "editOrganization(organization.id)", + icon: 'icon-edit', + "class": 'btn-xs btn-default', + awToolTip: 'Edit organization', + dataPlacement: 'top' + }, + + "delete": { + label: 'Delete', + ngClick: "deleteOrganization(organization.id, organization.name)", + icon: 'icon-trash', + "class": 'btn-xs btn-danger', + awToolTip: 'Delete organization', + dataPlacement: 'top' + } + } + }; + } +}]; From 1db4a288bcdc8940b925e6ce7337fc8236549ab2 Mon Sep 17 00:00:00 2001 From: John Mitchell Date: Thu, 2 Mar 2017 15:48:54 -0500 Subject: [PATCH 09/18] fix jshint error --- awx/ui/client/src/organizations/organizations.list.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/awx/ui/client/src/organizations/organizations.list.js b/awx/ui/client/src/organizations/organizations.list.js index 8c9042a6da..3c763069ed 100644 --- a/awx/ui/client/src/organizations/organizations.list.js +++ b/awx/ui/client/src/organizations/organizations.list.js @@ -62,5 +62,5 @@ export default [function() { } } }; - } + }; }]; From 7541244354bc80bcbfb3ae339d87d6c4f0c1b39c Mon Sep 17 00:00:00 2001 From: John Mitchell Date: Mon, 6 Mar 2017 10:12:35 -0500 Subject: [PATCH 10/18] remove org form and list def reference from app.js --- awx/ui/client/src/app.js | 2 -- 1 file changed, 2 deletions(-) diff --git a/awx/ui/client/src/app.js b/awx/ui/client/src/app.js index 6d81793495..fa0f67cc91 100644 --- a/awx/ui/client/src/app.js +++ b/awx/ui/client/src/app.js @@ -123,8 +123,6 @@ var tower = angular.module('Tower', [ scheduler.name, 'Utilities', - 'OrganizationFormDefinition', - 'OrganizationListDefinition', 'templates', 'PromptDialog', 'AWDirectives', From 46aaed6c65f1815551dd51eb0a706ea512c39ef4 Mon Sep 17 00:00:00 2001 From: John Mitchell Date: Tue, 14 Mar 2017 16:19:12 -0400 Subject: [PATCH 11/18] fix jshint error --- awx/ui/client/src/forms.js | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/awx/ui/client/src/forms.js b/awx/ui/client/src/forms.js index baf1b4fd05..4645ac41b3 100644 --- a/awx/ui/client/src/forms.js +++ b/awx/ui/client/src/forms.js @@ -17,17 +17,17 @@ import JobVarsPrompt from "./forms/JobVarsPrompt"; import LogViewerOptions from "./forms/LogViewerOptions"; import LogViewerStatus from "./forms/LogViewerStatus"; -export - { EventsViewer, - Groups, - HostGroups, - Hosts, - Inventories, - InventoryStatus, - JobEventData, - JobSummary, - JobTemplates, - JobVarsPrompt, - LogViewerOptions, - LogViewerStatus, - }; +export { + EventsViewer, + Groups, + HostGroups, + Hosts, + Inventories, + InventoryStatus, + JobEventData, + JobSummary, + JobTemplates, + JobVarsPrompt, + LogViewerOptions, + LogViewerStatus +}; From 434d14b428cd52be2b1f10b5dae9b1083e905eb5 Mon Sep 17 00:00:00 2001 From: John Mitchell Date: Tue, 14 Mar 2017 16:45:25 -0400 Subject: [PATCH 12/18] remove unused lists and forms --- awx/ui/client/src/app.js | 5 - awx/ui/client/src/forms.js | 14 +-- awx/ui/client/src/forms/EventsViewer.js | 85 -------------- awx/ui/client/src/forms/JobEventData.js | 32 ------ awx/ui/client/src/forms/JobSummary.js | 53 --------- awx/ui/client/src/forms/JobVarsPrompt.js | 40 ------- awx/ui/client/src/forms/LogViewerOptions.js | 102 ----------------- awx/ui/client/src/forms/LogViewerStatus.js | 61 ---------- awx/ui/client/src/forms/ProjectStatus.js | 50 --------- awx/ui/client/src/lists.js | 8 -- awx/ui/client/src/lists/JobEvents.js | 104 ----------------- awx/ui/client/src/lists/JobHosts.js | 105 ------------------ awx/ui/client/src/lists/Jobs.js | 85 -------------- awx/ui/client/src/lists/PortalJobTemplates.js | 46 -------- 14 files changed, 1 insertion(+), 789 deletions(-) delete mode 100644 awx/ui/client/src/forms/EventsViewer.js delete mode 100644 awx/ui/client/src/forms/JobEventData.js delete mode 100644 awx/ui/client/src/forms/JobSummary.js delete mode 100644 awx/ui/client/src/forms/JobVarsPrompt.js delete mode 100644 awx/ui/client/src/forms/LogViewerOptions.js delete mode 100644 awx/ui/client/src/forms/LogViewerStatus.js delete mode 100644 awx/ui/client/src/forms/ProjectStatus.js delete mode 100644 awx/ui/client/src/lists/JobEvents.js delete mode 100644 awx/ui/client/src/lists/JobHosts.js delete mode 100644 awx/ui/client/src/lists/Jobs.js delete mode 100644 awx/ui/client/src/lists/PortalJobTemplates.js diff --git a/awx/ui/client/src/app.js b/awx/ui/client/src/app.js index fa0f67cc91..43bf7d2c91 100644 --- a/awx/ui/client/src/app.js +++ b/awx/ui/client/src/app.js @@ -135,16 +135,11 @@ var tower = angular.module('Tower', [ 'GroupFormDefinition', 'GroupListDefinition', 'TemplatesListDefinition', - 'PortalJobTemplatesListDefinition', 'JobTemplateFormDefinition', 'CompletedJobsDefinition', 'AllJobsDefinition', - 'JobSummaryDefinition', 'HostGroupsFormDefinition', 'ScheduledJobsDefinition', - 'JobsListDefinition', - 'LogViewerStatusDefinition', - 'LogViewerOptionsDefinition', 'lrInfiniteScroll', 'PortalJobsListDefinition', 'features', diff --git a/awx/ui/client/src/forms.js b/awx/ui/client/src/forms.js index 4645ac41b3..b1be9928dc 100644 --- a/awx/ui/client/src/forms.js +++ b/awx/ui/client/src/forms.js @@ -4,30 +4,18 @@ * All Rights Reserved *************************************************/ -import EventsViewer from "./forms/EventsViewer"; import Groups from "./forms/Groups"; import HostGroups from "./forms/HostGroups"; import Hosts from "./forms/Hosts"; import Inventories from "./forms/Inventories"; import InventoryStatus from "./forms/InventoryStatus"; -import JobEventData from "./forms/JobEventData"; -import JobSummary from "./forms/JobSummary"; import JobTemplates from "./forms/JobTemplates"; -import JobVarsPrompt from "./forms/JobVarsPrompt"; -import LogViewerOptions from "./forms/LogViewerOptions"; -import LogViewerStatus from "./forms/LogViewerStatus"; export { - EventsViewer, Groups, HostGroups, Hosts, Inventories, InventoryStatus, - JobEventData, - JobSummary, - JobTemplates, - JobVarsPrompt, - LogViewerOptions, - LogViewerStatus + JobTemplates }; diff --git a/awx/ui/client/src/forms/EventsViewer.js b/awx/ui/client/src/forms/EventsViewer.js deleted file mode 100644 index 9b9579f2a1..0000000000 --- a/awx/ui/client/src/forms/EventsViewer.js +++ /dev/null @@ -1,85 +0,0 @@ -/************************************************* - * Copyright (c) 2015 Ansible, Inc. - * - * All Rights Reserved - *************************************************/ - - /** - * @ngdoc function - * @name forms.function:EventsViewer - * @description This form is for events on the job detail page -*/ - -export default - angular.module('EventsViewerFormDefinition', []) - .factory('EventsViewerForm', ['i18n', function(i18n) { - return { - - fields: { - host_name: { - label: i18n._('Host'), - section: i18n._('Event') - }, - status: { - labellabel: i18n._('Status'), - section: i18n._('Event') - }, - id: { - labellabel: i18n._('ID'), - section: i18n._('Event') - }, - created: { - labellabel: i18n._('Created On'), - section: i18n._('Event') - }, - role: { - labellabel: i18n._('Role'), - section: i18n._('Event') - }, - play: { - labellabel: i18n._('Play'), - type: 'text', - section: i18n._('Event') - }, - task: { - labellabel: i18n._('Task'), - section: i18n._('Event') - }, - item: { - labellabel: i18n._('Item'), - section: i18n._('Event') - }, - module_name: { - labellabel: i18n._('Module'), - section: i18n._('Event') - }, - module_args: { - labellabel: i18n._('Arguments'), - section: i18n._('Event') - }, - rc: { - labellabel: i18n._('Return Code'), - section: i18n._('Results') - }, - msg: { - labellabel: i18n._('Message'), - section: i18n._('Results') - }, - results: { - labellabel: i18n._('Results'), - section: i18n._('Results') - }, - start: { - labellabel: i18n._('Start'), - section: i18n._('Timing') - }, - end: { - labellabel: i18n._('End'), - section: i18n._('Timing') - }, - delta: { - labellabel: i18n._('Elapsed'), - section: i18n._('Timing') - } - } - };}]); diff --git a/awx/ui/client/src/forms/JobEventData.js b/awx/ui/client/src/forms/JobEventData.js deleted file mode 100644 index 221eeca1d8..0000000000 --- a/awx/ui/client/src/forms/JobEventData.js +++ /dev/null @@ -1,32 +0,0 @@ -/************************************************* - * Copyright (c) 2015 Ansible, Inc. - * - * All Rights Reserved - *************************************************/ - - /** - * @ngdoc function - * @name forms.function:JobEventData - * @description Not sure if this is used... -*/ - -export default - angular.module('JobEventDataDefinition', []) - .value('JobEventDataForm', { - - editTitle: '{{ id }} - {{ event_display }}', - name: 'job_events', - well: false, - 'class': 'horizontal-narrow', - - fields: { - event_data: { - label: false, - type: 'textarea', - readonly: true, - rows: 18, - 'class': 'modal-input-xxlarge' - } - } - - }); //Form diff --git a/awx/ui/client/src/forms/JobSummary.js b/awx/ui/client/src/forms/JobSummary.js deleted file mode 100644 index c211d8de34..0000000000 --- a/awx/ui/client/src/forms/JobSummary.js +++ /dev/null @@ -1,53 +0,0 @@ -/************************************************* - * Copyright (c) 2015 Ansible, Inc. - * - * All Rights Reserved - *************************************************/ - - /** - * @ngdoc function - * @name forms.function:JobSummary - * @description Display job status info in a dialog -*/ - -export default - angular.module('JobSummaryDefinition', []) - .value('JobSummary', { - - editTitle: '{{ id }} - {{ name }}', - name: 'jobs', - well: false, - - fields: { - status: { - //label: 'Job Status', - type: 'custom', - control: '
Status ' + - ' {{ status }}
', - readonly: true - }, - created: { - label: 'Created On', - type: 'text', - readonly: true - }, - result_stdout: { - label: 'Standard Out', - type: 'textarea', - readonly: true, - xtraWide: true, - rows: '{{ stdout_rows }}', - 'class': 'nowrap mono-space resizable', - ngShow: 'result_stdout != ""' - }, - result_traceback: { - label: 'Traceback', - type: 'textarea', - xtraWide: true, - readonly: true, - rows: '{{ traceback_rows }}', - 'class': 'nowrap mono-space resizable', - ngShow: 'result_traceback != ""' - } - } - }); diff --git a/awx/ui/client/src/forms/JobVarsPrompt.js b/awx/ui/client/src/forms/JobVarsPrompt.js deleted file mode 100644 index edf075f728..0000000000 --- a/awx/ui/client/src/forms/JobVarsPrompt.js +++ /dev/null @@ -1,40 +0,0 @@ -/************************************************* - * Copyright (c) 2015 Ansible, Inc. - * - * All Rights Reserved - *************************************************/ - -/** - * @ngdoc function - * @name forms.function:JobVarsPrompt - * @description This form is for job variables prompt modal -*/ - -export default - angular.module('JobVarsPromptFormDefinition', []) - - .value ('JobVarsPromptForm', { - - addTitle: '', - editTitle: '', - name: 'job', - well: false, - - actions: { }, - - fields: { - extra_vars: { - label: null, - type: 'textarea', - rows: 6, - - - "default": "---" - } - }, - - buttons: { }, - - related: { } - - }); diff --git a/awx/ui/client/src/forms/LogViewerOptions.js b/awx/ui/client/src/forms/LogViewerOptions.js deleted file mode 100644 index d2f64c2752..0000000000 --- a/awx/ui/client/src/forms/LogViewerOptions.js +++ /dev/null @@ -1,102 +0,0 @@ -/************************************************* - * Copyright (c) 2015 Ansible, Inc. - * - * All Rights Reserved - *************************************************/ - - /** - * @ngdoc function - * @name forms.function:LogViewerOptions - * @description This form is for the page to view logs -*/ - -export default - angular.module('LogViewerOptionsDefinition', []) - .value('LogViewerOptionsForm', { - - name: 'status', - well: false, - - fields: { - "job_template": { - label: "Job Template", - type: "text", - readonly: true - }, - "inventory": { - label: "Inventory", - type: "text", - readonly: true - }, - "project": { - label: "Project", - type: "text", - readonly: true - }, - "playbook": { - label: "Playbook", - type: "text", - readonly: true - }, - "credential": { - label: "Credential", - type: "text", - readonly: true - }, - "cloud credential": { - label: "Cloud Cred.", - type: "text", - readonly: true - }, - "forks": { - label: "Forks", - type: "text", - readonly: true - }, - "limit": { - label: "Limit", - type: "text", - readonly: true - }, - "verbosity": { - label: "Verbosity", - type: "text", - readonly: true - }, - "job_tags": { - label: "Job Tags", - type: "text", - readonly: true - }, - "inventory_source": { - label: "Group", - type: "text", - readonly: true - }, - "source": { - label: "Source", - type: "text", - readonly: true - }, - "source_path": { - label: "Source Path", - type: "text", - readonly: true - }, - "source_regions":{ - label: "Regions", - type: "text", - readonly: true - }, - "overwrite": { - label: "Overwrite", - type: "text", - readonly: true - }, - "overwrite_vars": { - label: "Overwrite Vars", - type: "text", - readonly: true - } - } - }); diff --git a/awx/ui/client/src/forms/LogViewerStatus.js b/awx/ui/client/src/forms/LogViewerStatus.js deleted file mode 100644 index a7c8fb215c..0000000000 --- a/awx/ui/client/src/forms/LogViewerStatus.js +++ /dev/null @@ -1,61 +0,0 @@ -/************************************************* - * Copyright (c) 2015 Ansible, Inc. - * - * All Rights Reserved - *************************************************/ - - /** - * @ngdoc function - * @name forms.function:LogViewerStatus - * @description Form definition for LogViewer.js helper -*/ - -export default - angular.module('LogViewerStatusDefinition', []) - .factory('LogViewerStatusForm', ['i18n', function(i18n) { - return { - - name: 'status', - well: false, - - fields: { - "name": { - label: i18n._("Name"), - type: "text", - readonly: true, - }, - "status": { - label: i18n._("Status"), - type: "text", - readonly: true - }, - "license_error": { - label: i18n._("License Error"), - type: "text", - readonly: true - }, - "started": { - label: i18n._("Started"), - type: "date", - "filter": "longDate", - readonly: true - }, - "finished": { - label: i18n._("Finished"), - type: "date", - "filter": "longDate", - readonly: true - }, - "elapsed": { - label: i18n._("Elapsed"), - type: "text", - readonly: true - }, - "launch_type": { - label: i18n._("Launch Type"), - type: "text", - readonly: true - } - } - - };}]); diff --git a/awx/ui/client/src/forms/ProjectStatus.js b/awx/ui/client/src/forms/ProjectStatus.js deleted file mode 100644 index 8d193b6826..0000000000 --- a/awx/ui/client/src/forms/ProjectStatus.js +++ /dev/null @@ -1,50 +0,0 @@ -/************************************************* - * Copyright (c) 2015 Ansible, Inc. - * - * All Rights Reserved - *************************************************/ - - /** - * @ngdoc function - * @name forms.function:ProjectStatus - * @description This form is for adding/editing project status -*/ - -export default - angular.module('ProjectStatusDefinition', []) - .value('ProjectStatusForm', { - - name: 'project_update', - editTitle: 'SCM STATUS', - well: false, - 'class': 'horizontal-narrow', - - fields: { - created: { - label: 'Created', - type: 'text', - readonly: true - }, - status: { - label: 'Status', - type: 'text', - readonly: true - }, - result_stdout: { - label: 'Std Out', - type: 'textarea', - ngShow: "result_stdout", - 'class': 'mono-space', - readonly: true, - rows: 15 - }, - result_traceback: { - label: 'Traceback', - type: 'textarea', - ngShow: "result_traceback", - 'class': 'mono-space', - readonly: true, - rows: 15 - } - } - }); //Form diff --git a/awx/ui/client/src/lists.js b/awx/ui/client/src/lists.js index d06b16c9dc..8896ac3ab1 100644 --- a/awx/ui/client/src/lists.js +++ b/awx/ui/client/src/lists.js @@ -12,10 +12,6 @@ import Inventories from "./lists/Inventories"; import InventoryGroups from "./lists/InventoryGroups"; import InventoryHosts from "./lists/InventoryHosts"; import InventorySources from "./lists/InventorySources"; -import JobEvents from "./lists/JobEvents"; -import JobHosts from "./lists/JobHosts"; -import Jobs from "./lists/Jobs"; -import PortalJobTemplates from "./lists/PortalJobTemplates"; import PortalJobs from "./lists/PortalJobs"; import ScheduledJobs from "./lists/ScheduledJobs"; import Templates from "./lists/Templates"; @@ -29,10 +25,6 @@ export InventoryGroups, InventoryHosts, InventorySources, - JobEvents, - JobHosts, - Jobs, - PortalJobTemplates, PortalJobs, ScheduledJobs, Templates diff --git a/awx/ui/client/src/lists/JobEvents.js b/awx/ui/client/src/lists/JobEvents.js deleted file mode 100644 index 97fc68cc61..0000000000 --- a/awx/ui/client/src/lists/JobEvents.js +++ /dev/null @@ -1,104 +0,0 @@ -/************************************************* - * Copyright (c) 2015 Ansible, Inc. - * - * All Rights Reserved - *************************************************/ - - -export default - angular.module('JobEventsListDefinition', []) - .factory('JobEventList', ['i18n', function(i18n) { - return { - - name: 'jobevents', - iterator: 'jobevent', - editTitle: i18n._('JOB EVENTS'), - index: false, - hover: true, - "class": "condensed", - hasChildren: true, - filterBy: '{ show: true }', - - navigationLinks: { - //details: { - // href: '/#/jobs/{{ job_id }}', - // label: 'Status', - // icon: 'icon-zoom-in', - // ngShow: 'job_id !== null' - //}, - events: { - href: '/#/job_events/{{ job_id }}', - label: i18n._('Events'), - active: true, - icon: 'icon-list-ul' - }, - hosts: { - href: '/#/job_host_summaries/{{ job_id }}', - label: i18n._('Host Summary'), - icon: 'icon-laptop' - } - }, - - fields: { - created: { - label: i18n._('Created On'), - columnClass: 'col-lg-1 col-md-1 hidden-sm hidden-xs', - key: true, - nosort: true, - noLink: true - }, - status: { - label: i18n._('Status'), - showValue: false, - columnClass: 'col-sm-1 col-xs-2 text-center', - nosort: true, - ngClick: 'viewJobEvent(jobevent.id)', - awToolTip: '{{ jobevent.statusBadgeToolTip }}', - dataPlacement: 'top', - badgeIcon: 'fa icon-job-{{ jobevent.status }}', - badgePlacement: 'left', - badgeToolTip: '{{ jobevent.statusBadgeToolTip }}', - badgeTipPlacement: 'top', - badgeNgClick: 'viewJobEvent(jobevent.id)' - }, - event_display: { - label: i18n._('Event'), - hasChildren: true, - ngClick: 'toggleChildren(jobevent.id, jobevent.related.children)', - nosort: true, - ngClass: '{{ jobevent.class }}', - appendHTML: 'jobevent.event_detail' - }, - host: { - label: i18n._('Host'), - ngBind: 'jobevent.summary_fields.host.name', - ngHref: '{{ jobevent.hostLink }}', - nosort: true, - id: 'job-event-host-header', - 'class': 'break', - columnClass: 'col-lg-2 hidden-sm hidden-xs' - } - }, - - actions: { - refresh: { - mode: 'all', - awToolTip: 'Refresh the page', - ngClick: 'refresh()', - actionClass: 'btn List-buttonDefault', - buttonContent: i18n._('REFRESH') - } - }, - - fieldActions: { - - columnClass: 'col-sm-1 col-xs-2', - - view: { - label: i18n._('View'), - ngClick: 'viewJobEvent(jobevent.id)', - awToolTip: i18n._('View event details'), - dataPlacement: 'top' - } - } - };}]); diff --git a/awx/ui/client/src/lists/JobHosts.js b/awx/ui/client/src/lists/JobHosts.js deleted file mode 100644 index a38e621a53..0000000000 --- a/awx/ui/client/src/lists/JobHosts.js +++ /dev/null @@ -1,105 +0,0 @@ -/************************************************* - * Copyright (c) 2015 Ansible, Inc. - * - * All Rights Reserved - *************************************************/ - - -export default - angular.module('JobHostDefinition', []) - .value('JobHostList', { - - name: 'jobhosts', - iterator: 'jobhost', - editTitle: 'ALL SUMMARIES', - "class": "table-condensed", - index: false, - hover: true, - - navigationLinks: { - ngHide: 'host_id !== null', - //details: { - // href: "/#/jobs/{{ job_id }}", - // label: 'Status', - // icon: 'icon-zoom-in', - // ngShow: "job_id !== null" - //}, - events: { - href: "/#/job_events/{{ job_id }}", - label: 'Events', - icon: 'icon-list-ul' - }, - hosts: { - href: "/#/job_host_summariess/{{ job_id }}", - label: 'Host Summary', - active: true, - icon: 'icon-laptop' - } - }, - - fields: { - host: { - label: 'Host', - key: true, - sourceModel: 'host', - sourceField: 'name', - ngBind: 'jobhost.host_name', - ngHref: "{{ jobhost.hostLinkTo }}" - }, - status: { - label: 'Status', - badgeNgHref: "{{ jobhost.statusLinkTo }}", - badgeIcon: 'fa icon-job-{{ jobhost.status }}', - badgePlacement: 'left', - badgeToolTip: "{{ jobhost.statusBadgeToolTip }}", - badgeTipPlacement: 'top', - ngHref: "{{ jobhost.statusLinkTo }}", - awToolTip: "{{ jobhost.statusBadgeToolTip }}", - dataPlacement: 'top' - }, - ok: { - label: 'Success', - }, - changed: { - label: 'Changed', - }, - failures: { - label: 'Failure', - }, - dark: { - label: 'Unreachable', - }, - skipped: { - label: 'Skipped', - } - }, - - actions: { - help: { - awPopOver: "
\n
Success
Tasks successfully executed on the host.
\n" + - "
Changed
Actions taken on the host.
\n" + - "
Failure
Tasks that failed on the host.
\n" + - "
Unreachable
Times the ansible server could not reach the host.
\n" + - "
Skipped
Tasks bypassed and not performed on the host due to prior task failure or the host being unreachable.
\n" + - "
\n", - dataPlacement: 'left', - dataContainer: "body", - mode: 'all', - actionClass: 'btn-xs btn-help', - awToolTip: 'Click for help', - dataTitle: 'Job Host Summary', - id: 'jobhost-help-button' - }, - refresh: { - mode: 'all', - awToolTip: "Refresh the page", - ngClick: "refresh()", - ngShow: "host_id == null", //don't show when viewing from inventory->hosts - actionClass: 'btn List-buttonDefault', - buttonContent: 'REFRESH' - } - } - - //fieldActions: {} - - }); diff --git a/awx/ui/client/src/lists/Jobs.js b/awx/ui/client/src/lists/Jobs.js deleted file mode 100644 index e03b1f5511..0000000000 --- a/awx/ui/client/src/lists/Jobs.js +++ /dev/null @@ -1,85 +0,0 @@ -/************************************************* - * Copyright (c) 2015 Ansible, Inc. - * - * All Rights Reserved - *************************************************/ - - -export default - angular.module('JobsListDefinition', []) - .value( 'JobsList', { - - name: 'jobs', - iterator: 'job', - editTitle: 'JOBS', - 'class': 'table-condensed', - index: false, - hover: true, - well: false, - - fields: { - id: { - label: 'ID', - ngClick:"viewjobResults(job)", - key: true, - desc: true, - columnClass: 'col-lg-1 col-md-1 col-sm-2 col-xs-2', - awToolTip: "{{ job.status_tip }}", - awTipPlacement: "top", - }, - status: { - label: '', - columnClass: 'col-lg-1 col-md-2 col-sm-2 col-xs-2', - awToolTip: "{{ job.status_tip }}", - awTipPlacement: "top", - dataTitle: "{{ job.status_popover_title }}", - icon: 'icon-job-{{ job.status }}', - iconOnly: true, - ngClick:"viewjobResults(job)" - }, - started: { - label: 'Started', - noLink: true, - filter: "longDate", - columnClass: "col-lg-2 col-md-2 hidden-xs" - }, - type: { - label: 'Type', - ngBind: 'job.type_label', - link: false, - columnClass: "col-lg-2 col-md-2 hidden-sm hidden-xs" - }, - name: { - label: 'Name', - columnClass: 'col-md-3 col-xs-5', - ngClick: "viewjobResults(job)", - } - }, - - actions: { }, - - fieldActions: { - submit: { - mode: 'all', - icon: 'icon-rocket', - ngClick: 'relaunchJob($event, job.id)', - awToolTip: 'Relaunch using the same parameters', - dataPlacement: 'top', - ngHide: "job.type == 'system_job' " - }, - cancel: { - mode: 'all', - ngClick: 'deleteJob(job.id)', - awToolTip: 'Cancel the job', - dataPlacement: 'top', - ngShow: "job.status == 'running'" - }, - "delete": { - mode: 'all', - ngClick: 'deleteJob(job.id)', - awToolTip: 'Delete the job', - dataPlacement: 'top', - ngShow: "job.status != 'running'" - } - } - }); diff --git a/awx/ui/client/src/lists/PortalJobTemplates.js b/awx/ui/client/src/lists/PortalJobTemplates.js deleted file mode 100644 index 234b1b6a45..0000000000 --- a/awx/ui/client/src/lists/PortalJobTemplates.js +++ /dev/null @@ -1,46 +0,0 @@ -/************************************************* - * Copyright (c) 2015 Ansible, Inc. - * - * All Rights Reserved - *************************************************/ - - -export default - angular.module('PortalJobTemplatesListDefinition', []) - .factory('PortalJobTemplateList', ['i18n', function(i18n) { - return { - - name: 'job_templates', - iterator: 'job_template', - editTitle: i18n._('JOB TEMPLATES'), - listTitle: i18n._('JOB TEMPLATES'), - index: false, - hover: true, - well: true, - emptyListText: i18n._('There are no job templates to display at this time'), - fields: { - name: { - key: true, - label: i18n._('Name'), - columnClass: 'col-lg-5 col-md-5 col-sm-9 col-xs-8', - linkTo: '/#/templates/{{job_template.id}}' - }, - description: { - label: i18n._('Description'), - columnClass: 'col-lg-4 col-md-4 hidden-sm hidden-xs' - } - }, - - actions: { - }, - - fieldActions: { - submit: { - label: i18n._('Launch'), - mode: 'all', - ngClick: 'submitJob(job_template.id)', - awToolTip: i18n._('Start a job using this template'), - dataPlacement: 'top' - } - } - };}]); From d52739d04e8200e2dab05975297da003e217ef3e Mon Sep 17 00:00:00 2001 From: John Mitchell Date: Fri, 17 Mar 2017 11:37:09 -0400 Subject: [PATCH 13/18] cleaned up the rest of the lists --- awx/ui/client/src/app.js | 12 -- awx/ui/client/src/forms/JobTemplates.js | 2 +- .../inventory.list.js} | 6 +- awx/ui/client/src/inventories/main.js | 5 + .../manage/copy-move/copy-move-groups.list.js | 24 +++ .../src/inventories/manage/copy-move/main.js | 4 +- .../manage/groups/inventory-groups.list.js | 167 +++++++++++++++++ .../src/inventories/manage/groups/main.js | 2 + .../manage/hosts/inventory-hosts.list.js | 119 ++++++++++++ .../src/inventories/manage/hosts/main.js | 2 + .../AllJobs.js => jobs/all-jobs.list.js} | 6 +- awx/ui/client/src/jobs/main.js | 4 +- awx/ui/client/src/lists.js | 31 ---- awx/ui/client/src/lists/Groups.js | 27 --- awx/ui/client/src/lists/Hosts.js | 28 --- awx/ui/client/src/lists/InventoryGroups.js | 170 ------------------ awx/ui/client/src/lists/InventoryHosts.js | 122 ------------- awx/ui/client/src/lists/InventorySources.js | 34 ---- awx/ui/client/src/portal-mode/main.js | 6 +- .../portal-mode/portal-job-templates.list.js | 44 +++++ .../portal-jobs.list.js} | 6 +- awx/ui/client/src/scheduler/main.js | 2 + .../scheduled-jobs.list.js} | 6 +- .../completed-jobs.list.js} | 6 +- .../src/templates/inventory-sources.list.js | 31 ++++ awx/ui/client/src/templates/main.js | 6 + .../templates.list.js} | 6 +- 27 files changed, 426 insertions(+), 452 deletions(-) rename awx/ui/client/src/{lists/Inventories.js => inventories/inventory.list.js} (96%) create mode 100644 awx/ui/client/src/inventories/manage/copy-move/copy-move-groups.list.js create mode 100644 awx/ui/client/src/inventories/manage/groups/inventory-groups.list.js create mode 100644 awx/ui/client/src/inventories/manage/hosts/inventory-hosts.list.js rename awx/ui/client/src/{lists/AllJobs.js => jobs/all-jobs.list.js} (97%) delete mode 100644 awx/ui/client/src/lists.js delete mode 100644 awx/ui/client/src/lists/Groups.js delete mode 100644 awx/ui/client/src/lists/Hosts.js delete mode 100644 awx/ui/client/src/lists/InventoryGroups.js delete mode 100644 awx/ui/client/src/lists/InventoryHosts.js delete mode 100644 awx/ui/client/src/lists/InventorySources.js create mode 100644 awx/ui/client/src/portal-mode/portal-job-templates.list.js rename awx/ui/client/src/{lists/PortalJobs.js => portal-mode/portal-jobs.list.js} (90%) rename awx/ui/client/src/{lists/ScheduledJobs.js => scheduler/scheduled-jobs.list.js} (95%) rename awx/ui/client/src/{lists/CompletedJobs.js => templates/completed-jobs.list.js} (95%) create mode 100644 awx/ui/client/src/templates/inventory-sources.list.js rename awx/ui/client/src/{lists/Templates.js => templates/templates.list.js} (97%) diff --git a/awx/ui/client/src/app.js b/awx/ui/client/src/app.js index 43bf7d2c91..ac431c2dd8 100644 --- a/awx/ui/client/src/app.js +++ b/awx/ui/client/src/app.js @@ -38,7 +38,6 @@ if ($basePath) { // Modules import './forms'; -import './lists'; import portalMode from './portal-mode/main'; import systemTracking from './system-tracking/main'; import inventories from './inventories/main'; @@ -126,25 +125,14 @@ var tower = angular.module('Tower', [ 'templates', 'PromptDialog', 'AWDirectives', - 'InventoriesListDefinition', 'InventoryFormDefinition', - 'InventoryGroupsDefinition', - 'InventoryHostsDefinition', 'HostFormDefinition', - 'HostListDefinition', 'GroupFormDefinition', - 'GroupListDefinition', - 'TemplatesListDefinition', 'JobTemplateFormDefinition', - 'CompletedJobsDefinition', - 'AllJobsDefinition', 'HostGroupsFormDefinition', - 'ScheduledJobsDefinition', 'lrInfiniteScroll', - 'PortalJobsListDefinition', 'features', 'pendolytics', - 'InventorySourcesListDefinition', ]) .constant('AngularScheduler.partials', urlPrefix + 'lib/angular-scheduler/lib/') diff --git a/awx/ui/client/src/forms/JobTemplates.js b/awx/ui/client/src/forms/JobTemplates.js index 0156b47770..a6c2eb0dfe 100644 --- a/awx/ui/client/src/forms/JobTemplates.js +++ b/awx/ui/client/src/forms/JobTemplates.js @@ -12,7 +12,7 @@ export default - angular.module('JobTemplateFormDefinition', [ 'CompletedJobsDefinition']) + angular.module('JobTemplateFormDefinition', []) .factory('JobTemplateFormObject', ['i18n', function(i18n) { return { diff --git a/awx/ui/client/src/lists/Inventories.js b/awx/ui/client/src/inventories/inventory.list.js similarity index 96% rename from awx/ui/client/src/lists/Inventories.js rename to awx/ui/client/src/inventories/inventory.list.js index d2ec51afc1..cea3ebb79b 100644 --- a/awx/ui/client/src/lists/Inventories.js +++ b/awx/ui/client/src/inventories/inventory.list.js @@ -5,9 +5,7 @@ *************************************************/ -export default - angular.module('InventoriesListDefinition', []) - .factory('InventoryList', ['i18n', function(i18n) { +export default ['i18n', function(i18n) { return { name: 'inventories', @@ -96,4 +94,4 @@ export default ngShow: 'inventory.summary_fields.user_capabilities.delete' } } - };}]); + };}]; diff --git a/awx/ui/client/src/inventories/main.js b/awx/ui/client/src/inventories/main.js index 6fb5916b25..1d9aa75804 100644 --- a/awx/ui/client/src/inventories/main.js +++ b/awx/ui/client/src/inventories/main.js @@ -13,6 +13,10 @@ import { copyMoveGroupRoute, copyMoveHostRoute } from './manage/copy-move/copy-m import adHocRoute from './manage/adhoc/adhoc.route'; import { templateUrl } from '../shared/template-url/template-url.factory'; import { N_ } from '../i18n'; + +// actual inventory list config object +import InventoryList from './inventory.list'; + export default angular.module('inventory', [ inventoryAdd.name, @@ -20,6 +24,7 @@ angular.module('inventory', [ inventoryList.name, inventoryManage.name, ]) + .factory('InventoryList', InventoryList) .config(['$stateProvider', '$stateExtenderProvider', 'stateDefinitionsProvider', function($stateProvider, $stateExtenderProvider, stateDefinitionsProvider) { // When stateDefinition.lazyLoad() resolves, states matching name.** or /url** will be de-registered and replaced with resolved states diff --git a/awx/ui/client/src/inventories/manage/copy-move/copy-move-groups.list.js b/awx/ui/client/src/inventories/manage/copy-move/copy-move-groups.list.js new file mode 100644 index 0000000000..5a98b24591 --- /dev/null +++ b/awx/ui/client/src/inventories/manage/copy-move/copy-move-groups.list.js @@ -0,0 +1,24 @@ +/************************************************* + * Copyright (c) 2015 Ansible, Inc. + * + * All Rights Reserved + *************************************************/ + + + + +export default { + name: 'groups', + iterator: 'copy', + selectTitle: 'Copy Groups', + index: false, + well: false, + emptyListText: 'PLEASE CREATE ADDITIONAL GROUPS / HOSTS TO PERFORM THIS ACTION', + fields: { + name: { + key: true, + label: 'Target Group Name' + } + }, + basePath: 'api/v1/inventories/{{$stateParams.inventory_id}}/groups' +}; diff --git a/awx/ui/client/src/inventories/manage/copy-move/main.js b/awx/ui/client/src/inventories/manage/copy-move/main.js index 1b32c11941..a9fbd47660 100644 --- a/awx/ui/client/src/inventories/manage/copy-move/main.js +++ b/awx/ui/client/src/inventories/manage/copy-move/main.js @@ -6,8 +6,10 @@ import CopyMoveGroupsController from './copy-move-groups.controller'; import CopyMoveHostsController from './copy-move-hosts.controller'; +import CopyMoveGroupList from './copy-move-groups.list'; export default angular.module('manageCopyMove', []) .controller('CopyMoveGroupsController', CopyMoveGroupsController) - .controller('CopyMoveHostsController', CopyMoveHostsController); + .controller('CopyMoveHostsController', CopyMoveHostsController) + .value('CopyMoveGroupList', CopyMoveGroupList); diff --git a/awx/ui/client/src/inventories/manage/groups/inventory-groups.list.js b/awx/ui/client/src/inventories/manage/groups/inventory-groups.list.js new file mode 100644 index 0000000000..3c4c12c9c1 --- /dev/null +++ b/awx/ui/client/src/inventories/manage/groups/inventory-groups.list.js @@ -0,0 +1,167 @@ +/************************************************* + * Copyright (c) 2015 Ansible, Inc. + * + * All Rights Reserved + *************************************************/ + +export default { + name: 'groups', + iterator: 'group', + editTitle: '{{ inventory.name }}', + listTitle: 'GROUPS', + searchSize: 'col-lg-12 col-md-12 col-sm-12 col-xs-12', + showTitle: false, + well: true, + index: false, + hover: true, + 'class': 'table-no-border', + multiSelect: true, + trackBy: 'group.id', + + fields: { + sync_status: { + label: '', + nosort: true, + mode: 'all', + iconOnly: true, + ngClick: 'viewUpdateStatus(group.id)', + awToolTip: "{{ group.status_tooltip }}", + dataTipWatch: "group.status_tooltip", + icon: "{{ 'fa icon-cloud-' + group.status_class }}", + ngClass: "group.status_class", + dataPlacement: "top", + columnClass: 'status-column List-staticColumn--smallStatus' + }, + failed_hosts: { + label: '', + nosort: true, + mode: 'all', + iconOnly: true, + awToolTip: "{{ group.hosts_status_tip }}", + dataPlacement: "top", + ngClick: "showFailedHosts(group)", + icon: "{{ 'fa icon-job-' + group.hosts_status_class }}", + columnClass: 'status-column List-staticColumn--smallStatus' + }, + name: { + label: 'Groups', + key: true, + ngClick: "groupSelect(group.id)", + columnClass: 'col-lg-6 col-md-6 col-sm-6 col-xs-6', + class: 'InventoryManage-breakWord', + }, + total_groups: { + nosort: true, + label: '', + type: 'badgeCount', + ngHide: 'group.total_groups == 0', + noLink: true, + awToolTip: "{{group.name | sanitize}} contains {{group.total_groups}} {{group.total_groups === 1 ? 'child' : 'children'}}" + } + }, + + actions: { + refresh: { + mode: 'all', + awToolTip: "Refresh the page", + ngClick: "refreshGroups()", + ngShow: "socketStatus == 'error'", + actionClass: 'btn List-buttonDefault', + buttonContent: 'REFRESH' + }, + launch: { + mode: 'all', + // $scope.$parent is governed by InventoryManageController, + ngDisabled: '!$parent.groupsSelected && !$parent.hostsSelected', + ngClick: '$parent.setAdhocPattern()', + awToolTip: "Select an inventory source by clicking the check box beside it. The inventory source can be a single group or host, a selection of multiple hosts, or a selection of multiple groups.", + dataTipWatch: "adhocCommandTooltip", + actionClass: 'btn List-buttonDefault', + buttonContent: 'RUN COMMANDS', + showTipWhenDisabled: true, + tooltipInnerClass: "Tooltip-wide", + ngShow: 'canAdhoc' + // TODO: set up a tip watcher and change text based on when + // things are selected/not selected. This is started and + // commented out in the inventory controller within the watchers. + // awToolTip: "{{ adhocButtonTipContents }}", + // dataTipWatch: "adhocButtonTipContents" + }, + create: { + mode: 'all', + ngClick: "createGroup()", + awToolTip: "Create a new group", + actionClass: 'btn List-buttonSubmit', + buttonContent: '+ ADD GROUP', + ngShow: 'canAdd', + dataPlacement: "top", + } + }, + + fieldActions: { + + columnClass: 'col-lg-6 col-md-6 col-sm-6 col-xs-6 text-right', + + group_update: { + //label: 'Sync', + mode: 'all', + ngClick: 'updateGroup(group)', + awToolTip: "{{ group.launch_tooltip }}", + dataTipWatch: "group.launch_tooltip", + ngShow: "(group.status !== 'running' && group.status " + + "!== 'pending' && group.status !== 'updating') && group.summary_fields.user_capabilities.start", + ngClass: "group.launch_class", + dataPlacement: "top", + }, + cancel: { + //label: 'Cancel', + mode: 'all', + ngClick: "cancelUpdate(group.id)", + awToolTip: "Cancel sync process", + 'class': 'red-txt', + ngShow: "(group.status == 'running' || group.status == 'pending' " + + "|| group.status == 'updating') && group.summary_fields.user_capabilities.start", + dataPlacement: "top", + iconClass: "fa fa-minus-circle" + }, + copy: { + mode: 'all', + ngClick: "copyMoveGroup(group.id)", + awToolTip: 'Copy or move group', + ngShow: "group.id > 0 && group.summary_fields.user_capabilities.copy", + dataPlacement: "top" + }, + schedule: { + mode: 'all', + ngClick: "scheduleGroup(group.id)", + awToolTip: "{{ group.group_schedule_tooltip }}", + ngClass: "group.scm_type_class", + dataPlacement: 'top', + ngShow: "!(group.summary_fields.inventory_source.source === '')" + }, + edit: { + //label: 'Edit', + mode: 'all', + ngClick: "editGroup(group.id)", + awToolTip: 'Edit group', + dataPlacement: "top", + ngShow: "group.summary_fields.user_capabilities.edit" + }, + view: { + //label: 'Edit', + mode: 'all', + ngClick: "editGroup(group.id)", + awToolTip: 'View group', + dataPlacement: "top", + ngShow: "!group.summary_fields.user_capabilities.edit" + }, + "delete": { + //label: 'Delete', + mode: 'all', + ngClick: "deleteGroup(group)", + awToolTip: 'Delete group', + dataPlacement: "top", + ngShow: "group.summary_fields.user_capabilities.delete" + } + } +}; diff --git a/awx/ui/client/src/inventories/manage/groups/main.js b/awx/ui/client/src/inventories/manage/groups/main.js index e1c2c16ddb..b5d467445f 100644 --- a/awx/ui/client/src/inventories/manage/groups/main.js +++ b/awx/ui/client/src/inventories/manage/groups/main.js @@ -11,6 +11,7 @@ import GetSourceTypeOptions from './factories/get-source-type-options.factory'; import GetSyncStatusMsg from './factories/get-sync-status-msg.factory'; import GroupsCancelUpdate from './factories/groups-cancel-update.factory'; import ViewUpdateStatus from './factories/view-update-status.factory'; +import InventoryGroups from './inventory-groups.list'; export default angular.module('manageGroups', []) @@ -19,5 +20,6 @@ angular.module('manageGroups', []) .factory('GetSyncStatusMsg', GetSyncStatusMsg) .factory('GroupsCancelUpdate', GroupsCancelUpdate) .factory('ViewUpdateStatus', ViewUpdateStatus) + .value('InventoryGroups', InventoryGroups) .controller('GroupAddController', GroupAddController) .controller('GroupEditController', GroupEditController); diff --git a/awx/ui/client/src/inventories/manage/hosts/inventory-hosts.list.js b/awx/ui/client/src/inventories/manage/hosts/inventory-hosts.list.js new file mode 100644 index 0000000000..a2793638a3 --- /dev/null +++ b/awx/ui/client/src/inventories/manage/hosts/inventory-hosts.list.js @@ -0,0 +1,119 @@ +/************************************************* + * Copyright (c) 2015 Ansible, Inc. + * + * All Rights Reserved + *************************************************/ + +export default { + name: 'hosts', + iterator: 'host', + editTitle: '{{ selected_group }}', + listTitle: 'HOSTS', + searchSize: 'col-lg-12 col-md-12 col-sm-12 col-xs-12', + showTitle: false, + well: true, + index: false, + hover: true, + hasChildren: true, + 'class': 'table-no-border', + multiSelect: true, + trackBy: 'host.id', + + fields: { + active_failures: { + label: '', + iconOnly: true, + nosort: true, + // do not remove this ng-click directive + // the list generator case to handle fields without ng-click + // cannot handle the aw-* directives + ngClick: 'noop()', + awPopOver: "{{ host.job_status_html }}", + dataTitle: "{{ host.job_status_title }}", + awToolTip: "{{ host.badgeToolTip }}", + dataPlacement: 'top', + icon: "{{ 'fa icon-job-' + host.active_failures }}", + id: 'active-failures-action', + columnClass: 'status-column List-staticColumn--smallStatus' + }, + name: { + key: true, + label: 'Hosts', + ngClick: "editHost(host.id)", + ngClass: "{ 'host-disabled-label': !host.enabled }", + columnClass: 'col-lg-6 col-md-8 col-sm-8 col-xs-7', + dataHostId: "{{ host.id }}", + dataType: "host", + class: 'InventoryManage-breakWord' + } + }, + + fieldActions: { + + columnClass: 'col-lg-6 col-md-4 col-sm-4 col-xs-5 text-right', + copy: { + mode: 'all', + ngClick: "copyMoveHost(host.id)", + awToolTip: 'Copy or move host to another group', + dataPlacement: "top", + ngShow: 'host.summary_fields.user_capabilities.edit' + }, + edit: { + //label: 'Edit', + ngClick: "editHost(host.id)", + icon: 'icon-edit', + awToolTip: 'Edit host', + dataPlacement: 'top', + ngShow: 'host.summary_fields.user_capabilities.edit' + }, + view: { + //label: 'Edit', + ngClick: "editHost(host.id)", + awToolTip: 'View host', + dataPlacement: 'top', + ngShow: '!host.summary_fields.user_capabilities.edit' + }, + "delete": { + //label: 'Delete', + ngClick: "deleteHost(host.id, host.name)", + icon: 'icon-trash', + awToolTip: 'Delete host', + dataPlacement: 'top', + ngShow: 'host.summary_fields.user_capabilities.delete' + } + }, + + actions: { + system_tracking: { + buttonContent: 'System Tracking', + ngClick: 'systemTracking()', + awToolTip: "Select one or two hosts by clicking the checkbox beside the host. System tracking offers the ability to compare the results of two scan runs from different dates on one host or the same date on two hosts.", + dataTipWatch: "systemTrackingTooltip", + dataPlacement: 'top', + awFeature: 'system_tracking', + actionClass: 'btn List-buttonDefault system-tracking', + ngDisabled: 'systemTrackingDisabled || !hostsSelected', + showTipWhenDisabled: true, + tooltipInnerClass: "Tooltip-wide", + ngShow: true + }, + refresh: { + mode: 'all', + awToolTip: "Refresh the page", + ngClick: "refreshGroups()", + ngShow: "socketStatus == 'error'", + actionClass: 'btn List-buttonDefault', + buttonContent: 'REFRESH' + }, + create: { + mode: 'all', + ngClick: "createHost()", + awToolTip: "Create a new host", + actionClass: 'btn List-buttonSubmit', + buttonContent: '+ ADD HOST', + ngShow: 'canAdd', + dataPlacement: "top", + } + } + +}; diff --git a/awx/ui/client/src/inventories/manage/hosts/main.js b/awx/ui/client/src/inventories/manage/hosts/main.js index 1b22bd3d35..7afed80efb 100644 --- a/awx/ui/client/src/inventories/manage/hosts/main.js +++ b/awx/ui/client/src/inventories/manage/hosts/main.js @@ -8,10 +8,12 @@ import HostsAddController from './hosts-add.controller'; import HostsEditController from './hosts-edit.controller'; import SetStatus from './factories/set-status.factory'; import SetEnabledMsg from './factories/set-enabled-msg.factory'; +import InventoryHosts from './inventory-hosts.list'; export default angular.module('manageHosts', []) .factory('SetStatus', SetStatus) .factory('SetEnabledMsg', SetEnabledMsg) + .value('InventoryHosts', InventoryHosts) .controller('HostsAddController', HostsAddController) .controller('HostEditController', HostsEditController); diff --git a/awx/ui/client/src/lists/AllJobs.js b/awx/ui/client/src/jobs/all-jobs.list.js similarity index 97% rename from awx/ui/client/src/lists/AllJobs.js rename to awx/ui/client/src/jobs/all-jobs.list.js index f3aacef09f..f0f3f4fe70 100644 --- a/awx/ui/client/src/lists/AllJobs.js +++ b/awx/ui/client/src/jobs/all-jobs.list.js @@ -5,9 +5,7 @@ *************************************************/ -export default - angular.module('AllJobsDefinition', []) - .factory('AllJobsList', ['i18n', function(i18n) { +export default ['i18n', function(i18n) { return { name: 'jobs', @@ -118,4 +116,4 @@ export default } } }; -}]); +}]; diff --git a/awx/ui/client/src/jobs/main.js b/awx/ui/client/src/jobs/main.js index 6045000ef0..2ee309875d 100644 --- a/awx/ui/client/src/jobs/main.js +++ b/awx/ui/client/src/jobs/main.js @@ -14,6 +14,7 @@ import RelaunchInventory from './factories/relaunch-inventory.factory'; import RelaunchJob from './factories/relaunch-job.factory'; import RelaunchPlaybook from './factories/relaunch-playbook.factory'; import RelaunchSCM from './factories/relaunch-scm.factory'; +import AllJobsList from './all-jobs.list'; export default angular.module('JobsModule', []) @@ -28,4 +29,5 @@ export default .factory('RelaunchInventory', RelaunchInventory) .factory('RelaunchJob', RelaunchJob) .factory('RelaunchPlaybook', RelaunchPlaybook) - .factory('RelaunchSCM', RelaunchSCM); + .factory('RelaunchSCM', RelaunchSCM) + .factory('AllJobsList', AllJobsList); diff --git a/awx/ui/client/src/lists.js b/awx/ui/client/src/lists.js deleted file mode 100644 index 8896ac3ab1..0000000000 --- a/awx/ui/client/src/lists.js +++ /dev/null @@ -1,31 +0,0 @@ -/************************************************* - * Copyright (c) 2015 Ansible, Inc. - * - * All Rights Reserved - *************************************************/ - -import CompletedJobs from "./lists/CompletedJobs"; -import AllJobs from "./lists/AllJobs"; -import Groups from "./lists/Groups"; -import Hosts from "./lists/Hosts"; -import Inventories from "./lists/Inventories"; -import InventoryGroups from "./lists/InventoryGroups"; -import InventoryHosts from "./lists/InventoryHosts"; -import InventorySources from "./lists/InventorySources"; -import PortalJobs from "./lists/PortalJobs"; -import ScheduledJobs from "./lists/ScheduledJobs"; -import Templates from "./lists/Templates"; - -export - { CompletedJobs, - AllJobs, - Groups, - Hosts, - Inventories, - InventoryGroups, - InventoryHosts, - InventorySources, - PortalJobs, - ScheduledJobs, - Templates - }; diff --git a/awx/ui/client/src/lists/Groups.js b/awx/ui/client/src/lists/Groups.js deleted file mode 100644 index 205adde477..0000000000 --- a/awx/ui/client/src/lists/Groups.js +++ /dev/null @@ -1,27 +0,0 @@ -/************************************************* - * Copyright (c) 2015 Ansible, Inc. - * - * All Rights Reserved - *************************************************/ - - - - -export default - angular.module('GroupListDefinition', []) - .value('CopyMoveGroupList', { - - name: 'groups', - iterator: 'copy', - selectTitle: 'Copy Groups', - index: false, - well: false, - emptyListText: 'PLEASE CREATE ADDITIONAL GROUPS / HOSTS TO PERFORM THIS ACTION', - fields: { - name: { - key: true, - label: 'Target Group Name' - } - }, - basePath: 'api/v1/inventories/{{$stateParams.inventory_id}}/groups' - }); diff --git a/awx/ui/client/src/lists/Hosts.js b/awx/ui/client/src/lists/Hosts.js deleted file mode 100644 index 5dc875f6af..0000000000 --- a/awx/ui/client/src/lists/Hosts.js +++ /dev/null @@ -1,28 +0,0 @@ -/************************************************* - * Copyright (c) 2015 Ansible, Inc. - * - * All Rights Reserved - *************************************************/ - -export default - angular.module('HostListDefinition', []) - .value('HostList', { - - name: 'copy_hosts', - iterator: 'copy_host', - selectTitle: 'Add Existing Hosts', - editTitle: 'Hosts', - index: false, - well: false, - - fields: { - name: { - key: true, - label: 'Host Name' - } - }, - - actions: { }, - - fieldActions: { } - }); diff --git a/awx/ui/client/src/lists/InventoryGroups.js b/awx/ui/client/src/lists/InventoryGroups.js deleted file mode 100644 index 1a5d0b989a..0000000000 --- a/awx/ui/client/src/lists/InventoryGroups.js +++ /dev/null @@ -1,170 +0,0 @@ -/************************************************* - * Copyright (c) 2015 Ansible, Inc. - * - * All Rights Reserved - *************************************************/ - -export default - angular.module('InventoryGroupsDefinition', []) - .value('InventoryGroups', { - - name: 'groups', - iterator: 'group', - editTitle: '{{ inventory.name }}', - listTitle: 'GROUPS', - searchSize: 'col-lg-12 col-md-12 col-sm-12 col-xs-12', - showTitle: false, - well: true, - index: false, - hover: true, - 'class': 'table-no-border', - multiSelect: true, - trackBy: 'group.id', - - fields: { - sync_status: { - label: '', - nosort: true, - mode: 'all', - iconOnly: true, - ngClick: 'viewUpdateStatus(group.id)', - awToolTip: "{{ group.status_tooltip }}", - dataTipWatch: "group.status_tooltip", - icon: "{{ 'fa icon-cloud-' + group.status_class }}", - ngClass: "group.status_class", - dataPlacement: "top", - columnClass: 'status-column List-staticColumn--smallStatus' - }, - failed_hosts: { - label: '', - nosort: true, - mode: 'all', - iconOnly: true, - awToolTip: "{{ group.hosts_status_tip }}", - dataPlacement: "top", - ngClick: "showFailedHosts(group)", - icon: "{{ 'fa icon-job-' + group.hosts_status_class }}", - columnClass: 'status-column List-staticColumn--smallStatus' - }, - name: { - label: 'Groups', - key: true, - ngClick: "groupSelect(group.id)", - columnClass: 'col-lg-6 col-md-6 col-sm-6 col-xs-6', - class: 'InventoryManage-breakWord', - }, - total_groups: { - nosort: true, - label: '', - type: 'badgeCount', - ngHide: 'group.total_groups == 0', - noLink: true, - awToolTip: "{{group.name | sanitize}} contains {{group.total_groups}} {{group.total_groups === 1 ? 'child' : 'children'}}" - } - }, - - actions: { - refresh: { - mode: 'all', - awToolTip: "Refresh the page", - ngClick: "refreshGroups()", - ngShow: "socketStatus == 'error'", - actionClass: 'btn List-buttonDefault', - buttonContent: 'REFRESH' - }, - launch: { - mode: 'all', - // $scope.$parent is governed by InventoryManageController, - ngDisabled: '!$parent.groupsSelected && !$parent.hostsSelected', - ngClick: '$parent.setAdhocPattern()', - awToolTip: "Select an inventory source by clicking the check box beside it. The inventory source can be a single group or host, a selection of multiple hosts, or a selection of multiple groups.", - dataTipWatch: "adhocCommandTooltip", - actionClass: 'btn List-buttonDefault', - buttonContent: 'RUN COMMANDS', - showTipWhenDisabled: true, - tooltipInnerClass: "Tooltip-wide", - ngShow: 'canAdhoc' - // TODO: set up a tip watcher and change text based on when - // things are selected/not selected. This is started and - // commented out in the inventory controller within the watchers. - // awToolTip: "{{ adhocButtonTipContents }}", - // dataTipWatch: "adhocButtonTipContents" - }, - create: { - mode: 'all', - ngClick: "createGroup()", - awToolTip: "Create a new group", - actionClass: 'btn List-buttonSubmit', - buttonContent: '+ ADD GROUP', - ngShow: 'canAdd', - dataPlacement: "top", - } - }, - - fieldActions: { - - columnClass: 'col-lg-6 col-md-6 col-sm-6 col-xs-6 text-right', - - group_update: { - //label: 'Sync', - mode: 'all', - ngClick: 'updateGroup(group)', - awToolTip: "{{ group.launch_tooltip }}", - dataTipWatch: "group.launch_tooltip", - ngShow: "(group.status !== 'running' && group.status " + - "!== 'pending' && group.status !== 'updating') && group.summary_fields.user_capabilities.start", - ngClass: "group.launch_class", - dataPlacement: "top", - }, - cancel: { - //label: 'Cancel', - mode: 'all', - ngClick: "cancelUpdate(group.id)", - awToolTip: "Cancel sync process", - 'class': 'red-txt', - ngShow: "(group.status == 'running' || group.status == 'pending' " + - "|| group.status == 'updating') && group.summary_fields.user_capabilities.start", - dataPlacement: "top", - iconClass: "fa fa-minus-circle" - }, - copy: { - mode: 'all', - ngClick: "copyMoveGroup(group.id)", - awToolTip: 'Copy or move group', - ngShow: "group.id > 0 && group.summary_fields.user_capabilities.copy", - dataPlacement: "top" - }, - schedule: { - mode: 'all', - ngClick: "scheduleGroup(group.id)", - awToolTip: "{{ group.group_schedule_tooltip }}", - ngClass: "group.scm_type_class", - dataPlacement: 'top', - ngShow: "!(group.summary_fields.inventory_source.source === '')" - }, - edit: { - //label: 'Edit', - mode: 'all', - ngClick: "editGroup(group.id)", - awToolTip: 'Edit group', - dataPlacement: "top", - ngShow: "group.summary_fields.user_capabilities.edit" - }, - view: { - //label: 'Edit', - mode: 'all', - ngClick: "editGroup(group.id)", - awToolTip: 'View group', - dataPlacement: "top", - ngShow: "!group.summary_fields.user_capabilities.edit" - }, - "delete": { - //label: 'Delete', - mode: 'all', - ngClick: "deleteGroup(group)", - awToolTip: 'Delete group', - dataPlacement: "top", - ngShow: "group.summary_fields.user_capabilities.delete" - } - } - }); diff --git a/awx/ui/client/src/lists/InventoryHosts.js b/awx/ui/client/src/lists/InventoryHosts.js deleted file mode 100644 index f65c818893..0000000000 --- a/awx/ui/client/src/lists/InventoryHosts.js +++ /dev/null @@ -1,122 +0,0 @@ -/************************************************* - * Copyright (c) 2015 Ansible, Inc. - * - * All Rights Reserved - *************************************************/ - -export default - angular.module('InventoryHostsDefinition', []) - .value('InventoryHosts', { - - name: 'hosts', - iterator: 'host', - editTitle: '{{ selected_group }}', - listTitle: 'HOSTS', - searchSize: 'col-lg-12 col-md-12 col-sm-12 col-xs-12', - showTitle: false, - well: true, - index: false, - hover: true, - hasChildren: true, - 'class': 'table-no-border', - multiSelect: true, - trackBy: 'host.id', - - fields: { - active_failures: { - label: '', - iconOnly: true, - nosort: true, - // do not remove this ng-click directive - // the list generator case to handle fields without ng-click - // cannot handle the aw-* directives - ngClick: 'noop()', - awPopOver: "{{ host.job_status_html }}", - dataTitle: "{{ host.job_status_title }}", - awToolTip: "{{ host.badgeToolTip }}", - dataPlacement: 'top', - icon: "{{ 'fa icon-job-' + host.active_failures }}", - id: 'active-failures-action', - columnClass: 'status-column List-staticColumn--smallStatus' - }, - name: { - key: true, - label: 'Hosts', - ngClick: "editHost(host.id)", - ngClass: "{ 'host-disabled-label': !host.enabled }", - columnClass: 'col-lg-6 col-md-8 col-sm-8 col-xs-7', - dataHostId: "{{ host.id }}", - dataType: "host", - class: 'InventoryManage-breakWord' - } - }, - - fieldActions: { - - columnClass: 'col-lg-6 col-md-4 col-sm-4 col-xs-5 text-right', - copy: { - mode: 'all', - ngClick: "copyMoveHost(host.id)", - awToolTip: 'Copy or move host to another group', - dataPlacement: "top", - ngShow: 'host.summary_fields.user_capabilities.edit' - }, - edit: { - //label: 'Edit', - ngClick: "editHost(host.id)", - icon: 'icon-edit', - awToolTip: 'Edit host', - dataPlacement: 'top', - ngShow: 'host.summary_fields.user_capabilities.edit' - }, - view: { - //label: 'Edit', - ngClick: "editHost(host.id)", - awToolTip: 'View host', - dataPlacement: 'top', - ngShow: '!host.summary_fields.user_capabilities.edit' - }, - "delete": { - //label: 'Delete', - ngClick: "deleteHost(host.id, host.name)", - icon: 'icon-trash', - awToolTip: 'Delete host', - dataPlacement: 'top', - ngShow: 'host.summary_fields.user_capabilities.delete' - } - }, - - actions: { - system_tracking: { - buttonContent: 'System Tracking', - ngClick: 'systemTracking()', - awToolTip: "Select one or two hosts by clicking the checkbox beside the host. System tracking offers the ability to compare the results of two scan runs from different dates on one host or the same date on two hosts.", - dataTipWatch: "systemTrackingTooltip", - dataPlacement: 'top', - awFeature: 'system_tracking', - actionClass: 'btn List-buttonDefault system-tracking', - ngDisabled: 'systemTrackingDisabled || !hostsSelected', - showTipWhenDisabled: true, - tooltipInnerClass: "Tooltip-wide", - ngShow: true - }, - refresh: { - mode: 'all', - awToolTip: "Refresh the page", - ngClick: "refreshGroups()", - ngShow: "socketStatus == 'error'", - actionClass: 'btn List-buttonDefault', - buttonContent: 'REFRESH' - }, - create: { - mode: 'all', - ngClick: "createHost()", - awToolTip: "Create a new host", - actionClass: 'btn List-buttonSubmit', - buttonContent: '+ ADD HOST', - ngShow: 'canAdd', - dataPlacement: "top", - } - } - - }); diff --git a/awx/ui/client/src/lists/InventorySources.js b/awx/ui/client/src/lists/InventorySources.js deleted file mode 100644 index e8643da9f8..0000000000 --- a/awx/ui/client/src/lists/InventorySources.js +++ /dev/null @@ -1,34 +0,0 @@ -/************************************************* - * Copyright (c) 2016 Ansible, Inc. - * - * All Rights Reserved - *************************************************/ - - -export default - angular.module('InventorySourcesListDefinition', []) - .value('InventorySourcesList', { - - name: 'workflow_inventory_sources', - iterator: 'inventory_source', - basePath: 'inventory_sources', - listTitle: 'INVENTORY SOURCES', - index: false, - hover: true, - - fields: { - name: { - label: 'Name', - ngBind: 'inventory_source.summary_fields.group.name', - columnClass: 'col-md-11', - simpleTip: { - awToolTip: "Inventory: {{inventory_source.summary_fields.inventory.name}}", - dataPlacement: "top" - } - } - }, - - actions: {}, - - fieldActions: {} - }); diff --git a/awx/ui/client/src/portal-mode/main.js b/awx/ui/client/src/portal-mode/main.js index 7ba8246c05..8abcdaf630 100644 --- a/awx/ui/client/src/portal-mode/main.js +++ b/awx/ui/client/src/portal-mode/main.js @@ -5,9 +5,13 @@ *************************************************/ import route from './portal-mode.route'; +import PortalJobsList from './portal-jobs.list'; +import PortalJobTemplateList from './portal-job-templates.list'; export default angular.module('portalMode', []) + .factory('PortalJobsList', PortalJobsList) + .factory('PortalJobTemplateList', PortalJobTemplateList) .run(['$stateExtender', function($stateExtender){ $stateExtender.addState(route); - }]); \ No newline at end of file + }]); diff --git a/awx/ui/client/src/portal-mode/portal-job-templates.list.js b/awx/ui/client/src/portal-mode/portal-job-templates.list.js new file mode 100644 index 0000000000..a0ca8e83e1 --- /dev/null +++ b/awx/ui/client/src/portal-mode/portal-job-templates.list.js @@ -0,0 +1,44 @@ +/************************************************* + * Copyright (c) 2015 Ansible, Inc. + * + * All Rights Reserved + *************************************************/ + + +export default ['i18n', function(i18n) { + return { + + name: 'job_templates', + iterator: 'job_template', + editTitle: i18n._('JOB TEMPLATES'), + listTitle: i18n._('JOB TEMPLATES'), + index: false, + hover: true, + well: true, + emptyListText: i18n._('There are no job templates to display at this time'), + fields: { + name: { + key: true, + label: i18n._('Name'), + columnClass: 'col-lg-5 col-md-5 col-sm-9 col-xs-8', + linkTo: '/#/templates/{{job_template.id}}' + }, + description: { + label: i18n._('Description'), + columnClass: 'col-lg-4 col-md-4 hidden-sm hidden-xs' + } + }, + + actions: { + }, + + fieldActions: { + submit: { + label: i18n._('Launch'), + mode: 'all', + ngClick: 'submitJob(job_template.id)', + awToolTip: i18n._('Start a job using this template'), + dataPlacement: 'top' + } + } + };}]; diff --git a/awx/ui/client/src/lists/PortalJobs.js b/awx/ui/client/src/portal-mode/portal-jobs.list.js similarity index 90% rename from awx/ui/client/src/lists/PortalJobs.js rename to awx/ui/client/src/portal-mode/portal-jobs.list.js index 57a17b1e5d..e2d74c6c21 100644 --- a/awx/ui/client/src/lists/PortalJobs.js +++ b/awx/ui/client/src/portal-mode/portal-jobs.list.js @@ -5,9 +5,7 @@ *************************************************/ -export default - angular.module('PortalJobsListDefinition', []) - .factory('PortalJobsList', ['i18n', function(i18n) { +export default ['i18n', function(i18n) { return { name: 'jobs', @@ -44,4 +42,4 @@ export default }, actions: { } - };}]); + };}]; diff --git a/awx/ui/client/src/scheduler/main.js b/awx/ui/client/src/scheduler/main.js index 298176eb27..1d08e673dd 100644 --- a/awx/ui/client/src/scheduler/main.js +++ b/awx/ui/client/src/scheduler/main.js @@ -17,6 +17,7 @@ import RRuleToAPI from './factories/r-rule-to-api.factory'; import SchedulePost from './factories/schedule-post.factory'; import ToggleSchedule from './factories/toggle-schedule.factory'; import SchedulesList from './schedules.list'; +import ScheduledJobsList from './scheduled-jobs.list'; export default angular.module('scheduler', []) @@ -30,6 +31,7 @@ export default .factory('SchedulePost', SchedulePost) .factory('ToggleSchedule', ToggleSchedule) .factory('SchedulesList', SchedulesList) + .factory('ScheduledJobsList', ScheduledJobsList) .directive('schedulerDatePicker', schedulerDatePicker) .run(['$stateExtender', function($stateExtender) { // Inventory sync schedule states registered in: awx/ui/client/src/inventories/manage/groups/main.js diff --git a/awx/ui/client/src/lists/ScheduledJobs.js b/awx/ui/client/src/scheduler/scheduled-jobs.list.js similarity index 95% rename from awx/ui/client/src/lists/ScheduledJobs.js rename to awx/ui/client/src/scheduler/scheduled-jobs.list.js index f134dca1c8..709a98bd3c 100644 --- a/awx/ui/client/src/lists/ScheduledJobs.js +++ b/awx/ui/client/src/scheduler/scheduled-jobs.list.js @@ -5,9 +5,7 @@ *************************************************/ -export default - angular.module('ScheduledJobsDefinition', []) - .factory('ScheduledJobsList', ['i18n', function(i18n) { +export default ['i18n', function(i18n) { return { name: 'schedules', @@ -85,4 +83,4 @@ export default ngShow: 'schedule.summary_fields.user_capabilities.delete' } } - };}]); + };}]; diff --git a/awx/ui/client/src/lists/CompletedJobs.js b/awx/ui/client/src/templates/completed-jobs.list.js similarity index 95% rename from awx/ui/client/src/lists/CompletedJobs.js rename to awx/ui/client/src/templates/completed-jobs.list.js index 5af98f634d..8ad664d3db 100644 --- a/awx/ui/client/src/lists/CompletedJobs.js +++ b/awx/ui/client/src/templates/completed-jobs.list.js @@ -5,9 +5,7 @@ *************************************************/ -export default - angular.module('CompletedJobsDefinition', []) - .factory('CompletedJobsList', ['i18n', function(i18n) { +export default ['i18n', function(i18n) { return { // These tooltip fields are consumed to build disabled related tabs tooltips in the form > add view awToolTip: i18n._('Please save and run a job to view'), @@ -84,4 +82,4 @@ export default ngShow: 'completed_job.summary_fields.user_capabilities.delete' } } - };}]); + };}]; diff --git a/awx/ui/client/src/templates/inventory-sources.list.js b/awx/ui/client/src/templates/inventory-sources.list.js new file mode 100644 index 0000000000..a80d57f466 --- /dev/null +++ b/awx/ui/client/src/templates/inventory-sources.list.js @@ -0,0 +1,31 @@ +/************************************************* + * Copyright (c) 2016 Ansible, Inc. + * + * All Rights Reserved + *************************************************/ + + +export default { + name: 'workflow_inventory_sources', + iterator: 'inventory_source', + basePath: 'inventory_sources', + listTitle: 'INVENTORY SOURCES', + index: false, + hover: true, + + fields: { + name: { + label: 'Name', + ngBind: 'inventory_source.summary_fields.group.name', + columnClass: 'col-md-11', + simpleTip: { + awToolTip: "Inventory: {{inventory_source.summary_fields.inventory.name}}", + dataPlacement: "top" + } + } + }, + + actions: {}, + + fieldActions: {} +}; diff --git a/awx/ui/client/src/templates/main.js b/awx/ui/client/src/templates/main.js index a537a6a08f..3c80ab2b6c 100644 --- a/awx/ui/client/src/templates/main.js +++ b/awx/ui/client/src/templates/main.js @@ -21,6 +21,9 @@ import templateCopyService from './copy-template/template-copy.service'; import CallbackHelpInit from './job_templates/factories/callback-help-init.factory'; import md5Setup from './job_templates/factories/md-5-setup.factory'; import WorkflowForm from './workflows.form'; +import CompletedJobsList from './completed-jobs.list'; +import InventorySourcesList from './inventory-sources.list'; +import TemplateList from './templates.list'; export default angular.module('templates', [surveyMaker.name, templatesList.name, jobTemplatesAdd.name, @@ -33,6 +36,9 @@ angular.module('templates', [surveyMaker.name, templatesList.name, jobTemplatesA .factory('CallbackHelpInit', CallbackHelpInit) .factory('md5Setup', md5Setup) .factory('WorkflowForm', WorkflowForm) + .factory('CompletedJobsList', CompletedJobsList) + .factory('TemplateList', TemplateList) + .value('InventorySourcesList', InventorySourcesList) .config(['$stateProvider', 'stateDefinitionsProvider', '$stateExtenderProvider', function($stateProvider, stateDefinitionsProvider, $stateExtenderProvider) { let stateTree, addJobTemplate, editJobTemplate, addWorkflow, editWorkflow, diff --git a/awx/ui/client/src/lists/Templates.js b/awx/ui/client/src/templates/templates.list.js similarity index 97% rename from awx/ui/client/src/lists/Templates.js rename to awx/ui/client/src/templates/templates.list.js index 4608406c0e..70e920dda0 100644 --- a/awx/ui/client/src/lists/Templates.js +++ b/awx/ui/client/src/templates/templates.list.js @@ -5,9 +5,7 @@ *************************************************/ -export default - angular.module('TemplatesListDefinition', []) - .factory('TemplateList', ['i18n', function(i18n) { +export default ['i18n', function(i18n) { return { name: 'templates', @@ -129,4 +127,4 @@ export default ngShow: 'template.summary_fields.user_capabilities.delete' } } - };}]); + };}]; From 73ec664d533b4ee3aa51ae8f221e4633d989cd6b Mon Sep 17 00:00:00 2001 From: John Mitchell Date: Fri, 17 Mar 2017 12:58:08 -0400 Subject: [PATCH 14/18] fix the rest of the forms --- awx/ui/client/src/app.js | 5 - awx/ui/client/src/forms.js | 21 - awx/ui/client/src/forms/Groups.js | 362 ------------------ awx/ui/client/src/forms/HostGroups.js | 55 --- awx/ui/client/src/forms/InventoryStatus.js | 60 --- .../inventory.form.js} | 6 +- awx/ui/client/src/inventories/main.js | 2 + .../inventories/manage/groups/groups.form.js | 360 +++++++++++++++++ .../src/inventories/manage/groups/main.js | 2 + .../manage/hosts/hosts.form.js} | 6 +- .../src/inventories/manage/hosts/main.js | 2 + .../job-template.form.js} | 47 +-- awx/ui/client/src/templates/main.js | 2 + 13 files changed, 393 insertions(+), 537 deletions(-) delete mode 100644 awx/ui/client/src/forms.js delete mode 100644 awx/ui/client/src/forms/Groups.js delete mode 100644 awx/ui/client/src/forms/HostGroups.js delete mode 100644 awx/ui/client/src/forms/InventoryStatus.js rename awx/ui/client/src/{forms/Inventories.js => inventories/inventory.form.js} (97%) create mode 100644 awx/ui/client/src/inventories/manage/groups/groups.form.js rename awx/ui/client/src/{forms/Hosts.js => inventories/manage/hosts/hosts.form.js} (97%) rename awx/ui/client/src/{forms/JobTemplates.js => templates/job-template.form.js} (94%) diff --git a/awx/ui/client/src/app.js b/awx/ui/client/src/app.js index ac431c2dd8..ead6518963 100644 --- a/awx/ui/client/src/app.js +++ b/awx/ui/client/src/app.js @@ -125,11 +125,6 @@ var tower = angular.module('Tower', [ 'templates', 'PromptDialog', 'AWDirectives', - 'InventoryFormDefinition', - 'HostFormDefinition', - 'GroupFormDefinition', - 'JobTemplateFormDefinition', - 'HostGroupsFormDefinition', 'lrInfiniteScroll', 'features', 'pendolytics', diff --git a/awx/ui/client/src/forms.js b/awx/ui/client/src/forms.js deleted file mode 100644 index b1be9928dc..0000000000 --- a/awx/ui/client/src/forms.js +++ /dev/null @@ -1,21 +0,0 @@ -/************************************************* - * Copyright (c) 2015 Ansible, Inc. - * - * All Rights Reserved -*************************************************/ - -import Groups from "./forms/Groups"; -import HostGroups from "./forms/HostGroups"; -import Hosts from "./forms/Hosts"; -import Inventories from "./forms/Inventories"; -import InventoryStatus from "./forms/InventoryStatus"; -import JobTemplates from "./forms/JobTemplates"; - -export { - Groups, - HostGroups, - Hosts, - Inventories, - InventoryStatus, - JobTemplates -}; diff --git a/awx/ui/client/src/forms/Groups.js b/awx/ui/client/src/forms/Groups.js deleted file mode 100644 index 506d66d1b2..0000000000 --- a/awx/ui/client/src/forms/Groups.js +++ /dev/null @@ -1,362 +0,0 @@ -/************************************************* - * Copyright (c) 2015 Ansible, Inc. - * - * All Rights Reserved - *************************************************/ - - /** - * @ngdoc function - * @name forms.function:Groups - * @description This form is for adding/editing a Group on the inventory page -*/ - -export default - angular.module('GroupFormDefinition', []) - .value('GroupFormObject', { - - addTitle: 'CREATE GROUP', - editTitle: '{{ name }}', - showTitle: true, - name: 'group', - basePath: 'groups', - // the parent node this generated state definition tree expects to attach to - stateTree: 'inventoryManage', - // form generator inspects the current state name to determine whether or not to set an active (.is-selected) class on a form tab - // this setting is optional on most forms, except where the form's edit state name is not parentStateName.edit - activeEditState: 'inventoryManage.editGroup', - detailsClick: "$state.go('inventoryManage.editGroup')", - well: false, - fields: { - name: { - label: 'Name', - type: 'text', - ngDisabled: '!(group_obj.summary_fields.user_capabilities.edit || canAdd)', - required: true, - tab: 'properties' - }, - description: { - label: 'Description', - type: 'text', - ngDisabled: '!(group_obj.summary_fields.user_capabilities.edit || canAdd)', - tab: 'properties' - }, - variables: { - label: 'Variables', - type: 'textarea', - class: 'Form-textAreaLabel Form-formGroup--fullWidth', - rows: 6, - 'default': '---', - dataTitle: 'Group Variables', - dataPlacement: 'right', - parseTypeName: 'parseType', - awPopOver: "

Variables defined here apply to all child groups and hosts.

" + - "

Enter variables using either JSON or YAML syntax. Use the " + - "radio button to toggle between the two.

" + - "JSON:
\n" + - "
{
  \"somevar\": \"somevalue\",
 \"password\": \"magic\"
}
\n" + - "YAML:
\n" + - "
---
somevar: somevalue
password: magic
\n" + - '

View JSON examples at www.json.org

' + - '

View YAML examples at docs.ansible.com

', - dataContainer: 'body', - tab: 'properties' - }, - source: { - label: 'Source', - type: 'select', - ngOptions: 'source.label for source in source_type_options track by source.value', - ngChange: 'sourceChange(source)', - ngDisabled: '!(group_obj.summary_fields.user_capabilities.edit || canAdd)', - ngModel: 'source' - }, - credential: { - // initializes a default value for this search param - // search params with default values set will not generate user-interactable search tags - search: { - kind: null - }, - label: 'Cloud Credential', - type: 'lookup', - list: 'CredentialList', - basePath: 'credentials', - ngShow: "source && source.value !== '' && source.value !== 'custom'", - sourceModel: 'credential', - sourceField: 'name', - ngClick: 'lookupCredential()', - awRequiredWhen: { - reqExpression: "cloudCredentialRequired", - init: "false" - }, - ngDisabled: '!(group_obj.summary_fields.user_capabilities.edit || canAdd)', - watchBasePath: "credentialBasePath" - }, - source_regions: { - label: 'Regions', - type: 'select', - ngOptions: 'source.label for source in source_region_choices track by source.value', - multiSelect: true, - ngShow: "source && (source.value == 'rax' || source.value == 'ec2' || source.value == 'gce' || source.value == 'azure' || source.value == 'azure_rm')", - - - dataTitle: 'Source Regions', - dataPlacement: 'right', - awPopOver: "

Click on the regions field to see a list of regions for your cloud provider. You can select multiple regions, " + - "or choose All to include all regions. Tower will only be updated with Hosts associated with the selected regions." + - "

", - dataContainer: 'body', - ngDisabled: '!(group_obj.summary_fields.user_capabilities.edit || canAdd)' - }, - instance_filters: { - label: 'Instance Filters', - type: 'text', - ngShow: "source && source.value == 'ec2'", - dataTitle: 'Instance Filters', - dataPlacement: 'right', - awPopOver: "

Provide a comma-separated list of filter expressions. " + - "Hosts are imported to Tower when ANY of the filters match.

" + - "Limit to hosts having a tag:
\n" + - "
tag-key=TowerManaged
\n" + - "Limit to hosts using either key pair:
\n" + - "
key-name=staging, key-name=production
\n" + - "Limit to hosts where the Name tag begins with test:
\n" + - "
tag:Name=test*
\n" + - "

View the Describe Instances documentation " + - "for a complete list of supported filters.

", - dataContainer: 'body', - ngDisabled: '!(group_obj.summary_fields.user_capabilities.edit || canAdd)' - }, - group_by: { - label: 'Only Group By', - type: 'select', - ngShow: "source && source.value == 'ec2'", - ngOptions: 'source.label for source in group_by_choices track by source.value', - multiSelect: true, - dataTitle: 'Only Group By', - dataPlacement: 'right', - awPopOver: "

Select which groups to create automatically. " + - "Tower will create group names similar to the following examples based on the options selected:

    " + - "
  • Availability Zone: zones » us-east-1b
  • " + - "
  • Image ID: images » ami-b007ab1e
  • " + - "
  • Instance ID: instances » i-ca11ab1e
  • " + - "
  • Instance Type: types » type_m1_medium
  • " + - "
  • Key Name: keys » key_testing
  • " + - "
  • Region: regions » us-east-1
  • " + - "
  • Security Group: security_groups » security_group_default
  • " + - "
  • Tags: tags » tag_Name » tag_Name_host1
  • " + - "
  • VPC ID: vpcs » vpc-5ca1ab1e
  • " + - "
  • Tag None: tags » tag_none
  • " + - "

If blank, all groups above are created except Instance ID.

", - dataContainer: 'body', - ngDisabled: '!(group_obj.summary_fields.user_capabilities.edit || canAdd)' - }, - inventory_script: { - label : "Custom Inventory Script", - type: 'lookup', - basePath: 'inventory_scripts', - list: 'InventoryScriptsList', - ngShow: "source && source.value === 'custom'", - sourceModel: 'inventory_script', - sourceField: 'name', - awRequiredWhen: { - reqExpression: "source && source.value === 'custom'", - init: "false" - }, - ngDisabled: '!(group_obj.summary_fields.user_capabilities.edit || canAdd)', - }, - custom_variables: { - id: 'custom_variables', - label: 'Environment Variables', //"{{vars_label}}" , - ngShow: "source && source.value=='custom' ", - type: 'textarea', - class: 'Form-textAreaLabel Form-formGroup--fullWidth', - rows: 6, - 'default': '---', - parseTypeName: 'envParseType', - dataTitle: "Environment Variables", - dataPlacement: 'right', - awPopOver: "

Provide environment variables to pass to the custom inventory script.

" + - "

Enter variables using either JSON or YAML syntax. Use the radio button to toggle between the two.

" + - "JSON:
\n" + - "
{
 \"somevar\": \"somevalue\",
 \"password\": \"magic\"
}
\n" + - "YAML:
\n" + - "
---
somevar: somevalue
password: magic
\n" + - '

View JSON examples at www.json.org

' + - '

View YAML examples at docs.ansible.com

', - dataContainer: 'body' - }, - ec2_variables: { - id: 'ec2_variables', - label: 'Source Variables', //"{{vars_label}}" , - ngShow: "source && source.value == 'ec2'", - type: 'textarea', - class: 'Form-textAreaLabel Form-formGroup--fullWidth', - rows: 6, - 'default': '---', - parseTypeName: 'envParseType', - dataTitle: "Source Variables", - dataPlacement: 'right', - awPopOver: "

Override variables found in ec2.ini and used by the inventory update script. For a detailed description of these variables " + - "" + - "view ec2.ini in the Ansible github repo.

" + - "

Enter variables using either JSON or YAML syntax. Use the radio button to toggle between the two.

" + - "JSON:
\n" + - "
{
 \"somevar\": \"somevalue\",
 \"password\": \"magic\"
}
\n" + - "YAML:
\n" + - "
---
somevar: somevalue
password: magic
\n" + - '

View JSON examples at www.json.org

' + - '

View YAML examples at docs.ansible.com

', - dataContainer: 'body' - }, - vmware_variables: { - id: 'vmware_variables', - label: 'Source Variables', //"{{vars_label}}" , - ngShow: "source && source.value == 'vmware'", - type: 'textarea', - class: 'Form-textAreaLabel Form-formGroup--fullWidth', - rows: 6, - 'default': '---', - parseTypeName: 'envParseType', - dataTitle: "Source Variables", - dataPlacement: 'right', - awPopOver: "

Override variables found in vmware.ini and used by the inventory update script. For a detailed description of these variables " + - "" + - "view vmware_inventory.ini in the Ansible github repo.

" + - "

Enter variables using either JSON or YAML syntax. Use the radio button to toggle between the two.

" + - "JSON:
\n" + - "
{
 \"somevar\": \"somevalue\",
 \"password\": \"magic\"
}
\n" + - "YAML:
\n" + - "
---
somevar: somevalue
password: magic
\n" + - '

View JSON examples at www.json.org

' + - '

View YAML examples at docs.ansible.com

', - dataContainer: 'body' - }, - openstack_variables: { - id: 'openstack_variables', - label: 'Source Variables', //"{{vars_label}}" , - ngShow: "source && source.value == 'openstack'", - type: 'textarea', - class: 'Form-textAreaLabel Form-formGroup--fullWidth', - rows: 6, - 'default': '---', - parseTypeName: 'envParseType', - dataTitle: "Source Variables", - dataPlacement: 'right', - awPopOver: "

Override variables found in openstack.yml and used by the inventory update script. For an example variable configuration " + - "" + - "view openstack.yml in the Ansible github repo.

" + - "

Enter variables using either JSON or YAML syntax. Use the radio button to toggle between the two.

" + - "JSON:
\n" + - "
{
 \"somevar\": \"somevalue\",
 \"password\": \"magic\"
}
\n" + - "YAML:
\n" + - "
---
somevar: somevalue
password: magic
\n" + - '

View JSON examples at www.json.org

' + - '

View YAML examples at docs.ansible.com

', - dataContainer: 'body' - }, - checkbox_group: { - label: 'Update Options', - type: 'checkbox_group', - ngShow: "source && (source.value !== '' && source.value !== null)", - class: 'Form-checkbox--stacked', - fields: [{ - name: 'overwrite', - label: 'Overwrite', - type: 'checkbox', - ngShow: "source.value !== '' && source.value !== null", - - - awPopOver: '

If checked, all child groups and hosts not found on the external source will be deleted from ' + - 'the local inventory.

When not checked, local child hosts and groups not found on the external source will ' + - 'remain untouched by the inventory update process.

', - dataTitle: 'Overwrite', - dataContainer: 'body', - dataPlacement: 'right', - labelClass: 'checkbox-options', - ngDisabled: '!(group_obj.summary_fields.user_capabilities.edit || canAdd)' - }, { - name: 'overwrite_vars', - label: 'Overwrite Variables', - type: 'checkbox', - ngShow: "source.value !== '' && source.value !== null", - - - awPopOver: '

If checked, all variables for child groups and hosts will be removed and replaced by those ' + - 'found on the external source.

When not checked, a merge will be performed, combining local variables with ' + - 'those found on the external source.

', - dataTitle: 'Overwrite Variables', - dataContainer: 'body', - dataPlacement: 'right', - labelClass: 'checkbox-options', - ngDisabled: '!(group_obj.summary_fields.user_capabilities.edit || canAdd)' - }, { - name: 'update_on_launch', - label: 'Update on Launch', - type: 'checkbox', - ngShow: "source.value !== '' && source.value !== null", - awPopOver: '

Each time a job runs using this inventory, refresh the inventory from the selected source before ' + - 'executing job tasks.

', - dataTitle: 'Update on Launch', - dataContainer: 'body', - dataPlacement: 'right', - labelClass: 'checkbox-options', - ngDisabled: '!(group_obj.summary_fields.user_capabilities.edit || canAdd)' - }] - }, - update_cache_timeout: { - label: "Cache Timeout (seconds)", - id: 'source-cache-timeout', - type: 'number', - ngDisabled: '!(group_obj.summary_fields.user_capabilities.edit || canAdd)', - integer: true, - min: 0, - ngShow: "source && source.value !== '' && update_on_launch", - spinner: true, - "default": 0, - awPopOver: '

Time in seconds to consider an inventory sync to be current. During job runs and callbacks the task system will ' + - 'evaluate the timestamp of the latest sync. If it is older than Cache Timeout, it is not considered current, ' + - 'and a new inventory sync will be performed.

', - dataTitle: 'Cache Timeout', - dataPlacement: 'right', - dataContainer: "body" - } - }, - - buttons: { - cancel: { - ngClick: 'formCancel()', - ngShow: '(group_obj.summary_fields.user_capabilities.edit || canAdd)' - }, - close: { - ngClick: 'formCancel()', - ngShow: '!(group_obj.summary_fields.user_capabilities.edit || canAdd)' - }, - save: { - ngClick: 'formSave()', - ngDisabled: true, - ngShow: '(group_obj.summary_fields.user_capabilities.edit || canAdd)' - } - }, - - related: { - "notifications": { - include: "NotificationsList" - } - } - - }) - .factory('GroupForm', ['GroupFormObject', 'NotificationsList', - function(GroupFormObject, NotificationsList) { - return function() { - var itm; - - for (itm in GroupFormObject.related) { - if (GroupFormObject.related[itm].include === "NotificationsList") { - GroupFormObject.related[itm] = angular.copy(NotificationsList); - GroupFormObject.related[itm].generateList = true; - GroupFormObject.related[itm].disabled = "source === undefined || source.value === ''"; - GroupFormObject.related[itm].ngClick = "$state.go('inventoryManage.editGroup.notifications')"; - } - } - return GroupFormObject; - }; - }]); diff --git a/awx/ui/client/src/forms/HostGroups.js b/awx/ui/client/src/forms/HostGroups.js deleted file mode 100644 index 16479fee2b..0000000000 --- a/awx/ui/client/src/forms/HostGroups.js +++ /dev/null @@ -1,55 +0,0 @@ -/************************************************* - * Copyright (c) 2015 Ansible, Inc. - * - * All Rights Reserved - *************************************************/ - - /** - * @ngdoc function - * @name forms.function:HostGroups - * @description This form is for groups of hosts on the inventory page -*/ - -export default - angular.module('HostGroupsFormDefinition', []) - .value('HostGroupsForm', { - - editTitle: 'HOST GROUPS', - name: 'host', - well: false, - formLabelSize: 'col-lg-3', - formFieldSize: 'col-lg-9', - - fields: { - groups: { - label: 'Groups', - type: 'select', - multiple: true, - ngOptions: 'group.name for group in inventory_groups track by group.value', - required: true, - awPopOver: "

Provide a host name, ip address, or ip address:port. Examples include:

" + - "
myserver.domain.com
" + - "127.0.0.1
" + - "10.1.0.140:25
" + - "server.example.com:25" + - "
", - dataTitle: 'Host Name', - dataPlacement: 'right', - dataContainer: '#form-modal .modal-content' - } - }, - - buttons: { //for now always generates