From d52739d04e8200e2dab05975297da003e217ef3e Mon Sep 17 00:00:00 2001 From: John Mitchell Date: Fri, 17 Mar 2017 11:37:09 -0400 Subject: [PATCH] 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' } } - };}]); + };}];