. Seems to be a bug in TB3 RC1
- $(this).remove();
- });
- $('.tooltip').each( function() {
- // close any lingering tooltips
- $(this).hide();
- });
- elem.attr({
- "aw-pop-over": html,
- "data-popover-title": title,
- "data-placement": "right" });
- elem.removeAttr('ng-click');
- $compile(elem)(scope);
- scope.triggerPopover(event);
- }
-
- scope.generateTable = function(data, event){
- var html, title = (scope.inventory.has_active_failures) ? i18n._("Recent Failed Jobs") : i18n._("Recent Successful Jobs");
- Wait('stop');
- if (data.count > 0) {
- html = `
-
`;
- }
- else {
- html = `
`;
- }
-
- attachElem(event, html, title);
- };
-
- scope.showHostSummary = function(event) {
- try{
- var elem = $(event.target).parent();
- // if the popover is visible already, then exit the function here
- if(elem.data()['bs.popover'].tip().hasClass('in')){
- return;
- }
- }
- catch(err){
- scope.gatherRecentJobs(event);
- }
- };
-
- }
- };
- }
-];
diff --git a/awx/ui/client/src/inventories-hosts/inventories/list/host-summary-popover/host-summary-popover.partial.html b/awx/ui/client/src/inventories-hosts/inventories/list/host-summary-popover/host-summary-popover.partial.html
deleted file mode 100644
index 2b04b43217..0000000000
--- a/awx/ui/client/src/inventories-hosts/inventories/list/host-summary-popover/host-summary-popover.partial.html
+++ /dev/null
@@ -1,3 +0,0 @@
-
diff --git a/awx/ui/client/src/inventories-hosts/inventories/list/host-summary-popover/main.js b/awx/ui/client/src/inventories-hosts/inventories/list/host-summary-popover/main.js
deleted file mode 100644
index e2b88a1d06..0000000000
--- a/awx/ui/client/src/inventories-hosts/inventories/list/host-summary-popover/main.js
+++ /dev/null
@@ -1,7 +0,0 @@
-import directive from './host-summary-popover.directive';
-import controller from './host-summary-popover.controller';
-
-export default
-angular.module('HostSummaryPopoverModule', [])
- .directive('hostSummaryPopover', directive)
- .controller('HostSummaryPopoverController', controller);
diff --git a/awx/ui/client/src/inventories-hosts/inventories/list/inventory-list.controller.js b/awx/ui/client/src/inventories-hosts/inventories/list/inventory-list.controller.js
deleted file mode 100644
index 85174c2652..0000000000
--- a/awx/ui/client/src/inventories-hosts/inventories/list/inventory-list.controller.js
+++ /dev/null
@@ -1,199 +0,0 @@
-/*************************************************
- * Copyright (c) 2016 Ansible, Inc.
- *
- * All Rights Reserved
- *************************************************/
-
-/**
- * @ngdoc function
- * @name controllers.function:Inventories
- * @description This controller's for the Inventory page
- */
-
-function InventoriesList($scope,
- $filter, qs, InventoryList, Prompt,
- ProcessErrors, GetBasePath, Wait, $state,
- Dataset, canAdd, i18n, Inventory, InventoryHostsStrings,
- ngToast) {
-
- let inventory = new Inventory();
-
- let list = InventoryList,
- defaultUrl = GetBasePath('inventory');
-
- init();
-
- function init(){
- $scope.canAddInventory = canAdd;
-
- $scope.$watchCollection(list.name, function(){
- _.forEach($scope[list.name], processInventoryRow);
- });
-
- // Search init
- $scope.list = list;
- $scope[`${list.iterator}_dataset`] = Dataset.data;
- $scope[list.name] = $scope[`${list.iterator}_dataset`].results;
- }
-
- function processInventoryRow(inventory) {
- inventory.launch_class = "";
-
- if (inventory.has_inventory_sources) {
- inventory.copyTip = i18n._('Inventories with sources cannot be copied');
- inventory.copyClass = "btn-disabled";
- if (inventory.inventory_sources_with_failures > 0) {
- inventory.syncStatus = 'error';
- inventory.syncTip = inventory.inventory_sources_with_failures + i18n._(' sources with sync failures. Click for details');
- }
- else {
- inventory.syncStatus = 'successful';
- inventory.syncTip = i18n._('No inventory sync failures. Click for details.');
- }
- }
- else {
- inventory.copyTip = i18n._('Copy Inventory');
- inventory.copyClass = "";
- inventory.syncStatus = 'na';
- inventory.syncTip = i18n._('Not configured for inventory sync.');
- inventory.launch_class = "btn-disabled";
- }
-
- if (inventory.has_active_failures) {
- inventory.hostsStatus = 'error';
- inventory.hostsTip = inventory.hosts_with_active_failures + i18n._(' hosts with failures. Click for details.');
- }
- else if (inventory.total_hosts) {
- inventory.hostsStatus = 'successful';
- inventory.hostsTip = i18n._('No hosts with failures. Click for details.');
- }
- else {
- inventory.hostsStatus = 'none';
- inventory.hostsTip = i18n._('Inventory contains 0 hosts.');
- }
-
- inventory.kind_label = inventory.kind === '' ? 'Inventory' : (inventory.kind === 'smart' ? i18n._('Smart Inventory'): i18n._('Inventory'));
-
- inventory.linkToDetails = (inventory.kind && inventory.kind === 'smart') ? `inventories.editSmartInventory({smartinventory_id:${inventory.id}})` : `inventories.edit({inventory_id:${inventory.id}})`;
- }
-
- $scope.copyInventory = inventory => {
- if (!inventory.has_inventory_sources) {
- Wait('start');
- new Inventory('get', inventory.id)
- .then(model => model.copy())
- .then(copiedInv => {
- ngToast.success({
- content: `
-
`,
- dismissButton: false,
- dismissOnTimeout: true
- });
- $state.go('.', null, { reload: true });
- })
- .catch(({ data, status }) => {
- const params = { hdr: 'Error!', msg: `Call to copy failed. Return status: ${status}` };
- ProcessErrors($scope, data, status, null, params);
- })
- .finally(() => Wait('stop'));
- }
- };
-
- $scope.editInventory = function (inventory, reload) {
- const goOptions = reload ? { reload: true } : null;
- if(inventory.kind && inventory.kind === 'smart') {
- $state.go('inventories.editSmartInventory', {smartinventory_id: inventory.id}, goOptions);
- }
- else {
- $state.go('inventories.edit', {inventory_id: inventory.id}, goOptions);
- }
- };
-
- $scope.deleteInventory = function (id, name) {
- var action = function () {
- var url = defaultUrl + id + '/';
- Wait('start');
- $('#prompt-modal').modal('hide');
- inventory.request('delete', id)
- .then(() => {
- Wait('stop');
- })
- .catch(({data, status}) => {
- ProcessErrors( $scope, data, status, null, { hdr: 'Error!',
- msg: 'Call to ' + url + ' failed. DELETE returned status: ' + status
- });
- });
- };
-
- inventory.getDependentResourceCounts(id)
- .then((counts) => {
- const invalidateRelatedLines = [];
- let deleteModalBody = `
`;
-
- counts.forEach(countObj => {
- if(countObj.count && countObj.count > 0) {
- invalidateRelatedLines.push(`
`);
- }
- });
-
- if (invalidateRelatedLines && invalidateRelatedLines.length > 0) {
- deleteModalBody = `
${InventoryHostsStrings.get('deleteResource.USED_BY', 'inventory')} ${InventoryHostsStrings.get('deleteResource.CONFIRM', 'inventory')}
`;
- invalidateRelatedLines.forEach(invalidateRelatedLine => {
- deleteModalBody += invalidateRelatedLine;
- });
- }
-
- deleteModalBody += '
';
-
- Prompt({
- hdr: i18n._('Delete'),
- resourceName: $filter('sanitize')(name),
- body: deleteModalBody,
- action: action,
- actionText: i18n._('DELETE')
- });
- });
- };
-
- $scope.$on(`ws-inventories`, function(e, data){
- let inventory = $scope.inventories.find((inventory) => inventory.id === data.inventory_id);
- if (data.status === 'pending_deletion' && inventory !== undefined) {
- inventory.pending_deletion = true;
- }
- if (data.status === 'deleted') {
- let reloadListStateParams = _.cloneDeep($state.params);
-
- if($scope.inventories.length === 1 && $state.params.inventory_search && _.hasIn($state, 'params.inventory_search.page') && $state.params.inventory_search.page !== '1') {
- reloadListStateParams.inventory_search.page = (parseInt(reloadListStateParams.inventory_search.page)-1).toString();
- }
-
- if (parseInt($state.params.inventory_id) === data.inventory_id || parseInt($state.params.smartinventory_id) === data.inventory_id) {
- $state.go("inventories", reloadListStateParams, {reload: true});
- } else {
- Wait('start');
- $state.go('.', reloadListStateParams);
- const path = GetBasePath($scope.list.basePath) || GetBasePath($scope.list.name);
- qs.search(path, reloadListStateParams.inventory_search)
- .then((searchResponse) => {
- $scope.inventories_dataset = searchResponse.data;
- $scope.inventories = searchResponse.data.results;
- })
- .finally(() => Wait('stop'));
- }
- }
- });
-}
-
-export default ['$scope',
- '$filter', 'QuerySet', 'InventoryList', 'Prompt',
- 'ProcessErrors', 'GetBasePath', 'Wait',
- '$state', 'Dataset', 'canAdd', 'i18n', 'InventoryModel',
- 'InventoryHostsStrings', 'ngToast', InventoriesList
-];
diff --git a/awx/ui/client/src/inventories-hosts/inventories/list/main.js b/awx/ui/client/src/inventories-hosts/inventories/list/main.js
deleted file mode 100644
index 4df9ff834f..0000000000
--- a/awx/ui/client/src/inventories-hosts/inventories/list/main.js
+++ /dev/null
@@ -1,16 +0,0 @@
-/*************************************************
- * Copyright (c) 2015 Ansible, Inc.
- *
- * All Rights Reserved
- *************************************************/
-
-import controller from './inventory-list.controller';
-import hostSummaryPopover from './host-summary-popover/main';
-import sourceSummaryPopover from './source-summary-popover/main';
-
-export default
-angular.module('InventoryList', [
- hostSummaryPopover.name,
- sourceSummaryPopover.name
- ])
- .controller('InventoryListController', controller);
diff --git a/awx/ui/client/src/inventories-hosts/inventories/list/source-summary-popover/main.js b/awx/ui/client/src/inventories-hosts/inventories/list/source-summary-popover/main.js
deleted file mode 100644
index 4b6659f510..0000000000
--- a/awx/ui/client/src/inventories-hosts/inventories/list/source-summary-popover/main.js
+++ /dev/null
@@ -1,7 +0,0 @@
-import directive from './source-summary-popover.directive';
-import controller from './source-summary-popover.controller';
-
-export default
-angular.module('SourceSummaryPopoverModule', [])
- .directive('sourceSummaryPopover', directive)
- .controller('SourceSummaryPopoverController', controller);
diff --git a/awx/ui/client/src/inventories-hosts/inventories/list/source-summary-popover/source-summary-popover.controller.js b/awx/ui/client/src/inventories-hosts/inventories/list/source-summary-popover/source-summary-popover.controller.js
deleted file mode 100644
index 70ae7aeacd..0000000000
--- a/awx/ui/client/src/inventories-hosts/inventories/list/source-summary-popover/source-summary-popover.controller.js
+++ /dev/null
@@ -1,27 +0,0 @@
-export default [ '$scope', 'Wait', 'Empty', 'Rest', 'ProcessErrors', '$state',
- function($scope, Wait, Empty, Rest, ProcessErrors, $state) {
-
- $scope.gatherSourceJobs = function(event) {
- if (!Empty($scope.inventory.id)) {
- Wait('start');
- Rest.setUrl($scope.inventory.related.inventory_sources + '?order_by=-last_job_run&page_size=5');
- Rest.get()
- .then(({data}) => {
- $scope.generateTable(data, event);
- })
- .catch(({data, status}) => {
- ProcessErrors( $scope, data, status, null, { hdr: 'Error!',
- msg: 'Call to ' + $scope.inventory.related.inventory_sources + ' failed. GET returned status: ' + status
- });
- });
- }
- };
-
- $scope.viewJob = function(url) {
- // Pull the id out of the URL
- var id = url.replace(/^\//, '').split('/')[3];
- $state.go('output', { id, type: 'inventory' } );
- };
-
- }
-];
diff --git a/awx/ui/client/src/inventories-hosts/inventories/list/source-summary-popover/source-summary-popover.directive.js b/awx/ui/client/src/inventories-hosts/inventories/list/source-summary-popover/source-summary-popover.directive.js
deleted file mode 100644
index c10e12a032..0000000000
--- a/awx/ui/client/src/inventories-hosts/inventories/list/source-summary-popover/source-summary-popover.directive.js
+++ /dev/null
@@ -1,98 +0,0 @@
-export default ['templateUrl', '$compile', 'Wait', '$filter', 'i18n',
- function(templateUrl, $compile, Wait, $filter, i18n) {
- return {
- restrict: 'E',
- replace: false,
- scope: {
- inventory: '='
- },
- controller: 'SourceSummaryPopoverController',
- templateUrl: templateUrl('inventories-hosts/inventories/list/source-summary-popover/source-summary-popover'),
- link: function(scope) {
-
- function ellipsis(a) {
- if (a.length > 20) {
- return a.substr(0,20) + '...';
- }
- return a;
- }
-
- function attachElem(event, html, title) {
- var elem = $(event.target).parent();
- try {
- elem.tooltip('hide');
- elem.popover('dispose');
- }
- catch(err) {
- //ignore
- }
- $('.popover').each(function() {
- // remove lingering popover
. Seems to be a bug in TB3 RC1
- $(this).remove();
- });
- $('.tooltip').each( function() {
- // close any lingering tool tipss
- $(this).hide();
- });
- elem.attr({
- "aw-pop-over": html,
- "data-popover-title": title,
- "data-placement": "right" });
- elem.removeAttr('ng-click');
- $compile(elem)(scope);
- scope.triggerPopover(event);
- }
-
- scope.generateTable = function(data, event) {
- var html, title;
-
- Wait('stop');
-
- // Build the html for our popover
- html = "
\n";
- html += "\n";
- html += "";
- html += "" + i18n._("Status") + " ";
- html += "" + i18n._("Last Sync") + " ";
- html += "" + i18n._("Source") + " ";
- html += " ";
- html += " \n";
- html += "\n";
- data.results.forEach( function(row) {
- if (row.related.last_update) {
- html += "";
- html += ` `;
- html += "" + ($filter('longDate')(row.last_updated)) + " ";
- html += "" + $filter('sanitize')(ellipsis(row.name)) + " ";
- html += " \n";
- }
- else {
- html += "";
- html += ` `;
- html += "NA ";
- html += "" + $filter('sanitize')(ellipsis(row.name)) + " ";
- html += " \n";
- }
- });
- html += " \n";
- html += "
\n";
- title = i18n._("Sync Status");
- attachElem(event, html, title);
- };
-
- scope.showSourceSummary = function(event) {
- try{
- var elem = $(event.target).parent();
- // if the popover is visible already, then exit the function here
- if(elem.data()['bs.popover'].tip().hasClass('in')){
- return;
- }
- }
- catch(err){
- scope.gatherSourceJobs(event);
- }
- };
- }
- };
- }
-];
diff --git a/awx/ui/client/src/inventories-hosts/inventories/list/source-summary-popover/source-summary-popover.partial.html b/awx/ui/client/src/inventories-hosts/inventories/list/source-summary-popover/source-summary-popover.partial.html
deleted file mode 100644
index b1b3331c4c..0000000000
--- a/awx/ui/client/src/inventories-hosts/inventories/list/source-summary-popover/source-summary-popover.partial.html
+++ /dev/null
@@ -1,3 +0,0 @@
-
-
-
diff --git a/awx/ui/client/src/inventories-hosts/inventories/main.js b/awx/ui/client/src/inventories-hosts/inventories/main.js
deleted file mode 100644
index a3160d7b1f..0000000000
--- a/awx/ui/client/src/inventories-hosts/inventories/main.js
+++ /dev/null
@@ -1,441 +0,0 @@
-/*************************************************
- * Copyright (c) 2015 Ansible, Inc.
- *
- * All Rights Reserved
- *************************************************/
-import { N_ } from '../../i18n';
-
-import adhoc from './adhoc/main';
-import group from './related/groups/main';
-import sources from './related/sources/main';
-import relatedHost from './related/hosts/main';
-import inventoryList from './list/main';
-import InventoryList from './inventory.list';
-import adHocRoute from './adhoc/adhoc.route';
-import insights from './insights/main';
-import completedJobsRoute from '~features/jobs/routes/inventoryCompletedJobs.route.js';
-import inventorySourceEditRoute from './related/sources/edit/sources-edit.route';
-import inventorySourceEditNotificationsRoute from './related/sources/edit/sources-notifications.route';
-import inventorySourceAddRoute from './related/sources/add/sources-add.route';
-import inventorySourceListRoute from './related/sources/list/sources-list.route';
-import inventorySourceListScheduleRoute from './related/sources/list/schedule/sources-schedule.route';
-import inventorySourceListScheduleAddRoute from './related/sources/list/schedule/sources-schedule-add.route';
-import inventorySourceListScheduleEditRoute from './related/sources/list/schedule/sources-schedule-edit.route';
-import adhocCredentialRoute from './adhoc/adhoc-credential.route';
-import inventoryGroupsList from './related/groups/list/groups-list.route';
-import inventoryGroupsAdd from './related/groups/add/groups-add.route';
-import inventoryGroupsEdit from './related/groups/edit/groups-edit.route';
-import groupNestedGroupsRoute from './related/groups/related/nested-groups/group-nested-groups.route';
-import hostNestedGroupsRoute from './related/hosts/related/nested-groups/host-nested-groups.route';
-import nestedGroupsAdd from './related/groups/related/nested-groups/group-nested-groups-add.route';
-import nestedHostsRoute from './related/groups/related/nested-hosts/group-nested-hosts.route';
-import inventoryHosts from './related/hosts/related-host.route';
-import smartInventoryHosts from './smart-inventory/smart-inventory-hosts.route';
-import inventoriesList from './inventories.route';
-import inventoryHostsAdd from './related/hosts/add/host-add.route';
-import inventoryHostsEdit from './related/hosts/edit/standard-host-edit.route';
-import smartInventoryHostsEdit from './related/hosts/edit/smart-host-edit.route';
-import ansibleFactsRoute from '../shared/ansible-facts/ansible-facts.route';
-import insightsRoute from './insights/insights.route';
-import inventorySourcesCredentialRoute from './related/sources/lookup/sources-lookup-credential.route';
-import inventorySourcesInventoryScriptRoute from './related/sources/lookup/sources-lookup-inventory-script.route';
-import inventorySourcesProjectRoute from './related/sources/lookup/sources-lookup-project.route';
-import SmartInventory from './smart-inventory/main';
-import StandardInventory from './standard-inventory/main';
-import hostNestedGroupsAssociateRoute from './related/hosts/related/nested-groups/host-nested-groups-associate.route';
-import groupNestedGroupsAssociateRoute from './related/groups/related/nested-groups/group-nested-groups-associate.route';
-import nestedHostsAssociateRoute from './related/groups/related/nested-hosts/group-nested-hosts-associate.route';
-import nestedHostsAddRoute from './related/groups/related/nested-hosts/group-nested-hosts-add.route';
-import hostCompletedJobsRoute from '~features/jobs/routes/hostCompletedJobs.route.js';
-
-export default
-angular.module('inventory', [
- adhoc.name,
- group.name,
- sources.name,
- relatedHost.name,
- inventoryList.name,
- insights.name,
- SmartInventory.name,
- StandardInventory.name,
- ])
- .factory('InventoryList', InventoryList)
- .config(['$stateProvider', 'stateDefinitionsProvider', '$stateExtenderProvider',
- function($stateProvider, stateDefinitionsProvider, $stateExtenderProvider) {
- let stateDefinitions = stateDefinitionsProvider.$get(),
- stateExtender = $stateExtenderProvider.$get();
-
- function generateInventoryStates() {
-
- let standardInventoryAdd = stateDefinitions.generateTree({
- name: 'inventories.add', // top-most node in the generated tree (will replace this state definition)
- url: '/inventory/add',
- modes: ['add'],
- form: 'InventoryForm',
- controllers: {
- add: 'InventoryAddController'
- },
- resolve: {
- add: {
- canAdd: ['rbacUiControlService', '$state', function(rbacUiControlService, $state) {
- return rbacUiControlService.canAdd('inventory')
- .then(function(res) {
- return res.canAdd;
- })
- .catch(function() {
- $state.go('inventories');
- });
- }]
- }
- }
- });
-
- let standardInventoryEdit = stateDefinitions.generateTree({
- name: 'inventories.edit',
- url: '/inventory/:inventory_id',
- modes: ['edit'],
- form: 'InventoryForm',
- controllers: {
- edit: 'InventoryEditController'
- },
- breadcrumbs: {
- edit: '{{breadcrumb.inventory_name}}'
- },
- data: {
- activityStream: true,
- activityStreamTarget: 'inventory'
- },
- resolve: {
- edit: {
- smartInventoryRedirect: ['resourceData', '$state', '$stateParams',
- function(resourceData, $state, $stateParams){
- if(resourceData.data.kind === "smart"){
- $state.go("inventories.editSmartInventory", {"smartinventory_id": $stateParams.inventory_id}, {reload: true});
- }
- }],
- InstanceGroupsData: ['$stateParams', 'Rest', 'GetBasePath', 'ProcessErrors',
- function($stateParams, Rest, GetBasePath, ProcessErrors){
- let path = `${GetBasePath('inventory')}${$stateParams.inventory_id}/instance_groups/`;
- Rest.setUrl(path);
- return Rest.get()
- .then(({data}) => {
- if (data.results.length > 0) {
- return data.results;
- }
- })
- .catch(({data, status}) => {
- ProcessErrors(null, data, status, null, {
- hdr: 'Error!',
- msg: 'Failed to get instance groups. GET returned ' +
- 'status: ' + status
- });
- });
- }],
- checkProjectPermission: ['resourceData', '$stateParams', 'Rest', 'GetBasePath', 'credentialTypesLookup',
- function(resourceData, $stateParams, Rest, GetBasePath, credentialTypesLookup){
- if(_.has(resourceData, 'data.summary_fields.insights_credential')){
- return credentialTypesLookup()
- .then(kinds => {
- let insightsKind = kinds.insights;
- let path = `${GetBasePath('projects')}?credential__credential_type=${insightsKind}&role_level=use_role`;
- Rest.setUrl(path);
- return Rest.get().then(({data}) => {
- if (data.results.length > 0){
- return true;
- }
- else {
- return false;
- }
- }).catch(() => {
- return false;
- });
- });
- }
- else {
- return false;
- }
- }],
- checkInventoryPermission: ['resourceData', '$stateParams', 'Rest', 'GetBasePath',
- function(resourceData, $stateParams, Rest, GetBasePath){
- if(_.has(resourceData, 'data.summary_fields.insights_credential')){
- let path = `${GetBasePath('inventory')}${$stateParams.inventory_id}/?role_level=use_role`;
- Rest.setUrl(path);
- return Rest.get().then(() => {
- return true;
- }).catch(() => {
- return false;
- });
- }
- else {
- return false;
- }
- }],
- CanRemediate: ['checkProjectPermission', 'checkInventoryPermission',
- function(checkProjectPermission, checkInventoryPermission){
- // the user can remediate an insights
- // inv if the user has "use" permission on
- // an insights project and the inventory
- // being edited:
- return checkProjectPermission === true && checkInventoryPermission === true;
- }]
- },
-
- }
- });
-
- let smartInventoryAdd = stateDefinitions.generateTree({
- name: 'inventories.addSmartInventory', // top-most node in the generated tree (will replace this state definition)
- url: '/smart/add?hostfilter',
- modes: ['add'],
- form: 'smartInventoryForm',
- controllers: {
- add: 'SmartInventoryAddController'
- },
- resolve: {
- add: {
- canAdd: ['rbacUiControlService', '$state', function(rbacUiControlService, $state) {
- return rbacUiControlService.canAdd('inventory')
- .then(function(res) {
- return res.canAdd;
- })
- .catch(function() {
- $state.go('inventories');
- });
- }]
- }
- }
- });
-
- let smartInventoryEdit = stateDefinitions.generateTree({
- name: 'inventories.editSmartInventory',
- url: '/smart/:smartinventory_id',
- modes: ['edit'],
- form: 'smartInventoryForm',
- controllers: {
- edit: 'SmartInventoryEditController'
- },
- breadcrumbs: {
- edit: '{{breadcrumb.inventory_name}}'
- },
- data: {
- activityStream: true,
- activityStreamTarget: 'inventory',
- activityStreamId: 'smartinventory_id'
- },
- resolve: {
- edit: {
- InstanceGroupsData: ['$stateParams', 'Rest', 'GetBasePath', 'ProcessErrors',
- function($stateParams, Rest, GetBasePath, ProcessErrors){
- let path = `${GetBasePath('inventory')}${$stateParams.smartinventory_id}/instance_groups/`;
- Rest.setUrl(path);
- return Rest.get()
- .then(({data}) => {
- if (data.results.length > 0) {
- return data.results;
- }
- })
- .catch(({data, status}) => {
- ProcessErrors(null, data, status, null, {
- hdr: 'Error!',
- msg: 'Failed to get instance groups. GET returned ' +
- 'status: ' + status
- });
- });
- }]
- }
- }
- });
-
- let relatedHostsAnsibleFacts = _.cloneDeep(ansibleFactsRoute);
- relatedHostsAnsibleFacts.name = 'inventories.edit.hosts.edit.ansible_facts';
-
- let relatedHostsInsights = _.cloneDeep(insightsRoute);
- relatedHostsInsights.name = 'inventories.edit.hosts.edit.insights';
-
- let addSourceCredential = _.cloneDeep(inventorySourcesCredentialRoute);
- addSourceCredential.name = 'inventories.edit.inventory_sources.add.credential';
-
- let addSourceInventoryScript = _.cloneDeep(inventorySourcesInventoryScriptRoute);
- addSourceInventoryScript.name = 'inventories.edit.inventory_sources.add.inventory_script';
- addSourceInventoryScript.url = '/inventory_script';
-
- let editSourceCredential = _.cloneDeep(inventorySourcesCredentialRoute);
- editSourceCredential.name = 'inventories.edit.inventory_sources.edit.credential';
-
- let addSourceProject = _.cloneDeep(inventorySourcesProjectRoute);
- addSourceProject.name = 'inventories.edit.inventory_sources.add.project';
- addSourceProject.url = '/project';
-
- let editSourceProject = _.cloneDeep(inventorySourcesProjectRoute);
- editSourceProject.name = 'inventories.edit.inventory_sources.edit.project';
- editSourceProject.url = '/project';
-
- let editSourceInventoryScript = _.cloneDeep(inventorySourcesInventoryScriptRoute);
- editSourceInventoryScript.name = 'inventories.edit.inventory_sources.edit.inventory_script';
- editSourceInventoryScript.url = '/inventory_script';
-
- let inventoryCompletedJobsRoute = _.cloneDeep(completedJobsRoute);
- inventoryCompletedJobsRoute.name = 'inventories.edit.completed_jobs';
-
- let smartInventoryCompletedJobsRoute = _.cloneDeep(completedJobsRoute);
- smartInventoryCompletedJobsRoute.name = 'inventories.editSmartInventory.completed_jobs';
-
- let inventoryAdhocRoute = _.cloneDeep(adHocRoute);
- inventoryAdhocRoute.name = 'inventories.edit.adhoc';
-
- let smartInventoryAdhocRoute = _.cloneDeep(adHocRoute);
- smartInventoryAdhocRoute.name = 'inventories.editSmartInventory.adhoc';
-
- let inventoryAdhocCredential = _.cloneDeep(adhocCredentialRoute);
- inventoryAdhocCredential.name = 'inventories.edit.adhoc.credential';
-
- let smartInventoryAdhocCredential = _.cloneDeep(adhocCredentialRoute);
- smartInventoryAdhocCredential.name = 'inventories.editSmartInventory.adhoc.credential';
-
- let relatedHostCompletedJobs = _.cloneDeep(hostCompletedJobsRoute);
- relatedHostCompletedJobs.name = 'inventories.edit.hosts.edit.completed_jobs';
-
- let inventoryRootGroupsList = _.cloneDeep(inventoryGroupsList);
- inventoryRootGroupsList.name = "inventories.edit.rootGroups";
- inventoryRootGroupsList.url = "/root_groups?{group_search:queryset}",
- inventoryRootGroupsList.ncyBreadcrumb.label = N_("ROOT GROUPS");// jshint ignore:line
- inventoryRootGroupsList.resolve.listDefinition = ['GroupList', (list) => {
- const rootGroupList = _.cloneDeep(list);
- rootGroupList.basePath = 'api/v2/inventories/{{$stateParams.inventory_id}}/root_groups/';
- rootGroupList.fields.name.uiSref = "inventories.edit.rootGroups.edit({group_id:group.id})";
- return rootGroupList;
- }];
-
- let inventoryRootGroupsAdd = _.cloneDeep(inventoryGroupsAdd);
- inventoryRootGroupsAdd.name = "inventories.edit.rootGroups.add";
- inventoryRootGroupsAdd.ncyBreadcrumb.parent = "inventories.edit.rootGroups";
-
- let inventoryRootGroupsEdit = _.cloneDeep(inventoryGroupsEdit);
- inventoryRootGroupsEdit.name = "inventories.edit.rootGroups.edit";
- inventoryRootGroupsEdit.ncyBreadcrumb.parent = "inventories.edit.rootGroups";
- inventoryRootGroupsEdit.views = {
- 'groupForm@inventories': {
- templateProvider: function(GenerateForm, GroupForm) {
- let form = _.cloneDeep(GroupForm);
- form.activeEditState = 'inventories.edit.rootGroups.edit';
- form.detailsClick = "$state.go('inventories.edit.rootGroups.edit')";
- form.parent = 'inventories.edit.rootGroups';
- form.related.nested_groups.ngClick = "$state.go('inventories.edit.rootGroups.edit.nested_groups')";
- form.related.nested_hosts.ngClick = "$state.go('inventories.edit.rootGroups.edit.nested_hosts')";
-
- return GenerateForm.buildHTML(form, {
- mode: 'edit',
- related: false
- });
- },
- controller: 'GroupEditController'
- }
- };
- inventoryGroupsEdit.views = {
- 'groupForm@inventories': {
- templateProvider: function(GenerateForm, GroupForm) {
- let form = GroupForm;
-
- return GenerateForm.buildHTML(form, {
- mode: 'edit',
- related: false
- });
- },
- controller: 'GroupEditController'
- }
- };
-
- let rootGroupNestedGroupsRoute = _.cloneDeep(groupNestedGroupsRoute);
- rootGroupNestedGroupsRoute.name = 'inventories.edit.rootGroups.edit.nested_groups';
- rootGroupNestedGroupsRoute.ncyBreadcrumb.parent = "inventories.edit.rootGroups.edit";
-
- let rootNestedGroupsAdd = _.cloneDeep(nestedGroupsAdd);
- rootNestedGroupsAdd.name = "inventories.edit.rootGroups.edit.nested_groups.add";
- rootNestedGroupsAdd.ncyBreadcrumb.parent = "inventories.edit.groups.edit.nested_groups";
-
- let rootGroupNestedGroupsAssociateRoute = _.cloneDeep(groupNestedGroupsAssociateRoute);
- rootGroupNestedGroupsAssociateRoute.name = 'inventories.edit.rootGroups.edit.nested_groups.associate';
-
- let rootGroupNestedHostsRoute = _.cloneDeep(nestedHostsRoute);
- rootGroupNestedHostsRoute.name = 'inventories.edit.rootGroups.edit.nested_hosts';
- rootGroupNestedHostsRoute.ncyBreadcrumb.parent = "inventories.edit.rootGroups.edit";
-
- let rootNestedHostsAdd = _.cloneDeep(nestedHostsAddRoute);
- rootNestedHostsAdd.name = "inventories.edit.rootGroups.edit.nested_hosts.add";
- rootNestedHostsAdd.ncyBreadcrumb.parent = "inventories.edit.rootGroups.edit.nested_hosts";
-
- let rootGroupNestedHostsAssociateRoute = _.cloneDeep(nestedHostsAssociateRoute);
- rootGroupNestedHostsAssociateRoute.name = 'inventories.edit.rootGroups.edit.nested_hosts.associate';
-
- return Promise.all([
- standardInventoryAdd,
- standardInventoryEdit,
- smartInventoryAdd,
- smartInventoryEdit
- ]).then((generated) => {
- return {
- states: _.reduce(generated, (result, definition) => {
- return result.concat(definition.states);
- }, [
- stateExtender.buildDefinition(inventoriesList),
- stateExtender.buildDefinition(inventoryAdhocRoute),
- stateExtender.buildDefinition(smartInventoryAdhocRoute),
- stateExtender.buildDefinition(inventoryAdhocCredential),
- stateExtender.buildDefinition(smartInventoryAdhocCredential),
- stateExtender.buildDefinition(inventorySourceListScheduleRoute),
- stateExtender.buildDefinition(inventorySourceListScheduleAddRoute),
- stateExtender.buildDefinition(inventorySourceListScheduleEditRoute),
- stateExtender.buildDefinition(relatedHostsAnsibleFacts),
- stateExtender.buildDefinition(relatedHostsInsights),
- stateExtender.buildDefinition(inventoryGroupsList),
- stateExtender.buildDefinition(inventoryRootGroupsList),
- stateExtender.buildDefinition(inventoryGroupsAdd),
- stateExtender.buildDefinition(rootNestedGroupsAdd),
- stateExtender.buildDefinition(inventoryRootGroupsAdd),
- stateExtender.buildDefinition(inventoryGroupsEdit),
- stateExtender.buildDefinition(inventoryRootGroupsEdit),
- stateExtender.buildDefinition(groupNestedGroupsRoute),
- stateExtender.buildDefinition(rootGroupNestedGroupsRoute),
- stateExtender.buildDefinition(nestedHostsRoute),
- stateExtender.buildDefinition(rootGroupNestedHostsRoute),
- stateExtender.buildDefinition(inventoryHosts),
- stateExtender.buildDefinition(smartInventoryHosts),
- stateExtender.buildDefinition(inventoryHostsAdd),
- stateExtender.buildDefinition(inventoryHostsEdit),
- stateExtender.buildDefinition(smartInventoryHostsEdit),
- stateExtender.buildDefinition(hostNestedGroupsRoute),
- stateExtender.buildDefinition(inventorySourceListRoute),
- stateExtender.buildDefinition(inventorySourceAddRoute),
- stateExtender.buildDefinition(inventorySourceEditRoute),
- stateExtender.buildDefinition(inventorySourceEditNotificationsRoute),
- stateExtender.buildDefinition(inventoryCompletedJobsRoute),
- stateExtender.buildDefinition(smartInventoryCompletedJobsRoute),
- stateExtender.buildDefinition(addSourceCredential),
- stateExtender.buildDefinition(addSourceInventoryScript),
- stateExtender.buildDefinition(editSourceCredential),
- stateExtender.buildDefinition(editSourceInventoryScript),
- stateExtender.buildDefinition(addSourceProject),
- stateExtender.buildDefinition(editSourceProject),
- stateExtender.buildDefinition(groupNestedGroupsAssociateRoute),
- stateExtender.buildDefinition(rootGroupNestedGroupsAssociateRoute),
- stateExtender.buildDefinition(hostNestedGroupsAssociateRoute),
- stateExtender.buildDefinition(nestedHostsAssociateRoute),
- stateExtender.buildDefinition(rootGroupNestedHostsAssociateRoute),
- stateExtender.buildDefinition(nestedGroupsAdd),
- stateExtender.buildDefinition(nestedHostsAddRoute),
- stateExtender.buildDefinition(rootNestedHostsAdd),
- stateExtender.buildDefinition(relatedHostCompletedJobs)
- ])
- };
- });
-
- }
-
- $stateProvider.state({
- name: 'inventories.**',
- url: '/inventories',
- reloadOnSearch: true,
- lazyLoad: () => generateInventoryStates()
- });
- }
- ]);
diff --git a/awx/ui/client/src/inventories-hosts/inventories/related/groups/add/groups-add.controller.js b/awx/ui/client/src/inventories-hosts/inventories/related/groups/add/groups-add.controller.js
deleted file mode 100644
index 80a1d917b7..0000000000
--- a/awx/ui/client/src/inventories-hosts/inventories/related/groups/add/groups-add.controller.js
+++ /dev/null
@@ -1,62 +0,0 @@
-/*************************************************
- * Copyright (c) 2017 Ansible, Inc.
- *
- * All Rights Reserved
- *************************************************/
-
-export default ['$state', '$stateParams', '$scope', 'GroupForm',
- 'ParseTypeChange', 'GenerateForm', 'inventoryData', 'GroupsService',
- 'GetChoices', 'GetBasePath', 'CreateSelect2',
- 'rbacUiControlService', 'ToJSON',
- function($state, $stateParams, $scope, GroupForm, ParseTypeChange,
- GenerateForm, inventoryData, GroupsService, GetChoices,
- GetBasePath, CreateSelect2, rbacUiControlService,
- ToJSON) {
-
- let form = GroupForm;
- init();
-
- function init() {
- // apply form definition's default field values
- GenerateForm.applyDefaults(form, $scope);
-
- rbacUiControlService.canAdd(GetBasePath('inventory') + $stateParams.inventory_id + "/groups")
- .then(function(canAdd) {
- $scope.canAdd = canAdd;
- });
- $scope.parseType = 'yaml';
- $scope.envParseType = 'yaml';
- ParseTypeChange({
- scope: $scope,
- field_id: 'group_group_variables',
- variable: 'group_variables',
- });
- }
-
- $scope.formCancel = function() {
- $state.go('^');
- };
-
- $scope.formSave = function() {
- var json_data;
- json_data = ToJSON($scope.parseType, $scope.group_variables, true);
-
- var group = {
- variables: json_data,
- name: $scope.name,
- description: $scope.description,
- inventory: inventoryData.id
- };
-
- GroupsService.post(group).then(res => {
- if ($stateParams.group_id && _.has(res, 'data')) {
- return GroupsService.associateGroup(res.data, $stateParams.group_id)
- .then(() => $state.go('^', null, { reload: true }));
- } else if(_.has(res, 'data.id')){
- $state.go('^.edit', { group_id: res.data.id }, { reload: true });
- }
- });
-
- };
- }
-];
diff --git a/awx/ui/client/src/inventories-hosts/inventories/related/groups/add/groups-add.route.js b/awx/ui/client/src/inventories-hosts/inventories/related/groups/add/groups-add.route.js
deleted file mode 100644
index 7f9e58ff9f..0000000000
--- a/awx/ui/client/src/inventories-hosts/inventories/related/groups/add/groups-add.route.js
+++ /dev/null
@@ -1,22 +0,0 @@
-import { N_ } from '../../../../../i18n';
-
-export default {
- name: "inventories.edit.groups.add",
- url: "/add",
- ncyBreadcrumb: {
- parent: "inventories.edit.groups",
- label: N_("CREATE GROUP")
- },
- views: {
- 'groupForm@inventories': {
- templateProvider: function(GenerateForm, GroupForm) {
- let form = GroupForm;
- return GenerateForm.buildHTML(form, {
- mode: 'add',
- related: false
- });
- },
- controller: 'GroupAddController'
- }
- },
-};
diff --git a/awx/ui/client/src/inventories-hosts/inventories/related/groups/add/main.js b/awx/ui/client/src/inventories-hosts/inventories/related/groups/add/main.js
deleted file mode 100644
index 8de2bc98de..0000000000
--- a/awx/ui/client/src/inventories-hosts/inventories/related/groups/add/main.js
+++ /dev/null
@@ -1,11 +0,0 @@
-/*************************************************
- * Copyright (c) 2017 Ansible, Inc.
- *
- * All Rights Reserved
- *************************************************/
-
-import controller from './groups-add.controller';
-
-export default
-angular.module('groupAdd', [])
- .controller('GroupAddController', controller);
diff --git a/awx/ui/client/src/inventories-hosts/inventories/related/groups/edit/groups-edit.controller.js b/awx/ui/client/src/inventories-hosts/inventories/related/groups/edit/groups-edit.controller.js
deleted file mode 100644
index a187043159..0000000000
--- a/awx/ui/client/src/inventories-hosts/inventories/related/groups/edit/groups-edit.controller.js
+++ /dev/null
@@ -1,61 +0,0 @@
-/*************************************************
- * Copyright (c) 2016 Ansible, Inc.
- *
- * All Rights Reserved
- *************************************************/
-
-export default ['$state', '$stateParams', '$scope', 'ParseVariableString', 'rbacUiControlService', 'ToJSON',
- 'ParseTypeChange', 'GroupsService', 'GetChoices', 'GetBasePath', 'CreateSelect2', 'groupData', '$rootScope',
- function($state, $stateParams, $scope, ParseVariableString, rbacUiControlService, ToJSON,
- ParseTypeChange, GroupsService, GetChoices, GetBasePath, CreateSelect2, groupData, $rootScope) {
-
- init();
-
- function init() {
- rbacUiControlService.canAdd(GetBasePath('inventory') + $stateParams.inventory_id + "/groups")
- .then(function(canAdd) {
- $scope.canAdd = canAdd;
- });
-
- $scope = angular.extend($scope, groupData);
-
- $rootScope.breadcrumb.group_name = groupData.name;
-
- $scope.$watch('summary_fields.user_capabilities.edit', function(val) {
- $scope.canAdd = val;
- });
-
- // init codemirror(s)
- $scope.group_variables = $scope.variables === null || $scope.variables === '' ? '---' : ParseVariableString($scope.variables);
- $scope.parseType = 'yaml';
- $scope.envParseType = 'yaml';
-
-
- ParseTypeChange({
- scope: $scope,
- field_id: 'group_group_variables',
- variable: 'group_variables',
- readOnly: !$scope.summary_fields.user_capabilities.edit
- });
- }
-
- $scope.formCancel = function() {
- $state.go('^');
- };
-
- $scope.formSave = function() {
- var json_data;
- json_data = ToJSON($scope.parseType, $scope.group_variables, true);
- // group fields
- var group = {
- variables: json_data,
- name: $scope.name,
- description: $scope.description,
- inventory: $scope.inventory,
- id: groupData.id
- };
- GroupsService.put(group).then(() => $state.go($state.current, null, { reload: true }));
- };
-
- }
-];
diff --git a/awx/ui/client/src/inventories-hosts/inventories/related/groups/edit/groups-edit.route.js b/awx/ui/client/src/inventories-hosts/inventories/related/groups/edit/groups-edit.route.js
deleted file mode 100644
index 6d1a670168..0000000000
--- a/awx/ui/client/src/inventories-hosts/inventories/related/groups/edit/groups-edit.route.js
+++ /dev/null
@@ -1,13 +0,0 @@
-export default {
- name: "inventories.edit.groups.edit",
- url: "/edit/:group_id",
- ncyBreadcrumb: {
- parent: "inventories.edit.groups",
- label: "{{breadcrumb.group_name}}"
- },
- resolve: {
- groupData: ['$stateParams', 'GroupsService', function($stateParams, GroupsService) {
- return GroupsService.get({ id: $stateParams.group_id }).then(response => response.data.results[0]);
- }]
- }
-};
diff --git a/awx/ui/client/src/inventories-hosts/inventories/related/groups/edit/main.js b/awx/ui/client/src/inventories-hosts/inventories/related/groups/edit/main.js
deleted file mode 100644
index 0c52e2d6b9..0000000000
--- a/awx/ui/client/src/inventories-hosts/inventories/related/groups/edit/main.js
+++ /dev/null
@@ -1,11 +0,0 @@
-/*************************************************
- * Copyright (c) 2017 Ansible, Inc.
- *
- * All Rights Reserved
- *************************************************/
-
-import controller from './groups-edit.controller';
-
-export default
-angular.module('groupEdit', [])
- .controller('GroupEditController', controller);
diff --git a/awx/ui/client/src/inventories-hosts/inventories/related/groups/groups.form.js b/awx/ui/client/src/inventories-hosts/inventories/related/groups/groups.form.js
deleted file mode 100644
index 74448958b0..0000000000
--- a/awx/ui/client/src/inventories-hosts/inventories/related/groups/groups.form.js
+++ /dev/null
@@ -1,103 +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 ['i18n',
-function(i18n){
- return {
- addTitle: i18n._('CREATE GROUP'),
- editTitle: '{{ name }}',
- showTitle: true,
- name: 'group',
- basePath: 'groups',
- parent: 'inventories.edit.groups',
- // the parent node this generated state definition tree expects to attach to
- stateTree: 'inventories',
- // 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: 'inventories.edit.groups.edit',
- detailsClick: "$state.go('inventories.edit.groups.edit')",
- well: false,
- tabs: true,
- fields: {
- name: {
- label: i18n._('Name'),
- type: 'text',
- ngDisabled: '!(group_obj.summary_fields.user_capabilities.edit || canAdd)',
- required: true,
- tab: 'properties'
- },
- description: {
- label: i18n._('Description'),
- type: 'text',
- ngDisabled: '!(group_obj.summary_fields.user_capabilities.edit || canAdd)',
- tab: 'properties'
- },
- group_variables: {
- realName: 'variables',
- label: i18n._('Variables'),
- type: 'textarea',
- class: 'Form-textAreaLabel Form-formGroup--fullWidth',
- rows: 6,
- 'default': '---',
- dataTitle: i18n._('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'
- }
- },
-
- 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: {
- nested_groups: {
- name: 'nested_groups',
- awToolTip: i18n._('Please save before defining groups.'),
- dataPlacement: 'top',
- ngClick: "$state.go('inventories.edit.groups.edit.nested_groups')",
- title: i18n._('Groups'),
- iterator: 'nested_group'
- },
- nested_hosts: {
- name: 'nested_hosts',
- awToolTip: i18n._('Please save before defining hosts.'),
- dataPlacement: 'top',
- ngClick: "$state.go('inventories.edit.groups.edit.nested_hosts')",
- include: "NestedHostsListDefinition",
- title: i18n._('Hosts'),
- iterator: 'nested_hosts'
- },
- }
- };
-}];
diff --git a/awx/ui/client/src/inventories-hosts/inventories/related/groups/groups.list.js b/awx/ui/client/src/inventories-hosts/inventories/related/groups/groups.list.js
deleted file mode 100644
index ffd048de78..0000000000
--- a/awx/ui/client/src/inventories-hosts/inventories/related/groups/groups.list.js
+++ /dev/null
@@ -1,113 +0,0 @@
-/*************************************************
- * Copyright (c) 2017 Ansible, Inc.
- *
- * All Rights Reserved
- *************************************************/
-
- export default ['i18n', function(i18n) {
- return {
- name: 'groups',
- iterator: 'group',
- editTitle: '{{ inventory.name }}',
- well: true,
- wellOverride: true,
- index: false,
- hover: true,
- multiSelect: true,
- trackBy: 'group.id',
- basePath: 'api/v2/inventories/{{$stateParams.inventory_id}}/groups/',
- layoutClass: 'List-staticColumnLayout--groups',
- actionHolderClass: 'List-actionHolder List-actionHolder--rootGroups',
- fields: {
- name: {
- label: i18n._('Groups'),
- key: true,
- uiSref: "inventories.edit.groups.edit({group_id:group.id})",
- columnClass: 'col-lg-10 col-md-10 col-sm-10 col-xs-10',
- }
- },
-
- actions: {
- refresh: {
- mode: 'all',
- awToolTip: i18n._("Refresh the page"),
- ngClick: "refreshGroups()",
- ngShow: "socketStatus == 'error'",
- actionClass: 'btn List-buttonDefault',
- buttonContent: i18n._('REFRESH')
- },
- groupsToggle: {
- mode: 'all',
- type: 'toggle',
- buttons: [
- {
- text: i18n._('ALL GROUPS'),
- ngClick: "$state.go('inventories.edit.groups')",
- ngClass: "{'btn-primary': $state.includes('inventories.edit.groups'), 'Button-primary--hollow': $state.includes('inventories.edit.rootGroups')}"
- },
- {
- text: i18n._('ROOT GROUPS'),
- ngClick: "$state.go('inventories.edit.rootGroups')",
- ngClass: "{'btn-primary': $state.includes('inventories.edit.rootGroups'), 'Button-primary--hollow': $state.includes('inventories.edit.groups')}"
- }
- ]
- },
- launch: {
- mode: 'all',
- ngDisabled: '!groupsSelected',
- ngClick: 'setAdhocPattern()',
- awToolTip: i18n._("Select an inventory source by clicking the check box beside it. The inventory source can be a single group or a selection of multiple groups."),
- dataPlacement: 'top',
- actionClass: 'btn List-buttonDefault',
- buttonContent: i18n._('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: i18n._("Create a new group"),
- actionClass: 'at-Button--add',
- actionId: 'button-add',
- ngShow: 'canAdd',
- dataPlacement: "top",
- }
- },
-
- fieldActions: {
-
- columnClass: 'col-lg-2 col-md-2 col-sm-2 col-xs-2 text-right',
-
- edit: {
- //label: 'Edit',
- mode: 'all',
- ngClick: "editGroup(group.id)",
- awToolTip: i18n._('Edit group'),
- dataPlacement: "top",
- ngShow: "group.summary_fields.user_capabilities.edit"
- },
- view: {
- //label: 'Edit',
- mode: 'all',
- ngClick: "editGroup(group.id)",
- awToolTip: i18n._('View group'),
- dataPlacement: "top",
- ngShow: "!group.summary_fields.user_capabilities.edit"
- },
- "delete": {
- //label: 'Delete',
- mode: 'all',
- ngClick: "deleteGroup(group)",
- awToolTip: i18n._('Delete group'),
- dataPlacement: "top",
- ngShow: "group.summary_fields.user_capabilities.delete"
- }
- }
- };
-}];
diff --git a/awx/ui/client/src/inventories-hosts/inventories/related/groups/list/groups-list.controller.js b/awx/ui/client/src/inventories-hosts/inventories/related/groups/list/groups-list.controller.js
deleted file mode 100644
index b0e451aed0..0000000000
--- a/awx/ui/client/src/inventories-hosts/inventories/related/groups/list/groups-list.controller.js
+++ /dev/null
@@ -1,216 +0,0 @@
-/*************************************************
- * Copyright (c) 2016 Ansible, Inc.
- *
- * All Rights Reserved
- *************************************************/
- export default
- ['$scope', '$state', '$stateParams', 'listDefinition', 'InventoryUpdate',
- 'GroupsService', 'CancelSourceUpdate', 'Dataset', 'inventoryData', 'canAdd',
- 'InventoryHostsStrings', '$transitions', 'GetBasePath', 'Rest',
- function($scope, $state, $stateParams, listDefinition, InventoryUpdate,
- GroupsService, CancelSourceUpdate, Dataset, inventoryData, canAdd,
- InventoryHostsStrings, $transitions, GetBasePath, Rest){
-
- let list = listDefinition;
-
- init();
-
- function init(){
- $scope.inventory_id = $stateParams.inventory_id;
- $scope.canAdhoc = inventoryData.summary_fields.user_capabilities.adhoc;
- $scope.canAdd = canAdd;
-
- $scope.strings = {
- deleteModal: {},
- close: InventoryHostsStrings.get('CLOSE')
- };
-
- // Search init
- $scope.list = list;
- $scope[`${list.iterator}_dataset`] = Dataset.data;
- $scope[list.name] = $scope[`${list.iterator}_dataset`].results;
-
- if($state.current.name === "inventories.edit.groups") {
- $scope.rowBeingEdited = $state.params.group_id;
- $scope.listBeingEdited = "groups";
- }
-
- $scope.inventory_id = $stateParams.inventory_id;
-
- $scope.$watchCollection(list.name, function(){
- _.forEach($scope[list.name], processRow);
- });
-
- $scope.$on('selectedOrDeselected', function(e, value) {
- let item = value.value;
-
- if (value.isSelected) {
- if(!$scope.groupsSelected) {
- $scope.groupsSelected = [];
- }
- $scope.groupsSelected.push(item);
- } else {
- _.remove($scope.groupsSelected, { id: item.id });
- if($scope.groupsSelected.length === 0) {
- $scope.groupsSelected = null;
- }
- }
- });
-
- }
-
- function processRow(group){
- if (group === undefined || group === null) {
- group = {};
- }
-
- angular.forEach($scope.groupsSelected, function(selectedGroup){
- if(selectedGroup.id === group.id) {
- group.isSelected = true;
- }
- });
- }
-
- $scope.createGroup = function(){
- if ($state.includes('inventories.edit.groups')) {
- $state.go('inventories.edit.groups.add');
- } else if ($state.includes('inventories.edit.rootGroups')) {
- $state.go('inventories.edit.rootGroups.add');
- }
- };
- $scope.editGroup = function(id){
- if ($state.includes('inventories.edit.groups')) {
- $state.go('inventories.edit.groups.edit', {group_id: id});
- } else if ($state.includes('inventories.edit.rootGroups')) {
- $state.go('inventories.edit.rootGroups.edit', {group_id: id});
- }
- };
- $scope.goToGroupGroups = function(id){
- $state.go('inventories.edit.groups.edit.nested_groups', {group_id: id});
- };
- $scope.deleteGroup = function(group){
- const promises = [];
-
- Rest.setUrl(group.related.hosts);
- promises.push(Rest.get());
-
- Rest.setUrl(group.related.children);
- promises.push(Rest.get());
-
- Promise.all(promises)
- .then(([hostResponse, groupResponse]) => {
- $scope.toDelete = {};
- $scope.strings.deleteModal = {};
- $scope.toDelete.hostCount = _.get(hostResponse, ['data', 'count'], 0);
- $scope.toDelete.groupCount = _.get(groupResponse, ['data', 'count'], 0);
- angular.extend($scope.toDelete, group);
-
- if($scope.toDelete.groupCount === 0 && $scope.toDelete.hostCount === 0) {
- // This group doesn't have any child groups or hosts - the user is just trying to delete
- // the group
- $scope.deleteOption = "delete";
- }
- else {
- $scope.strings.deleteModal.group = InventoryHostsStrings.get('deletegroup.GROUP', $scope.toDelete.groupCount);
- $scope.strings.deleteModal.host = InventoryHostsStrings.get('deletegroup.HOST', $scope.toDelete.hostCount);
-
- if($scope.toDelete.groupCount === 0 || $scope.toDelete.groupCount === 0) {
- if($scope.toDelete.groupCount === 0) {
- $scope.strings.deleteModal.deleteGroupsHosts = InventoryHostsStrings.get('deletegroup.DELETE_HOST', $scope.toDelete.hostCount);
- $scope.strings.deleteModal.promoteGroupsHosts = InventoryHostsStrings.get('deletegroup.PROMOTE_HOST', $scope.toDelete.hostCount);
- }
- else if($scope.toDelete.hostCount === 0) {
- $scope.strings.deleteModal.deleteGroupsHosts = InventoryHostsStrings.get('deletegroup.DELETE_GROUP', $scope.toDelete.groupCount);
- $scope.strings.deleteModal.promoteGroupsHosts = InventoryHostsStrings.get('deletegroup.PROMOTE_GROUP', $scope.toDelete.groupCount);
- }
- }
- else {
- $scope.strings.deleteModal.deleteGroupsHosts = InventoryHostsStrings.get('deletegroup.DELETE_GROUPS_AND_HOSTS', {groups: $scope.toDelete.groupCount, hosts: $scope.toDelete.hostCount});
- $scope.strings.deleteModal.promoteGroupsHosts = InventoryHostsStrings.get('deletegroup.PROMOTE_GROUPS_AND_HOSTS', {groups: $scope.toDelete.groupCount, hosts: $scope.toDelete.hostCount});
- }
- }
-
- $('#group-delete-modal').modal('show');
- });
-
-
- };
- $scope.confirmDelete = function(){
- let reloadListStateParams = null;
-
- if($scope.groups.length === 1 && $state.params.group_search && _.has($state, 'params.group_search.page') && $state.params.group_search.page !== '1') {
- reloadListStateParams = _.cloneDeep($state.params);
- reloadListStateParams.group_search.page = (parseInt(reloadListStateParams.group_search.page)-1).toString();
- }
-
- switch($scope.deleteOption){
- case 'promote':
- GroupsService.promote($scope.toDelete.id, $stateParams.inventory_id)
- .then(() => {
- if (parseInt($state.params.group_id) === $scope.toDelete.id) {
- $state.go("^", reloadListStateParams, {reload: true});
- } else {
- $state.go($state.current, reloadListStateParams, {reload: true});
- }
- setTimeout(function(){
- $('#group-delete-modal').modal('hide');
- $('body').removeClass('modal-open');
- $('.modal-backdrop').remove();
- }, 1000);
- });
- break;
- default:
- GroupsService.delete($scope.toDelete.id).then(() => {
- if (parseInt($state.params.group_id) === $scope.toDelete.id) {
- $state.go("^", reloadListStateParams, {reload: true});
- } else {
- $state.go($state.current, reloadListStateParams, {reload: true});
- }
- setTimeout(function(){
- $('#group-delete-modal').modal('hide');
- $('body').removeClass('modal-open');
- $('.modal-backdrop').remove();
- }, 1000);
- });
- }
- };
- $scope.updateGroup = function(group) {
- GroupsService.getInventorySource({group: group.id}).then(res =>InventoryUpdate({
- scope: $scope,
- group_id: group.id,
- url: res.data.results[0].related.update,
- group_name: group.name,
- group_source: res.data.results[0].source
- }));
- };
-
- $scope.cancelUpdate = function (id) {
- CancelSourceUpdate({ scope: $scope, id: id });
- };
-
- var cleanUpStateChangeListener = $transitions.onSuccess({}, function(trans) {
- if (trans.to().name === "inventories.edit.groups.edit") {
- $scope.rowBeingEdited = trans.params('to').group_id;
- $scope.listBeingEdited = "groups";
- }
- else {
- delete $scope.rowBeingEdited;
- delete $scope.listBeingEdited;
- }
- });
-
- // Remove the listener when the scope is destroyed to avoid a memory leak
- $scope.$on('$destroy', function() {
- cleanUpStateChangeListener();
- });
-
- $scope.setAdhocPattern = function(){
- var pattern = _($scope.groupsSelected)
- .map(function(item){
- return item.name;
- }).value().join(':');
-
- $state.go('inventories.edit.adhoc', {pattern: pattern});
- };
-
- }];
diff --git a/awx/ui/client/src/inventories-hosts/inventories/related/groups/list/groups-list.partial.html b/awx/ui/client/src/inventories-hosts/inventories/related/groups/list/groups-list.partial.html
deleted file mode 100644
index 5c9e7cccf7..0000000000
--- a/awx/ui/client/src/inventories-hosts/inventories/related/groups/list/groups-list.partial.html
+++ /dev/null
@@ -1,56 +0,0 @@
-
-
-
-
-
-
-
-
Deleting group {{ toDelete.name }} .
- This group contains at least one group or host .
- Delete or promote the group's children?
-
-
-
-
-
-
-
Are you sure you want to permanently delete the group below from the inventory?
-
{{ toDelete.name }}
-
-
-
-
-
-
diff --git a/awx/ui/client/src/inventories-hosts/inventories/related/groups/list/groups-list.route.js b/awx/ui/client/src/inventories-hosts/inventories/related/groups/list/groups-list.route.js
deleted file mode 100644
index 2ad7a90a0a..0000000000
--- a/awx/ui/client/src/inventories-hosts/inventories/related/groups/list/groups-list.route.js
+++ /dev/null
@@ -1,73 +0,0 @@
-import { N_ } from '../../../../../i18n';
-import {templateUrl} from '../../../../../shared/template-url/template-url.factory';
-
-export default {
- name: "inventories.edit.groups",
- url: "/groups?{group_search:queryset}",
- resolve: {
- listDefinition: ['GroupList', (list) => list],
- Dataset: ['listDefinition', 'QuerySet', '$stateParams', 'GetBasePath', '$interpolate', '$rootScope',
- (list, qs, $stateParams, GetBasePath, $interpolate, $rootScope) => {
- // allow related list definitions to use interpolated $rootScope / $stateParams in basePath field
- let path, interpolator;
- if (GetBasePath(list.basePath)) {
- path = GetBasePath(list.basePath);
- } else {
- interpolator = $interpolate(list.basePath);
- path = interpolator({ $rootScope: $rootScope, $stateParams: $stateParams });
- }
- return qs.search(path, $stateParams[`${list.iterator}_search`]);
- }
- ],
- inventoryData: ['InventoriesService', '$stateParams', function(InventoriesService, $stateParams) {
- return InventoriesService.getInventory($stateParams.inventory_id).then(res => res.data);
- }],
- canAdd: ['rbacUiControlService', '$state', 'GetBasePath', '$stateParams', function(rbacUiControlService, $state, GetBasePath, $stateParams) {
- return rbacUiControlService.canAdd(GetBasePath('inventory') + $stateParams.inventory_id + "/groups")
- .then(function(res) {
- return res.canAdd;
- })
- .catch(function() {
- return false;
- });
- }]
- },
- params: {
- group_search: {
- value: {
- page_size: "20",
- order_by: "name"
- },
- dynamic: true,
- squash: ""
- }
- },
- ncyBreadcrumb: {
- parent: "inventories.edit",
- label: N_("ALL GROUPS")
- },
- views: {
- 'related': {
- templateProvider: function(listDefinition, generateList, $templateRequest, $stateParams, GetBasePath) {
- let list = _.cloneDeep(listDefinition);
- if($stateParams && $stateParams.group) {
- list.basePath = GetBasePath('groups') + _.last($stateParams.group) + '/children';
- }
- else {
- //reaches here if the user is on the root level group
- list.basePath = GetBasePath('inventory') + $stateParams.inventory_id + '/groups';
- }
-
- let html = generateList.build({
- list: list,
- mode: 'edit'
- });
- // Include the custom group delete modal template
- return $templateRequest(templateUrl('inventories-hosts/inventories/related/groups/list/groups-list')).then((template) => {
- return html.concat(template);
- });
- },
- controller: 'GroupsListController'
- }
- }
-};
diff --git a/awx/ui/client/src/inventories-hosts/inventories/related/groups/list/main.js b/awx/ui/client/src/inventories-hosts/inventories/related/groups/list/main.js
deleted file mode 100644
index 6c030c9869..0000000000
--- a/awx/ui/client/src/inventories-hosts/inventories/related/groups/list/main.js
+++ /dev/null
@@ -1,11 +0,0 @@
-/*************************************************
- * Copyright (c) 2017 Ansible, Inc.
- *
- * All Rights Reserved
- *************************************************/
-
-import controller from './groups-list.controller';
-
-export default
- angular.module('groupsList', [])
- .controller('GroupsListController', controller);
diff --git a/awx/ui/client/src/inventories-hosts/inventories/related/groups/main.js b/awx/ui/client/src/inventories-hosts/inventories/related/groups/main.js
deleted file mode 100644
index 940bcf5645..0000000000
--- a/awx/ui/client/src/inventories-hosts/inventories/related/groups/main.js
+++ /dev/null
@@ -1,24 +0,0 @@
-/*************************************************
- * Copyright (c) 2017 Ansible, Inc.
- *
- * All Rights Reserved
- *************************************************/
-
-import groupList from './list/main';
-import groupAdd from './add/main';
-import groupEdit from './edit/main';
-import groupFormDefinition from './groups.form';
-import groupListDefinition from './groups.list';
-import nestedGroups from './related/nested-groups/main';
-import nestedHosts from './related/nested-hosts/main';
-
-export default
- angular.module('group', [
- groupList.name,
- groupAdd.name,
- groupEdit.name,
- nestedGroups.name,
- nestedHosts.name
- ])
- .factory('GroupForm', groupFormDefinition)
- .factory('GroupList', groupListDefinition);
diff --git a/awx/ui/client/src/inventories-hosts/inventories/related/groups/related/nested-groups/group-nested-groups-add.controller.js b/awx/ui/client/src/inventories-hosts/inventories/related/groups/related/nested-groups/group-nested-groups-add.controller.js
deleted file mode 100644
index 25633199bd..0000000000
--- a/awx/ui/client/src/inventories-hosts/inventories/related/groups/related/nested-groups/group-nested-groups-add.controller.js
+++ /dev/null
@@ -1,58 +0,0 @@
-/*************************************************
- * Copyright (c) 2017 Ansible, Inc.
- *
- * All Rights Reserved
- *************************************************/
-
-export default ['$state', '$stateParams', '$scope', 'NestedGroupForm',
- 'ParseTypeChange', 'GenerateForm', 'inventoryData', 'GroupsService',
- 'GetChoices', 'GetBasePath', 'CreateSelect2',
- 'rbacUiControlService', 'ToJSON', 'canAdd',
- function($state, $stateParams, $scope, NestedGroupForm, ParseTypeChange,
- GenerateForm, inventoryData, GroupsService, GetChoices,
- GetBasePath, CreateSelect2, rbacUiControlService,
- ToJSON, canAdd) {
-
- let form = NestedGroupForm;
- init();
-
- function init() {
- // apply form definition's default field values
- GenerateForm.applyDefaults(form, $scope);
- $scope.canAdd = canAdd;
- $scope.parseType = 'yaml';
- $scope.envParseType = 'yaml';
- ParseTypeChange({
- scope: $scope,
- field_id: 'nested_group_nested_group_variables',
- variable: 'nested_group_variables',
- });
- }
-
- $scope.formCancel = function() {
- $state.go('^');
- };
-
- $scope.formSave = function() {
- var json_data;
- json_data = ToJSON($scope.parseType, $scope.nested_group_variables, true);
-
- var group = {
- variables: json_data,
- name: $scope.name,
- description: $scope.description,
- inventory: inventoryData.id
- };
-
- GroupsService.post(group).then(res => {
- if ($stateParams.group_id && _.has(res, 'data')) {
- return GroupsService.associateGroup(res.data, $stateParams.group_id)
- .then(() => $state.go('^', null, { reload: true }));
- } else if(_.has(res, 'data.id')){
- $state.go('^.edit', { group_id: res.data.id }, { reload: true });
- }
- });
-
- };
- }
-];
diff --git a/awx/ui/client/src/inventories-hosts/inventories/related/groups/related/nested-groups/group-nested-groups-add.route.js b/awx/ui/client/src/inventories-hosts/inventories/related/groups/related/nested-groups/group-nested-groups-add.route.js
deleted file mode 100644
index 2aba06a290..0000000000
--- a/awx/ui/client/src/inventories-hosts/inventories/related/groups/related/nested-groups/group-nested-groups-add.route.js
+++ /dev/null
@@ -1,33 +0,0 @@
-import { N_ } from '../../../../../../i18n';
-
-export default {
- name: "inventories.edit.groups.edit.nested_groups.add",
- url: "/add",
- ncyBreadcrumb: {
- parent: "inventories.edit.groups.edit.nested_groups",
- label: N_("CREATE GROUP")
- },
- views: {
- 'nestedGroupForm@inventories': {
- templateProvider: function(GenerateForm, NestedGroupForm) {
- let form = NestedGroupForm;
- return GenerateForm.buildHTML(form, {
- mode: 'add',
- related: false
- });
- },
- controller: 'NestedGroupsAddController'
- }
- },
- resolve: {
- canAdd: ['rbacUiControlService', '$state', 'GetBasePath', '$stateParams', function(rbacUiControlService, $state, GetBasePath, $stateParams) {
- return rbacUiControlService.canAdd(GetBasePath('inventory') + $stateParams.inventory_id + "/groups")
- .then(function(res) {
- return res.canAdd;
- })
- .catch(function() {
- return false;
- });
- }]
- }
-};
diff --git a/awx/ui/client/src/inventories-hosts/inventories/related/groups/related/nested-groups/group-nested-groups-associate.route.js b/awx/ui/client/src/inventories-hosts/inventories/related/groups/related/nested-groups/group-nested-groups-associate.route.js
deleted file mode 100644
index 0df6fdc481..0000000000
--- a/awx/ui/client/src/inventories-hosts/inventories/related/groups/related/nested-groups/group-nested-groups-associate.route.js
+++ /dev/null
@@ -1,32 +0,0 @@
-export default {
- name: 'inventories.edit.groups.edit.nested_groups.associate',
- squashSearchUrl: true,
- url: '/associate',
- ncyBreadcrumb:{
- skip:true
- },
- views: {
- 'modal@^.^': {
- templateProvider: function() {
- return `
`;
- },
- controller: function($scope, $q, GroupsService, $state){
- $scope.associateGroups = function(selectedItems){
- var deferred = $q.defer();
- return $q.all( _.map(selectedItems, (selectedItem) => GroupsService.associateGroup({id: selectedItem.id}, $state.params.group_id)) )
- .then( () =>{
- deferred.resolve();
- }, (error) => {
- deferred.reject(error);
- });
- };
- }
- }
- },
- onExit: function($state) {
- if ($state.transition) {
- $('#associate-groups-modal').modal('hide');
- $('body').removeClass('modal-open');
- }
- },
-};
diff --git a/awx/ui/client/src/inventories-hosts/inventories/related/groups/related/nested-groups/group-nested-groups-disassociate.partial.html b/awx/ui/client/src/inventories-hosts/inventories/related/groups/related/nested-groups/group-nested-groups-disassociate.partial.html
deleted file mode 100644
index ce1e432932..0000000000
--- a/awx/ui/client/src/inventories-hosts/inventories/related/groups/related/nested-groups/group-nested-groups-disassociate.partial.html
+++ /dev/null
@@ -1,36 +0,0 @@
-
-
-
-
-
-
-
Are you sure you want to disassociate the group below from {{disassociateFrom.name}}?
-
{{ toDisassociate.name }}
-
-
-
-
-
-
diff --git a/awx/ui/client/src/inventories-hosts/inventories/related/groups/related/nested-groups/group-nested-groups-list.controller.js b/awx/ui/client/src/inventories-hosts/inventories/related/groups/related/nested-groups/group-nested-groups-list.controller.js
deleted file mode 100644
index aa87266985..0000000000
--- a/awx/ui/client/src/inventories-hosts/inventories/related/groups/related/nested-groups/group-nested-groups-list.controller.js
+++ /dev/null
@@ -1,138 +0,0 @@
-/*************************************************
- * Copyright (c) 2016 Ansible, Inc.
- *
- * All Rights Reserved
- *************************************************/
- export default
- ['$scope', '$rootScope', '$state', '$stateParams', 'NestedGroupListDefinition', 'InventoryUpdate',
- 'GroupsService', 'CancelSourceUpdate', 'rbacUiControlService', 'GetBasePath',
- 'Dataset', 'Find', 'QuerySet', 'inventoryData', 'canAdd', 'groupData', 'ProcessErrors',
- '$transitions',
- function($scope, $rootScope, $state, $stateParams, NestedGroupListDefinition, InventoryUpdate,
- GroupsService, CancelSourceUpdate, rbacUiControlService, GetBasePath,
- Dataset, Find, qs, inventoryData, canAdd, groupData, ProcessErrors,
- $transitions){
-
- let list = NestedGroupListDefinition;
-
- init();
-
- function init(){
- $scope.inventory_id = $stateParams.inventory_id;
- $scope.canAdhoc = inventoryData.summary_fields.user_capabilities.adhoc;
- $scope.canAdd = canAdd;
- $scope.disassociateFrom = groupData;
-
- // Search init
- $scope.list = list;
- $scope[`${list.iterator}_dataset`] = Dataset.data;
- $scope[list.name] = $scope[`${list.iterator}_dataset`].results;
-
- if($state.current.name === "inventories.edit.groups.edit.nested_groups.edit") {
- $scope.rowBeingEdited = $state.params.group_id;
- $scope.listBeingEdited = "groups";
- }
-
- $scope.inventory_id = $stateParams.inventory_id;
-
- $scope.$on('selectedOrDeselected', function(e, value) {
- let item = value.value;
-
- if (value.isSelected) {
- if(!$scope.groupsSelected) {
- $scope.groupsSelected = [];
- }
- $scope.groupsSelected.push(item);
- } else {
- _.remove($scope.groupsSelected, { id: item.id });
- if($scope.groupsSelected.length === 0) {
- $scope.groupsSelected = null;
- }
- }
- });
-
- }
-
- $scope.disassociateGroup = function(group){
- $scope.toDisassociate = {};
- angular.extend($scope.toDisassociate, group);
- $('#group-disassociate-modal').modal('show');
- };
-
- $scope.confirmDisassociate = function(){
-
- // Bind an even listener for the modal closing. Trying to $state.go() before the modal closes
- // will mean that these two things are running async and the modal may not finish closing before
- // the state finishes transitioning.
- $('#group-disassociate-modal').off('hidden.bs.modal').on('hidden.bs.modal', function () {
- // Remove the event handler so that we don't end up with multiple bindings
- $('#group-disassociate-modal').off('hidden.bs.modal');
-
- let reloadListStateParams = null;
-
- if($scope.nested_groups.length === 1 && $state.params.nested_group_search && !_.isEmpty($state.params.nested_group_search.page) && $state.params.nested_group_search.page !== '1') {
- reloadListStateParams = _.cloneDeep($state.params);
- reloadListStateParams.nested_group_search.page = (parseInt(reloadListStateParams.nested_group_search.page)-1).toString();
- }
-
- // Reload the inventory manage page and show that the group has been removed
- $state.go('.', reloadListStateParams, {reload: true});
- });
-
- let closeModal = function(){
- $('#group-disassociate-modal').modal('hide');
- $('body').removeClass('modal-open');
- $('.modal-backdrop').remove();
- };
-
- GroupsService.disassociateGroup($scope.toDisassociate.id, $scope.disassociateFrom.id)
- .then(() => {
- closeModal();
- }).catch((error) => {
- closeModal();
- ProcessErrors(null, error.data, error.status, null, {
- hdr: 'Error!',
- msg: 'Failed to disassociate group from parent group: POST returned status' +
- error.status
- });
- });
- };
-
- $scope.editGroup = function(id){
- if ($state.includes('inventories.edit.groups')) {
- $state.go('inventories.edit.groups.edit', {group_id: id});
- } else if ($state.includes('inventories.edit.rootGroups')) {
- $state.go('inventories.edit.rootGroups.edit', {group_id: id});
- }
- };
-
- $scope.goToGroupGroups = function(id){
- $state.go('inventories.edit.groups.edit.nested_groups', {group_id: id});
- };
-
- var cleanUpStateChangeListener = $transitions.onSuccess({}, function(trans) {
- if (trans.to().name === "inventories.edit.groups.edit.nested_groups.edit") {
- $scope.rowBeingEdited = trans.params('to').group_id;
- $scope.listBeingEdited = "groups";
- }
- else {
- delete $scope.rowBeingEdited;
- delete $scope.listBeingEdited;
- }
- });
-
- // Remove the listener when the scope is destroyed to avoid a memory leak
- $scope.$on('$destroy', function() {
- cleanUpStateChangeListener();
- });
-
- $scope.setAdhocPattern = function(){
- var pattern = _($scope.groupsSelected)
- .map(function(item){
- return item.name;
- }).value().join(':');
-
- $state.go('inventories.edit.adhoc', {pattern: pattern});
- };
-
- }];
diff --git a/awx/ui/client/src/inventories-hosts/inventories/related/groups/related/nested-groups/group-nested-groups.form.js b/awx/ui/client/src/inventories-hosts/inventories/related/groups/related/nested-groups/group-nested-groups.form.js
deleted file mode 100644
index adc2cab8ab..0000000000
--- a/awx/ui/client/src/inventories-hosts/inventories/related/groups/related/nested-groups/group-nested-groups.form.js
+++ /dev/null
@@ -1,94 +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 ['i18n',
-function(i18n){
- return {
- addTitle: i18n._('CREATE GROUP'),
- editTitle: '{{ name }}',
- showTitle: true,
- name: 'nested_group',
- iterator: "nested_group",
- basePath: 'groups',
- parent: 'inventories.edit.groups.edit.nested_groups',
- // the parent node this generated state definition tree expects to attach to
- stateTree: 'inventories',
- // 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: 'inventories.edit.groups.edit.nested_groups.edit',
- detailsClick: "$state.go('inventories.edit.groups.edit.nested_groups.edit')",
- well: false,
- tabs: true,
- fields: {
- name: {
- label: i18n._('Name'),
- type: 'text',
- ngDisabled: '!(group_obj.summary_fields.user_capabilities.edit || canAdd)',
- required: true,
- tab: 'properties'
- },
- description: {
- label: i18n._('Description'),
- type: 'text',
- ngDisabled: '!(group_obj.summary_fields.user_capabilities.edit || canAdd)',
- tab: 'properties'
- },
- nested_group_variables: {
- realName: 'variables',
- label: i18n._('Variables'),
- type: 'textarea',
- class: 'Form-textAreaLabel Form-formGroup--fullWidth',
- rows: 6,
- 'default': '---',
- dataTitle: i18n._('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'
- }
- },
-
- 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: {
- nested_groups: {
- name: 'related_groups',
- ngClick: "$state.go('inventories.edit.groups.edit.related_groups')",
- title: i18n._('Groups'),
- iterator: 'related_group'
- },
-
- }
- };
-}];
diff --git a/awx/ui/client/src/inventories-hosts/inventories/related/groups/related/nested-groups/group-nested-groups.list.js b/awx/ui/client/src/inventories-hosts/inventories/related/groups/related/nested-groups/group-nested-groups.list.js
deleted file mode 100644
index 8041662dc3..0000000000
--- a/awx/ui/client/src/inventories-hosts/inventories/related/groups/related/nested-groups/group-nested-groups.list.js
+++ /dev/null
@@ -1,106 +0,0 @@
-/*************************************************
- * Copyright (c) 2017 Ansible, Inc.
- *
- * All Rights Reserved
- *************************************************/
-
- export default ['i18n', function(i18n) {
- return {
- name: 'nested_groups',
- iterator: 'nested_group',
- editTitle: '{{ inventory.name }}',
- well: true,
- wellOverride: true,
- index: false,
- hover: true,
- multiSelect: true,
- trackBy: 'nested_group.id',
- basePath: 'api/v2/groups/{{$stateParams.group_id}}/children/',
- layoutClass: 'List-staticColumnLayout--groups',
- fields: {
- name: {
- label: i18n._('Groups'),
- key: true,
- uiSref: "inventories.edit.groups.edit({group_id:nested_group.id})",
- columnClass: 'col-lg-6 col-md-6 col-sm-6 col-xs-6',
- }
- },
-
- actions: {
- refresh: {
- mode: 'all',
- awToolTip: i18n._("Refresh the page"),
- ngClick: "refreshGroups()",
- ngShow: "socketStatus == 'error'",
- actionClass: 'btn List-buttonDefault',
- buttonContent: i18n._('REFRESH')
- },
- launch: {
- mode: 'all',
- ngDisabled: '!groupsSelected',
- ngClick: 'setAdhocPattern()',
- awToolTip: i18n._("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."),
- dataPlacement: 'top',
- actionClass: 'btn List-buttonDefault',
- buttonContent: i18n._('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"
- },
- add: {
- mode: 'all',
- type: 'buttonDropdown',
- awToolTip: i18n._("Add a group"),
- actionClass: 'at-Button--add',
- actionId: 'button-add',
- ngShow: 'canAdd',
- dataPlacement: "top",
- options: [
- {
- optionContent: i18n._('Existing Group'),
- optionSref: '.associate',
- ngShow: 'canAdd'
- },
- {
- optionContent: i18n._('New Group'),
- optionSref: '.add',
- ngShow: 'canAdd'
- }
- ],
- }
- },
-
- fieldActions: {
-
- columnClass: 'col-lg-6 col-md-6 col-sm-6 col-xs-6 text-right',
-
- edit: {
- mode: 'all',
- ngClick: "editGroup(nested_group.id)",
- awToolTip: i18n._('Edit group'),
- dataPlacement: "top",
- ngShow: "nested_group.summary_fields.user_capabilities.edit"
- },
- view: {
- mode: 'all',
- ngClick: "editGroup(nested_group.id)",
- awToolTip: i18n._('View group'),
- dataPlacement: "top",
- ngShow: "!nested_group.summary_fields.user_capabilities.edit"
- },
- "delete": {
- mode: 'all',
- ngClick: "disassociateGroup(nested_group)",
- awToolTip: i18n._('Disassociate group'),
- iconClass: 'fa fa-times',
- dataPlacement: "top",
- ngShow: "nested_group.summary_fields.user_capabilities.delete"
- }
- }
- };
-}];
diff --git a/awx/ui/client/src/inventories-hosts/inventories/related/groups/related/nested-groups/group-nested-groups.route.js b/awx/ui/client/src/inventories-hosts/inventories/related/groups/related/nested-groups/group-nested-groups.route.js
deleted file mode 100644
index 66495716ac..0000000000
--- a/awx/ui/client/src/inventories-hosts/inventories/related/groups/related/nested-groups/group-nested-groups.route.js
+++ /dev/null
@@ -1,80 +0,0 @@
-import {templateUrl} from '../../../../../../shared/template-url/template-url.factory';
-import { N_ } from '../../../../../../i18n';
-
-export default {
- name: 'inventories.edit.groups.edit.nested_groups',
- url: "/nested_groups?{nested_group_search:queryset}",
- params: {
- nested_group_search: {
- value: {
- page_size: "20",
- order_by: "name"
- },
- dynamic: true,
- squash: ""
- }
- },
- ncyBreadcrumb: {
- parent: "inventories.edit.groups.edit",
- label: N_("ASSOCIATED GROUPS")
- },
- views: {
- // 'related@inventories.edit.groups.edit': {
- 'related': {
- templateProvider: function(NestedGroupListDefinition, generateList, $templateRequest) {
- let list = _.cloneDeep(NestedGroupListDefinition);
-
- let html = generateList.build({
- list: list,
- mode: 'edit'
- });
-
- return $templateRequest(templateUrl('inventories-hosts/inventories/related/groups/related/nested-groups/group-nested-groups-disassociate')).then((template) => {
- return html.concat(template);
- });
- },
- controller: 'NestedGroupsListController'
- }
- },
- resolve: {
- Dataset: ['NestedGroupListDefinition', 'QuerySet', '$stateParams', 'GetBasePath', '$interpolate', '$rootScope',
- (list, qs, $stateParams, GetBasePath, $interpolate, $rootScope) => {
- // allow related list definitions to use interpolated $rootScope / $stateParams in basePath field
- let path, interpolator;
- if (GetBasePath(list.basePath)) {
- path = GetBasePath(list.basePath);
- } else {
- interpolator = $interpolate(list.basePath);
- path = interpolator({ $rootScope: $rootScope, $stateParams: $stateParams });
- }
- if($stateParams.group_id){
- path = GetBasePath('groups') + $stateParams.group_id + '/children';
- }
- else if($stateParams.host_id){
- path = GetBasePath('hosts') + $stateParams.host_id + '/all_groups';
- }
- return qs.search(path, $stateParams[`${list.iterator}_search`]);
- }
- ],
- host: ['$stateParams', 'HostsService', function($stateParams, HostsService) {
- if($stateParams.host_id){
- return HostsService.get({ id: $stateParams.host_id }).then(function(res) {
- return res.data.results[0];
- });
- }
- }],
- inventoryData: ['InventoriesService', '$stateParams', 'host', function(InventoriesService, $stateParams, host) {
- var id = ($stateParams.inventory_id) ? $stateParams.inventory_id : host.summary_fields.inventory.id;
- return InventoriesService.getInventory(id).then(res => res.data);
- }],
- canAdd: ['rbacUiControlService', '$state', 'GetBasePath', '$stateParams', function(rbacUiControlService, $state, GetBasePath, $stateParams) {
- return rbacUiControlService.canAdd(GetBasePath('inventory') + $stateParams.inventory_id + "/groups")
- .then(function(res) {
- return res.canAdd;
- })
- .catch(function() {
- return false;
- });
- }]
- }
-};
diff --git a/awx/ui/client/src/inventories-hosts/inventories/related/groups/related/nested-groups/main.js b/awx/ui/client/src/inventories-hosts/inventories/related/groups/related/nested-groups/main.js
deleted file mode 100644
index 445854d120..0000000000
--- a/awx/ui/client/src/inventories-hosts/inventories/related/groups/related/nested-groups/main.js
+++ /dev/null
@@ -1,17 +0,0 @@
-/*************************************************
- * Copyright (c) 2017 Ansible, Inc.
- *
- * All Rights Reserved
- *************************************************/
-
-import nestedGroupListDefinition from './group-nested-groups.list';
-import controller from './group-nested-groups-list.controller';
-import addController from './group-nested-groups-add.controller';
-import NestedGroupForm from './group-nested-groups.form';
-
-export default
- angular.module('nestedGroups', [])
- .factory('NestedGroupForm', NestedGroupForm)
- .factory('NestedGroupListDefinition', nestedGroupListDefinition)
- .controller('NestedGroupsListController', controller)
- .controller('NestedGroupsAddController', addController);
diff --git a/awx/ui/client/src/inventories-hosts/inventories/related/groups/related/nested-hosts/group-nested-hosts-add.controller.js b/awx/ui/client/src/inventories-hosts/inventories/related/groups/related/nested-hosts/group-nested-hosts-add.controller.js
deleted file mode 100644
index 85019412e2..0000000000
--- a/awx/ui/client/src/inventories-hosts/inventories/related/groups/related/nested-hosts/group-nested-hosts-add.controller.js
+++ /dev/null
@@ -1,49 +0,0 @@
-/*************************************************
- * Copyright (c) 2016 Ansible, Inc.
- *
- * All Rights Reserved
- *************************************************/
-
-export default ['$state', '$stateParams', '$scope', 'RelatedHostsFormDefinition', 'ParseTypeChange',
- 'GenerateForm', 'HostsService', 'ToJSON', 'canAdd', 'GroupsService',
- function($state, $stateParams, $scope, RelatedHostsFormDefinition, ParseTypeChange,
- GenerateForm, HostsService, ToJSON, canAdd, GroupsService) {
-
- init();
-
- function init() {
- $scope.canAdd = canAdd;
- $scope.parseType = 'yaml';
- $scope.host = { enabled: true };
- // apply form definition's default field values
- GenerateForm.applyDefaults(RelatedHostsFormDefinition, $scope);
-
- ParseTypeChange({
- scope: $scope,
- field_id: 'host_host_variables',
- variable: 'host_variables',
- parse_variable: 'parseType'
- });
- }
- $scope.formCancel = function() {
- $state.go('^');
- };
- $scope.toggleHostEnabled = function() {
- $scope.host.enabled = !$scope.host.enabled;
- };
- $scope.formSave = function(){
- var json_data = ToJSON($scope.parseType, $scope.host_variables, true),
- params = {
- variables: json_data,// $scope.variables === '---' || $scope.variables === '{}' ? null : $scope.variables,
- name: $scope.name,
- description: $scope.description,
- enabled: $scope.host.enabled,
- inventory: $stateParams.inventory_id
- };
- HostsService.post(params).then(function(res) {
- return GroupsService.associateHost(res.data, $stateParams.group_id)
- .then(() => $state.go('^', null, { reload: true }));
- });
- };
- }
-];
diff --git a/awx/ui/client/src/inventories-hosts/inventories/related/groups/related/nested-hosts/group-nested-hosts-add.route.js b/awx/ui/client/src/inventories-hosts/inventories/related/groups/related/nested-hosts/group-nested-hosts-add.route.js
deleted file mode 100644
index 438aa4a5f2..0000000000
--- a/awx/ui/client/src/inventories-hosts/inventories/related/groups/related/nested-hosts/group-nested-hosts-add.route.js
+++ /dev/null
@@ -1,33 +0,0 @@
-import { N_ } from '../../../../../../i18n';
-
-export default {
- name: "inventories.edit.groups.edit.nested_hosts.add",
- url: "/add",
- ncyBreadcrumb: {
- parent: "inventories.edit.groups.edit.nested_hosts",
- label: N_("CREATE HOST")
- },
- views: {
- 'hostForm@inventories': {
- templateProvider: function(GenerateForm, RelatedHostsFormDefinition, NestedHostsFormDefinition, $stateParams) {
- let form = ($stateParams.group_id) ? NestedHostsFormDefinition : RelatedHostsFormDefinition;
- return GenerateForm.buildHTML(form, {
- mode: 'add',
- related: false
- });
- },
- controller: 'NestedHostsAddController'
- }
- },
- resolve: {
- canAdd: ['rbacUiControlService', 'GetBasePath', '$stateParams', function(rbacUiControlService, GetBasePath, $stateParams) {
- return rbacUiControlService.canAdd(GetBasePath('inventory') + $stateParams.inventory_id + "/hosts")
- .then(function(res) {
- return res.canAdd;
- })
- .catch(function() {
- return false;
- });
- }]
- }
-};
diff --git a/awx/ui/client/src/inventories-hosts/inventories/related/groups/related/nested-hosts/group-nested-hosts-associate.route.js b/awx/ui/client/src/inventories-hosts/inventories/related/groups/related/nested-hosts/group-nested-hosts-associate.route.js
deleted file mode 100644
index 220a5a4285..0000000000
--- a/awx/ui/client/src/inventories-hosts/inventories/related/groups/related/nested-hosts/group-nested-hosts-associate.route.js
+++ /dev/null
@@ -1,32 +0,0 @@
-export default {
- name: 'inventories.edit.groups.edit.nested_hosts.associate',
- squashSearchUrl: true,
- url: '/associate',
- ncyBreadcrumb:{
- skip:true
- },
- views: {
- 'modal@^.^': {
- templateProvider: function() {
- return `
`;
- },
- controller: function($scope, $q, GroupsService, $state){
- $scope.associateHosts = function(selectedItems){
- var deferred = $q.defer();
- return $q.all( _.map(selectedItems, (selectedItem) => GroupsService.associateHost({id: selectedItem.id}, $state.params.group_id)) )
- .then( () =>{
- deferred.resolve();
- }, (error) => {
- deferred.reject(error);
- });
- };
- }
- }
- },
- onExit: function($state) {
- if ($state.transition) {
- $('#associate-groups-modal').modal('hide');
- $('body').removeClass('modal-open');
- }
- },
-};
diff --git a/awx/ui/client/src/inventories-hosts/inventories/related/groups/related/nested-hosts/group-nested-hosts-disassociate.partial.html b/awx/ui/client/src/inventories-hosts/inventories/related/groups/related/nested-hosts/group-nested-hosts-disassociate.partial.html
deleted file mode 100644
index 0ba72e03e0..0000000000
--- a/awx/ui/client/src/inventories-hosts/inventories/related/groups/related/nested-hosts/group-nested-hosts-disassociate.partial.html
+++ /dev/null
@@ -1,36 +0,0 @@
-
-
-
-
-
-
-
Are you sure you want to disassociate the host below from {{disassociateFrom.name}}?Note that only hosts directly in this group can be disassociated. Hosts in sub-groups must be disassociated directly from the sub-group level that they belong.
-
{{ toDisassociate.name }}
-
-
-
-
-
-
diff --git a/awx/ui/client/src/inventories-hosts/inventories/related/groups/related/nested-hosts/group-nested-hosts-list.controller.js b/awx/ui/client/src/inventories-hosts/inventories/related/groups/related/nested-hosts/group-nested-hosts-list.controller.js
deleted file mode 100644
index 07fe46ea95..0000000000
--- a/awx/ui/client/src/inventories-hosts/inventories/related/groups/related/nested-hosts/group-nested-hosts-list.controller.js
+++ /dev/null
@@ -1,169 +0,0 @@
-/*************************************************
- * Copyright (c) 2017 Ansible, Inc.
- *
- * All Rights Reserved
- *************************************************/
-
-export default ['$scope', 'NestedHostsListDefinition', '$rootScope', 'GetBasePath',
- 'rbacUiControlService', 'Dataset', '$state', '$filter', 'Prompt', 'Wait',
- 'HostsService', 'SetStatus', 'canAdd', 'GroupsService', 'ProcessErrors', 'groupData', 'inventoryData', 'InventoryHostsStrings',
- '$transitions',
- function($scope, NestedHostsListDefinition, $rootScope, GetBasePath,
- rbacUiControlService, Dataset, $state, $filter, Prompt, Wait,
- HostsService, SetStatus, canAdd, GroupsService, ProcessErrors, groupData, inventoryData, InventoryHostsStrings,
- $transitions) {
-
- let list = NestedHostsListDefinition;
-
- init();
-
- function init(){
- $scope.canAdd = canAdd;
- $scope.enableSmartInventoryButton = false;
- $scope.disassociateFrom = groupData;
- $scope.smartInventoryButtonTooltip = InventoryHostsStrings.get('smartinventorybutton.DISABLED_INSTRUCTIONS');
-
- // Search init
- $scope.list = list;
- $scope[`${list.iterator}_dataset`] = Dataset.data;
- $scope[list.name] = $scope[`${list.iterator}_dataset`].results;
-
- $scope.inventory_obj = inventoryData;
-
- $rootScope.flashMessage = null;
-
- $scope.$watchCollection(list.name, function() {
- $scope[list.name] = _.map($scope.nested_hosts, function(value) {
- angular.forEach(value.summary_fields.groups.results, function(directParentGroup) {
- if(directParentGroup.id === parseInt($state.params.group_id)) {
- value.can_disassociate = true;
- }
- });
- angular.forEach($scope.hostsSelected, function(selectedHost){
- if(selectedHost.id === value.id) {
- value.isSelected = true;
- }
- });
- return value;
- });
- setJobStatus();
- });
-
- $transitions.onSuccess({}, function(trans) {
- if(trans.params('to') && trans.params('to').host_search) {
- let hasMoreThanDefaultKeys = false;
- angular.forEach(trans.params('to').host_search, function(value, key) {
- if(key !== 'order_by' && key !== 'page_size' && key !== 'page') {
- hasMoreThanDefaultKeys = true;
- }
- });
- $scope.enableSmartInventoryButton = hasMoreThanDefaultKeys ? true : false;
- $scope.smartInventoryButtonTooltip = hasMoreThanDefaultKeys ? InventoryHostsStrings.get('smartinventorybutton.ENABLED_INSTRUCTIONS') : InventoryHostsStrings.get('smartinventorybutton.DISABLED_INSTRUCTIONS');
- }
- else {
- $scope.enableSmartInventoryButton = false;
- $scope.smartInventoryButtonTooltip = InventoryHostsStrings.get('smartinventorybutton.DISABLED_INSTRUCTIONS');
- }
- });
-
- $scope.$on('selectedOrDeselected', function(e, value) {
- let item = value.value;
-
- if (value.isSelected) {
- if(!$scope.hostsSelected) {
- $scope.hostsSelected = [];
- }
- $scope.hostsSelected.push(item);
- } else {
- _.remove($scope.hostsSelected, { id: item.id });
- if($scope.hostsSelected.length === 0) {
- $scope.hostsSelected = null;
- }
- }
- });
-
- }
-
- function setJobStatus(){
- _.forEach($scope.nested_hosts, function(value) {
- SetStatus({
- scope: $scope,
- host: value
- });
- });
- }
-
- $scope.associateHost = function(){
- $state.go('inventories.edit.groups.edit.nested_hosts.associate');
- };
- $scope.editHost = function(id){
- $state.go('inventories.edit.hosts.edit', {host_id: id});
- };
- $scope.disassociateHost = function(host){
- $scope.toDisassociate = {};
- angular.extend($scope.toDisassociate, host);
- $('#host-disassociate-modal').modal('show');
- };
-
- $scope.confirmDisassociate = function(){
-
- // Bind an even listener for the modal closing. Trying to $state.go() before the modal closes
- // will mean that these two things are running async and the modal may not finish closing before
- // the state finishes transitioning.
- $('#host-disassociate-modal').off('hidden.bs.modal').on('hidden.bs.modal', function () {
- // Remove the event handler so that we don't end up with multiple bindings
- $('#host-disassociate-modal').off('hidden.bs.modal');
-
- let reloadListStateParams = null;
-
- if($scope.nested_hosts.length === 1 && $state.params.nested_host_search && !_.isEmpty($state.params.nested_host_search.page) && $state.params.nested_host_search.page !== '1') {
- reloadListStateParams = _.cloneDeep($state.params);
- reloadListStateParams.nested_host_search.page = (parseInt(reloadListStateParams.nested_host_search.page)-1).toString();
- }
-
- // Reload the inventory manage page and show that the group has been removed
- $state.go('.', reloadListStateParams, {reload: true});
- });
-
- let closeModal = function(){
- $('#host-disassociate-modal').modal('hide');
- $('body').removeClass('modal-open');
- $('.modal-backdrop').remove();
- };
-
- GroupsService.disassociateHost($scope.toDisassociate.id, $scope.disassociateFrom.id)
- .then(() => {
- closeModal();
- }).catch((error) => {
- closeModal();
- ProcessErrors(null, error.data, error.status, null, {
- hdr: 'Error!',
- msg: 'Failed to disassociate host from group: POST returned status' +
- error.status
- });
- });
- };
-
- $scope.toggleHost = function(event, host) {
- try {
- $(event.target).tooltip('hide');
- } catch (e) {
- // ignore
- }
-
- host.enabled = !host.enabled;
-
- HostsService.put(host).then(function(){
- $state.go($state.current, null, {reload: true});
- });
- };
-
- $scope.setAdhocPattern = function(){
- var pattern = _($scope.hostsSelected)
- .map(function(item){
- return item.name;
- }).value().join(':');
-
- $state.go('inventories.edit.adhoc', {pattern: pattern});
- };
-}];
diff --git a/awx/ui/client/src/inventories-hosts/inventories/related/groups/related/nested-hosts/group-nested-hosts.form.js b/awx/ui/client/src/inventories-hosts/inventories/related/groups/related/nested-hosts/group-nested-hosts.form.js
deleted file mode 100644
index 4f9d8512ab..0000000000
--- a/awx/ui/client/src/inventories-hosts/inventories/related/groups/related/nested-hosts/group-nested-hosts.form.js
+++ /dev/null
@@ -1,118 +0,0 @@
-/*************************************************
- * Copyright (c) 2015 Ansible, Inc.
- *
- * All Rights Reserved
- *************************************************/
-
- /**
- * @ngdoc function
- * @name forms.function:Hosts
- * @description This form is for adding/editing a host on the inventory page
-*/
-
-export default ['i18n',
-function(i18n) {
- return {
-
- addTitle: i18n._('CREATE HOST'),
- editTitle: '{{ host.name }}',
- name: 'host',
- basePath: 'hosts',
- well: false,
- formLabelSize: 'col-lg-3',
- formFieldSize: 'col-lg-9',
- iterator: 'host',
- activeEditState: 'inventories.edit.groups.edit.nested_hosts.edit',
- stateTree: 'inventories.edit.groups.edit.nested_hosts',
- headerFields:{
- enabled: {
- class: 'Form-header-field',
- ngClick: 'toggleHostEnabled(host)',
- type: 'toggle',
- awToolTip: "
" +
- i18n._("Indicates if a host is available and should be included in running jobs.") +
- "
" +
- i18n._("For hosts that are part of an external" +
- " inventory, this may be" +
- " reset by the inventory sync process.") +
- "
",
- dataTitle: i18n._('Host Enabled'),
- }
- },
- fields: {
- name: {
- label: i18n._('Host Name'),
- type: 'text',
- required: true,
- awPopOver: "
" +
- i18n._("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: i18n._('Host Name'),
- dataPlacement: 'right',
- dataContainer: 'body',
- ngDisabled: '!(host.summary_fields.user_capabilities.edit || canAdd)'
- },
- description: {
- label: i18n._('Description'),
- ngDisabled: '!(host.summary_fields.user_capabilities.edit || canAdd)',
- type: 'text'
- },
- host_variables: {
- label: i18n._('Variables'),
- type: 'textarea',
- rows: 6,
- class: 'Form-formGroup--fullWidth',
- "default": "---",
- awPopOver: "
" + i18n._("Enter inventory 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" +
- '
' + i18n.sprintf(i18n._('View JSON examples at %s'), 'www.json.org ') + '
' +
- '
' + i18n.sprintf(i18n._('View YAML examples at %s'), 'docs.ansible.com ') + '
',
- dataTitle: i18n._('Host Variables'),
- dataPlacement: 'right',
- dataContainer: 'body'
- }
- },
-
- buttons: {
- cancel: {
- ngClick: 'formCancel()',
- ngShow: '(host.summary_fields.user_capabilities.edit || canAdd)'
- },
- close: {
- ngClick: 'formCancel()',
- ngShow: '!(host.summary_fields.user_capabilities.edit || canAdd)'
- },
- save: {
- ngClick: 'formSave()',
- ngDisabled: true,
- ngShow: '(host.summary_fields.user_capabilities.edit || canAdd)'
- }
- },
-
- related: {
- ansible_facts: {
- name: 'ansible_facts',
- awToolTip: i18n._('Please save before viewing facts.'),
- dataPlacement: 'top',
- title: i18n._('Facts'),
- skipGenerator: true
- },
- nested_groups: {
- name: 'nested_groups',
- awToolTip: i18n._('Please save before defining groups.'),
- dataPlacement: 'top',
- ngClick: "$state.go('inventories.edit.groups.edit.nested_hosts.edit.nested_groups')",
- title: i18n._('Groups'),
- iterator: 'nested_group'
- }
- }
- };
- }];
diff --git a/awx/ui/client/src/inventories-hosts/inventories/related/groups/related/nested-hosts/group-nested-hosts.list.js b/awx/ui/client/src/inventories-hosts/inventories/related/groups/related/nested-hosts/group-nested-hosts.list.js
deleted file mode 100644
index d0722dcf9e..0000000000
--- a/awx/ui/client/src/inventories-hosts/inventories/related/groups/related/nested-hosts/group-nested-hosts.list.js
+++ /dev/null
@@ -1,155 +0,0 @@
-/*************************************************
- * Copyright (c) 2017 Ansible, Inc.
- *
- * All Rights Reserved
- *************************************************/
-
-export default ['i18n', function(i18n) {
- return {
- name: 'nested_hosts',
- iterator: 'nested_host',
- editTitle: '{{ nested_host.name }}', // i don't think this is correct
- // showTitle: false,
- well: true,
- wellOverride: true,
- index: false,
- hover: true,
- // hasChildren: true,
- multiSelect: true,
- trackBy: 'nested_host.id',
- basePath: 'api/v2/groups/{{$stateParams.group_id}}/all_hosts/',
- layoutClass: 'List-staticColumnLayout--hostsWithCheckbox',
- staticColumns: [
- {
- field: 'toggleHost',
- content: {
- ngDisabled: '!nested_host.summary_fields.user_capabilities.edit',
- label: '',
- columnClass: 'List-staticColumn--toggle',
- type: "toggle",
- ngClick: "toggleHost($event, nested_host)",
- awToolTip: "
" +
- i18n._("Indicates if a host is available and should be included in running jobs.") +
- "
" +
- i18n._("For hosts that are part of an external" +
- " inventory, this flag may be" +
- " reset by the inventory sync process.") +
- "
",
- dataPlacement: "right",
- nosort: true,
- }
- },
- {
- field: 'active_failures',
- content: {
- 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: "{{ nested_host.job_status_html }}",
- dataTitle: "{{ nested_host.job_status_title }}",
- awToolTip: "{{ nested_host.badgeToolTip }}",
- dataPlacement: 'top',
- icon: "{{ 'fa icon-job-' + nested_host.active_failures }}",
- id: 'active-failures-action',
- columnClass: 'status-column List-staticColumn--smallStatus'
- }
- }
- ],
-
- fields: {
- name: {
- key: true,
- label: i18n._('Hosts'),
- uiSref: "inventories.edit.hosts.edit({host_id: nested_host.id})",
- ngClass: "{ 'host-disabled-label': !nested_host.enabled }",
- columnClass: 'col-lg-4 col-md-8 col-sm-8 col-xs-7',
- dataHostId: "{{ nested_host.id }}",
- dataType: "nested_host",
- },
- description: {
- label: i18n._('Description'),
- columnClass: 'd-none d-lg-flex col-lg-4',
- template: `
-
- {{ nested_host.description }}
-
- `
- },
- },
-
- fieldActions: {
-
- columnClass: 'col-lg-4 col-md-4 col-sm-4 col-xs-5 text-right',
- edit: {
- ngClick: "editHost(nested_host.id)",
- icon: 'icon-edit',
- awToolTip: i18n._('Edit host'),
- dataPlacement: 'top',
- ngShow: 'nested_host.summary_fields.user_capabilities.edit'
- },
- view: {
- ngClick: "editHost(nested_host.id)",
- awToolTip: i18n._('View host'),
- dataPlacement: 'top',
- ngShow: '!nested_host.summary_fields.user_capabilities.edit'
- },
- "delete": {
- //label: 'Delete',
- ngClick: "disassociateHost(nested_host)",
- iconClass: 'fa fa-times',
- awToolTip: i18n._('Disassociate host'),
- dataPlacement: 'top',
- ngShow: 'nested_host.summary_fields.user_capabilities.delete'
- }
- },
-
- actions: {
- launch: {
- mode: 'all',
- ngDisabled: '!hostsSelected',
- ngClick: 'setAdhocPattern()',
- awToolTip: i18n._("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."),
- dataPlacement: 'top',
- actionClass: 'btn List-buttonDefault',
- buttonContent: i18n._('RUN COMMANDS'),
- showTipWhenDisabled: true,
- tooltipInnerClass: "Tooltip-wide",
- // TODO: we don't always want to show this
- ngShow: 'inventory_obj.summary_fields.user_capabilities.adhoc'
- },
- refresh: {
- mode: 'all',
- awToolTip: i18n._("Refresh the page"),
- ngClick: "refreshGroups()",
- ngShow: "socketStatus == 'error'",
- actionClass: 'btn List-buttonDefault',
- buttonContent: i18n._('REFRESH')
- },
- add: {
- mode: 'all',
- type: 'buttonDropdown',
- awToolTip: i18n._("Add a host"),
- actionClass: 'at-Button--add',
- actionId: 'button-add',
- ngShow: 'canAdd',
- dataPlacement: "top",
- options: [
- {
- optionContent: i18n._('Existing Host'),
- optionSref: '.associate',
- ngShow: 'canAdd'
- },
- {
- optionContent: i18n._('New Host'),
- optionSref: '.add',
- ngShow: 'canAdd'
- }
- ],
- }
- }
- };
-}];
diff --git a/awx/ui/client/src/inventories-hosts/inventories/related/groups/related/nested-hosts/group-nested-hosts.route.js b/awx/ui/client/src/inventories-hosts/inventories/related/groups/related/nested-hosts/group-nested-hosts.route.js
deleted file mode 100644
index 456da422d9..0000000000
--- a/awx/ui/client/src/inventories-hosts/inventories/related/groups/related/nested-hosts/group-nested-hosts.route.js
+++ /dev/null
@@ -1,66 +0,0 @@
-import { N_ } from '../../../../../../i18n';
-import {templateUrl} from '../../../../../../shared/template-url/template-url.factory';
-
-export default {
- name: "inventories.edit.groups.edit.nested_hosts",
- url: "/nested_hosts?{nested_host_search:queryset}",
- params: {
- nested_host_search: {
- value: {
- page_size: "20",
- order_by: "name"
- },
- dynamic: true,
- squash: ""
- }
- },
- ncyBreadcrumb: {
- parent: "inventories.edit.groups.edit",
- label: N_("ASSOCIATED HOSTS")
- },
- views: {
- // 'related@inventories.edit.groups.edit': {
- 'related': {
- templateProvider: function(NestedHostsListDefinition, generateList, $templateRequest) {
- let list = _.cloneDeep(NestedHostsListDefinition);
-
- let html = generateList.build({
- list: list,
- mode: 'edit'
- });
- return $templateRequest(templateUrl('inventories-hosts/inventories/related/groups/related/nested-hosts/group-nested-hosts-disassociate')).then((template) => {
- return html.concat(template);
- });
- },
- controller: 'NestedHostsListController'
- }
- },
- resolve: {
- Dataset: ['NestedHostsListDefinition', 'QuerySet', '$stateParams', 'GetBasePath', '$interpolate', '$rootScope',
- (list, qs, $stateParams, GetBasePath, $interpolate, $rootScope) => {
- // allow related list definitions to use interpolated $rootScope / $stateParams in basePath field
- let path, interpolator;
- if (GetBasePath(list.basePath)) {
- path = GetBasePath(list.basePath);
- } else {
- interpolator = $interpolate(list.basePath);
- path = interpolator({ $rootScope: $rootScope, $stateParams: $stateParams });
- }
- path = `api/v2/groups/${$stateParams.group_id}/all_hosts`;
- return qs.search(path, $stateParams[`${list.iterator}_search`]);
- }
- ],
- inventoryData: ['InventoriesService', '$stateParams', function(InventoriesService, $stateParams) {
- return InventoriesService.getInventory($stateParams.inventory_id).then(res => res.data);
- }],
- canAdd: ['rbacUiControlService', function(rbacUiControlService) {
- return rbacUiControlService.canAdd('hosts')
- .then(function(res) {
- return res.canAdd;
- })
- .catch(function() {
- return false;
- });
- }]
- }
-};
diff --git a/awx/ui/client/src/inventories-hosts/inventories/related/groups/related/nested-hosts/main.js b/awx/ui/client/src/inventories-hosts/inventories/related/groups/related/nested-hosts/main.js
deleted file mode 100644
index 6905795f3d..0000000000
--- a/awx/ui/client/src/inventories-hosts/inventories/related/groups/related/nested-hosts/main.js
+++ /dev/null
@@ -1,17 +0,0 @@
-/*************************************************
- * Copyright (c) 2017 Ansible, Inc.
- *
- * All Rights Reserved
- *************************************************/
-
-import nestedHostsListDefinition from './group-nested-hosts.list';
-import nestedHostsFormDefinition from './group-nested-hosts.form';
-import controller from './group-nested-hosts-list.controller';
-import addController from './group-nested-hosts-add.controller';
-
-export default
- angular.module('nestedHosts', [])
- .factory('NestedHostsListDefinition', nestedHostsListDefinition)
- .factory('NestedHostsFormDefinition', nestedHostsFormDefinition)
- .controller('NestedHostsAddController', addController)
- .controller('NestedHostsListController', controller);
diff --git a/awx/ui/client/src/inventories-hosts/inventories/related/hosts/add/host-add.controller.js b/awx/ui/client/src/inventories-hosts/inventories/related/hosts/add/host-add.controller.js
deleted file mode 100644
index 37f3eefc8f..0000000000
--- a/awx/ui/client/src/inventories-hosts/inventories/related/hosts/add/host-add.controller.js
+++ /dev/null
@@ -1,41 +0,0 @@
-/*************************************************
- * Copyright (c) 2016 Ansible, Inc.
- *
- * All Rights Reserved
- *************************************************/
-
-export default ['$state', '$stateParams', '$scope', 'RelatedHostsFormDefinition',
- 'GenerateForm', 'HostsService', 'ToJSON', 'canAdd',
- function($state, $stateParams, $scope, RelatedHostsFormDefinition,
- GenerateForm, HostsService, ToJSON, canAdd) {
-
- init();
-
- function init() {
- $scope.canAdd = canAdd;
- $scope.host = { enabled: true };
- // apply form definition's default field values
- GenerateForm.applyDefaults(RelatedHostsFormDefinition, $scope);
- }
- $scope.formCancel = function() {
- $state.go('^');
- };
- $scope.toggleHostEnabled = function() {
- $scope.host.enabled = !$scope.host.enabled;
- };
- $scope.formSave = function(){
- var json_data = ToJSON($scope.parseType, $scope.host_variables, true),
- params = {
- variables: json_data,// $scope.variables === '---' || $scope.variables === '{}' ? null : $scope.variables,
- name: $scope.name,
- description: $scope.description,
- enabled: $scope.host.enabled,
- inventory: $stateParams.inventory_id
- };
- HostsService.post(params).then(function(res) {
- $state.go('^.edit', { host_id: res.data.id }, { reload: true });
- })
- .catch(function(){});
- };
- }
-];
diff --git a/awx/ui/client/src/inventories-hosts/inventories/related/hosts/add/host-add.route.js b/awx/ui/client/src/inventories-hosts/inventories/related/hosts/add/host-add.route.js
deleted file mode 100644
index 7621eeb045..0000000000
--- a/awx/ui/client/src/inventories-hosts/inventories/related/hosts/add/host-add.route.js
+++ /dev/null
@@ -1,22 +0,0 @@
-import { N_ } from '../../../../../i18n';
-
-export default {
- name: "inventories.edit.hosts.add",
- url: "/add",
- ncyBreadcrumb: {
- parent: "inventories.edit.hosts",
- label: N_("CREATE HOST")
- },
- views: {
- 'hostForm@inventories': {
- templateProvider: function(GenerateForm, RelatedHostsFormDefinition) {
- let form = RelatedHostsFormDefinition;
- return GenerateForm.buildHTML(form, {
- mode: 'add',
- related: false
- });
- },
- controller: 'RelatedHostAddController'
- }
- },
-};
diff --git a/awx/ui/client/src/inventories-hosts/inventories/related/hosts/add/main.js b/awx/ui/client/src/inventories-hosts/inventories/related/hosts/add/main.js
deleted file mode 100644
index 7a55327c9f..0000000000
--- a/awx/ui/client/src/inventories-hosts/inventories/related/hosts/add/main.js
+++ /dev/null
@@ -1,11 +0,0 @@
-/*************************************************
- * Copyright (c) 2017 Ansible, Inc.
- *
- * All Rights Reserved
- *************************************************/
-
-import controller from './host-add.controller';
-
-export default
-angular.module('relatedHostsAdd', [])
- .controller('RelatedHostAddController', controller);
diff --git a/awx/ui/client/src/inventories-hosts/inventories/related/hosts/edit/host-edit.controller.js b/awx/ui/client/src/inventories-hosts/inventories/related/hosts/edit/host-edit.controller.js
deleted file mode 100644
index e54127f176..0000000000
--- a/awx/ui/client/src/inventories-hosts/inventories/related/hosts/edit/host-edit.controller.js
+++ /dev/null
@@ -1,46 +0,0 @@
-/*************************************************
- * Copyright (c) 2016 Ansible, Inc.
- *
- * All Rights Reserved
- *************************************************/
-
- export default
- ['$scope', '$state', 'HostsService', 'host', '$rootScope',
- function($scope, $state, HostsService, host, $rootScope){
- $scope.isSmartInvHost = $state.includes('inventories.editSmartInventory.hosts.edit');
- $scope.parseType = 'yaml';
- $scope.formCancel = function(){
- $state.go('^', null, {reload: true});
- };
- $scope.toggleHostEnabled = function(){
- $scope.host.enabled = !$scope.host.enabled;
- };
- $scope.toggleEnabled = function(){
- $scope.host.enabled = !$scope.host.enabled;
- };
- $scope.formSave = function(){
- var host = {
- id: $scope.host.id,
- variables: $scope.host_variables === '---' || $scope.host_variables === '{}' ? null : $scope.host_variables,
- name: $scope.name,
- description: $scope.description,
- enabled: $scope.host.enabled
- };
- if (typeof $scope.host.instance_id !== 'undefined') {
- host.instance_id = $scope.host.instance_id;
- }
- HostsService.put(host).then(function(){
- $state.go('.', null, {reload: true});
- });
-
- };
- var init = function(){
- $scope.host = host;
- $scope.name = host.name;
- $rootScope.breadcrumb.host_name = host.name;
- $scope.description = host.description;
- $scope.host_variables = host.variables;
- };
-
- init();
- }];
diff --git a/awx/ui/client/src/inventories-hosts/inventories/related/hosts/edit/main.js b/awx/ui/client/src/inventories-hosts/inventories/related/hosts/edit/main.js
deleted file mode 100644
index 9536f686dc..0000000000
--- a/awx/ui/client/src/inventories-hosts/inventories/related/hosts/edit/main.js
+++ /dev/null
@@ -1,10 +0,0 @@
-/*************************************************
- * Copyright (c) 2017 Ansible, Inc.
- *
- * All Rights Reserved
- *************************************************/
-import controller from './host-edit.controller';
-
-export default
-angular.module('relatedHostEdit', [])
- .controller('RelatedHostEditController', controller);
diff --git a/awx/ui/client/src/inventories-hosts/inventories/related/hosts/edit/smart-host-edit.route.js b/awx/ui/client/src/inventories-hosts/inventories/related/hosts/edit/smart-host-edit.route.js
deleted file mode 100644
index 033e6054ca..0000000000
--- a/awx/ui/client/src/inventories-hosts/inventories/related/hosts/edit/smart-host-edit.route.js
+++ /dev/null
@@ -1,29 +0,0 @@
-export default {
- name: "inventories.editSmartInventory.hosts.edit",
- url: "/edit/:host_id",
- ncyBreadcrumb: {
- parent: "inventories.editSmartInventory.hosts",
- label: "{{breadcrumb.host_name}}"
- },
- views: {
- 'hostForm@inventories': {
- templateProvider: function(GenerateForm, RelatedHostsFormDefinition) {
- let form = _.cloneDeep(RelatedHostsFormDefinition);
- form.stateTree = 'inventories.editSmartInventory.hosts';
- delete form.related;
- return GenerateForm.buildHTML(form, {
- mode: 'edit',
- related: false
- });
- },
- controller: 'RelatedHostEditController'
- }
- },
- resolve: {
- host: ['$stateParams', 'InventoriesService', function($stateParams, InventoriesService) {
- return InventoriesService.getHost($stateParams.smartinventory_id, $stateParams.host_id).then(function(res) {
- return res.data.results[0];
- });
- }]
- }
-};
diff --git a/awx/ui/client/src/inventories-hosts/inventories/related/hosts/edit/standard-host-edit.route.js b/awx/ui/client/src/inventories-hosts/inventories/related/hosts/edit/standard-host-edit.route.js
deleted file mode 100644
index 432037658f..0000000000
--- a/awx/ui/client/src/inventories-hosts/inventories/related/hosts/edit/standard-host-edit.route.js
+++ /dev/null
@@ -1,25 +0,0 @@
-export default {
- name: "inventories.edit.hosts.edit",
- url: "/edit/:host_id",
- ncyBreadcrumb: {
- parent: "inventories.edit.hosts",
- label: "{{breadcrumb.host_name}}"
- },
- views: {
- 'hostForm@inventories': {
- templateProvider: function(GenerateForm, RelatedHostsFormDefinition) {
- let form = RelatedHostsFormDefinition;
- return GenerateForm.buildHTML(form, {
- mode: 'edit',
- related: false
- });
- },
- controller: 'RelatedHostEditController'
- }
- },
- resolve: {
- host: ['$stateParams', 'HostsService', function($stateParams, HostsService) {
- return HostsService.get({ id: $stateParams.host_id }).then((response) => response.data.results[0]);
- }]
- }
-};
diff --git a/awx/ui/client/src/inventories-hosts/inventories/related/hosts/list/host-list.controller.js b/awx/ui/client/src/inventories-hosts/inventories/related/hosts/list/host-list.controller.js
deleted file mode 100644
index cf79463247..0000000000
--- a/awx/ui/client/src/inventories-hosts/inventories/related/hosts/list/host-list.controller.js
+++ /dev/null
@@ -1,167 +0,0 @@
-/*************************************************
- * Copyright (c) 2017 Ansible, Inc.
- *
- * All Rights Reserved
- *************************************************/
-
-// import HostsService from './../hosts/host.service';
-export default ['$scope', 'ListDefinition', '$rootScope', 'GetBasePath',
- 'rbacUiControlService', 'Dataset', '$state', '$filter', 'Prompt', 'Wait',
- 'HostsService', 'SetStatus', 'canAdd', 'i18n', 'InventoryHostsStrings', '$transitions',
- function($scope, ListDefinition, $rootScope, GetBasePath,
- rbacUiControlService, Dataset, $state, $filter, Prompt, Wait,
- HostsService, SetStatus, canAdd, i18n, InventoryHostsStrings, $transitions) {
-
- let list = ListDefinition;
-
- init();
-
- function init(){
- $scope.canAdd = canAdd;
- $scope.enableSmartInventoryButton = false;
- $scope.smartInventoryButtonTooltip = InventoryHostsStrings.get('smartinventorybutton.DISABLED_INSTRUCTIONS');
-
- // Search init
- $scope.list = list;
- $scope[`${list.iterator}_dataset`] = Dataset.data;
- $scope[list.name] = $scope[`${list.iterator}_dataset`].results;
-
- $rootScope.flashMessage = null;
-
- $scope.$watchCollection(list.name, function() {
- $scope[list.name] = _.map($scope.hosts, function(value) {
- value.inventory_name = value.summary_fields.inventory.name;
- value.inventory_id = value.summary_fields.inventory.id;
- angular.forEach($scope.hostsSelected, function(selectedHost){
- if(selectedHost.id === value.id) {
- value.isSelected = true;
- }
- });
- return value;
- });
- setJobStatus();
- });
-
- $transitions.onSuccess({}, function(trans) {
- if(trans.params('to') && trans.params('to').host_search) {
- let hasMoreThanDefaultKeys = false;
- angular.forEach(trans.params('to').host_search, function(value, key) {
- if(key !== 'order_by' && key !== 'page_size' && key !== 'page') {
- hasMoreThanDefaultKeys = true;
- }
- });
- $scope.enableSmartInventoryButton = hasMoreThanDefaultKeys ? true : false;
- $scope.smartInventoryButtonTooltip = hasMoreThanDefaultKeys ? InventoryHostsStrings.get('smartinventorybutton.ENABLED_INSTRUCTIONS') : InventoryHostsStrings.get('smartinventorybutton.DISABLED_INSTRUCTIONS');
- }
- else {
- $scope.enableSmartInventoryButton = false;
- $scope.smartInventoryButtonTooltip = InventoryHostsStrings.get('smartinventorybutton.DISABLED_INSTRUCTIONS');
- }
- });
-
- $scope.$on('selectedOrDeselected', function(e, value) {
- let item = value.value;
-
- if (value.isSelected) {
- if(!$scope.hostsSelected) {
- $scope.hostsSelected = [];
- }
- $scope.hostsSelected.push(item);
- } else {
- _.remove($scope.hostsSelected, { id: item.id });
- if($scope.hostsSelected.length === 0) {
- $scope.hostsSelected = null;
- }
- }
- });
-
- }
-
- function setJobStatus(){
- _.forEach($scope.hosts, function(value) {
- SetStatus({
- scope: $scope,
- host: value
- });
- });
- }
-
- $scope.createHost = function(){
- $state.go('inventories.edit.hosts.add');
- };
- $scope.editHost = function(host){
- if($state.includes('inventories.edit.hosts')) {
- $state.go('inventories.edit.hosts.edit', {host_id: host.id});
- }
- else if($state.includes('inventories.editSmartInventory.hosts')) {
- $state.go('inventories.editSmartInventory.hosts.edit', {host_id: host.id});
- }
- };
- $scope.goToInsights = function(host){
- $state.go('inventories.edit.hosts.edit.insights', {inventory_id: host.inventory_id, host_id:host.id});
- };
- $scope.deleteHost = function(id, name){
- var body = '
' + i18n._('Are you sure you want to permanently delete the host below from the inventory?') + '
' + $filter('sanitize')(name) + '
';
- var action = function(){
- delete $rootScope.promptActionBtnClass;
- Wait('start');
- HostsService.delete(id).then(() => {
- $('#prompt-modal').modal('hide');
-
- let reloadListStateParams = null;
-
- if($scope.hosts.length === 1 && $state.params.host_search && _.has($state, 'params.host_search.page') && $state.params.host_search.page !== '1') {
- reloadListStateParams = _.cloneDeep($state.params);
- reloadListStateParams.host_search.page = (parseInt(reloadListStateParams.host_search.page)-1).toString();
- }
-
- if (parseInt($state.params.host_id) === id) {
- $state.go('^', reloadListStateParams, {reload: true});
- } else {
- $state.go('.', reloadListStateParams, {reload: true});
- }
- Wait('stop');
- });
- };
- // Prompt depends on having $rootScope.promptActionBtnClass available...
- Prompt({
- hdr: i18n._('Delete Host'),
- body: body,
- action: action,
- actionText: i18n._('DELETE'),
- });
- $rootScope.promptActionBtnClass = 'Modal-errorButton';
- };
-
- $scope.toggleHost = function(event, host) {
- try {
- $(event.target).tooltip('hide');
- } catch (e) {
- // ignore
- }
-
- host.enabled = !host.enabled;
-
- HostsService.put(host).then(function(){
- $state.go($state.current, null, {reload: true});
- });
- };
-
- $scope.smartInventory = function() {
- $state.go('inventories.addSmartInventory');
- };
-
- $scope.setAdhocPattern = function(){
- var pattern = _($scope.hostsSelected)
- .map(function(item){
- return item.name;
- }).value().join(':');
-
- if($state.includes('inventories.edit')) {
- $state.go('inventories.edit.adhoc', {pattern: pattern});
- }
- else if($state.includes('inventories.editSmartInventory')) {
- $state.go('inventories.editSmartInventory.adhoc', {pattern: pattern});
- }
- };
-}];
diff --git a/awx/ui/client/src/inventories-hosts/inventories/related/hosts/list/main.js b/awx/ui/client/src/inventories-hosts/inventories/related/hosts/list/main.js
deleted file mode 100644
index 6cb8d2dda5..0000000000
--- a/awx/ui/client/src/inventories-hosts/inventories/related/hosts/list/main.js
+++ /dev/null
@@ -1,11 +0,0 @@
-/*************************************************
- * Copyright (c) 2017 Ansible, Inc.
- *
- * All Rights Reserved
- *************************************************/
-
-import RelatedHostListController from './host-list.controller';
-
-export default
-angular.module('relatedHostList', [])
- .controller('RelatedHostListController', RelatedHostListController);
diff --git a/awx/ui/client/src/inventories-hosts/inventories/related/hosts/main.js b/awx/ui/client/src/inventories-hosts/inventories/related/hosts/main.js
deleted file mode 100644
index 08b0cdc5b6..0000000000
--- a/awx/ui/client/src/inventories-hosts/inventories/related/hosts/main.js
+++ /dev/null
@@ -1,24 +0,0 @@
-/*************************************************
- * Copyright (c) 2017 Ansible, Inc.
- *
- * All Rights Reserved
- *************************************************/
-
- import relatedHostAdd from './add/main';
- import relatedHostEdit from './edit/main';
- import relatedHostList from './list/main';
- import relatedHostsListDefinition from './related-host.list';
- import relatedHostsFormDefinition from './related-host.form';
- import relatedGroupsLabels from './related-groups-labels/main';
- import nestedGroups from './related/nested-groups/main';
-
-export default
-angular.module('relatedHost', [
- relatedHostAdd.name,
- relatedHostEdit.name,
- relatedHostList.name,
- relatedGroupsLabels.name,
- nestedGroups.name
- ])
- .factory('RelatedHostsFormDefinition', relatedHostsFormDefinition)
- .factory('RelatedHostsListDefinition', relatedHostsListDefinition);
diff --git a/awx/ui/client/src/inventories-hosts/inventories/related/hosts/related-groups-labels/main.js b/awx/ui/client/src/inventories-hosts/inventories/related/hosts/related-groups-labels/main.js
deleted file mode 100644
index a3be739b8a..0000000000
--- a/awx/ui/client/src/inventories-hosts/inventories/related/hosts/related-groups-labels/main.js
+++ /dev/null
@@ -1,11 +0,0 @@
-/*************************************************
- * Copyright (c) 2015 Ansible, Inc.
- *
- * All Rights Reserved
- *************************************************/
-
-import relatedGroupsabelsList from './relatedGroupsLabelsList.directive';
-
-export default
- angular.module('relatedGroupsLabels', [])
- .directive('relatedGroupsLabelsList', relatedGroupsabelsList);
diff --git a/awx/ui/client/src/inventories-hosts/inventories/related/hosts/related-groups-labels/relatedGroupsLabelsList.block.less b/awx/ui/client/src/inventories-hosts/inventories/related/hosts/related-groups-labels/relatedGroupsLabelsList.block.less
deleted file mode 100644
index 092a13a041..0000000000
--- a/awx/ui/client/src/inventories-hosts/inventories/related/hosts/related-groups-labels/relatedGroupsLabelsList.block.less
+++ /dev/null
@@ -1,5 +0,0 @@
-.RelatedGroupsLabelsCell{
- width:100%;
- display: flex;
- align-items: center;
-}
diff --git a/awx/ui/client/src/inventories-hosts/inventories/related/hosts/related-groups-labels/relatedGroupsLabelsList.directive.js b/awx/ui/client/src/inventories-hosts/inventories/related/hosts/related-groups-labels/relatedGroupsLabelsList.directive.js
deleted file mode 100644
index 7ecdee5973..0000000000
--- a/awx/ui/client/src/inventories-hosts/inventories/related/hosts/related-groups-labels/relatedGroupsLabelsList.directive.js
+++ /dev/null
@@ -1,104 +0,0 @@
-/* jshint unused: vars */
-export default
- [ 'templateUrl',
- 'Wait',
- 'Rest',
- 'GetBasePath',
- 'ProcessErrors',
- 'Prompt',
- '$q',
- '$filter',
- '$state',
- 'i18n',
- function(templateUrl, Wait, Rest, GetBasePath, ProcessErrors, Prompt, $q, $filter, $state, i18n) {
- return {
- restrict: 'E',
- scope: false,
- templateUrl: templateUrl('inventories-hosts/inventories/related/hosts/related-groups-labels/relatedGroupsLabelsList'),
- link: function(scope, element, attrs) {
- scope.showDelete = attrs.showDelete === 'true';
- scope.seeMoreInactive = true;
-
- var getNext = function(data, arr, resolve) {
- Rest.setUrl(data.next);
- Rest.get()
- .then(({data}) => {
- if (data.next) {
- getNext(data, arr.concat(data.results), resolve);
- } else {
- resolve.resolve(arr.concat(data.results));
- }
- });
- };
-
- scope.seeMore = function () {
- var seeMoreResolve = $q.defer();
- Rest.setUrl(`${scope[scope.$parent.list.iterator].related.groups}?order_by=id`);
- Rest.get()
- .then(({data}) => {
- if (data.next) {
- getNext(data, data.results, seeMoreResolve);
- } else {
- seeMoreResolve.resolve(data.results);
- }
- });
-
- seeMoreResolve.promise.then(function (groups) {
- scope.related_groups = groups;
- scope.seeMoreInactive = false;
- });
- };
-
- scope.seeLess = function() {
- // Trim the groups array back down to 5 items
- scope.related_groups = scope.related_groups.slice(0, 5);
- // Re-set the seeMoreInteractive flag so that the "See More" will be displayed
- scope.seeMoreInactive = true;
- };
-
- scope.deleteLabel = function(host, group) {
- var action = function () {
- $('#prompt-modal').modal('hide');
- scope.seeMoreInactive = true;
- Wait('start');
- let url = `${GetBasePath('groups')}${group.id}/hosts`;
- if(url) {
- Rest.setUrl(url);
- Rest.post({"disassociate": true, "id": host.id})
- .then(() => {
- Wait('stop');
- $state.go('.', null, {reload: true});
- })
- .catch(({data, status}) => {
- Wait('stop');
- ProcessErrors(scope, data, status, null, { hdr: 'Error!',
- msg: 'Could not disassociate host from group. Call to ' + url + ' failed. DELETE returned status: ' + status });
- });
- }
- };
-
- Prompt({
- hdr: i18n._('Remove host from ') + group.name ,
- body: '
' + i18n._('Confirm the removal of the') + ' ' + $filter('sanitize')(host.name) + ' ' + i18n._('from the') + ' ' + $filter('sanitize')(group.name) + ' ' + i18n._('group') + '.
',
- action: action,
- actionText: i18n._('REMOVE')
- });
- };
-
- scope.$watchCollection(scope.$parent.list.iterator, function() {
- // To keep the array of groups fresh, we need to set up a watcher - otherwise, the
- // array will get set initially and then never be updated as groups are removed
- if (scope[scope.$parent.list.iterator].summary_fields.groups){
- scope.related_groups = scope[scope.$parent.list.iterator].summary_fields.groups.results;
- scope.count = scope[scope.$parent.list.iterator].summary_fields.groups.count;
- }
- else{
- scope.related_groups = null;
- scope.count = null;
- }
- });
-
- }
- };
- }
- ];
diff --git a/awx/ui/client/src/inventories-hosts/inventories/related/hosts/related-groups-labels/relatedGroupsLabelsList.partial.html b/awx/ui/client/src/inventories-hosts/inventories/related/hosts/related-groups-labels/relatedGroupsLabelsList.partial.html
deleted file mode 100644
index 8b40988fdd..0000000000
--- a/awx/ui/client/src/inventories-hosts/inventories/related/hosts/related-groups-labels/relatedGroupsLabelsList.partial.html
+++ /dev/null
@@ -1,14 +0,0 @@
-
-
- {{ related_group.name }}
-
-
-
-
-
-
View More
-
View Less
diff --git a/awx/ui/client/src/inventories-hosts/inventories/related/hosts/related-host.form.js b/awx/ui/client/src/inventories-hosts/inventories/related/hosts/related-host.form.js
deleted file mode 100644
index 1e1b935fa7..0000000000
--- a/awx/ui/client/src/inventories-hosts/inventories/related/hosts/related-host.form.js
+++ /dev/null
@@ -1,140 +0,0 @@
-/*************************************************
- * Copyright (c) 2015 Ansible, Inc.
- *
- * All Rights Reserved
- *************************************************/
-
- /**
- * @ngdoc function
- * @name forms.function:Hosts
- * @description This form is for adding/editing a host on the inventory page
-*/
-
-export default ['i18n',
-function(i18n) {
- return {
-
- addTitle: i18n._('CREATE HOST'),
- editTitle: '{{ host.name }}',
- name: 'host',
- basePath: 'hosts',
- well: false,
- formLabelSize: 'col-lg-3',
- formFieldSize: 'col-lg-9',
- iterator: 'host',
- detailsClick: "$state.go('inventories.edit.hosts.edit', null, {reload:true})",
- stateTree: 'inventories.edit.hosts',
- headerFields:{
- enabled: {
- class: 'Form-header-field',
- ngClick: 'toggleHostEnabled(host)',
- type: 'toggle',
- awToolTip: "
" +
- i18n._("Indicates if a host is available and should be included in running jobs.") +
- "
" +
- i18n._("For hosts that are part of an external" +
- " inventory, this may be" +
- " reset by the inventory sync process.") +
- "
",
- dataTitle: i18n._('Host Enabled'),
- dataPlacement: "right",
- ngDisabled: '!host.summary_fields.user_capabilities.edit || isSmartInvHost'
- }
- },
- fields: {
- name: {
- label: i18n._('Host Name'),
- type: 'text',
- required: true,
- awPopOver: "
" +
- i18n._("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: i18n._('Host Name'),
- dataPlacement: 'right',
- dataContainer: 'body',
- ngDisabled: '!(host.summary_fields.user_capabilities.edit || canAdd) || isSmartInvHost'
- },
- description: {
- label: i18n._('Description'),
- ngDisabled: '!(host.summary_fields.user_capabilities.edit || canAdd) || isSmartInvHost',
- type: 'text'
- },
- host_variables: {
- label: i18n._('Variables'),
- type: 'code_mirror',
- class: 'Form-formGroup--fullWidth',
- "default": "---",
- variables: 'host_variables',
- awPopOver: `
${i18n._("Enter inventory variables using either JSON or YAML syntax. Use the radio button to toggle between the two.")}
- JSON:
-
- { "somevar": "somevalue", "password": "magic" }
-
- YAML:
-
- ---
- somevar: somevalue
- password: magic
-
-
${i18n.sprintf(i18n._(
- 'View JSON examples at %s'),
- 'www.json.org '
- )}
-
${i18n.sprintf(i18n._('View YAML examples at %s'), 'docs.ansible.com ')}
`,
- ngDisabled: '!(host.summary_fields.user_capabilities.edit || canAdd) || isSmartInvHost'
- }
- },
-
- buttons: {
- cancel: {
- ngClick: 'formCancel()',
- ngShow: '(host.summary_fields.user_capabilities.edit || canAdd) && !isSmartInvHost'
- },
- close: {
- ngClick: 'formCancel()',
- ngShow: '!(host.summary_fields.user_capabilities.edit || canAdd) || isSmartInvHost'
- },
- save: {
- ngClick: 'formSave()',
- ngDisabled: true,
- ngShow: '(host.summary_fields.user_capabilities.edit || canAdd) && !isSmartInvHost'
- }
- },
-
- related: {
- ansible_facts: {
- name: 'ansible_facts',
- awToolTip: i18n._('Please save before viewing facts.'),
- dataPlacement: 'top',
- title: i18n._('Facts'),
- skipGenerator: true
- },
- nested_groups: {
- name: 'nested_groups',
- awToolTip: i18n._('Please save before defining groups.'),
- dataPlacement: 'top',
- ngClick: "$state.go('inventories.edit.hosts.edit.nested_groups')",
- title: i18n._('Groups'),
- iterator: 'nested_group'
- },
- insights: {
- name: 'insights',
- awToolTip: i18n._('Please save before viewing Insights.'),
- dataPlacement: 'top',
- title: i18n._('Insights'),
- skipGenerator: true,
- ngIf: "host.insights_system_id!==null && host.summary_fields.inventory.hasOwnProperty('insights_credential_id')"
- },
- completed_jobs: {
- name: 'completed_jobs',
- title: i18n._('Completed Jobs'),
- skipGenerator: true
- }
- }
- };
- }];
diff --git a/awx/ui/client/src/inventories-hosts/inventories/related/hosts/related-host.list.js b/awx/ui/client/src/inventories-hosts/inventories/related/hosts/related-host.list.js
deleted file mode 100644
index fdef44a350..0000000000
--- a/awx/ui/client/src/inventories-hosts/inventories/related/hosts/related-host.list.js
+++ /dev/null
@@ -1,147 +0,0 @@
-/*************************************************
- * Copyright (c) 2017 Ansible, Inc.
- *
- * All Rights Reserved
- *************************************************/
-
-export default ['i18n', function(i18n) {
- return {
- name: 'hosts',
- iterator: 'host',
- editTitle: '{{ selected_group }}',
- showTitle: false,
- well: true,
- wellOverride: true,
- index: false,
- hover: true,
- multiSelect: true,
- trackBy: 'host.id',
- basePath: 'api/v2/inventories/{{$stateParams.inventory_id}}/hosts/',
- layoutClass: 'List-staticColumnLayout--hostsWithCheckbox',
- staticColumns: [
- {
- field: 'toggleHost',
- content: {
- ngDisabled: '!host.summary_fields.user_capabilities.edit',
- label: '',
- type: "toggle",
- ngClick: "toggleHost($event, host)",
- awToolTip: "
" +
- i18n._("Indicates if a host is available and should be included in running jobs.") +
- "
" +
- i18n._("For hosts that are part of an external" +
- " inventory, this may be" +
- " reset by the inventory sync process.") +
- "
",
- dataPlacement: "right",
- nosort: true,
- }
- },
- {
- field: 'active_failures',
- content: {
- 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'
- }
- }
- ],
-
- fields: {
- name: {
- key: true,
- label: i18n._('Hosts'),
- uiSref: ".edit({inventory_id: host.inventory_id,host_id: host.id})",
- ngClass: "{ 'host-disabled-label': !host.enabled }",
- columnClass: 'col-lg-3 col-md-3 col-sm-3 col-xs-7',
- dataHostId: "{{ host.id }}",
- dataType: "host",
- },
- description: {
- label: i18n._('Description'),
- columnClass: 'd-none d-lg-flex col-lg-3',
- template: `
-
- {{ host.description }}
-
- `
- },
- groups: {
- label: i18n._("Related Groups"),
- type: 'related_groups',
- nosort: true,
- showDelete: true,
- columnClass: 'd-none d-lg-flex List-tableCell col-lg-3'
- }
- },
-
- fieldActions: {
-
- columnClass: 'col-lg-3 col-md-6 col-sm-4 col-xs-5 text-right',
- edit: {
- ngClick: "editHost(host)",
- icon: 'icon-edit',
- awToolTip: i18n._('Edit host'),
- dataPlacement: 'top',
- ngShow: 'host.summary_fields.user_capabilities.edit'
- },
- insights: {
- ngClick: "goToInsights(host)",
- icon: 'fa-info',
- awToolTip: i18n._('View Insights Data'),
- dataPlacement: 'top',
- ngShow: 'host.insights_system_id && host.summary_fields.inventory.hasOwnProperty("insights_credential_id")',
- ngClass: "{'List-actionButton--selected': $stateParams['host_id'] == host.id && $state.is('inventories.edit.hosts.edit.insights')}"
- },
- view: {
- ngClick: "editHost(host)",
- awToolTip: i18n._('View host'),
- dataPlacement: 'top',
- ngShow: '!host.summary_fields.user_capabilities.edit'
- },
- "delete": {
- ngClick: "deleteHost(host.id, host.name)",
- icon: 'icon-trash',
- awToolTip: i18n._('Delete host'),
- dataPlacement: 'top',
- ngShow: 'host.summary_fields.user_capabilities.delete'
- }
- },
-
- actions: {
- launch: {
- mode: 'all',
- ngDisabled: '!hostsSelected',
- ngClick: 'setAdhocPattern()',
- awToolTip: i18n._("Select an inventory source by clicking the check box beside it. The inventory source can be a single host or a selection of multiple hosts."),
- dataPlacement: 'top',
- actionClass: 'btn List-buttonDefault',
- buttonContent: i18n._('RUN COMMANDS'),
- showTipWhenDisabled: true,
- tooltipInnerClass: "Tooltip-wide",
- // TODO: we don't always want to show this
- ngShow: 'inventory_obj.summary_fields.user_capabilities.adhoc'
- },
- create: {
- mode: 'all',
- ngClick: "createHost()",
- awToolTip: i18n._("Create a new host"),
- actionClass: 'at-Button--add',
- actionId: 'button-add',
- ngShow: 'canAdd',
- dataPlacement: "top",
- }
- }
- };
-}];
diff --git a/awx/ui/client/src/inventories-hosts/inventories/related/hosts/related-host.route.js b/awx/ui/client/src/inventories-hosts/inventories/related/hosts/related-host.route.js
deleted file mode 100644
index 0c8f6cb23a..0000000000
--- a/awx/ui/client/src/inventories-hosts/inventories/related/hosts/related-host.route.js
+++ /dev/null
@@ -1,83 +0,0 @@
-import { N_ } from '../../../../i18n';
-
-export default {
- name: "inventories.edit.hosts",
- url: "/hosts?{host_search:queryset}",
- params: {
- host_search: {
- value: {
- page_size: "20",
- order_by: "name"
- },
- dynamic: true,
- squash:""
- }
- },
- ncyBreadcrumb: {
- parent: "inventories.edit",
- label: N_("HOSTS")
- },
- views: {
- 'related': {
- templateProvider: function(ListDefinition, generateList, $stateParams, GetBasePath) {
- let list = _.cloneDeep(ListDefinition);
- if($stateParams && $stateParams.group) {
- list.basePath = GetBasePath('groups') + _.last($stateParams.group) + '/all_hosts';
- }
- else {
- //reaches here if the user is on the root level group
- list.basePath = GetBasePath('inventory') + $stateParams.inventory_id + '/hosts';
- }
- let html = generateList.build({
- list: list,
- mode: 'edit'
- });
- return html;
- },
- controller: 'RelatedHostListController'
- }
- },
- resolve: {
- ListDefinition: ['RelatedHostsListDefinition', '$stateParams', 'GetBasePath', (RelatedHostsListDefinition, $stateParams, GetBasePath) => {
- let list = _.cloneDeep(RelatedHostsListDefinition);
- list.basePath = GetBasePath('inventory') + $stateParams.inventory_id + '/hosts';
- return list;
- }],
- Dataset: ['ListDefinition', 'QuerySet', '$stateParams', 'GetBasePath', '$interpolate', '$rootScope',
- (list, qs, $stateParams, GetBasePath, $interpolate, $rootScope) => {
- // allow related list definitions to use interpolated $rootScope / $stateParams in basePath field
- let path, interpolator;
- if (GetBasePath(list.basePath)) {
- path = GetBasePath(list.basePath);
- } else {
- interpolator = $interpolate(list.basePath);
- path = interpolator({ $rootScope: $rootScope, $stateParams: $stateParams });
- }
- return qs.search(path, $stateParams[`${list.iterator}_search`]);
- }
- ],
- hostsUrl: ['InventoriesService', '$stateParams', function(InventoriesService, $stateParams) {
- return $stateParams.group && $stateParams.group.length > 0 ?
- // nested context - provide all hosts managed by nodes
- InventoriesService.childHostsUrl(_.last($stateParams.group)) :
- // root context - provide all hosts in an inventory
- InventoriesService.rootHostsUrl($stateParams.inventory_id);
- }],
- hostsDataset: ['ListDefinition', 'QuerySet', '$stateParams', 'hostsUrl', (list, qs, $stateParams, hostsUrl) => {
- let path = hostsUrl;
- return qs.search(path, $stateParams[`${list.iterator}_search`]);
- }],
- inventoryData: ['InventoriesService', '$stateParams', function(InventoriesService, $stateParams) {
- return InventoriesService.getInventory($stateParams.inventory_id).then(res => res.data);
- }],
- canAdd: ['rbacUiControlService', function(rbacUiControlService) {
- return rbacUiControlService.canAdd('hosts')
- .then(function(res) {
- return res.canAdd;
- })
- .catch(function() {
- return false;
- });
- }]
- }
-};
diff --git a/awx/ui/client/src/inventories-hosts/inventories/related/hosts/related/nested-groups/host-nested-groups-associate.route.js b/awx/ui/client/src/inventories-hosts/inventories/related/hosts/related/nested-groups/host-nested-groups-associate.route.js
deleted file mode 100644
index c710a76754..0000000000
--- a/awx/ui/client/src/inventories-hosts/inventories/related/hosts/related/nested-groups/host-nested-groups-associate.route.js
+++ /dev/null
@@ -1,32 +0,0 @@
-export default {
- name: 'inventories.edit.hosts.edit.nested_groups.associate',
- squashSearchUrl: true,
- url: '/associate',
- ncyBreadcrumb:{
- skip:true
- },
- views: {
- 'modal@inventories.edit.hosts.edit': {
- templateProvider: function() {
- return `
`;
- },
- controller: function($scope, $q, GroupsService, $state){
- $scope.associateGroups = function(selectedItems){
- var deferred = $q.defer();
- return $q.all( _.map(selectedItems, (selectedItem) => GroupsService.associateHost({id: parseInt($state.params.host_id)}, selectedItem.id)) )
- .then( () =>{
- deferred.resolve();
- }, (error) => {
- deferred.reject(error);
- });
- };
- }
- }
- },
- onExit: function($state) {
- if ($state.transition) {
- $('#associate-groups-modal').modal('hide');
- $('body').removeClass('modal-open');
- }
- },
-};
diff --git a/awx/ui/client/src/inventories-hosts/inventories/related/hosts/related/nested-groups/host-nested-groups-disassociate.partial.html b/awx/ui/client/src/inventories-hosts/inventories/related/hosts/related/nested-groups/host-nested-groups-disassociate.partial.html
deleted file mode 100644
index 2d379f686f..0000000000
--- a/awx/ui/client/src/inventories-hosts/inventories/related/hosts/related/nested-groups/host-nested-groups-disassociate.partial.html
+++ /dev/null
@@ -1,37 +0,0 @@
-
-
-
-
-
-
-
- Are you sure you want to disassociate the host below from {{disassociateFrom.name}}?
-
{{ toDisassociate.name }}
-
-
-
-
-
-
diff --git a/awx/ui/client/src/inventories-hosts/inventories/related/hosts/related/nested-groups/host-nested-groups-list.controller.js b/awx/ui/client/src/inventories-hosts/inventories/related/hosts/related/nested-groups/host-nested-groups-list.controller.js
deleted file mode 100644
index 9fdeb7d652..0000000000
--- a/awx/ui/client/src/inventories-hosts/inventories/related/hosts/related/nested-groups/host-nested-groups-list.controller.js
+++ /dev/null
@@ -1,112 +0,0 @@
-/*************************************************
- * Copyright (c) 2016 Ansible, Inc.
- *
- * All Rights Reserved
- *************************************************/
- export default
- ['$scope', '$rootScope', '$state', '$stateParams', 'HostNestedGroupListDefinition', 'InventoryUpdate',
- 'GroupsService', 'CancelSourceUpdate', 'rbacUiControlService', 'GetBasePath',
- 'Dataset', 'Find', 'QuerySet', 'inventoryData', 'canAdd', 'ProcessErrors', 'host',
- function($scope, $rootScope, $state, $stateParams, HostNestedGroupListDefinition, InventoryUpdate,
- GroupsService, CancelSourceUpdate, rbacUiControlService, GetBasePath,
- Dataset, Find, qs, inventoryData, canAdd, ProcessErrors, host){
-
- let list = HostNestedGroupListDefinition;
-
- init();
-
- function init(){
- $scope.toDisassociate = host;
- $scope.inventory_id = $stateParams.inventory_id;
- $scope.canAdhoc = inventoryData.summary_fields.user_capabilities.adhoc;
- $scope.canAdd = canAdd;
-
- // Search init
- $scope.list = list;
- $scope[`${list.iterator}_dataset`] = Dataset.data;
- $scope[list.name] = $scope[`${list.iterator}_dataset`].results;
-
- $scope.$on('selectedOrDeselected', function(e, value) {
- let item = value.value;
-
- if (value.isSelected) {
- if(!$scope.groupsSelected) {
- $scope.groupsSelected = [];
- }
- $scope.groupsSelected.push(item);
- } else {
- _.remove($scope.groupsSelected, { id: item.id });
- if($scope.groupsSelected.length === 0) {
- $scope.groupsSelected = null;
- }
- }
- });
-
- }
-
- $scope.associateGroup = function() {
- $state.go('.associate');
- };
-
- $scope.disassociateGroup = function(group){
- $scope.disassociateFrom = group;
- $('#group-disassociate-modal').modal('show');
- };
-
- $scope.confirmDisassociate = function(){
-
- // Bind an even listener for the modal closing. Trying to $state.go() before the modal closes
- // will mean that these two things are running async and the modal may not finish closing before
- // the state finishes transitioning.
- $('#group-disassociate-modal').off('hidden.bs.modal').on('hidden.bs.modal', function () {
- // Remove the event handler so that we don't end up with multiple bindings
- $('#group-disassociate-modal').off('hidden.bs.modal');
-
- let reloadListStateParams = null;
-
- if($scope.nested_groups.length === 1 && $state.params.nested_group_search && !_.isEmpty($state.params.nested_group_search.page) && $state.params.nested_group_search.page !== '1') {
- reloadListStateParams = _.cloneDeep($state.params);
- reloadListStateParams.nested_group_search.page = (parseInt(reloadListStateParams.nested_group_search.page)-1).toString();
- }
-
- // Reload the inventory manage page and show that the group has been removed
- $state.go('.', reloadListStateParams, {reload: true});
- });
-
- let closeModal = function(){
- $('#group-disassociate-modal').modal('hide');
- $('body').removeClass('modal-open');
- $('.modal-backdrop').remove();
- };
-
- GroupsService.disassociateHost($scope.toDisassociate.id, $scope.disassociateFrom.id)
- .then(() => {
- closeModal();
- }).catch((error) => {
- closeModal();
- ProcessErrors(null, error.data, error.status, null, {
- hdr: 'Error!',
- msg: 'Failed to disassociate group from parent group: POST returned status' +
- error.status
- });
- });
- };
-
- $scope.editGroup = function(id){
- $state.go('inventories.edit.groups.edit', {group_id: id});
- };
-
- $scope.goToGroupGroups = function(id){
- $state.go('inventories.edit.groups.edit.nested_groups', {group_id: id});
- };
-
- $scope.setAdhocPattern = function(){
- var pattern = _($scope.groupsSelected)
- .map(function(item){
- return item.name;
- }).value().join(':');
-
- $state.go('^.^.^.adhoc', {pattern: pattern});
- };
-
- }];
diff --git a/awx/ui/client/src/inventories-hosts/inventories/related/hosts/related/nested-groups/host-nested-groups.list.js b/awx/ui/client/src/inventories-hosts/inventories/related/hosts/related/nested-groups/host-nested-groups.list.js
deleted file mode 100644
index f945bb5458..0000000000
--- a/awx/ui/client/src/inventories-hosts/inventories/related/hosts/related/nested-groups/host-nested-groups.list.js
+++ /dev/null
@@ -1,110 +0,0 @@
-/*************************************************
- * Copyright (c) 2017 Ansible, Inc.
- *
- * All Rights Reserved
- *************************************************/
-
- export default ['i18n', function(i18n) {
- return {
- name: 'nested_groups',
- iterator: 'nested_group',
- editTitle: '{{ inventory.name }}',
- well: true,
- wellOverride: true,
- index: false,
- hover: true,
- multiSelect: true,
- trackBy: 'nested_group.id',
- basePath: 'api/v2/hosts/{{$stateParams.host_id}}/all_groups/',
- layoutClass: 'List-staticColumnLayout--hostNestedGroups',
- staticColumns: [
- {
- field: 'failed_hosts',
- content: {
- label: '',
- nosort: true,
- mode: 'all',
- iconOnly: true,
- awToolTip: "{{ nested_group.hosts_status_tip }}",
- dataPlacement: "top",
- icon: "{{ 'fa icon-job-' + nested_group.hosts_status_class }}",
- columnClass: 'status-column'
- }
- }
- ],
-
- fields: {
- name: {
- label: i18n._('Groups'),
- key: true,
- ngClick: "goToGroupGroups(nested_group.id)",
- columnClass: 'col-lg-6 col-md-6 col-sm-6 col-xs-6',
- }
- },
-
- actions: {
- refresh: {
- mode: 'all',
- awToolTip: i18n._("Refresh the page"),
- ngClick: "refreshGroups()",
- ngShow: "socketStatus == 'error'",
- actionClass: 'btn List-buttonDefault',
- buttonContent: i18n._('REFRESH')
- },
- launch: {
- mode: 'all',
- ngDisabled: '!groupsSelected',
- ngClick: 'setAdhocPattern()',
- awToolTip: i18n._("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."),
- dataPlacement: 'top',
- actionClass: 'btn List-buttonDefault',
- buttonContent: i18n._('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"
- },
- associate: {
- mode: 'all',
- ngClick: 'associateGroup()',
- awToolTip: i18n._("Associate an existing group"),
- actionClass: 'at-Button--add',
- actionId: 'button-add',
- ngShow: 'canAdd',
- dataPlacement: "top",
- }
- },
-
- fieldActions: {
-
- columnClass: 'col-lg-6 col-md-6 col-sm-6 col-xs-6 text-right',
-
- edit: {
- mode: 'all',
- ngClick: "editGroup(nested_group.id)",
- awToolTip: i18n._('Edit group'),
- dataPlacement: "top",
- ngShow: "nested_group.summary_fields.user_capabilities.edit"
- },
- view: {
- mode: 'all',
- ngClick: "editGroup(nested_group.id)",
- awToolTip: i18n._('View group'),
- dataPlacement: "top",
- ngShow: "!nested_group.summary_fields.user_capabilities.edit"
- },
- "delete": {
- mode: 'all',
- ngClick: "disassociateGroup(nested_group)",
- awToolTip: i18n._('Disassociate group'),
- iconClass: 'fa fa-times',
- dataPlacement: "top",
- ngShow: "nested_group.summary_fields.user_capabilities.delete"
- }
- }
- };
-}];
diff --git a/awx/ui/client/src/inventories-hosts/inventories/related/hosts/related/nested-groups/host-nested-groups.route.js b/awx/ui/client/src/inventories-hosts/inventories/related/hosts/related/nested-groups/host-nested-groups.route.js
deleted file mode 100644
index 7f3a82a493..0000000000
--- a/awx/ui/client/src/inventories-hosts/inventories/related/hosts/related/nested-groups/host-nested-groups.route.js
+++ /dev/null
@@ -1,78 +0,0 @@
-import {templateUrl} from '../../../../../../shared/template-url/template-url.factory';
-import { N_ } from '../../../../../../i18n';
-
-export default {
- name: 'inventories.edit.hosts.edit.nested_groups',
- url: "/nested_groups?{nested_group_search:queryset}",
- params: {
- nested_group_search: {
- value: {
- page_size: "20",
- order_by: "name"
- },
- dynamic: true,
- squash: ""
- }
- },
- ncyBreadcrumb: {
- parent: "inventories.edit.hosts.edit",
- label: N_("ASSOCIATED GROUPS")
- },
- views: {
- // 'related@inventories.edit.groups.edit': {
- 'related': {
- templateProvider: function(HostNestedGroupListDefinition, generateList, $templateRequest) {
- let list = _.cloneDeep(HostNestedGroupListDefinition);
-
- let html = generateList.build({
- list: list,
- mode: 'edit'
- });
-
- return $templateRequest(templateUrl('inventories-hosts/inventories/related/hosts/related/nested-groups/host-nested-groups-disassociate')).then((template) => {
- return html.concat(template);
- });
- },
- controller: 'HostNestedGroupsListController'
- }
- },
- resolve: {
- Dataset: ['HostNestedGroupListDefinition', 'QuerySet', '$stateParams', 'GetBasePath', '$interpolate', '$rootScope',
- (list, qs, $stateParams, GetBasePath, $interpolate, $rootScope) => {
- // allow related list definitions to use interpolated $rootScope / $stateParams in basePath field
- let path, interpolator;
- if (GetBasePath(list.basePath)) {
- path = GetBasePath(list.basePath);
- } else {
- interpolator = $interpolate(list.basePath);
- path = interpolator({ $rootScope: $rootScope, $stateParams: $stateParams });
- }
- if($stateParams.group_id){
- path = GetBasePath('groups') + $stateParams.group_id + '/children';
- }
- else if($stateParams.host_id){
- path = GetBasePath('hosts') + $stateParams.host_id + '/all_groups';
- }
- return qs.search(path, $stateParams[`${list.iterator}_search`]);
- }
- ],
- host: ['$stateParams', 'HostsService', function($stateParams, HostsService) {
- if($stateParams.host_id){
- return HostsService.get({ id: $stateParams.host_id }).then((res) => res.data.results[0]);
- }
- }],
- inventoryData: ['InventoriesService', '$stateParams', 'host', function(InventoriesService, $stateParams, host) {
- var id = ($stateParams.inventory_id) ? $stateParams.inventory_id : host.summary_fields.inventory.id;
- return InventoriesService.getInventory(id).then(res => res.data);
- }],
- canAdd: ['rbacUiControlService', '$state', 'GetBasePath', '$stateParams', function(rbacUiControlService, $state, GetBasePath, $stateParams) {
- return rbacUiControlService.canAdd(GetBasePath('inventory') + $stateParams.inventory_id + "/groups")
- .then(function(res) {
- return res.canAdd;
- })
- .catch(function() {
- return false;
- });
- }]
- }
-};
diff --git a/awx/ui/client/src/inventories-hosts/inventories/related/hosts/related/nested-groups/main.js b/awx/ui/client/src/inventories-hosts/inventories/related/hosts/related/nested-groups/main.js
deleted file mode 100644
index d2ec22fe62..0000000000
--- a/awx/ui/client/src/inventories-hosts/inventories/related/hosts/related/nested-groups/main.js
+++ /dev/null
@@ -1,13 +0,0 @@
-/*************************************************
- * Copyright (c) 2017 Ansible, Inc.
- *
- * All Rights Reserved
- *************************************************/
-
-import HostNestedGroupListDefinition from './host-nested-groups.list';
-import HostNestedGroupsListController from './host-nested-groups-list.controller';
-
-export default
- angular.module('hostNestedGroups', [])
- .factory('HostNestedGroupListDefinition', HostNestedGroupListDefinition)
- .controller('HostNestedGroupsListController', HostNestedGroupsListController);
diff --git a/awx/ui/client/src/inventories-hosts/inventories/related/sources/add/main.js b/awx/ui/client/src/inventories-hosts/inventories/related/sources/add/main.js
deleted file mode 100644
index 04cfc8ba9a..0000000000
--- a/awx/ui/client/src/inventories-hosts/inventories/related/sources/add/main.js
+++ /dev/null
@@ -1,11 +0,0 @@
-/*************************************************
- * Copyright (c) 2017 Ansible, Inc.
- *
- * All Rights Reserved
- *************************************************/
-
-import controller from './sources-add.controller';
-
-export default
-angular.module('sourcesAdd', [])
- .controller('SourcesAddController', controller);
diff --git a/awx/ui/client/src/inventories-hosts/inventories/related/sources/add/sources-add.controller.js b/awx/ui/client/src/inventories-hosts/inventories/related/sources/add/sources-add.controller.js
deleted file mode 100644
index 382edb320b..0000000000
--- a/awx/ui/client/src/inventories-hosts/inventories/related/sources/add/sources-add.controller.js
+++ /dev/null
@@ -1,233 +0,0 @@
-/*************************************************
- * Copyright (c) 2017 Ansible, Inc.
- *
- * All Rights Reserved
- *************************************************/
-
-export default ['$state', 'ConfigData', '$scope', 'SourcesFormDefinition', 'ParseTypeChange',
- 'GenerateForm', 'inventoryData', 'GetChoices',
- 'GetBasePath', 'CreateSelect2', 'GetSourceTypeOptions',
- 'SourcesService', 'Empty', 'Wait', 'Rest', 'Alert', 'ProcessErrors',
- 'inventorySourcesOptions', '$rootScope', 'i18n', 'InventorySourceModel', 'InventoryHostsStrings',
- function($state, ConfigData, $scope, SourcesFormDefinition, ParseTypeChange,
- GenerateForm, inventoryData, GetChoices,
- GetBasePath, CreateSelect2, GetSourceTypeOptions,
- SourcesService, Empty, Wait, Rest, Alert, ProcessErrors,
- inventorySourcesOptions,$rootScope, i18n, InventorySource, InventoryHostsStrings) {
-
- let form = SourcesFormDefinition;
- $scope.mode = 'add';
- // apply form definition's default field values
- GenerateForm.applyDefaults(form, $scope, true);
- $scope.canAdd = inventorySourcesOptions.actions.POST;
- $scope.envParseType = 'yaml';
- const virtualEnvs = ConfigData.custom_virtualenvs || [];
- $scope.custom_virtualenvs_options = virtualEnvs;
-
- GetChoices({
- scope: $scope,
- field: 'verbosity',
- variable: 'verbosity_options',
- options: inventorySourcesOptions
- });
-
- CreateSelect2({
- element: '#inventory_source_verbosity',
- multiple: false
- });
-
- $scope.verbosity = $scope.verbosity_options[1];
-
- CreateSelect2({
- element: '#inventory_source_custom_virtualenv',
- multiple: false,
- opts: $scope.custom_virtualenvs_options
- });
-
- GetSourceTypeOptions({
- scope: $scope,
- variable: 'source_type_options'
- });
-
- const inventorySource = new InventorySource();
-
- var getInventoryFiles = function (project) {
- var url;
-
- if (!Empty(project)) {
- url = GetBasePath('projects') + project + '/inventories/';
- Wait('start');
- Rest.setUrl(url);
- Rest.get()
- .then(({data}) => {
- $scope.inventory_files = data;
- $scope.inventory_files.push("/ (project root)");
- CreateSelect2({
- element:'#inventory-file-select',
- addNew: true,
- multiple: false,
- scope: $scope,
- options: 'inventory_files',
- model: 'inventory_file'
- });
- Wait('stop');
- })
- .catch(() => {
- Alert('Cannot get inventory files', 'Unable to retrieve the list of inventory files for this project.', 'alert-info');
- Wait('stop');
- });
- }
- };
-
- // Register a watcher on project_name
- if ($scope.getInventoryFilesUnregister) {
- $scope.getInventoryFilesUnregister();
- }
- $scope.getInventoryFilesUnregister = $scope.$watch('project', function (newValue, oldValue) {
- if (newValue !== oldValue) {
- getInventoryFiles(newValue);
- }
- });
-
- $scope.lookupCredential = function(){
- // For most source type selections, we filter for 1-1 matches to credential_type namespace.
- let searchKey = 'credential_type__namespace';
- let searchValue = $scope.source.value;
-
- // SCM and custom source types are more generic in terms of the credentials they
- // accept - any cloud or user-defined credential type can be used. We filter for
- // these using the credential_type kind field, which categorizes all cloud and
- // user-defined credentials as 'cloud'.
- if ($scope.source.value === 'scm') {
- searchKey = 'credential_type__kind';
- searchValue = 'cloud';
- }
-
- if ($scope.source.value === 'custom') {
- searchKey = 'credential_type__kind';
- searchValue = 'cloud';
- }
-
- // When the selection is 'ec2' we actually want to filter for the 'aws' namespace.
- if ($scope.source.value === 'ec2') {
- searchValue = 'aws';
- }
-
- $state.go('.credential', {
- credential_search: {
- [searchKey]: searchValue,
- page_size: '5',
- page: '1'
- }
- });
- };
-
- $scope.lookupProject = function(){
- $state.go('.project', {
- project_search: {
- page_size: '5',
- page: '1'
- }
- });
- };
-
- $scope.sourceChange = function(source) {
- source = (source && source.value) ? source.value : '';
- if ($scope.source.value === "scm" && $scope.source.value === "custom") {
- $scope.credentialBasePath = GetBasePath('credentials') + '?credential_type__kind__in=cloud,network';
- }
- else{
- $scope.credentialBasePath = (source === 'ec2') ? GetBasePath('credentials') + '?credential_type__namespace=aws' : GetBasePath('credentials') + (source === '' ? '' : '?credential_type__namespace=' + (source));
- }
- if (true) {
- $scope.envParseType = 'yaml';
-
- var varName;
- if (source === 'scm') {
- varName = 'custom_variables';
- } else {
- varName = source + '_variables';
- }
-
- $scope[varName] = $scope[varName] === (null || undefined) ? '---' : $scope[varName];
- ParseTypeChange({
- scope: $scope,
- field_id: varName,
- variable: varName,
- parse_variable: 'envParseType'
- });
- }
-
- if (source === 'scm') {
- $scope.projectBasePath = GetBasePath('projects') + '?not__status=never updated';
- }
-
- $scope.cloudCredentialRequired = source !== '' && source !== 'scm' && source !== 'custom' && source !== 'ec2' ? true : false;
- $scope.credential = null;
- $scope.credential_name = null;
- $scope.overwrite_vars = false;
- };
-
- $scope.$on('sourceTypeOptionsReady', function() {
- CreateSelect2({
- element: '#inventory_source_source',
- multiple: false
- });
- });
-
- $scope.formCancel = function() {
- $state.go('^');
- };
-
- $scope.formSave = function() {
- var params;
-
- params = {
- name: $scope.name,
- description: $scope.description,
- inventory: inventoryData.id,
- source_script: $scope.inventory_script,
- credential: $scope.credential,
- overwrite: $scope.overwrite,
- overwrite_vars: $scope.overwrite_vars,
- update_on_launch: $scope.update_on_launch,
- verbosity: $scope.verbosity.value,
- update_cache_timeout: $scope.update_cache_timeout || 0,
- custom_virtualenv: $scope.custom_virtualenv || null,
- enabled_var: $scope.enabled_var,
- enabled_value: $scope.enabled_value,
- host_filter: $scope.host_filter
- };
-
- if ($scope.source) {
- let source_vars = $scope.source.value === 'scm' ? $scope.custom_variables : $scope[$scope.source.value + '_variables'];
- params.source_vars = source_vars === '---' || source_vars === '{}' ? null : source_vars;
- params.source = $scope.source.value;
- if ($scope.source.value === 'scm') {
- params.update_on_project_update = $scope.update_on_project_update;
- params.source_project = $scope.project;
-
- if ($scope.inventory_file === '/ (project root)') {
- params.source_path = "";
- } else {
- params.source_path = $scope.inventory_file;
- }
- }
- } else {
- params.source = null;
- }
-
- inventorySource.request('post', {
- data: params
- }).then((response) => {
- let inventory_source_id = response.data.id;
- $state.go('^.edit', {inventory_source_id: inventory_source_id}, {reload: true});
- }).catch(({ data, status, config }) => {
- ProcessErrors($scope, data, status, null, {
- hdr: 'Error!',
- msg: InventoryHostsStrings.get('error.CALL', { path: `${config.url}`, status })
- });
- });
- };
- }
-];
diff --git a/awx/ui/client/src/inventories-hosts/inventories/related/sources/add/sources-add.route.js b/awx/ui/client/src/inventories-hosts/inventories/related/sources/add/sources-add.route.js
deleted file mode 100644
index dc53ded31a..0000000000
--- a/awx/ui/client/src/inventories-hosts/inventories/related/sources/add/sources-add.route.js
+++ /dev/null
@@ -1,40 +0,0 @@
-import { N_ } from '../../../../../i18n';
-
-export default {
- name: "inventories.edit.inventory_sources.add",
- url: "/add",
- ncyBreadcrumb: {
- parent: "inventories.edit.inventory_sources",
- label: N_("CREATE INVENTORY SOURCE")
- },
- views: {
- 'sourcesForm@inventories': {
- templateProvider: function(GenerateForm, SourcesFormDefinition) {
- let form = SourcesFormDefinition;
- return GenerateForm.buildHTML(form, {
- mode: 'add',
- related: false
- });
- },
- controller: 'SourcesAddController'
- }
- },
- resolve: {
- inventorySourcesOptions: ['InventoriesService', '$stateParams', function(InventoriesService, $stateParams) {
- return InventoriesService.inventorySourcesOptions($stateParams.inventory_id)
- .then(function(res) {
- return res.data;
- });
- }],
- ConfigData: ['ConfigService', 'ProcessErrors', 'i18n', (ConfigService, ProcessErrors, i18n) => {
- return ConfigService.getConfig()
- .then(response => response)
- .catch(({data, status}) => {
- ProcessErrors(null, data, status, null, {
- hdr: i18n._('Error!'),
- msg: i18n._('Failed to get config. GET returned status: ') + status
- });
- });
- }]
- }
-};
diff --git a/awx/ui/client/src/inventories-hosts/inventories/related/sources/edit/main.js b/awx/ui/client/src/inventories-hosts/inventories/related/sources/edit/main.js
deleted file mode 100644
index 8c68bc5544..0000000000
--- a/awx/ui/client/src/inventories-hosts/inventories/related/sources/edit/main.js
+++ /dev/null
@@ -1,11 +0,0 @@
-/*************************************************
- * Copyright (c) 2017 Ansible, Inc.
- *
- * All Rights Reserved
- *************************************************/
-
-import controller from './sources-edit.controller';
-
-export default
-angular.module('sourcesEdit', [])
- .controller('SourcesEditController', controller);
diff --git a/awx/ui/client/src/inventories-hosts/inventories/related/sources/edit/sources-edit.controller.js b/awx/ui/client/src/inventories-hosts/inventories/related/sources/edit/sources-edit.controller.js
deleted file mode 100644
index b8207fe5f2..0000000000
--- a/awx/ui/client/src/inventories-hosts/inventories/related/sources/edit/sources-edit.controller.js
+++ /dev/null
@@ -1,315 +0,0 @@
-/*************************************************
- * Copyright (c) 2016 Ansible, Inc.
- *
- * All Rights Reserved
- *************************************************/
-
-export default ['$state', '$scope', 'ParseVariableString', 'ParseTypeChange',
- 'GetChoices', 'GetBasePath', 'CreateSelect2', 'GetSourceTypeOptions',
- 'SourcesService', 'inventoryData', 'inventorySourcesOptions', 'Empty',
- 'Wait', 'Rest', 'Alert', '$rootScope', 'i18n', 'InventoryHostsStrings',
- 'ProcessErrors', 'inventorySource', 'isNotificationAdmin', 'ConfigData',
- function($state, $scope, ParseVariableString, ParseTypeChange,
- GetChoices, GetBasePath, CreateSelect2, GetSourceTypeOptions,
- SourcesService, inventoryData, inventorySourcesOptions, Empty,
- Wait, Rest, Alert, $rootScope, i18n, InventoryHostsStrings,
- ProcessErrors, inventorySource, isNotificationAdmin, ConfigData) {
-
- const inventorySourceData = inventorySource.get();
-
- // To toggle notifications a user needs to have a read role on the inventory
- // _and_ have at least a notification template admin role on an org.
- // If the user has gotten this far it's safe to say they have
- // at least read access to the inventory
- $scope.sufficientRoleForNotifToggle = isNotificationAdmin;
- $scope.sufficientRoleForNotif = isNotificationAdmin || $scope.user_is_system_auditor;
- $scope.projectBasePath = GetBasePath('projects') + '?not__status=never updated';
- $scope.canAdd = inventorySourcesOptions.actions.POST;
- const virtualEnvs = ConfigData.custom_virtualenvs || [];
- $scope.custom_virtualenvs_options = virtualEnvs;
- // instantiate expected $scope values from inventorySourceData
- _.assign($scope,
- {credential: inventorySourceData.credential},
- {overwrite: inventorySourceData.overwrite},
- {overwrite_vars: inventorySourceData.overwrite_vars},
- {update_on_launch: inventorySourceData.update_on_launch},
- {update_cache_timeout: inventorySourceData.update_cache_timeout},
- {inventory_script: inventorySourceData.source_script},
- {verbosity: inventorySourceData.verbosity});
-
- $scope.inventory_source_obj = inventorySourceData;
- $scope.breadcrumb.inventory_source_name = inventorySourceData.name;
- if (inventorySourceData.credential) {
- $scope.credential_name = inventorySourceData.summary_fields.credential.name;
- }
-
- if(inventorySourceData.source === 'scm') {
- $scope.project = inventorySourceData.source_project;
- $scope.project_name = inventorySourceData.summary_fields.source_project.name;
- updateSCMProject();
- }
-
- // display custom inventory_script name
- if (inventorySourceData.source === 'custom' && inventorySourceData.summary_fields.source_script) {
- $scope.inventory_script_name = inventorySourceData.summary_fields.source_script.name;
- }
- $scope = angular.extend($scope, inventorySourceData);
-
- $scope.$watch('summary_fields.user_capabilities.edit', function(val) {
- $scope.canAdd = val;
- });
-
- $scope.$on('sourceTypeOptionsReady', function() {
- $scope.source = _.find($scope.source_type_options, { value: inventorySourceData.source });
- var source = $scope.source && $scope.source.value ? $scope.source.value : null;
- $scope.cloudCredentialRequired = source !== '' && source !== 'scm' && source !== 'custom' && source !== 'ec2' ? true : false;
- CreateSelect2({
- element: '#inventory_source_source',
- multiple: false
- });
-
- if (true) {
- var varName;
- if (source === 'scm') {
- varName = 'custom_variables';
- } else {
- varName = source + '_variables';
- }
-
- $scope[varName] = ParseVariableString(inventorySourceData
- .source_vars);
-
- ParseTypeChange({
- scope: $scope,
- field_id: varName,
- variable: varName,
- parse_variable: 'envParseType',
- readOnly: !$scope.summary_fields.user_capabilities.edit
- });
- }
- });
-
- $scope.envParseType = 'yaml';
-
- GetSourceTypeOptions({
- scope: $scope,
- variable: 'source_type_options'
- });
-
- GetChoices({
- scope: $scope,
- field: 'verbosity',
- variable: 'verbosity_options',
- options: inventorySourcesOptions
- });
-
- var i;
- for (i = 0; i < $scope.verbosity_options.length; i++) {
- if ($scope.verbosity_options[i].value === $scope.verbosity) {
- $scope.verbosity = $scope.verbosity_options[i];
- }
- }
-
- CreateSelect2({
- element: '#inventory_source_custom_virtualenv',
- multiple: false,
- opts: $scope.custom_virtualenvs_options
- });
-
- initVerbositySelect();
-
- $scope.$watch('verbosity', initVerbositySelect);
-
- // Register a watcher on project_name
- if ($scope.getInventoryFilesUnregister) {
- $scope.getInventoryFilesUnregister();
- }
- $scope.getInventoryFilesUnregister = $scope.$watch('project', function (newValue, oldValue) {
- if (newValue !== oldValue) {
- updateSCMProject();
- }
- });
-
- function initVerbositySelect(){
- CreateSelect2({
- element: '#inventory_source_verbosity',
- multiple: false
- });
- }
-
- function sync_inventory_file_select2() {
- CreateSelect2({
- element:'#inventory-file-select',
- addNew: true,
- multiple: false,
- scope: $scope,
- options: 'inventory_files',
- model: 'inventory_file'
- });
-
- // TODO: figure out why the inventory file model is being set to
- // dirty
- }
-
- function updateSCMProject() {
- var url;
-
- if (!Empty($scope.project)) {
- url = GetBasePath('projects') + $scope.project + '/inventories/';
- Wait('start');
- Rest.setUrl(url);
- Rest.get()
- .then(({data}) => {
- $scope.inventory_files = data;
- $scope.inventory_files.push("/ (project root)");
-
- if (inventorySourceData.source_path !== "") {
- $scope.inventory_file = inventorySourceData.source_path;
- if ($scope.inventory_files.indexOf($scope.inventory_file) < 0) {
- $scope.inventory_files.push($scope.inventory_file);
- }
- } else {
- $scope.inventory_file = "/ (project root)";
- }
- sync_inventory_file_select2();
- Wait('stop');
- })
- .catch(() => {
- Alert('Cannot get inventory files', 'Unable to retrieve the list of inventory files for this project.', 'alert-info');
- Wait('stop');
- });
- }
- }
-
- $scope.lookupProject = function(){
- $state.go('.project', {
- project_search: {
- page_size: '5',
- page: '1'
- }
- });
- };
-
- $scope.lookupCredential = function(){
- // For most source type selections, we filter for 1-1 matches to credential_type namespace.
- let searchKey = 'credential_type__namespace';
- let searchValue = $scope.source.value;
-
- // SCM and custom source types are more generic in terms of the credentials they
- // accept - any cloud or user-defined credential type can be used. We filter for
- // these using the credential_type kind field, which categorizes all cloud and
- // user-defined credentials as 'cloud'.
- if ($scope.source.value === 'scm') {
- searchKey = 'credential_type__kind';
- searchValue = 'cloud';
- }
-
- if ($scope.source.value === 'custom') {
- searchKey = 'credential_type__kind';
- searchValue = 'cloud';
- }
-
- // When the selection is 'ec2' we actually want to filter for the 'aws' namespace.
- if ($scope.source.value === 'ec2') {
- searchValue = 'aws';
- }
-
- $state.go('.credential', {
- credential_search: {
- [searchKey]: searchValue,
- page_size: '5',
- page: '1'
- }
- });
- };
-
- $scope.formCancel = function() {
- $state.go('^');
- };
- $scope.formSave = function() {
- var params;
-
- console.log($scope);
-
- params = {
- id: inventorySourceData.id,
- name: $scope.name,
- description: $scope.description,
- inventory: inventoryData.id,
- source_script: $scope.inventory_script,
- credential: $scope.credential,
- overwrite: $scope.overwrite,
- overwrite_vars: $scope.overwrite_vars,
- update_on_launch: $scope.update_on_launch,
- update_cache_timeout: $scope.update_cache_timeout || 0,
- verbosity: $scope.verbosity.value,
- custom_virtualenv: $scope.custom_virtualenv || null,
- enabled_var: $scope.enabled_var,
- enabled_value: $scope.enabled_value,
- host_filter: $scope.host_filter
- };
-
- if ($scope.source) {
- let source_vars = $scope.source.value === 'scm' ? $scope.custom_variables : $scope[$scope.source.value + '_variables'];
- params.source_vars = source_vars === '---' || source_vars === '{}' ? null : source_vars;
- params.source = $scope.source.value;
- if ($scope.source.value === 'scm') {
- params.update_on_project_update = $scope.update_on_project_update;
- params.source_project = $scope.project;
-
- if ($scope.inventory_file === '/ (project root)') {
- params.source_path = "";
- } else {
- params.source_path = $scope.inventory_file;
- }
- }
- } else {
- params.source = null;
- }
-
- inventorySource.request('put', {
- data: params
- }).then(() => {
- $state.go('.', null, { reload: true });
- }).catch(({ data, status, config }) => {
- ProcessErrors($scope, data, status, null, {
- hdr: 'Error!',
- msg: InventoryHostsStrings.get('error.CALL', { path: `${config.url}`, status })
- });
- });
- };
-
- $scope.sourceChange = function(source) {
- source = (source && source.value) ? source.value : '';
- if ($scope.source.value === "scm" && $scope.source.value === "custom") {
- $scope.credentialBasePath = GetBasePath('credentials') + '?credential_type__kind__in=cloud,network';
- }
- else{
- $scope.credentialBasePath = (source === 'ec2') ? GetBasePath('credentials') + '?credential_type__namespace=aws' : GetBasePath('credentials') + (source === '' ? '' : 'credential_type__namespace=' + (source));
- }
- if (source === 'ec2' || source === 'custom' || source === 'vmware' || source === 'openstack' || source === 'scm' || source === 'cloudforms' || source === "satellite6") {
- $scope.envParseType = 'yaml';
-
- var varName;
- if (source === 'scm') {
- varName = 'custom_variables';
- } else {
- varName = source + '_variables';
- }
-
- $scope[varName] = $scope[varName] === (null || undefined) ? '---' : $scope[varName];
- ParseTypeChange({
- scope: $scope,
- field_id: varName,
- variable: varName,
- parse_variable: 'envParseType'
- });
- }
-
- $scope.cloudCredentialRequired = source !== '' && source !== 'scm' && source !== 'custom' && source !== 'ec2' ? true : false;
- $scope.credential = null;
- $scope.credential_name = null;
- $scope.overwrite_vars = false;
- };
- }
-];
diff --git a/awx/ui/client/src/inventories-hosts/inventories/related/sources/edit/sources-edit.route.js b/awx/ui/client/src/inventories-hosts/inventories/related/sources/edit/sources-edit.route.js
deleted file mode 100644
index e66cb0b691..0000000000
--- a/awx/ui/client/src/inventories-hosts/inventories/related/sources/edit/sources-edit.route.js
+++ /dev/null
@@ -1,53 +0,0 @@
-export default {
- name: "inventories.edit.inventory_sources.edit",
- url: "/edit/:inventory_source_id",
- ncyBreadcrumb: {
- parent: "inventories.edit.inventory_sources",
- label: '{{breadcrumb.inventory_source_name}}'
- },
- views: {
- 'groupForm@inventories': {
- templateProvider: function(GenerateForm, SourcesFormDefinition) {
- let form = SourcesFormDefinition;
- return GenerateForm.buildHTML(form, {
- mode: 'edit',
- related: false
- });
- },
- controller: 'SourcesEditController'
- }
- },
- resolve: {
- inventorySource: ['InventorySourceModel', '$stateParams', (InventorySource, $stateParams) => {
- return new InventorySource('get', $stateParams.inventory_source_id);
- }],
- inventorySourcesOptions: ['InventoriesService', '$stateParams', function(InventoriesService, $stateParams) {
- return InventoriesService.inventorySourcesOptions($stateParams.inventory_id)
- .then((response) => response.data);
- }],
- isNotificationAdmin: ['Rest', 'ProcessErrors', 'GetBasePath', 'i18n',
- function(Rest, ProcessErrors, GetBasePath, i18n) {
- Rest.setUrl(`${GetBasePath('organizations')}?role_level=notification_admin_role&page_size=1`);
- return Rest.get()
- .then(({data}) => {
- return data.count > 0;
- })
- .catch(({data, status}) => {
- ProcessErrors(null, data, status, null, {
- hdr: i18n._('Error!'),
- msg: i18n._('Failed to get organizations for which this user is a notification administrator. GET returned ') + status
- });
- });
- }],
- ConfigData: ['ConfigService', 'ProcessErrors', 'i18n', (ConfigService, ProcessErrors, i18n) => {
- return ConfigService.getConfig()
- .then(response => response)
- .catch(({data, status}) => {
- ProcessErrors(null, data, status, null, {
- hdr: i18n._('Error!'),
- msg: i18n._('Failed to get config. GET returned status: ') + status
- });
- });
- }]
- }
-};
diff --git a/awx/ui/client/src/inventories-hosts/inventories/related/sources/edit/sources-notifications.route.js b/awx/ui/client/src/inventories-hosts/inventories/related/sources/edit/sources-notifications.route.js
deleted file mode 100644
index b739f2287d..0000000000
--- a/awx/ui/client/src/inventories-hosts/inventories/related/sources/edit/sources-notifications.route.js
+++ /dev/null
@@ -1,89 +0,0 @@
-import { N_ } from '../../../../../i18n';
-
-export default {
- searchPrefix: 'notification',
- name: "inventories.edit.inventory_sources.edit.notifications",
- url: `/notifications`,
- ncyBreadcrumb: {
- parent: "inventories.edit.inventory_sources.edit",
- label: N_("NOTIFICATIONS")
- },
- params: {
- [ 'notification_search']: {
- value: { order_by: 'name' }
- }
- },
- views: {
- 'related': {
- templateProvider: function(FormDefinition, GenerateForm, $stateParams, SourcesFormDefinition) {
- var form, html;
- if($stateParams && $stateParams.inventory_source_id){
- form = SourcesFormDefinition;
- }
- else {
- form = typeof(FormDefinition) === 'function' ?
- FormDefinition() : FormDefinition;
- }
- html = GenerateForm.buildCollection({
- mode: 'edit',
- related: `notifications`,
- form: form
- });
- return html;
- },
- controller: ['$scope', 'NotificationsList', 'Dataset', 'ToggleNotification', 'NotificationsListInit', 'GetBasePath', '$stateParams',
- function($scope, list, Dataset, ToggleNotification, NotificationsListInit, GetBasePath, $stateParams) {
- var params = $stateParams,
- id = params.inventory_source_id,
- url = GetBasePath('inventory_sources');
-
- function init() {
- $scope.list = list;
- $scope[`${list.iterator}_dataset`] = Dataset.data;
- $scope[list.name] = $scope[`${list.iterator}_dataset`].results;
-
-
- NotificationsListInit({
- scope: $scope,
- url: url,
- id: id
- });
-
- $scope.$watch(`${list.iterator}_dataset`, function() {
- // The list data has changed and we need to update which notifications are on/off
- $scope.$emit('relatednotifications');
- });
- }
-
- $scope.toggleNotification = function(event, notifier_id, column) {
- var notifier = this.notification;
- try {
- $(event.target).tooltip('hide');
- }
- catch(e) {
- // ignore
- }
- ToggleNotification({
- scope: $scope,
- url: url + id,
- notifier: notifier,
- column: column,
- callback: 'NotificationRefresh'
- });
- };
-
- init();
-
- }
- ]
- }
- },
- resolve: {
- Dataset: ['NotificationsList', 'QuerySet', '$stateParams', 'GetBasePath',
- (list, qs, $stateParams, GetBasePath) => {
- let path = GetBasePath(list.basePath);
- return qs.search(path, $stateParams[`${list.iterator}_search`]);
- }
- ]
- }
-};
diff --git a/awx/ui/client/src/inventories-hosts/inventories/related/sources/factories/cancel-source-update.factory.js b/awx/ui/client/src/inventories-hosts/inventories/related/sources/factories/cancel-source-update.factory.js
deleted file mode 100644
index 97388e03f2..0000000000
--- a/awx/ui/client/src/inventories-hosts/inventories/related/sources/factories/cancel-source-update.factory.js
+++ /dev/null
@@ -1,63 +0,0 @@
-export default
- function CancelSourceUpdate(Empty, Rest, ProcessErrors, Alert, Wait, Find) {
- return function(params) {
- var scope = params.scope,
- id = params.id,
- inventory_source = params.inventory_source;
-
- // Cancel the update process
- if (Empty(inventory_source)) {
- inventory_source = Find({ list: scope.inventory_sources, key: 'id', val: id });
- scope.selected_inventory_source_id = inventory_source.id;
- }
-
- if (inventory_source && (inventory_source.status === 'running' || inventory_source.status === 'pending')) {
- // We found the inventory_source, and there is a running update
- Wait('start');
- Rest.setUrl(inventory_source.url);
- Rest.get()
- .then(({data}) => {
- // Check that we have access to cancelling an update
- var url = (data.related.current_update) ? data.related.current_update : data.related.last_update;
- url += 'cancel/';
- Rest.setUrl(url);
- Rest.get()
- .then(({data}) => {
- if (data.can_cancel) {
- // Cancel the update process
- Rest.setUrl(url);
- Rest.post()
- .then(() => {
- Wait('stop');
- //Alert('Inventory Sync Canceled', 'Request to cancel the sync process was submitted to the task manger. ' +
- // 'Click the
button to monitor the status.', 'alert-info');
- })
- .catch(({data, status}) => {
- ProcessErrors(scope, data, status, null, { hdr: 'Error!',
- msg: 'Call to ' + url + ' failed. POST status: ' + status
- });
- });
- }
- else {
- Wait('stop');
- }
- })
- .catch(({data, status}) => {
- ProcessErrors(scope, data, status, null, { hdr: 'Error!',
- msg: 'Call to ' + url + ' failed. GET status: ' + status
- });
- });
- })
- .catch(({data, status}) => {
- ProcessErrors(scope, data, status, null, { hdr: 'Error!',
- msg: 'Call to ' + inventory_source.url + ' failed. GET status: ' + status
- });
- });
- }
- };
- }
-
-CancelSourceUpdate.$inject =
- [ 'Empty', 'Rest', 'ProcessErrors',
- 'Alert', 'Wait', 'Find'
- ];
diff --git a/awx/ui/client/src/inventories-hosts/inventories/related/sources/factories/get-source-type-options.factory.js b/awx/ui/client/src/inventories-hosts/inventories/related/sources/factories/get-source-type-options.factory.js
deleted file mode 100644
index 33e9b83ca7..0000000000
--- a/awx/ui/client/src/inventories-hosts/inventories/related/sources/factories/get-source-type-options.factory.js
+++ /dev/null
@@ -1,37 +0,0 @@
-export default
- function GetSourceTypeOptions(Rest, ProcessErrors, GetBasePath) {
- return function(params) {
- var scope = params.scope,
- variable = params.variable;
-
- if (scope[variable] === undefined) {
- scope[variable] = [];
- Rest.setUrl(GetBasePath('inventory_sources'));
- Rest.options()
- .then(({data}) => {
- var i, choices = data.actions.GET.source.choices;
- for (i = 0; i < choices.length; i++) {
- if (choices[i][0] !== 'file' && choices[i][0] !== "") {
- scope[variable].push({
- label: choices[i][1],
- value: choices[i][0]
- });
- }
- }
- scope.cloudCredentialRequired = false;
- scope.$emit('sourceTypeOptionsReady');
- })
- .catch(({data, status}) => {
- ProcessErrors(scope, data, status, null, { hdr: 'Error!',
- msg: 'Failed to retrieve options for inventory_sources.source. OPTIONS status: ' + status
- });
- });
- }
- };
- }
-
-GetSourceTypeOptions.$inject =
- [ 'Rest',
- 'ProcessErrors',
- 'GetBasePath'
- ];
diff --git a/awx/ui/client/src/inventories-hosts/inventories/related/sources/factories/get-sync-status-msg.factory.js b/awx/ui/client/src/inventories-hosts/inventories/related/sources/factories/get-sync-status-msg.factory.js
deleted file mode 100644
index 772af4c68b..0000000000
--- a/awx/ui/client/src/inventories-hosts/inventories/related/sources/factories/get-sync-status-msg.factory.js
+++ /dev/null
@@ -1,61 +0,0 @@
-export default
- function GetSyncStatusMsg(i18n) {
- return function(params) {
- var status = params.status,
- launch_class = '',
- launch_tip = i18n._('Start sync process'),
- schedule_tip = i18n._('Schedule inventory syncs'),
- stat, stat_class, status_tip;
-
- stat = status;
- stat_class = stat;
-
- switch (status) {
- case 'never updated':
- stat = 'never';
- stat_class = 'na';
- status_tip = i18n._('Sync not performed. Click') + '
' + i18n._('to start it now.');
- break;
- case 'none':
- case 'ok':
- case '':
- launch_class = 'btn-disabled';
- stat = 'n/a';
- stat_class = 'na';
- status_tip = i18n._('Cloud source not configured. Click') + '
' + i18n._('to update.');
- launch_tip = i18n._('Cloud source not configured.');
- break;
- case 'canceled':
- status_tip = i18n._('Sync canceled. Click to view log.');
- break;
- case 'failed':
- status_tip = i18n._('Sync failed. Click to view log.');
- break;
- case 'successful':
- status_tip = i18n._('Sync completed. Click to view log.');
- break;
- case 'pending':
- status_tip = i18n._('Sync pending.');
- launch_class = "btn-disabled";
- launch_tip = "Sync pending";
- break;
- case 'updating':
- case 'running':
- launch_class = "btn-disabled";
- launch_tip = i18n._("Sync running");
- status_tip = i18n._("Sync running. Click to view log.");
- break;
- }
-
- return {
- "class": stat_class,
- "tooltip": status_tip,
- "status": stat,
- "launch_class": launch_class,
- "launch_tip": launch_tip,
- "schedule_tip": schedule_tip
- };
- };
- }
-
-GetSyncStatusMsg.$inject = ['i18n'];
diff --git a/awx/ui/client/src/inventories-hosts/inventories/related/sources/factories/view-update-status.factory.js b/awx/ui/client/src/inventories-hosts/inventories/related/sources/factories/view-update-status.factory.js
deleted file mode 100644
index 5b928e5cf5..0000000000
--- a/awx/ui/client/src/inventories-hosts/inventories/related/sources/factories/view-update-status.factory.js
+++ /dev/null
@@ -1,35 +0,0 @@
-export default
- function ViewUpdateStatus($state, Rest, ProcessErrors, Alert, Wait, Empty, Find) {
- return function(params) {
- var scope = params.scope,
- inventory_source_id = params.inventory_source_id,
- inventory_source = Find({ list: scope.inventory_sources, key: 'id', val: inventory_source_id });
-
- if (inventory_source) {
- if (Empty(inventory_source.status) || inventory_source.status === "never updated") {
- Alert('No Status Available', '
An inventory sync has not been performed for the selected group. Start the process by ' +
- 'clicking the button.
', 'alert-info', null, null, null, null, true);
- } else {
- Wait('start');
- Rest.setUrl(inventory_source.url);
- Rest.get()
- .then(({data}) => {
- // Get the ID from the correct summary field
- var update_id = (data.summary_fields.current_update) ? data.summary_fields.current_update.id : data.summary_fields.last_update.id;
-
- $state.go('output', { id: update_id, type: 'inventory' });
- })
- .catch(({data, status}) => {
- ProcessErrors(scope, data, status, null, { hdr: 'Error!',
- msg: 'Failed to retrieve inventory source: ' + inventory_source.url +
- ' GET returned status: ' + status });
- });
- }
- }
- };
- }
-
-ViewUpdateStatus.$inject =
- [ '$state', 'Rest', 'ProcessErrors',
- 'Alert', 'Wait', 'Empty', 'Find'
- ];
diff --git a/awx/ui/client/src/inventories-hosts/inventories/related/sources/list/main.js b/awx/ui/client/src/inventories-hosts/inventories/related/sources/list/main.js
deleted file mode 100644
index 2c7c3b62f8..0000000000
--- a/awx/ui/client/src/inventories-hosts/inventories/related/sources/list/main.js
+++ /dev/null
@@ -1,11 +0,0 @@
-/*************************************************
- * Copyright (c) 2017 Ansible, Inc.
- *
- * All Rights Reserved
- *************************************************/
-
-import controller from './sources-list.controller';
-
-export default
- angular.module('sourcesList', [])
- .controller('SourcesListController', controller);
diff --git a/awx/ui/client/src/inventories-hosts/inventories/related/sources/list/schedule/sources-schedule-add.route.js b/awx/ui/client/src/inventories-hosts/inventories/related/sources/list/schedule/sources-schedule-add.route.js
deleted file mode 100644
index 0b38774378..0000000000
--- a/awx/ui/client/src/inventories-hosts/inventories/related/sources/list/schedule/sources-schedule-add.route.js
+++ /dev/null
@@ -1,17 +0,0 @@
-import { N_ } from '../../../../../../i18n';
-import {templateUrl} from '../../../../../../shared/template-url/template-url.factory';
-
-export default {
- name: 'inventories.edit.inventory_sources.edit.schedules.add',
- url: '/add',
- ncyBreadcrumb: {
- parent: 'inventories.edit.inventory_sources.edit.schedules',
- label: N_("CREATE SCHEDULE")
- },
- views: {
- 'scheduler@inventories': {
- controller: 'schedulerAddController',
- templateUrl: templateUrl("scheduler/schedulerForm")
- }
- }
-};
diff --git a/awx/ui/client/src/inventories-hosts/inventories/related/sources/list/schedule/sources-schedule-edit.route.js b/awx/ui/client/src/inventories-hosts/inventories/related/sources/list/schedule/sources-schedule-edit.route.js
deleted file mode 100644
index 2c956fd6cd..0000000000
--- a/awx/ui/client/src/inventories-hosts/inventories/related/sources/list/schedule/sources-schedule-edit.route.js
+++ /dev/null
@@ -1,18 +0,0 @@
-import {templateUrl} from '../../../../../../shared/template-url/template-url.factory';
-import editScheduleResolve from '../../../../../../scheduler/editSchedule.resolve';
-
-export default {
- name: 'inventories.edit.inventory_sources.edit.schedules.edit',
- url: '/:schedule_id',
- ncyBreadcrumb: {
- parent: 'inventories.edit.inventory_sources.edit.schedules',
- label: "{{breadcrumb.schedule_name}}"
- },
- views: {
- 'scheduler@inventories': {
- templateUrl: templateUrl("scheduler/schedulerForm"),
- controller: 'schedulerEditController',
- }
- },
- resolve: editScheduleResolve()
-};
diff --git a/awx/ui/client/src/inventories-hosts/inventories/related/sources/list/schedule/sources-schedule.route.js b/awx/ui/client/src/inventories-hosts/inventories/related/sources/list/schedule/sources-schedule.route.js
deleted file mode 100644
index 89cd27dffe..0000000000
--- a/awx/ui/client/src/inventories-hosts/inventories/related/sources/list/schedule/sources-schedule.route.js
+++ /dev/null
@@ -1,54 +0,0 @@
-import { N_ } from '../../../../../../i18n';
-
-export default {
- searchPrefix: 'schedule',
- name: 'inventories.edit.inventory_sources.edit.schedules',
- url: '/schedules',
- ncyBreadcrumb: {
- parent: 'inventories.edit.inventory_sources.edit',
- label: N_('SCHEDULES')
- },
- views: {
- 'related': {
- templateProvider: function(ScheduleList, generateList){
- let html = generateList.build({
- list: ScheduleList,
- mode: 'edit'
- });
- return html;
- },
- controller: 'schedulerListController'
- }
- },
- resolve: {
- Dataset: ['ScheduleList', 'QuerySet', '$stateParams', 'GetBasePath', 'inventorySource',
- function(list, qs, $stateParams, GetBasePath, inventorySource) {
- let path = `${inventorySource.get().related.schedules}`;
- return qs.search(path, $stateParams[`${list.iterator}_search`]);
- }
- ],
- ParentObject: ['inventorySource', function(inventorySource) {
- return inventorySource.get();
- }],
- UnifiedJobsOptions: ['Rest', 'GetBasePath', '$stateParams', '$q',
- function(Rest, GetBasePath, $stateParams, $q) {
- Rest.setUrl(GetBasePath('unified_jobs'));
- var val = $q.defer();
- Rest.options()
- .then(function(data) {
- val.resolve(data.data);
- }, function(data) {
- val.reject(data);
- });
- return val.promise;
- }],
- ScheduleList: ['SchedulesList', 'inventorySource',
- (SchedulesList, inventorySource) => {
- let list = _.cloneDeep(SchedulesList);
- list.basePath = `${inventorySource.get().related.schedules}`;
- list.title = false;
- return list;
- }
- ]
- }
-};
diff --git a/awx/ui/client/src/inventories-hosts/inventories/related/sources/list/sources-list.controller.js b/awx/ui/client/src/inventories-hosts/inventories/related/sources/list/sources-list.controller.js
deleted file mode 100644
index 5efa694624..0000000000
--- a/awx/ui/client/src/inventories-hosts/inventories/related/sources/list/sources-list.controller.js
+++ /dev/null
@@ -1,217 +0,0 @@
-/*************************************************
- * Copyright (c) 2016 Ansible, Inc.
- *
- * All Rights Reserved
- *************************************************/
- export default
- ['$scope', '$rootScope', '$state', '$stateParams', 'SourcesListDefinition',
- 'InventoryUpdate', 'CancelSourceUpdate',
- 'ViewUpdateStatus', 'rbacUiControlService', 'GetBasePath',
- 'GetSyncStatusMsg', 'Dataset', 'Find', 'QuerySet',
- 'inventoryData', '$filter', 'Prompt', 'Wait', 'SourcesService', 'inventorySourceOptions',
- 'canAdd', 'hasSyncableSources', 'i18n', 'InventoryHostsStrings', 'InventorySourceModel', 'ProcessErrors',
- function($scope, $rootScope, $state, $stateParams, SourcesListDefinition,
- InventoryUpdate, CancelSourceUpdate,
- ViewUpdateStatus, rbacUiControlService, GetBasePath, GetSyncStatusMsg,
- Dataset, Find, qs, inventoryData, $filter, Prompt,
- Wait, SourcesService, inventorySourceOptions, canAdd, hasSyncableSources, i18n,
- InventoryHostsStrings, InventorySource, ProcessErrors){
-
- let inventorySource = new InventorySource();
-
- let list = SourcesListDefinition;
- var inventory_source;
-
- init();
-
- function init(){
- $scope.inventory_id = $stateParams.inventory_id;
- $scope.canAdhoc = inventoryData.summary_fields.user_capabilities.adhoc;
- $scope.canAdd = canAdd;
- $scope.showSyncAll = hasSyncableSources;
-
- // Search init
- $scope.list = list;
- $scope[`${list.iterator}_dataset`] = Dataset.data;
- $scope[list.name] = $scope[`${list.iterator}_dataset`].results;
-
- $scope.inventory_id = $stateParams.inventory_id;
- _.forEach($scope[list.name], buildStatusIndicators);
- optionsRequestDataProcessing();
-
- $scope.$on(`ws-jobs`, function(e, data){
- inventory_source = Find({ list: $scope.inventory_sources, key: 'id', val: data.inventory_source_id });
-
- if (inventory_source) {
- var status = GetSyncStatusMsg({
- status: data.status
- });
- inventory_source.status = data.status;
- inventory_source.status_class = status.class;
- inventory_source.status_tooltip = status.tooltip;
- inventory_source.launch_tooltip = status.launch_tip;
- inventory_source.launch_class = status.launch_class;
- }
- });
-
- $scope.$watchCollection(`${$scope.list.name}`, function() {
- _.forEach($scope[list.name], buildStatusIndicators);
- optionsRequestDataProcessing();
- });
- }
-
- function optionsRequestDataProcessing(){
- if ($scope[list.name] !== undefined) {
- $scope[list.name].forEach(function(item, item_idx) {
- var itm = $scope[list.name][item_idx];
-
- // Set the item source label
- if (list.fields.source && inventorySourceOptions && inventorySourceOptions.hasOwnProperty('source')) {
- inventorySourceOptions.source.choices.forEach(function(choice) {
- if (choice[0] === item.source) {
- itm.source_label = choice[1];
- }
- });
- }
- });
- }
- }
-
- function buildStatusIndicators(inventory_source){
- if (inventory_source === undefined || inventory_source === null) {
- inventory_source = {};
- }
-
- let inventory_source_status;
-
- inventory_source_status = GetSyncStatusMsg({
- status: inventory_source.status,
- has_inventory_sources: inventory_source.has_inventory_sources,
- source: ( (inventory_source) ? inventory_source.source : null )
- });
- _.assign(inventory_source,
- {status_class: inventory_source_status.class},
- {status_tooltip: inventory_source_status.tooltip},
- {launch_tooltip: inventory_source_status.launch_tip},
- {launch_class: inventory_source_status.launch_class},
- {source: inventory_source ? inventory_source.source : null},
- {status: inventory_source ? inventory_source.status : null});
- }
-
- $scope.createSource = function(){
- $state.go('inventories.edit.inventory_sources.add');
- };
- $scope.editSource = function(id){
- $state.go('inventories.edit.inventory_sources.edit', {inventory_source_id: id});
- };
- $scope.deleteSource = function(inventory_source){
- var action = function(){
- $rootScope.promptActionBtnClass = "Modal-errorButton--sourcesDelete";
- Wait('start');
- let hostDelete = SourcesService.deleteHosts(inventory_source.id).catch(({data, status}) => {
- $('#prompt-modal').modal('hide');
- Wait('stop');
- ProcessErrors($scope, data, status, null,
- {
- hdr: i18n._('Error!'),
- msg: i18n._('There was an error deleting inventory source hosts. Returned status: ') +
- status
- });
- });
- let groupDelete = SourcesService.deleteGroups(inventory_source.id).catch(({data, status}) => {
- $('#prompt-modal').modal('hide');
- Wait('stop');
- ProcessErrors($scope, data, status, null,
- {
- hdr: i18n._('Error!'),
- msg: i18n._('There was an error deleting inventory source groups. Returned status: ') +
- status
- });
- });
- Promise.all([hostDelete, groupDelete]).then(() => {
- SourcesService.delete(inventory_source.id).then(() => {
- $('#prompt-modal').modal('hide');
- delete $rootScope.promptActionBtnClass;
- let reloadListStateParams = null;
-
- if($scope.inventory_sources.length === 1 && $state.params.inventory_source_search && !_.isEmpty($state.params.inventory_source_search.page) && $state.params.inventory_source_search.page !== '1') {
- reloadListStateParams = _.cloneDeep($state.params);
- reloadListStateParams.inventory_source_search.page = (parseInt(reloadListStateParams.inventory_source_search.page)-1).toString();
- }
- if (parseInt($state.params.inventory_source_id) === inventory_source.id) {
- $state.go('^', reloadListStateParams, {reload: true});
- } else {
- $state.go('.', reloadListStateParams, {reload: true});
- }
- Wait('stop');
- })
- .catch(({data, status}) => {
- $('#prompt-modal').modal('hide');
- Wait('stop');
- ProcessErrors($scope, data, status, null,
- {
- hdr: i18n._('Error!'),
- msg: i18n._('There was an error deleting inventory source. Returned status: ') +
- status
- });
- });
- });
- };
-
- inventorySource.getDependentResourceCounts(inventory_source.id)
- .then((counts) => {
- const invalidateRelatedLines = [];
- let deleteModalBody = `
${InventoryHostsStrings.get('deleteResource.CONFIRM', 'inventory source')}
`;
-
- counts.forEach(countObj => {
- if(countObj.count && countObj.count > 0) {
- invalidateRelatedLines.push(`
${countObj.label} ${countObj.count}
`);
- }
- });
-
- if (invalidateRelatedLines && invalidateRelatedLines.length > 0) {
- deleteModalBody = `
${InventoryHostsStrings.get('deleteResource.USED_BY', 'inventory source')} ${InventoryHostsStrings.get('deleteResource.CONFIRM', 'inventory source')}
`;
- invalidateRelatedLines.forEach(invalidateRelatedLine => {
- deleteModalBody += invalidateRelatedLine;
- });
- }
-
- Prompt({
- hdr: i18n._('Delete Source'),
- resourceName: $filter('sanitize')(inventory_source.name),
- body: deleteModalBody,
- action: action,
- actionText: i18n._('DELETE')
- });
- $rootScope.promptActionBtnClass = 'Modal-errorButton';
- });
-
- };
-
- $scope.updateSource = function(inventory_source) {
- InventoryUpdate({
- scope: $scope,
- url: inventory_source.related.update
- });
- };
-
- $scope.cancelUpdate = function (id) {
- CancelSourceUpdate({ scope: $scope, id: id });
- };
-
- $scope.viewUpdateStatus = function (id) {
- ViewUpdateStatus({
- scope: $scope,
- inventory_source_id: id
- });
- };
-
- $scope.syncAllSources = function() {
- InventoryUpdate({
- scope: $scope,
- url: inventoryData.related.update_inventory_sources,
- updateAllSources: true
- });
- };
-
- }];
diff --git a/awx/ui/client/src/inventories-hosts/inventories/related/sources/list/sources-list.partial.html b/awx/ui/client/src/inventories-hosts/inventories/related/sources/list/sources-list.partial.html
deleted file mode 100644
index 5ac271784d..0000000000
--- a/awx/ui/client/src/inventories-hosts/inventories/related/sources/list/sources-list.partial.html
+++ /dev/null
@@ -1,29 +0,0 @@
-
diff --git a/awx/ui/client/src/inventories-hosts/inventories/related/sources/list/sources-list.route.js b/awx/ui/client/src/inventories-hosts/inventories/related/sources/list/sources-list.route.js
deleted file mode 100644
index 0bc50c9e75..0000000000
--- a/awx/ui/client/src/inventories-hosts/inventories/related/sources/list/sources-list.route.js
+++ /dev/null
@@ -1,90 +0,0 @@
-import { N_ } from '../../../../../i18n';
-
-export default {
- name: "inventories.edit.inventory_sources",
- url: "/inventory_sources?{inventory_source_search:queryset}",
- params: {
- inventory_source_search: {
- value: {
- page_size: "20",
- order_by: "name",
- not__source: ""
- },
- dynamic: true,
- squash: ""
- }
- },
- data: {
- socket: {
- groups: {
- jobs: ["status_changed"],
- inventories: ["status_changed"]
- }
- }
- },
- ncyBreadcrumb: {
- parent: "inventories.edit",
- label: N_("SOURCES")
- },
- views: {
- 'related': {
- templateProvider: function(SourcesListDefinition, generateList) {
- let list = _.cloneDeep(SourcesListDefinition);
- let html = generateList.build({
- list: list,
- mode: 'edit'
- });
- return html;
- },
- controller: 'SourcesListController'
- }
- },
- resolve: {
- inventorySourceOptions: ['SourcesService', (SourcesService) => {
- return SourcesService.options().then(response => response.data.actions.GET);
- }],
- Dataset: ['SourcesListDefinition', 'QuerySet', '$stateParams', 'GetBasePath', '$interpolate', '$rootScope',
- (list, qs, $stateParams, GetBasePath, $interpolate, $rootScope) => {
- // allow related list definitions to use interpolated $rootScope / $stateParams in basePath field
- let path, interpolator;
- if (GetBasePath(list.basePath)) {
- path = GetBasePath(list.basePath);
- } else {
- interpolator = $interpolate(list.basePath);
- path = interpolator({ $rootScope: $rootScope, $stateParams: $stateParams });
- }
- return qs.search(path, $stateParams[`${list.iterator}_search`]);
- }
- ],
- inventoryData: ['InventoriesService', '$stateParams', function(InventoriesService, $stateParams) {
- return InventoriesService.getInventory($stateParams.inventory_id).then(res => res.data);
- }],
- canAdd: ['rbacUiControlService', 'GetBasePath', '$stateParams', function(rbacUiControlService, GetBasePath, $stateParams) {
- return rbacUiControlService.canAdd(GetBasePath('inventory') + $stateParams.inventory_id + "/inventory_sources")
- .then(function(res) {
- return res.canAdd;
- })
- .catch(function() {
- return false;
- });
- }],
- hasSyncableSources: ['InventoriesService', '$stateParams', function(InventoriesService, $stateParams) {
- return InventoriesService.updateInventorySourcesGet($stateParams.inventory_id)
- .then(function(res) {
- let canUpdateFound = false;
- if(res.data && res.data.length > 0) {
- res.data.forEach(function(source) {
- if(source.can_update) {
- canUpdateFound = true;
- }
- });
- }
-
- return canUpdateFound;
- })
- .catch(function() {
- return false;
- });
- }]
- }
-};
diff --git a/awx/ui/client/src/inventories-hosts/inventories/related/sources/lookup/sources-lookup-credential.route.js b/awx/ui/client/src/inventories-hosts/inventories/related/sources/lookup/sources-lookup-credential.route.js
deleted file mode 100644
index a61e96725e..0000000000
--- a/awx/ui/client/src/inventories-hosts/inventories/related/sources/lookup/sources-lookup-credential.route.js
+++ /dev/null
@@ -1,55 +0,0 @@
-export default {
- params: {
- credential_search: {
- value: {
- page_size:"5",
- order_by:"name",
- role_level:"use_role",
- kind: null,
- credential_type__kind: null
- },
- dynamic:true,
- squash:""
- }
- },
- data: {
- basePath:"credentials",
- formChildState:true
- },
- ncyBreadcrumb: {
- skip: true
- },
- views: {
- 'modal': {
- templateProvider: function(ListDefinition, generateList) {
- let list_html = generateList.build({
- mode: 'lookup',
- list: ListDefinition,
- input_type: 'radio'
- });
- return `
${list_html} `;
-
- }
- }
- },
- resolve: {
- ListDefinition: ['CredentialList', function(list) {
- return list;
- }],
- Dataset: ['ListDefinition', 'QuerySet', '$stateParams', 'GetBasePath', '$transition$',
- (list, qs, $stateParams, GetBasePath, $transition$) => {
- const toState = $transition$.to();
- toState.params.credential_search.value.credential_type__namespace = _.get($stateParams, 'credential_search.credential_type__namespace', null);
- toState.params.credential_search.value.credential_type__kind = _.get($stateParams, 'credential_search.credential_type__kind', null);
- return qs.search(GetBasePath('credentials'), $stateParams[`${list.iterator}_search`]);
- }
- ]
- },
- onExit: function($state) {
- if ($state.transition) {
- $('#form-modal').modal('hide');
- $('.modal-backdrop').remove();
- $('body').removeClass('modal-open');
- }
- }
-};
diff --git a/awx/ui/client/src/inventories-hosts/inventories/related/sources/lookup/sources-lookup-inventory-script.route.js b/awx/ui/client/src/inventories-hosts/inventories/related/sources/lookup/sources-lookup-inventory-script.route.js
deleted file mode 100644
index c2a9ab71b9..0000000000
--- a/awx/ui/client/src/inventories-hosts/inventories/related/sources/lookup/sources-lookup-inventory-script.route.js
+++ /dev/null
@@ -1,65 +0,0 @@
-export default {
- params: {
- inventory_script_search: {
- value: {
- page_size: "5",
- order_by: "name",
- role_level: "admin_role",
- },
- dynamic: true,
- squash: ""
- }
- },
- data: {
- basePath: "inventory_scripts",
- formChildState: true
- },
- ncyBreadcrumb: {
- skip: true
- },
- views: {
- 'modal': {
- templateProvider: function(ListDefinition, generateList) {
- let list_html = generateList.build({
- mode: 'lookup',
- list: ListDefinition,
- input_type: 'radio'
- });
- return `
${list_html} `;
-
- }
- }
- },
- resolve: {
- ListDefinition: ['InventoryScriptsList', function(list) {
- return list;
- }],
- OrganizationId: ['ListDefinition', 'InventoriesService', '$stateParams', '$rootScope',
- function(list, InventoriesService, $stateParams, $rootScope){
- if($rootScope.$$childTail &&
- $rootScope.$$childTail.$resolve &&
- $rootScope.$$childTail.$resolve.hasOwnProperty('inventoryData')){
- return $rootScope.$$childTail.$resolve.inventoryData.summary_fields.organization.id;
- }
- else {
- return InventoriesService.getInventory($stateParams.inventory_id).then(res => res.data.summary_fields.organization.id);
- }
- }],
- Dataset: ['ListDefinition', 'QuerySet', '$stateParams', 'GetBasePath', '$interpolate', '$rootScope', '$state', 'OrganizationId',
- (list, qs, $stateParams, GetBasePath, $interpolate, $rootScope, $state, OrganizationId) => {
-
- $stateParams[`${list.iterator}_search`].role_level = "admin_role";
- $stateParams[`${list.iterator}_search`].organization = OrganizationId;
-
- return qs.search(GetBasePath('inventory_scripts'), $stateParams[`${list.iterator}_search`]);
- }
- ]
- },
- onExit: function($state) {
- if ($state.transition) {
- $('#form-modal').modal('hide');
- $('.modal-backdrop').remove();
- $('body').removeClass('modal-open');
- }
- }
-};
diff --git a/awx/ui/client/src/inventories-hosts/inventories/related/sources/lookup/sources-lookup-project.route.js b/awx/ui/client/src/inventories-hosts/inventories/related/sources/lookup/sources-lookup-project.route.js
deleted file mode 100644
index 53869691a7..0000000000
--- a/awx/ui/client/src/inventories-hosts/inventories/related/sources/lookup/sources-lookup-project.route.js
+++ /dev/null
@@ -1,51 +0,0 @@
-export default {
- params: {
- project_search: {
- value: {
- page_size:"5",
- order_by:"name",
- not__status:"never updated",
- role_level:"use_role",
- },
- dynamic:true,
- squash:""
- }
- },
- data: {
- basePath:"projects",
- formChildState:true
- },
- ncyBreadcrumb: {
- skip: true
- },
- views: {
- 'modal': {
- templateProvider: function(ListDefinition, generateList) {
- let list_html = generateList.build({
- mode: 'lookup',
- list: ListDefinition,
- input_type: 'radio'
- });
- return `
${list_html} `;
-
- }
- }
- },
- resolve: {
- ListDefinition: ['ProjectList', function(list) {
- return list;
- }],
- Dataset: ['ListDefinition', 'QuerySet', '$stateParams', 'GetBasePath',
- (list, qs, $stateParams, GetBasePath) => {
- return qs.search(GetBasePath('projects'), $stateParams[`${list.iterator}_search`]);
- }
- ]
- },
- onExit: function($state) {
- if ($state.transition) {
- $('#form-modal').modal('hide');
- $('.modal-backdrop').remove();
- $('body').removeClass('modal-open');
- }
- }
-};
diff --git a/awx/ui/client/src/inventories-hosts/inventories/related/sources/main.js b/awx/ui/client/src/inventories-hosts/inventories/related/sources/main.js
deleted file mode 100644
index 51eafc26c6..0000000000
--- a/awx/ui/client/src/inventories-hosts/inventories/related/sources/main.js
+++ /dev/null
@@ -1,30 +0,0 @@
-/*************************************************
- * Copyright (c) 2017 Ansible, Inc.
- *
- * All Rights Reserved
- *************************************************/
-
-import sourcesList from './list/main';
-import sourcesAdd from './add/main';
-import sourcesEdit from './edit/main';
-import sourcesFormDefinition from './sources.form';
-import sourcesListDefinition from './sources.list';
-import service from './sources.service';
-import GetSyncStatusMsg from './factories/get-sync-status-msg.factory';
-import ViewUpdateStatus from './factories/view-update-status.factory';
-import CancelSourceUpdate from './factories/cancel-source-update.factory';
-import GetSourceTypeOptions from './factories/get-source-type-options.factory';
-
-export default
- angular.module('sources', [
- sourcesList.name,
- sourcesAdd.name,
- sourcesEdit.name
- ])
- .factory('SourcesFormDefinition', sourcesFormDefinition)
- .factory('SourcesListDefinition', sourcesListDefinition)
- .factory('GetSyncStatusMsg', GetSyncStatusMsg)
- .factory('ViewUpdateStatus', ViewUpdateStatus)
- .factory('CancelSourceUpdate', CancelSourceUpdate)
- .factory('GetSourceTypeOptions', GetSourceTypeOptions)
- .service('SourcesService', service);
diff --git a/awx/ui/client/src/inventories-hosts/inventories/related/sources/sources.form.js b/awx/ui/client/src/inventories-hosts/inventories/related/sources/sources.form.js
deleted file mode 100644
index 01e322e24d..0000000000
--- a/awx/ui/client/src/inventories-hosts/inventories/related/sources/sources.form.js
+++ /dev/null
@@ -1,534 +0,0 @@
-/*************************************************
- * Copyright (c) 2019 Ansible, Inc.
- *
- * All Rights Reserved
- *************************************************/
-
-export default ['NotificationsList', 'i18n', function(NotificationsList, i18n){
-
- var notifications_object = {
- generateList: true,
- include: "NotificationsList",
- ngIf: "(sufficientRoleForNotif) && !(inventory_source_obj.source === undefined || inventory_source_obj.source === '')",
- ngClick: "$state.go('inventories.edit.inventory_sources.edit.notifications')"
- };
- let clone = _.clone(NotificationsList);
- notifications_object = angular.extend(clone, notifications_object);
- return {
- addTitle: i18n._('CREATE SOURCE'),
- editTitle: '{{ name }}',
- showTitle: true,
- name: 'inventory_source',
- basePath: 'inventory_sources',
- parent: 'inventories.edit.sources',
- // the parent node this generated state definition tree expects to attach to
- stateTree: 'inventories',
- tabs: true,
- // 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: 'inventories.edit.inventory_sources.edit',
- detailsClick: "$state.go('inventories.edit.inventory_sources.edit')",
- well: false,
- subFormTitles: {
- sourceSubForm: i18n._('Source Details'),
- },
- fields: {
- name: {
- label: i18n._('Name'),
- type: 'text',
- ngDisabled: '!(inventory_source_obj.summary_fields.user_capabilities.edit || canAdd)',
- required: true,
- tab: 'properties'
- },
- description: {
- label: i18n._('Description'),
- type: 'text',
- ngDisabled: '!(inventory_source_obj.summary_fields.user_capabilities.edit || canAdd)',
- tab: 'properties'
- },
- source: {
- label: i18n._('Source'),
- type: 'select',
- required: true,
- ngOptions: 'source.label for source in source_type_options track by source.value',
- ngChange: 'sourceChange(source)',
- ngDisabled: '!(inventory_source_obj.summary_fields.user_capabilities.edit || canAdd)',
- ngModel: 'source',
- hasSubForm: true
- },
- custom_virtualenv: {
- label: i18n._('Ansible Environment'),
- type: 'select',
- defaultText: i18n._('Use Default Environment'),
- ngOptions: 'venv for venv in custom_virtualenvs_options track by venv',
-
- awPopOver: "
" + i18n._("Select the custom Python virtual environment for this inventory source sync to run on.") + "
",
- dataTitle: i18n._('Ansible Environment'),
- dataContainer: 'body',
- dataPlacement: 'right',
- ngDisabled: '!(inventory_source_obj.summary_fields.user_capabilities.edit || canAdd)',
- ngShow: 'custom_virtualenvs_options.length > 1'
- },
- credential: {
- label: i18n._('Credential'),
- type: 'lookup',
- list: 'CredentialList',
- basePath: 'credentials',
- ngShow: "source && source.value !== ''",
- sourceModel: 'credential',
- sourceField: 'name',
- ngClick: 'lookupCredential()',
- awRequiredWhen: {
- reqExpression: "cloudCredentialRequired",
- init: "false"
- },
- subForm: 'sourceSubForm',
- ngDisabled: '!(inventory_source_obj.summary_fields.user_capabilities.edit || canAdd)',
- watchBasePath: "credentialBasePath"
- },
- project: {
- // initializes a default value for this search param
- // search params with default values set will not generate user-interactable search tags
- label: i18n._('Project'),
- type: 'lookup',
- list: 'ProjectList',
- basePath: 'projects',
- ngShow: "source && source.value === 'scm'",
- sourceModel: 'project',
- sourceField: 'name',
- ngClick: 'lookupProject()',
- awRequiredWhen: {
- reqExpression: "source && source.value === 'scm'",
- init: "false"
- },
- ngDisabled: '!(inventory_source_obj.summary_fields.user_capabilities.edit || canAdd)',
- watchBasePath: "projectBasePath",
- subForm: 'sourceSubForm'
- },
- inventory_file: {
- label: i18n._('Inventory File'),
- type:'select',
- defaultText: i18n._('Choose an inventory file'),
- ngOptions: 'file for file in inventory_files track by file',
- ngShow: "source && source.value === 'scm'",
- ngDisabled: "!(inventory_source_obj.summary_fields.user_capabilities.edit || canAdd) || disableInventoryFileBecausePermissionDenied",
- id: 'inventory-file-select',
- awRequiredWhen: {
- reqExpression: "source && source.value === 'scm'",
- init: "true"
- },
- column: 1,
- awPopOver: "
" + i18n._("Select the inventory file to be synced by this source. " +
- "You can select from the dropdown or enter a file within the input.") + "
",
- dataTitle: i18n._('Inventory File'),
- dataPlacement: 'right',
- dataContainer: "body",
- includeInventoryFileNotFoundError: true,
- subForm: 'sourceSubForm'
- },
- inventory_script: {
- label : i18n._("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: '!(inventory_source_obj.summary_fields.user_capabilities.edit || canAdd)',
- subForm: 'sourceSubForm'
- },
- custom_variables: {
- id: 'custom_variables',
- label: i18n._('Environment Variables'), //"{{vars_label}}" ,
- ngShow: "source && source.value=='custom' || source.value === 'scm'",
- type: 'textarea',
- class: 'Form-textAreaLabel Form-formGroup--fullWidth',
- rows: 6,
- 'default': '---',
- parseTypeName: 'envParseType',
- dataTitle: i18n._("Environment Variables"),
- dataPlacement: 'right',
- awPopOver: "
" + i18n._("Provide environment variables to pass to the custom inventory script.") + "
" +
- "
" + i18n._("Enter variables using either JSON or YAML syntax. Use the radio button to toggle between the two.") + "
" +
- i18n._("JSON:") + "
\n" +
- "
{ \"somevar\": \"somevalue\", \"password\": \"magic\" } \n" +
- i18n._("YAML:") + "
\n" +
- "
--- somevar: somevalue password: magic \n" +
- "
" + i18n._("View JSON examples at ") + 'www.json.org
' +
- "
" + i18n._("View YAML examples at ") + 'docs.ansible.com
',
- dataContainer: 'body',
- subForm: 'sourceSubForm'
- },
- ec2_variables: {
- id: 'ec2_variables',
- label: i18n._('Source Variables'), //"{{vars_label}}" ,
- ngShow: "source && source.value == 'ec2'",
- type: 'textarea',
- class: 'Form-textAreaLabel Form-formGroup--fullWidth',
- rows: 6,
- 'default': '---',
- parseTypeName: 'envParseType',
- dataTitle: i18n._("Source Variables"),
- dataPlacement: 'right',
- awPopOver: "
" + i18n._("Enter variables to configure the inventory source. For a detailed description of how to configure this plugin, see ") +
- "" +
- i18n._("Inventory Plugins") + " " + i18n._("in the documentation and the ") +
- "aws_ec2 " +
- i18n._("plugin configuration guide.") + "
" +
- "
" + i18n._("Enter variables using either JSON or YAML syntax. Use the radio button to toggle between the two.") + "
" +
- i18n._("JSON:") + "
\n" +
- "
{ \"somevar\": \"somevalue\", \"password\": \"magic\" } \n" +
- i18n._("YAML:") + "
\n" +
- "
--- somevar: somevalue password: magic \n" +
- "
" + i18n._("View JSON examples at ") + 'www.json.org
' +
- "
" + i18n._("View YAML examples at ") + 'docs.ansible.com
',
- dataContainer: 'body',
- subForm: 'sourceSubForm'
- },
- vmware_variables: {
- id: 'vmware_variables',
- label: i18n._('Source Variables'), //"{{vars_label}}" ,
- ngShow: "source && source.value == 'vmware'",
- type: 'textarea',
- class: 'Form-textAreaLabel Form-formGroup--fullWidth',
- rows: 6,
- 'default': '---',
- parseTypeName: 'envParseType',
- dataTitle: i18n._("Source Variables"),
- dataPlacement: 'right',
- awPopOver: "
" + i18n._("Enter variables to configure the inventory source. For a detailed description of how to configure this plugin, see ") +
- "" +
- i18n._("Inventory Plugins") + " " + i18n._("in the documentation and the ") +
- "vmware_vm_inventory " +
- i18n._("plugin configuration guide.") + "
" +
- "
" + i18n._("Enter variables using either JSON or YAML syntax. Use the radio button to toggle between the two.") + "
" +
- i18n._("JSON:") + "
\n" +
- "
{ \"somevar\": \"somevalue\", \"password\": \"magic\" } \n" +
- i18n._("YAML:") + "
\n" +
- "
--- somevar: somevalue password: magic \n" +
- "
" + i18n._("View JSON examples at ") + 'www.json.org
' +
- "
" + i18n._("View YAML examples at ") + 'docs.ansible.com
',
- dataContainer: 'body',
- subForm: 'sourceSubForm'
- },
- openstack_variables: {
- id: 'openstack_variables',
- label: i18n._('Source Variables'), //"{{vars_label}}" ,
- ngShow: "source && source.value == 'openstack'",
- type: 'textarea',
- class: 'Form-textAreaLabel Form-formGroup--fullWidth',
- rows: 6,
- 'default': '---',
- parseTypeName: 'envParseType',
- dataTitle: i18n._("Source Variables"),
- dataPlacement: 'right',
- awPopOver: "
" + i18n._("Enter variables to configure the inventory source. For a detailed description of how to configure this plugin, see ") +
- "" +
- i18n._("Inventory Plugins") + " " + i18n._("in the documentation and the ") +
- "openstack " +
- i18n._("plugin configuration guide.") + "
" +
- "
" + i18n._("Enter variables using either JSON or YAML syntax. Use the radio button to toggle between the two.") + "
" +
- i18n._("JSON:") + "
\n" +
- "
{ \"somevar\": \"somevalue\", \"password\": \"magic\" } \n" +
- i18n._("YAML:") + "
\n" +
- "
--- somevar: somevalue password: magic \n" +
- "
" + i18n._("View JSON examples at ") + 'www.json.org
' +
- "
" + i18n._("View YAML examples at ") + 'docs.ansible.com
',
- dataContainer: 'body',
- subForm: 'sourceSubForm'
- },
- cloudforms_variables: {
- id: 'cloudforms_variables',
- label: i18n._('Source Variables'),
- ngShow: "source && source.value == 'cloudforms'",
- type: 'textarea',
- class: 'Form-textAreaLabel Form-formGroup--fullWidth',
- rows: 6,
- 'default': '---',
- parseTypeName: 'envParseType',
- dataTitle: i18n._("Source Variables"),
- dataPlacement: 'right',
- awPopOver: i18n._("Override variables found in cloudforms.ini and used by the inventory update script. For an example variable configuration") +
- '
' +
- i18n._("view cloudforms.ini in the Ansible Collections github repo.") + " " + i18n._(" Enter inventory variables using either JSON or YAML syntax. Use the radio button to toggle between the two. Refer to the Ansible Tower documentation for example syntax."),
- dataContainer: 'body',
- subForm: 'sourceSubForm'
- },
- satellite6_variables: {
- id: 'satellite6_variables',
- label: i18n._('Source Variables'),
- ngShow: "source && source.value == 'satellite6'",
- type: 'textarea',
- class: 'Form-textAreaLabel Form-formGroup--fullWidth',
- rows: 6,
- 'default': '---',
- parseTypeName: 'envParseType',
- dataTitle: i18n._("Source Variables"),
- dataPlacement: 'right',
- awPopOver: "
" + i18n._("Enter variables to configure the inventory source. For a detailed description of how to configure this plugin, see ") +
- "" +
- i18n._("Inventory Plugins") + " " + i18n._("in the documentation and the ") +
- "foreman " +
- i18n._("plugin configuration guide.") + "
" +
- "
" + i18n._("Enter variables using either JSON or YAML syntax. Use the radio button to toggle between the two.") + "
" +
- i18n._("JSON:") + "
\n" +
- "
{ \"somevar\": \"somevalue\", \"password\": \"magic\" } \n" +
- i18n._("YAML:") + "
\n" +
- "
--- somevar: somevalue password: magic \n" +
- "
" + i18n._("View JSON examples at ") + 'www.json.org
' +
- "
" + i18n._("View YAML examples at ") + 'docs.ansible.com
',
- dataContainer: 'body',
- subForm: 'sourceSubForm'
- },
- azure_rm_variables: {
- id: 'azure_rm_variables',
- label: i18n._('Source Variables'), //"{{vars_label}}" ,
- ngShow: "source && source.value == 'azure_rm'",
- type: 'textarea',
- class: 'Form-textAreaLabel Form-formGroup--fullWidth',
- rows: 6,
- 'default': '---',
- parseTypeName: 'envParseType',
- dataTitle: i18n._("Source Variables"),
- dataPlacement: 'right',
- awPopOver: "
" + i18n._("Enter variables to configure the inventory source. For a detailed description of how to configure this plugin, see ") +
- "" +
- i18n._("Inventory Plugins") + " " + i18n._("in the documentation and the ") +
- "azure_rm " +
- i18n._("plugin configuration guide.") + "
" +
- "
" + i18n._("Enter variables using either JSON or YAML syntax. Use the radio button to toggle between the two.") + "
" +
- i18n._("JSON:") + "
\n" +
- "
{ \"somevar\": \"somevalue\", \"password\": \"magic\" } \n" +
- i18n._("YAML:") + "
\n" +
- "
--- somevar: somevalue password: magic \n" +
- "
" + i18n._("View JSON examples at ") + 'www.json.org
' +
- "
" + i18n._("View YAML examples at ") + 'docs.ansible.com
',
- dataContainer: 'body',
- subForm: 'sourceSubForm'
- },
- gce_variables: {
- id: 'gce_variables',
- label: i18n._('Source Variables'), //"{{vars_label}}" ,
- ngShow: "source && source.value == 'gce'",
- type: 'textarea',
- class: 'Form-textAreaLabel Form-formGroup--fullWidth',
- rows: 6,
- 'default': '---',
- parseTypeName: 'envParseType',
- dataTitle: i18n._("Source Variables"),
- dataPlacement: 'right',
- awPopOver: "
" + i18n._("Enter variables to configure the inventory source. For a detailed description of how to configure this plugin, see ") +
- "" +
- i18n._("Inventory Plugins") + " " + i18n._("in the documentation and the ") +
- "gcp_compute " +
- i18n._("plugin configuration guide.") + "
" +
- "
" + i18n._("Enter variables using either JSON or YAML syntax. Use the radio button to toggle between the two.") + "
" +
- i18n._("JSON:") + "
\n" +
- "
{ \"somevar\": \"somevalue\", \"password\": \"magic\" } \n" +
- i18n._("YAML:") + "
\n" +
- "
--- somevar: somevalue password: magic \n" +
- "
" + i18n._("View JSON examples at ") + 'www.json.org
' +
- "
" + i18n._("View YAML examples at ") + 'docs.ansible.com
',
- dataContainer: 'body',
- subForm: 'sourceSubForm'
- },
- tower_variables: {
- id: 'tower_variables',
- label: i18n._('Source Variables'), //"{{vars_label}}" ,
- ngShow: "source && source.value == 'tower'",
- type: 'textarea',
- class: 'Form-textAreaLabel Form-formGroup--fullWidth',
- rows: 6,
- 'default': '---',
- parseTypeName: 'envParseType',
- dataTitle: i18n._("Source Variables"),
- dataPlacement: 'right',
- awPopOver: "
" + i18n._("Enter variables to configure the inventory source. For a detailed description of how to configure this plugin, see ") +
- "" +
- i18n._("Inventory Plugins") + " " + i18n._("in the documentation and the ") +
- "tower " +
- i18n._("plugin configuration guide.") + "
" +
- "
" + i18n._("Enter variables using either JSON or YAML syntax. Use the radio button to toggle between the two.") + "
" +
- i18n._("JSON:") + "
\n" +
- "
{ \"somevar\": \"somevalue\", \"password\": \"magic\" } \n" +
- i18n._("YAML:") + "
\n" +
- "
--- somevar: somevalue password: magic \n" +
- "
" + i18n._("View JSON examples at ") + 'www.json.org
' +
- "
" + i18n._("View YAML examples at ") + 'docs.ansible.com
',
- dataContainer: 'body',
- subForm: 'sourceSubForm'
- },
- rhv_variables: {
- id: 'rhv_variables',
- label: i18n._('Source Variables'), //"{{vars_label}}" ,
- ngShow: "source && source.value == 'rhv'",
- type: 'textarea',
- class: 'Form-textAreaLabel Form-formGroup--fullWidth',
- rows: 6,
- 'default': '---',
- parseTypeName: 'envParseType',
- dataTitle: i18n._("Source Variables"),
- dataPlacement: 'right',
- awPopOver: "
" + i18n._("Enter variables to configure the inventory source. For a detailed description of how to configure this plugin, see ") +
- "" +
- i18n._("Inventory Plugins") + " " + i18n._("in the documentation and the ") +
- "ovirt " +
- i18n._("plugin configuration guide.") + "
" +
- "
" + i18n._("Enter variables using either JSON or YAML syntax. Use the radio button to toggle between the two.") + "
" +
- i18n._("JSON:") + "
\n" +
- "
{ \"somevar\": \"somevalue\", \"password\": \"magic\" } \n" +
- i18n._("YAML:") + "
\n" +
- "
--- somevar: somevalue password: magic \n" +
- "
" + i18n._("View JSON examples at ") + 'www.json.org
' +
- "
" + i18n._("View YAML examples at ") + 'docs.ansible.com
',
- dataContainer: 'body',
- subForm: 'sourceSubForm'
- },
- verbosity: {
- label: i18n._('Verbosity'),
- type: 'select',
- ngOptions: 'v.label for v in verbosity_options track by v.value',
- ngShow: "source && (source.value !== '' && source.value !== null)",
- disableChooseOption: true,
- column: 1,
- awPopOver: "
" + i18n._("Control the level of output ansible will produce for inventory source update jobs.") + "
",
- dataTitle: i18n._('Verbosity'),
- dataPlacement: 'right',
- dataContainer: "body",
- ngDisabled: '!(inventory_source_obj.summary_fields.user_capabilities.edit || canAdd)',
- subForm: 'sourceSubForm'
- },
- host_filter: {
- label: i18n._("Host Filter"),
- type: 'text',
- dataTitle: i18n._('Host Filter'),
- dataPlacement: 'right',
- awPopOver: "
" + i18n._("Regular expression where only matching host names will be imported. The filter is applied as a post-processing step after any inventory plugin filters are applied.") + "
",
- dataContainer: 'body',
- ngDisabled: '!(inventory_source_obj.summary_fields.user_capabilities.edit || canAdd)',
- subForm: 'sourceSubForm'
- },
- enabled_var: {
- label: i18n._("Enabled Variable"),
- type: 'text',
- dataTitle: i18n._('Enabled Variable'),
- dataPlacement: 'right',
- awPopOver: "
" + i18n._("Retrieve the enabled state from the given dict of host variables. The enabled variable may be specified using dot notation, e.g: 'foo.bar'") + "
",
- dataContainer: 'body',
- ngDisabled: '!(inventory_source_obj.summary_fields.user_capabilities.edit || canAdd)',
- subForm: 'sourceSubForm'
- },
- enabled_value: {
- label: i18n._("Enabled Value"),
- type: 'text',
- dataTitle: i18n._('Enabled Value'),
- dataPlacement: 'right',
- awPopOver: "
" + i18n._("This field is ignored unless an Enabled Variable is set. If the enabled variable matches this value, the host will be enabled on import.") + "
",
- dataContainer: 'body',
- ngDisabled: '!(inventory_source_obj.summary_fields.user_capabilities.edit || canAdd)',
- subForm: 'sourceSubForm'
- },
- checkbox_group: {
- label: i18n._('Update Options'),
- type: 'checkbox_group',
- ngShow: "source && (source.value !== '' && source.value !== null)",
- subForm: 'sourceSubForm',
- fields: [{
- name: 'overwrite',
- label: i18n._('Overwrite'),
- type: 'checkbox',
- ngShow: "source.value !== '' && source.value !== null",
- awPopOver: "
" + i18n._("If checked, any hosts and groups that were previously present on the external source but are now removed will be removed from the Tower inventory. Hosts and groups that were not managed by the inventory source will be promoted to the next manually created group or if there is no manually created group to promote them into, they will be left in the \"all\" default group for the inventory.") + '
' +
- i18n._("When not checked, local child hosts and groups not found on the external source will remain untouched by the inventory update process.") + "
",
- dataTitle: i18n._('Overwrite'),
- dataContainer: 'body',
- dataPlacement: 'right',
- ngDisabled: "(!(inventory_source_obj.summary_fields.user_capabilities.edit || canAdd))"
- }, {
- name: 'overwrite_vars',
- label: i18n._('Overwrite Variables'),
- type: 'checkbox',
- ngShow: "source.value !== '' && source.value !== null",
- awPopOver: "
" + i18n._("If checked, all variables for child groups and hosts will be removed and replaced by those found on the external source.") + '
' +
- i18n._("When not checked, a merge will be performed, combining local variables with those found on the external source.") + "
",
- dataTitle: i18n._('Overwrite Variables'),
- dataContainer: 'body',
- dataPlacement: 'right',
- ngDisabled: "(!(inventory_source_obj.summary_fields.user_capabilities.edit || canAdd))"
- }, {
- name: 'update_on_launch',
- label: i18n._('Update on Launch'),
- type: 'checkbox',
- ngShow: "source.value !== '' && source.value !== null",
- awPopOver: "
" + i18n._("Each time a job runs using this inventory, " +
- "refresh the inventory from the selected source before executing job tasks.") + "
",
- dataTitle: i18n._('Update on Launch'),
- dataContainer: 'body',
- dataPlacement: 'right',
- ngDisabled: '!(inventory_source_obj.summary_fields.user_capabilities.edit || canAdd)'
- }, {
- name: 'update_on_project_update',
- label: i18n._('Update on Project Update'),
- type: 'checkbox',
- ngShow: "source.value === 'scm'",
- awPopOver: "
" + i18n._("After every project update where the SCM revision changes, " +
- "refresh the inventory from the selected source before executing job tasks. " +
- "This is intended for static content, like the Ansible inventory .ini file format.") + "
",
- dataTitle: i18n._('Update on Project Update'),
- dataContainer: 'body',
- dataPlacement: 'right',
- ngDisabled: '!(inventory_source_obj.summary_fields.user_capabilities.edit || canAdd)'
- }]
- },
- update_cache_timeout: {
- label: i18n._("Cache Timeout") + "
" + i18n._("(seconds)") + " ",
- id: 'source-cache-timeout',
- type: 'number',
- ngDisabled: '!(inventory_source_obj.summary_fields.user_capabilities.edit || canAdd)',
- integer: true,
- min: 0,
- ngShow: "source && source.value !== '' && update_on_launch",
- spinner: true,
- "default": 0,
- awPopOver: "
" + i18n._("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: i18n._('Cache Timeout'),
- dataPlacement: 'right',
- dataContainer: "body",
- subForm: 'sourceSubForm'
- }
- },
-
- buttons: {
- cancel: {
- ngClick: 'formCancel()',
- ngShow: '(inventory_source_obj.summary_fields.user_capabilities.edit || canAdd)'
- },
- close: {
- ngClick: 'formCancel()',
- ngShow: '!(inventory_source_obj.summary_fields.user_capabilities.edit || canAdd)'
- },
- save: {
- ngClick: 'formSave()',
- ngDisabled: true,
- ngShow: '(inventory_source_obj.summary_fields.user_capabilities.edit || canAdd)'
- }
- },
-
- related: {
- notifications: notifications_object,
- schedules: {
- title: i18n._('Schedules'),
- skipGenerator: true,
- ngClick: "$state.go('inventories.edit.inventory_sources.edit.schedules')"
- }
- }
-
- };
-
-}];
diff --git a/awx/ui/client/src/inventories-hosts/inventories/related/sources/sources.list.js b/awx/ui/client/src/inventories-hosts/inventories/related/sources/sources.list.js
deleted file mode 100644
index 4350de5823..0000000000
--- a/awx/ui/client/src/inventories-hosts/inventories/related/sources/sources.list.js
+++ /dev/null
@@ -1,127 +0,0 @@
-/*************************************************
- * Copyright (c) 2017 Ansible, Inc.
- *
- * All Rights Reserved
- *************************************************/
-
- export default ['i18n', function(i18n) {
- return {
- name: 'inventory_sources',
- iterator: 'inventory_source',
- editTitle: '{{ inventory_source.name }}',
- well: true,
- wellOverride: true,
- index: false,
- hover: true,
- trackBy: 'inventory_source.id',
- basePath: 'api/v2/inventories/{{$stateParams.inventory_id}}/inventory_sources/',
- layoutClass: 'List-staticColumnLayout--statusOrCheckbox',
- staticColumns: [
- {
- field: 'sync_status',
- content: {
- label: '',
- nosort: true,
- mode: 'all',
- iconOnly: true,
- ngClick: 'viewUpdateStatus(inventory_source.id)',
- awToolTip: "{{ inventory_source.status_tooltip }}",
- dataTipWatch: "inventory_source.status_tooltip",
- icon: "{{ 'fa icon-cloud-' + inventory_source.status_class }}",
- ngClass: "inventory_source.status_class",
- dataPlacement: "top",
- }
- }
- ],
-
- fields: {
- name: {
- label: i18n._('Sources'),
- key: true,
- uiSref: "inventories.edit.inventory_sources.edit({inventory_source_id:inventory_source.id})",
- columnClass: 'col-lg-4 col-md-4 col-sm-4 col-xs-4',
- },
- source: {
- label: i18n._('Type'),
- ngBind: 'inventory_source.source_label',
- columnClass: 'col-lg-4 col-md-4 col-sm-4 col-xs-4'
- }
- },
-
- actions: {
- refresh: {
- mode: 'all',
- awToolTip: i18n._("Refresh the page"),
- ngClick: "refreshGroups()",
- ngShow: "socketStatus == 'error'",
- actionClass: 'btn List-buttonDefault',
- buttonContent: i18n._('REFRESH')
- },
- sync_all: {
- mode: 'all',
- awToolTip: i18n._("Sync all inventory sources"),
- ngClick: "syncAllSources()",
- ngShow: "showSyncAll",
- actionClass: 'btn List-buttonDefault',
- buttonContent: i18n._('SYNC ALL'),
- dataPlacement: "top"
- },
- create: {
- mode: 'all',
- ngClick: "createSource()",
- awToolTip: i18n._("Create a new source"),
- actionClass: 'at-Button--add',
- actionId: 'button-add',
- ngShow: 'canAdd',
- dataPlacement: "top",
- }
- },
-
- fieldActions: {
-
- columnClass: 'col-lg-4 col-md-4 col-sm-4 col-xs-4 text-right',
-
- edit: {
- mode: 'all',
- ngClick: "editSource(inventory_source.id)",
- awToolTip: i18n._('Edit source'),
- dataPlacement: "top",
- ngShow: "inventory_source.summary_fields.user_capabilities.edit"
- },
- source_update: {
- mode: 'all',
- ngClick: 'updateSource(inventory_source)',
- awToolTip: "{{ inventory_source.launch_tooltip }}",
- dataTipWatch: "inventory_source.launch_tooltip",
- ngShow: "(inventory_source.status !== 'running' && inventory_source.status " +
- "!== 'pending' && inventory_source.status !== 'updating') && inventory_source.summary_fields.user_capabilities.start",
- ngClass: "inventory_source.launch_class",
- dataPlacement: "top",
- },
- cancel: {
- mode: 'all',
- ngClick: "cancelUpdate(inventory_source.id)",
- awToolTip: i18n._("Cancel sync process"),
- 'class': 'red-txt',
- ngShow: "(inventory_source.status == 'running' || inventory_source.status == 'pending' " +
- "|| inventory_source.status == 'updating') && inventory_source.summary_fields.user_capabilities.start",
- dataPlacement: "top",
- iconClass: "fa fa-minus-circle"
- },
- view: {
- mode: 'all',
- ngClick: "editSource(inventory_source.id)",
- awToolTip: i18n._('View source'),
- dataPlacement: "top",
- ngShow: "!inventory_source.summary_fields.user_capabilities.edit"
- },
- "delete": {
- mode: 'all',
- ngClick: "deleteSource(inventory_source)",
- awToolTip: i18n._('Delete source'),
- dataPlacement: "top",
- ngShow: "inventory_source.summary_fields.user_capabilities.delete"
- }
- }
- };
-}];
diff --git a/awx/ui/client/src/inventories-hosts/inventories/related/sources/sources.service.js b/awx/ui/client/src/inventories-hosts/inventories/related/sources/sources.service.js
deleted file mode 100644
index a42ac51097..0000000000
--- a/awx/ui/client/src/inventories-hosts/inventories/related/sources/sources.service.js
+++ /dev/null
@@ -1,136 +0,0 @@
-export default
-['$rootScope', 'Rest', 'GetBasePath', 'ProcessErrors', 'Wait', function($rootScope, Rest, GetBasePath, ProcessErrors, Wait){
- return {
- stringifyParams: function(params){
- return _.reduce(params, (result, value, key) => {
- return result + key + '=' + value + '&';
- }, '');
- },
- // cute abstractions via fn.bind()
- url: function(){
- return '';
- },
- error: function(data) {
- ProcessErrors($rootScope, data.data, data.status, null, { hdr: 'Error!',
- msg: 'Call to ' + this.url + '. GET returned: ' + data.status });
- },
- success: function(data){
- return data;
- },
- // HTTP methods
- get: function(params){
- Wait('start');
- this.url = GetBasePath('inventory_sources') + '?' + this.stringifyParams(params);
- Rest.setUrl(this.url);
- return Rest.get()
- .then(this.success.bind(this))
- .catch(this.error.bind(this))
- .finally(Wait('stop'));
- },
- post: function(inventory_source){
- Wait('start');
- this.url = GetBasePath('inventory_sources');
- Rest.setUrl(this.url);
- return Rest.post(inventory_source)
- .then(this.success.bind(this))
- .catch(this.error.bind(this))
- .finally(Wait('stop'));
- },
- put: function(inventory_source){
- Wait('start');
- this.url = GetBasePath('inventory_sources') + inventory_source.id;
- Rest.setUrl(this.url);
- return Rest.put(inventory_source)
- .then(this.success.bind(this))
- .catch(this.error.bind(this))
- .finally(Wait('stop'));
- },
- delete: function(id){
- Wait('start');
- this.url = GetBasePath('inventory_sources') + id;
- Rest.setUrl(this.url);
- return Rest.destroy()
- .then(this.success.bind(this))
- .catch(this.error.bind(this))
- .finally(Wait('stop'));
- },
- options: function(){
- this.url = GetBasePath('inventory_sources');
- Rest.setUrl(this.url);
- return Rest.options()
- .then(this.success.bind(this))
- .catch(this.error.bind(this));
- },
- getCredential: function(id){
- Wait('start');
- this.url = GetBasePath('credentials') + id;
- Rest.setUrl(this.url);
- return Rest.get()
- .then(this.success.bind(this))
- .catch(this.error.bind(this))
- .finally(Wait('stop'));
- },
- getInventorySource: function(params){
- Wait('start');
- this.url = GetBasePath('inventory_sources') + '?' + this.stringifyParams(params);
- Rest.setUrl(this.url);
- return Rest.get()
- .then(this.success.bind(this))
- .catch(this.error.bind(this))
- .finally(Wait('stop'));
- },
- putInventorySource: function(params, url){
- Wait('start');
- this.url = url;
- Rest.setUrl(this.url);
- return Rest.put(params)
- .then(this.success.bind(this))
- .catch(this.error.bind(this))
- .finally(Wait('stop'));
- },
- // these relationship setters could be consolidated, but verbosity makes the operation feel more clear @ controller level
- associateGroup: function(group, target){
- Wait('start');
- this.url = GetBasePath('groups') + target + '/children/';
- Rest.setUrl(this.url);
- return Rest.post(group)
- .then(this.success.bind(this))
- .catch(this.error.bind(this))
- .finally(Wait('stop'));
- },
- disassociateGroup: function(group, parent){
- Wait('start');
- this.url = GetBasePath('groups') + parent + '/children/';
- Rest.setUrl(this.url);
- return Rest.post({id: group, disassociate: 1})
- .then(this.success.bind(this))
- .catch(this.error.bind(this))
- .finally(Wait('stop'));
- },
- promote: function(group, inventory){
- Wait('start');
- this.url = GetBasePath('inventory') + inventory + '/groups/';
- Rest.setUrl(this.url);
- return Rest.post({id: group, disassociate: 1})
- .then(this.success.bind(this))
- .catch(this.error.bind(this))
- .finally(Wait('stop'));
- },
- deleteHosts(id) {
- this.url = GetBasePath('inventory_sources') + id + '/hosts/';
- Rest.setUrl(this.url);
- return Rest.destroy()
- .then(this.success.bind(this))
- .catch(this.error.bind(this))
- .finally();
- },
- deleteGroups(id) {
- this.url = GetBasePath('inventory_sources') + id + '/groups/';
- Rest.setUrl(this.url);
- return Rest.destroy()
- .then(this.success.bind(this))
- .catch(this.error.bind(this))
- .finally();
- }
- };
-}];
diff --git a/awx/ui/client/src/inventories-hosts/inventories/smart-inventory/add/main.js b/awx/ui/client/src/inventories-hosts/inventories/smart-inventory/add/main.js
deleted file mode 100644
index 911492557f..0000000000
--- a/awx/ui/client/src/inventories-hosts/inventories/smart-inventory/add/main.js
+++ /dev/null
@@ -1,11 +0,0 @@
-/*************************************************
- * Copyright (c) 2017 Ansible, Inc.
- *
- * All Rights Reserved
- *************************************************/
-
-import controller from './smart-inventory-add.controller';
-
-export default
-angular.module('smartInventoryAdd', [])
- .controller('SmartInventoryAddController', controller);
diff --git a/awx/ui/client/src/inventories-hosts/inventories/smart-inventory/add/smart-inventory-add.controller.js b/awx/ui/client/src/inventories-hosts/inventories/smart-inventory/add/smart-inventory-add.controller.js
deleted file mode 100644
index 1f21e3844f..0000000000
--- a/awx/ui/client/src/inventories-hosts/inventories/smart-inventory/add/smart-inventory-add.controller.js
+++ /dev/null
@@ -1,102 +0,0 @@
-/*************************************************
- * Copyright (c) 2017 Ansible, Inc.
- *
- * All Rights Reserved
- *************************************************/
-
-/**
- * @ngdoc function
- * @name controllers.function:Inventories
- * @description This controller's for the Inventory page
- */
-
-function SmartInventoryAdd($scope, $location,
- GenerateForm, smartInventoryForm, rbacUiControlService, Rest, Alert, ProcessErrors,
- GetBasePath, ParseTypeChange, Wait, ToJSON,
- $state, canAdd, InstanceGroupsService) {
-
- $scope.canAdd = canAdd;
-
- // Inject dynamic view
- var defaultUrl = GetBasePath('inventory'),
- form = smartInventoryForm;
-
- init();
-
- function init() {
- $scope.canEditOrg = true;
- form.formLabelSize = null;
- form.formFieldSize = null;
-
- // apply form definition's default field values
- GenerateForm.applyDefaults(form, $scope);
-
- $scope.parseType = 'yaml';
- ParseTypeChange({
- scope: $scope,
- variable: 'smartinventory_variables',
- parse_variable: 'parseType',
- field_id: 'smartinventory_smartinventory_variables'
- });
-
- $scope.smart_hosts = $state.params.hostfilter ? JSON.parse($state.params.hostfilter) : '';
- }
-
- // Save
- $scope.formSave = function() {
- Wait('start');
- try {
- let fld, data = {};
-
- for (fld in form.fields) {
- data[fld] = $scope[fld];
- }
-
- data.variables = ToJSON($scope.parseType, $scope.smartinventory_variables, true);
-
- data.host_filter = decodeURIComponent($scope.smart_hosts.host_filter);
-
- data.kind = "smart";
-
- Rest.setUrl(defaultUrl);
- Rest.post(data)
- .then(({data}) => {
- const inventory_id = data.id,
- instance_group_url = data.related.instance_groups;
-
- InstanceGroupsService.addInstanceGroups(instance_group_url, $scope.instance_groups)
- .then(() => {
- Wait('stop');
- $state.go('inventories.editSmartInventory', {smartinventory_id: inventory_id}, {reload: true});
- })
- .catch(({data, status}) => {
- ProcessErrors($scope, data, status, form, {
- hdr: 'Error!',
- msg: 'Failed to post instance groups. POST returned ' +
- 'status: ' + status
- });
- });
- })
- .catch(({data, status}) => {
- ProcessErrors($scope, data, status, form, {
- hdr: 'Error!',
- msg: 'Failed to add new inventory. Post returned status: ' + status
- });
- });
- } catch (err) {
- Wait('stop');
- Alert("Error", "Error parsing inventory variables. Parser returned: " + err);
- }
-
- };
-
- $scope.formCancel = function() {
- $state.go('inventories');
- };
-}
-
-export default ['$scope', '$location',
- 'GenerateForm', 'smartInventoryForm', 'rbacUiControlService', 'Rest', 'Alert',
- 'ProcessErrors', 'GetBasePath', 'ParseTypeChange',
- 'Wait', 'ToJSON', '$state', 'canAdd', 'InstanceGroupsService', SmartInventoryAdd
-];
diff --git a/awx/ui/client/src/inventories-hosts/inventories/smart-inventory/edit/main.js b/awx/ui/client/src/inventories-hosts/inventories/smart-inventory/edit/main.js
deleted file mode 100644
index b5c59c9e6d..0000000000
--- a/awx/ui/client/src/inventories-hosts/inventories/smart-inventory/edit/main.js
+++ /dev/null
@@ -1,11 +0,0 @@
-/*************************************************
- * Copyright (c) 2017 Ansible, Inc.
- *
- * All Rights Reserved
- *************************************************/
-
-import controller from './smart-inventory-edit.controller';
-
-export default
-angular.module('smartInventoryEdit', [])
- .controller('SmartInventoryEditController', controller);
diff --git a/awx/ui/client/src/inventories-hosts/inventories/smart-inventory/edit/smart-inventory-edit.controller.js b/awx/ui/client/src/inventories-hosts/inventories/smart-inventory/edit/smart-inventory-edit.controller.js
deleted file mode 100644
index 42f7f27223..0000000000
--- a/awx/ui/client/src/inventories-hosts/inventories/smart-inventory/edit/smart-inventory-edit.controller.js
+++ /dev/null
@@ -1,110 +0,0 @@
-/*************************************************
- * Copyright (c) 2017 Ansible, Inc.
- *
- * All Rights Reserved
- *************************************************/
-
-function SmartInventoryEdit($scope, $location,
- $stateParams, InventoryForm, Rest, ProcessErrors,
- GetBasePath, ParseTypeChange, Wait, ToJSON,
- ParseVariableString, $state, OrgAdminLookup, resourceData,
- $rootScope, InstanceGroupsService, InstanceGroupsData) {
-
- // Inject dynamic view
- var defaultUrl = GetBasePath('inventory'),
- form = InventoryForm,
- inventory_id = $stateParams.smartinventory_id,
- inventoryData = resourceData.data,
- instance_group_url = inventoryData.related.instance_groups;
- init();
-
- function init() {
- form.formLabelSize = null;
- form.formFieldSize = null;
- $scope.inventory_id = inventory_id;
-
- $scope = angular.extend($scope, inventoryData);
-
- $scope.smartinventory_variables = inventoryData.variables === null || inventoryData.variables === '' ? '---' : ParseVariableString(inventoryData.variables);
- $scope.organization_name = inventoryData.summary_fields.organization.name;
- $scope.instance_groups = InstanceGroupsData;
-
- $scope.$watch('inventory_obj.summary_fields.user_capabilities.edit', function(val) {
- if (val === false) {
- $scope.canAdd = false;
- }
- });
-
- $scope.parseType = 'yaml';
-
- $scope.inventory_obj = inventoryData;
- $rootScope.breadcrumb.inventory_name = inventoryData.name;
-
- ParseTypeChange({
- scope: $scope,
- variable: 'smartinventory_variables',
- parse_variable: 'parseType',
- field_id: 'smartinventory_smartinventory_variables',
- readOnly: !$scope.inventory_obj.summary_fields.user_capabilities.edit
- });
-
- OrgAdminLookup.checkForAdminAccess({organization: inventoryData.organization})
- .then(function(canEditOrg){
- $scope.canEditOrg = canEditOrg;
- });
-
- $scope.smart_hosts = {
- host_filter: encodeURIComponent($scope.host_filter)
- };
- }
-
- // Save
- $scope.formSave = function() {
- Wait('start');
-
- let fld, data = {};
-
- for (fld in form.fields) {
- data[fld] = $scope[fld];
- }
-
- data.variables = ToJSON($scope.parseType, $scope.smartinventory_variables, true);
- data.host_filter = decodeURIComponent($scope.smart_hosts.host_filter);
- data.kind = "smart";
-
- Rest.setUrl(defaultUrl + inventory_id + '/');
- Rest.put(data)
- .then(() => {
- InstanceGroupsService.editInstanceGroups(instance_group_url, $scope.instance_groups)
- .then(() => {
- Wait('stop');
- $state.go($state.current, {}, { reload: true });
- })
- .catch(({data, status}) => {
- ProcessErrors($scope, data, status, form, {
- hdr: 'Error!',
- msg: 'Failed to update instance groups. POST returned status: ' + status
- });
- });
- })
- .catch(({data, status}) => {
- ProcessErrors($scope, data, status, form, {
- hdr: 'Error!',
- msg: 'Failed to update inventory. PUT returned status: ' + status
- });
- });
- };
-
- $scope.formCancel = function() {
- $state.go('inventories');
- };
-
-}
-
-export default [ '$scope', '$location',
- '$stateParams', 'InventoryForm', 'Rest',
- 'ProcessErrors', 'GetBasePath', 'ParseTypeChange', 'Wait',
- 'ToJSON', 'ParseVariableString',
- '$state', 'OrgAdminLookup', 'resourceData',
- '$rootScope', 'InstanceGroupsService', 'InstanceGroupsData', SmartInventoryEdit
-];
diff --git a/awx/ui/client/src/inventories-hosts/inventories/smart-inventory/main.js b/awx/ui/client/src/inventories-hosts/inventories/smart-inventory/main.js
deleted file mode 100644
index 0f8a57560f..0000000000
--- a/awx/ui/client/src/inventories-hosts/inventories/smart-inventory/main.js
+++ /dev/null
@@ -1,20 +0,0 @@
-/*************************************************
- * Copyright (c) 2017 Ansible, Inc.
- *
- * All Rights Reserved
- *************************************************/
-
-import smartInventoryAdd from './add/main';
-import smartInventoryEdit from './edit/main';
-import smartInventoryForm from './smart-inventory.form';
-import smartInventoryHostFilter from './smart-inventory-host-filter/smart-inventory-host-filter.directive';
-import hostFilterModal from './smart-inventory-host-filter/host-filter-modal/host-filter-modal.directive';
-
-export default
-angular.module('smartInventory', [
- smartInventoryAdd.name,
- smartInventoryEdit.name
- ])
- .factory('smartInventoryForm', smartInventoryForm)
- .directive('smartInventoryHostFilter', smartInventoryHostFilter)
- .directive('hostFilterModal', hostFilterModal);
diff --git a/awx/ui/client/src/inventories-hosts/inventories/smart-inventory/smart-inventory-host-filter/host-filter-modal/host-filter-modal.directive.js b/awx/ui/client/src/inventories-hosts/inventories/smart-inventory/smart-inventory-host-filter/host-filter-modal/host-filter-modal.directive.js
deleted file mode 100644
index beaf2ae8c9..0000000000
--- a/awx/ui/client/src/inventories-hosts/inventories/smart-inventory/smart-inventory-host-filter/host-filter-modal/host-filter-modal.directive.js
+++ /dev/null
@@ -1,96 +0,0 @@
-export default ['templateUrl', function(templateUrl) {
- return {
- restrict: 'E',
- scope: {
- hostFilter: '=',
- organization: '='
- },
- templateUrl: templateUrl('inventories-hosts/inventories/smart-inventory/smart-inventory-host-filter/host-filter-modal/host-filter-modal'),
- link: function(scope, element) {
-
- $('#host-filter-modal').on('hidden.bs.modal', function () {
- $('#host-filter-modal').off('hidden.bs.modal');
- $(element).remove();
- });
-
- scope.showModal = function() {
- $('#host-filter-modal').modal('show');
- };
-
- scope.destroyModal = function() {
- $('#host-filter-modal').modal('hide');
- };
-
- },
- controller: ['$scope', 'QuerySet', 'GetBasePath', 'HostsList', '$compile', 'generateList', 'i18n', '$rootScope', function($scope, qs, GetBasePath, HostsList, $compile, GenerateList, i18n, $rootScope) {
-
- function init() {
-
- $scope.appStrings = $rootScope.appStrings;
-
- $scope.host_default_params = {
- order_by: 'name',
- page_size: 5,
- inventory__organization: $scope.organization
- };
-
- $scope.host_queryset = _.merge({
- order_by: 'name',
- page_size: 5,
- inventory__organization: $scope.organization
- }, $scope.hostFilter ? $scope.hostFilter : {});
-
- // Fire off the initial search
- qs.search(GetBasePath('hosts'), $scope.host_queryset)
- .then(res => {
- $scope.host_dataset = res.data;
- $scope.hosts = $scope.host_dataset.results;
-
- let hostList = _.cloneDeep(HostsList);
- delete hostList.staticColumns;
- delete hostList.fields.toggleHost;
- delete hostList.fields.active_failures;
- delete hostList.fields.name.ngClick;
- hostList.fields.name.columnClass = 'col-sm-6';
- hostList.fields.name.noLink = true;
- hostList.well = false;
- delete hostList.fields.inventory.ngClick;
- hostList.fields.inventory.columnClass = 'col-sm-6';
- hostList.fields.inventory.ngBind = 'host.summary_fields.inventory.name';
- hostList.emptyListText = i18n._('Perform a search above to define a host filter');
- hostList.layoutClass = 'List-defaultLayout';
- hostList.alwaysShowSearch = true;
- hostList.emptyListClass = 'List-noItems List-emptyHostFilter';
- let html = GenerateList.build({
- list: hostList,
- input_type: 'host-filter-modal-body',
- hideViewPerPage: true
- });
-
- $scope.list = hostList;
-
- $('#host-filter-modal-body').append($compile(html)($scope));
-
- $scope.showModal();
- });
- }
-
- init();
-
- $scope.cancelForm = function() {
- $scope.destroyModal();
- };
-
- $scope.saveForm = function() {
- // Strip defaults out of the state params copy
- angular.forEach(Object.keys($scope.host_default_params), function(value) {
- delete $scope.host_queryset[value];
- });
-
- $scope.hostFilter = angular.copy($scope.host_queryset);
-
- $scope.destroyModal();
- };
- }]
- };
-}];
diff --git a/awx/ui/client/src/inventories-hosts/inventories/smart-inventory/smart-inventory-host-filter/host-filter-modal/host-filter-modal.partial.html b/awx/ui/client/src/inventories-hosts/inventories/smart-inventory/smart-inventory-host-filter/host-filter-modal/host-filter-modal.partial.html
deleted file mode 100644
index 5c8f36e40e..0000000000
--- a/awx/ui/client/src/inventories-hosts/inventories/smart-inventory/smart-inventory-host-filter/host-filter-modal/host-filter-modal.partial.html
+++ /dev/null
@@ -1,21 +0,0 @@
-
diff --git a/awx/ui/client/src/inventories-hosts/inventories/smart-inventory/smart-inventory-host-filter/smart-inventory-host-filter.controller.js b/awx/ui/client/src/inventories-hosts/inventories/smart-inventory/smart-inventory-host-filter/smart-inventory-host-filter.controller.js
deleted file mode 100644
index d83105f61c..0000000000
--- a/awx/ui/client/src/inventories-hosts/inventories/smart-inventory/smart-inventory-host-filter/smart-inventory-host-filter.controller.js
+++ /dev/null
@@ -1,39 +0,0 @@
-/*************************************************
- * Copyright (c) 2017 Ansible, Inc.
- *
- * All Rights Reserved
- *************************************************/
-
-export default ['$scope', 'QuerySet', 'InventoryHostsStrings',
- function($scope, qs, InventoryHostsStrings) {
- $scope.hostFilterTags = [];
- $scope.strings = InventoryHostsStrings;
-
- $scope.$watch('organization', function(){
- if($scope.hasEditPermissions) {
- $scope.filterTooltip = $scope.organization ? InventoryHostsStrings.get('smartinventories.hostfilter.INSTRUCTIONS') : InventoryHostsStrings.get('smartinventories.hostfilter.MISSING_ORG');
- }
- else {
- $scope.filterTooltip = InventoryHostsStrings.get('smartinventories.hostfilter.MISSING_PERMISSIONS');
- }
- });
-
- $scope.$watch('hostFilter', function(){
- $scope.hostFilterTags = [];
-
- if($scope.hostFilter && $scope.hostFilter !== '') {
- let hostFilterCopy = angular.copy($scope.hostFilter);
-
- let searchParam = hostFilterCopy.host_filter.split('%20and%20');
- delete hostFilterCopy.host_filter;
-
- $.each(searchParam, function(index, param) {
- let paramParts = decodeURIComponent(param).split(/=(.+)/);
- $scope.hostFilterTags.push(qs.decodeParam(paramParts[1], paramParts[0]));
- });
-
- $scope.hostFilterTags = $scope.hostFilterTags.concat(qs.stripDefaultParams(hostFilterCopy));
- }
- });
- }
-];
diff --git a/awx/ui/client/src/inventories-hosts/inventories/smart-inventory/smart-inventory-host-filter/smart-inventory-host-filter.directive.js b/awx/ui/client/src/inventories-hosts/inventories/smart-inventory/smart-inventory-host-filter/smart-inventory-host-filter.directive.js
deleted file mode 100644
index dd60d0e736..0000000000
--- a/awx/ui/client/src/inventories-hosts/inventories/smart-inventory/smart-inventory-host-filter/smart-inventory-host-filter.directive.js
+++ /dev/null
@@ -1,27 +0,0 @@
-/*************************************************
- * Copyright (c) 2017 Ansible, Inc.
- *
- * All Rights Reserved
- *************************************************/
-
-import smartInventoryHostFilterController from './smart-inventory-host-filter.controller';
-
-export default ['templateUrl', '$compile',
- function(templateUrl, $compile) {
- return {
- scope: {
- hostFilter: '=',
- hasEditPermissions: '=',
- organization: '='
- },
- restrict: 'E',
- templateUrl: templateUrl('inventories-hosts/inventories/smart-inventory/smart-inventory-host-filter/smart-inventory-host-filter'),
- controller: smartInventoryHostFilterController,
- link: function(scope) {
- scope.openHostFilterModal = function() {
- $('#content-container').append($compile('
')(scope));
- };
- }
- };
- }
-];
diff --git a/awx/ui/client/src/inventories-hosts/inventories/smart-inventory/smart-inventory-host-filter/smart-inventory-host-filter.partial.html b/awx/ui/client/src/inventories-hosts/inventories/smart-inventory/smart-inventory-host-filter/smart-inventory-host-filter.partial.html
deleted file mode 100644
index e662415f8c..0000000000
--- a/awx/ui/client/src/inventories-hosts/inventories/smart-inventory/smart-inventory-host-filter/smart-inventory-host-filter.partial.html
+++ /dev/null
@@ -1,13 +0,0 @@
-
-
-
-
-
-
-
-
- {{tag}}
-
-
-
-
diff --git a/awx/ui/client/src/inventories-hosts/inventories/smart-inventory/smart-inventory-hosts.route.js b/awx/ui/client/src/inventories-hosts/inventories/smart-inventory/smart-inventory-hosts.route.js
deleted file mode 100644
index aac38ff707..0000000000
--- a/awx/ui/client/src/inventories-hosts/inventories/smart-inventory/smart-inventory-hosts.route.js
+++ /dev/null
@@ -1,70 +0,0 @@
-import { N_ } from '../../../i18n';
-
-export default {
- name: "inventories.editSmartInventory.hosts",
- url: "/hosts?{host_search:queryset}",
- params: {
- host_search: {
- value: {
- page_size: "20",
- order_by: "name"
- },
- dynamic: true,
- squash:""
- }
- },
- ncyBreadcrumb: {
- label: N_("HOSTS")
- },
- views: {
- 'related': {
- templateProvider: function(ListDefinition, generateList) {
- let list = _.cloneDeep(ListDefinition);
- let html = generateList.build({
- list: list,
- mode: 'edit'
- });
- return html;
- },
- controller: 'RelatedHostListController'
- }
- },
- resolve: {
- ListDefinition: ['RelatedHostsListDefinition', '$stateParams', 'GetBasePath', (RelatedHostsListDefinition, $stateParams, GetBasePath) => {
- let list = _.cloneDeep(RelatedHostsListDefinition);
- list.basePath = GetBasePath('inventory') + $stateParams.smartinventory_id + '/hosts';
- delete list.actions.create;
- delete list.fields.groups;
- delete list.fieldActions.delete;
- delete list.fieldActions.edit;
- delete list.fieldActions.view.ngShow;
- let toggleHost = list.staticColumns.find((el) => { return el.field === 'toggleHost'; });
- toggleHost.content.ngDisabled = true;
- list.fields.name.columnClass = 'col-lg-8 col-md-11 col-sm-8 col-xs-7';
- return list;
- }],
- Dataset: ['ListDefinition', 'QuerySet', '$stateParams', 'GetBasePath', '$interpolate', '$rootScope',
- (list, qs, $stateParams, GetBasePath, $interpolate, $rootScope) => {
- // allow related list definitions to use interpolated $rootScope / $stateParams in basePath field
- let path, interpolator;
- if (GetBasePath(list.basePath)) {
- path = GetBasePath(list.basePath);
- } else {
- interpolator = $interpolate(list.basePath);
- path = interpolator({ $rootScope: $rootScope, $stateParams: $stateParams });
- }
- return qs.search(path, $stateParams[`${list.iterator}_search`]);
- }
- ],
- hostsUrl: ['InventoriesService', '$stateParams', function(InventoriesService, $stateParams) {
- return InventoriesService.rootHostsUrl($stateParams.smartinventory_id);
- }],
- hostsDataset: ['ListDefinition', 'QuerySet', '$stateParams', 'hostsUrl', (list, qs, $stateParams, hostsUrl) => {
- let path = hostsUrl;
- return qs.search(path, $stateParams[`${list.iterator}_search`]);
- }],
- inventoryData: ['InventoriesService', '$stateParams', function(InventoriesService, $stateParams) {
- return InventoriesService.getInventory($stateParams.smartinventory_id).then(res => res.data);
- }]
- }
-};
diff --git a/awx/ui/client/src/inventories-hosts/inventories/smart-inventory/smart-inventory.form.js b/awx/ui/client/src/inventories-hosts/inventories/smart-inventory/smart-inventory.form.js
deleted file mode 100644
index dd4702379a..0000000000
--- a/awx/ui/client/src/inventories-hosts/inventories/smart-inventory/smart-inventory.form.js
+++ /dev/null
@@ -1,162 +0,0 @@
-/*************************************************
- * Copyright (c) 2017 Ansible, Inc.
- *
- * All Rights Reserved
- *************************************************/
-
-export default ['i18n', function(i18n) {
- return {
-
- addTitle: i18n._('NEW SMART INVENTORY'),
- editTitle: '{{ name }}',
- name: 'smartinventory',
- basePath: 'inventory',
- breadcrumbName: i18n._('SMART INVENTORY'),
- stateTree: 'inventories',
- activeEditState: 'inventories.editSmartInventory',
- detailsClick: "$state.go('inventories.editSmartInventory')",
-
- fields: {
- name: {
- label: i18n._('Name'),
- type: 'text',
- required: true,
- capitalize: false,
- ngDisabled: '!(inventory_obj.summary_fields.user_capabilities.edit || canAdd)'
- },
- description: {
- label: i18n._('Description'),
- type: 'text',
- ngDisabled: '!(inventory_obj.summary_fields.user_capabilities.edit || canAdd)'
- },
- organization: {
- label: i18n._('Organization'),
- type: 'lookup',
- basePath: 'organizations',
- list: 'OrganizationList',
- sourceModel: 'organization',
- sourceField: 'name',
- required: true,
- ngDisabled: '!(inventory_obj.summary_fields.user_capabilities.edit || canAdd) || !canEditOrg',
- awLookupWhen: '(inventory_obj.summary_fields.user_capabilities.edit || canAdd) && canEditOrg'
- },
- smart_hosts: {
- label: i18n._('Smart Host Filter'),
- type: 'custom',
- control: '
',
- awPopOver: "
" + i18n._("Populate the hosts for this inventory by using a search filter.") + "
" + i18n._("Example: ansible_facts.ansible_distribution:\"RedHat\"") + "
" + i18n._("Refer to the Ansible Tower documentation for further syntax and examples.") + "
",
- dataTitle: i18n._('Smart Host Filter'),
- dataPlacement: 'right',
- dataContainer: 'body',
- required: true
- },
- instance_groups: {
- label: i18n._('Instance Groups'),
- type: 'custom',
- awPopOver: "
" + i18n._("Select the Instance Groups for this Inventory to run on.") + "
",
- dataTitle: i18n._('Instance Groups'),
- dataPlacement: 'right',
- dataContainer: 'body',
- control: '
',
- },
- smartinventory_variables: {
- label: i18n._('Variables'),
- type: 'textarea',
- class: 'Form-formGroup--fullWidth',
- rows: 6,
- "default": "---",
- awPopOver: "
" + i18n._("Enter inventory 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" +
- '
' + i18n.sprintf(i18n._('View JSON examples at %s'), 'www.json.org ') + '
' +
- '
' + i18n.sprintf(i18n._('View YAML examples at %s'), 'docs.ansible.com ') + '
',
- dataTitle: i18n._('Inventory Variables'),
- dataPlacement: 'right',
- dataContainer: 'body',
- ngDisabled: '!(inventory_obj.summary_fields.user_capabilities.edit || canAdd)' // TODO: get working
- }
- },
-
- buttons: {
- cancel: {
- ngClick: 'formCancel()',
- ngShow: '(inventory_obj.summary_fields.user_capabilities.edit || canAdd)'
- },
- close: {
- ngClick: 'formCancel()',
- ngShow: '!(inventory_obj.summary_fields.user_capabilities.edit || canAdd)'
- },
- save: {
- ngClick: 'formSave()',
- ngDisabled: true,
- ngShow: '(inventory_obj.summary_fields.user_capabilities.edit || canAdd)'
- }
- },
- related: {
- permissions: {
- name: 'permissions',
- awToolTip: i18n._('Please save before assigning permissions.'),
- dataPlacement: 'top',
- basePath: 'api/v2/inventories/{{$stateParams.smartinventory_id}}/access_list/',
- type: 'collection',
- title: i18n._('Permissions'),
- iterator: 'permission',
- index: false,
- open: false,
- search: {
- order_by: 'username'
- },
- actions: {
- add: {
- label: i18n._('Add'),
- ngClick: "$state.go('.add')",
- awToolTip: i18n._('Add a permission'),
- actionClass: 'at-Button--add',
- actionId: 'button-add--permission',
- ngShow: '(inventory_obj.summary_fields.user_capabilities.edit || canAdd)'
-
- }
- },
- fields: {
- username: {
- key: true,
- label: i18n._('User'),
- linkBase: 'users',
- columnClass: 'col-sm-3 col-xs-4'
- },
- role: {
- label: i18n._('Role'),
- type: 'role',
- nosort: true,
- columnClass: 'col-sm-4 col-xs-4'
- },
- team_roles: {
- label: i18n._('Team Roles'),
- type: 'team_roles',
- nosort: true,
- columnClass: 'col-sm-5 col-xs-4'
- }
- },
- ngClick: "$state.go('inventories.editSmartInventory.permissions');"
- },
- hosts: {
- name: 'hosts',
- awToolTip: i18n._('Please save before viewing hosts.'),
- dataPlacement: 'top',
- include: "RelatedHostsListDefinition",
- title: i18n._('Hosts'),
- iterator: 'host',
- ngClick: "$state.go('inventories.editSmartInventory.hosts');",
- skipGenerator: true
- },
- completed_jobs: {
- title: i18n._('Completed Jobs'),
- skipGenerator: true,
- ngClick: "$state.go('inventories.editSmartInventory.completed_jobs')"
- }
- }
-
- };
- }];
diff --git a/awx/ui/client/src/inventories-hosts/inventories/standard-inventory/add/inventory-add.controller.js b/awx/ui/client/src/inventories-hosts/inventories/standard-inventory/add/inventory-add.controller.js
deleted file mode 100644
index 469a976dc2..0000000000
--- a/awx/ui/client/src/inventories-hosts/inventories/standard-inventory/add/inventory-add.controller.js
+++ /dev/null
@@ -1,91 +0,0 @@
-/*************************************************
- * Copyright (c) 2016 Ansible, Inc.
- *
- * All Rights Reserved
- *************************************************/
-
-/**
- * @ngdoc function
- * @name controllers.function:Inventories
- * @description This controller's for the Inventory page
- */
-
-function InventoriesAdd($scope, $location,
- GenerateForm, InventoryForm, rbacUiControlService, Rest, Alert, ProcessErrors,
- GetBasePath, ParseTypeChange, Wait, ToJSON,
- $state, canAdd, CreateSelect2, InstanceGroupsService) {
-
- $scope.canAdd = canAdd;
-
- // Inject dynamic view
- var defaultUrl = GetBasePath('inventory'),
- form = InventoryForm;
-
- init();
-
- function init() {
- $scope.canEditOrg = true;
- form.formLabelSize = null;
- form.formFieldSize = null;
-
- // apply form definition's default field values
- GenerateForm.applyDefaults(form, $scope);
- }
-
- // Save
- $scope.formSave = function() {
- Wait('start');
- try {
- var fld, data;
-
- data = {};
- for (fld in form.fields) {
- if (form.fields[fld].realName) {
- data[form.fields[fld].realName] = $scope[fld];
- } else {
- data[fld] = $scope[fld];
- }
- }
-
- Rest.setUrl(defaultUrl);
- Rest.post(data)
- .then(({data}) => {
- const inventory_id = data.id,
- instance_group_url = data.related.instance_groups;
-
- InstanceGroupsService.addInstanceGroups(instance_group_url, $scope.instance_groups)
- .then(() => {
- Wait('stop');
- $state.go('inventories.edit', {inventory_id: inventory_id}, {reload: true});
- })
- .catch(({data, status}) => {
- ProcessErrors($scope, data, status, form, {
- hdr: 'Error!',
- msg: 'Failed to post instance groups. POST returned ' +
- 'status: ' + status
- });
- });
- })
- .catch(({data, status}) => {
- ProcessErrors($scope, data, status, form, {
- hdr: 'Error!',
- msg: 'Failed to add new inventory. Post returned status: ' + status
- });
- });
- } catch (err) {
- Wait('stop');
- Alert("Error", "Error parsing inventory variables. Parser returned: " + err);
- }
-
- };
-
- $scope.formCancel = function() {
- $state.go('inventories');
- };
-}
-
-export default ['$scope', '$location',
- 'GenerateForm', 'InventoryForm', 'rbacUiControlService', 'Rest', 'Alert',
- 'ProcessErrors', 'GetBasePath', 'ParseTypeChange',
- 'Wait', 'ToJSON', '$state','canAdd', 'CreateSelect2', 'InstanceGroupsService', InventoriesAdd
-];
diff --git a/awx/ui/client/src/inventories-hosts/inventories/standard-inventory/add/main.js b/awx/ui/client/src/inventories-hosts/inventories/standard-inventory/add/main.js
deleted file mode 100644
index 2e477aa96c..0000000000
--- a/awx/ui/client/src/inventories-hosts/inventories/standard-inventory/add/main.js
+++ /dev/null
@@ -1,11 +0,0 @@
-/*************************************************
- * Copyright (c) 2015 Ansible, Inc.
- *
- * All Rights Reserved
- *************************************************/
-
-import controller from './inventory-add.controller';
-
-export default
-angular.module('InventoryAdd', [])
- .controller('InventoryAddController', controller);
diff --git a/awx/ui/client/src/inventories-hosts/inventories/standard-inventory/edit/inventory-edit.controller.js b/awx/ui/client/src/inventories-hosts/inventories/standard-inventory/edit/inventory-edit.controller.js
deleted file mode 100644
index ce2d8e7ea7..0000000000
--- a/awx/ui/client/src/inventories-hosts/inventories/standard-inventory/edit/inventory-edit.controller.js
+++ /dev/null
@@ -1,112 +0,0 @@
-/*************************************************
- * Copyright (c) 2016 Ansible, Inc.
- *
- * All Rights Reserved
- *************************************************/
-
-/**
- * @ngdoc function
- * @name controllers.function:Inventories
- * @description This controller's for the Inventory page
- */
-
-function InventoriesEdit($scope, $location,
- $stateParams, InventoryForm, Rest, ProcessErrors,
- GetBasePath, ParseTypeChange, Wait, ToJSON,
- ParseVariableString, $state, OrgAdminLookup, $rootScope, resourceData,
- CreateSelect2, InstanceGroupsService, InstanceGroupsData, CanRemediate) {
-
- // Inject dynamic view
- let defaultUrl = GetBasePath('inventory'),
- form = InventoryForm,
- fld, data,
- inventoryData = resourceData.data,
- instance_group_url = inventoryData.related.instance_groups;
-
- init();
-
- function init() {
- form.formLabelSize = null;
- form.formFieldSize = null;
-
- $scope = angular.extend($scope, inventoryData);
-
- $scope.insights_credential_name = (inventoryData.summary_fields.insights_credential && inventoryData.summary_fields.insights_credential.name) ? inventoryData.summary_fields.insights_credential.name : null;
- $scope.insights_credential = (inventoryData.summary_fields.insights_credential && inventoryData.summary_fields.insights_credential.id) ? inventoryData.summary_fields.insights_credential.id : null;
- $scope.is_insights = (inventoryData.summary_fields.insights_credential && inventoryData.summary_fields.insights_credential.id) ? true : false;
- $scope.organization_name = inventoryData.summary_fields.organization.name;
- $scope.inventory_variables = inventoryData.variables === null || inventoryData.variables === '' ? '---' : ParseVariableString(inventoryData.variables);
- $scope.parseType = 'yaml';
- $scope.instance_groups = InstanceGroupsData;
- $scope.canRemediate = CanRemediate;
-
- OrgAdminLookup.checkForRoleLevelAdminAccess(inventoryData.organization, 'inventory_admin_role')
- .then(function(canEditOrg){
- $scope.canEditOrg = canEditOrg;
- });
-
- $scope.inventory_obj = inventoryData;
- $scope.inventory_name = inventoryData.name;
- $rootScope.breadcrumb.inventory_name = inventoryData.name;
-
- $scope.$watch('inventory_obj.summary_fields.user_capabilities.edit', function(val) {
- if (val === false) {
- $scope.canAdd = false;
- }
- });
- }
-
- // Save
- $scope.formSave = function() {
- Wait('start');
-
- data = {};
- for (fld in form.fields) {
- if (form.fields[fld].realName) {
- data[form.fields[fld].realName] = $scope[fld];
- } else {
- data[fld] = $scope[fld];
- }
- }
-
- Rest.setUrl(defaultUrl + $stateParams.inventory_id + '/');
- Rest.put(data)
- .then(() => {
- InstanceGroupsService.editInstanceGroups(instance_group_url, $scope.instance_groups)
- .then(() => {
- Wait('stop');
- $state.go($state.current, {}, { reload: true });
- })
- .catch(({data, status}) => {
- ProcessErrors($scope, data, status, form, {
- hdr: 'Error!',
- msg: 'Failed to update instance groups. POST returned status: ' + status
- });
- });
- })
- .catch(({data, status}) => {
- ProcessErrors($scope, data, status, form, {
- hdr: 'Error!',
- msg: 'Failed to update inventory. PUT returned status: ' + status
- });
- });
- };
-
- $scope.formCancel = function() {
- $state.go('inventories');
- };
-
- $scope.remediateInventory = function(inv_id, insights_credential){
- $state.go('templates.addJobTemplate', {inventory_id: inv_id, credential_id: insights_credential});
- };
-
-}
-
-export default ['$scope', '$location',
- '$stateParams', 'InventoryForm', 'Rest',
- 'ProcessErrors', 'GetBasePath', 'ParseTypeChange', 'Wait',
- 'ToJSON', 'ParseVariableString',
- '$state', 'OrgAdminLookup', '$rootScope', 'resourceData', 'CreateSelect2',
- 'InstanceGroupsService', 'InstanceGroupsData', 'CanRemediate',
- InventoriesEdit,
-];
diff --git a/awx/ui/client/src/inventories-hosts/inventories/standard-inventory/edit/main.js b/awx/ui/client/src/inventories-hosts/inventories/standard-inventory/edit/main.js
deleted file mode 100644
index 130a5e8b4b..0000000000
--- a/awx/ui/client/src/inventories-hosts/inventories/standard-inventory/edit/main.js
+++ /dev/null
@@ -1,11 +0,0 @@
-/*************************************************
- * Copyright (c) 2015 Ansible, Inc.
- *
- * All Rights Reserved
- *************************************************/
-
-import controller from './inventory-edit.controller';
-
-export default
- angular.module('InventoryEdit', [])
- .controller('InventoryEditController', controller);
diff --git a/awx/ui/client/src/inventories-hosts/inventories/standard-inventory/inventory.form.js b/awx/ui/client/src/inventories-hosts/inventories/standard-inventory/inventory.form.js
deleted file mode 100644
index f093a525f0..0000000000
--- a/awx/ui/client/src/inventories-hosts/inventories/standard-inventory/inventory.form.js
+++ /dev/null
@@ -1,181 +0,0 @@
-/*************************************************
- * Copyright (c) 2017 Ansible, Inc.
- *
- * All Rights Reserved
- *************************************************/
-
-/**
- * @ngdoc function
- * @name forms.function:Inventories
- * @description This form is for adding/editing an inventory
- */
-
-export default ['i18n',
-function(i18n) {
- return {
-
- addTitle: i18n._('NEW INVENTORY'),
- editTitle: '{{ inventory_name }}',
- name: 'inventory',
- basePath: 'inventory',
- // the top-most node of this generated state tree
- stateTree: 'inventories',
- tabs: true,
-
- fields: {
- name: {
- realName: 'name',
- label: i18n._('Name'),
- type: 'text',
- required: true,
- capitalize: false,
- ngDisabled: '!(inventory_obj.summary_fields.user_capabilities.edit || canAdd)'
- },
- description: {
- realName: 'description',
- label: i18n._('Description'),
- type: 'text',
- ngDisabled: '!(inventory_obj.summary_fields.user_capabilities.edit || canAdd)'
- },
- organization: {
- label: i18n._('Organization'),
- type: 'lookup',
- basePath: 'organizations',
- list: 'OrganizationList',
- sourceModel: 'organization',
- sourceField: 'name',
- required: true,
- ngDisabled: '!(inventory_obj.summary_fields.user_capabilities.edit || canAdd) || !canEditOrg',
- awLookupWhen: '(inventory_obj.summary_fields.user_capabilities.edit || canAdd) && canEditOrg'
- },
- insights_credential: {
- label: i18n._('Insights Credential'),
- type: 'lookup',
- list: 'CredentialList',
- basePath: 'credentials',
- sourceModel: 'insights_credential',
- sourceField: 'name',
- ngDisabled: '!(inventory_obj.summary_fields.user_capabilities.edit || canAdd) || !canEditOrg',
- },
- instance_groups: {
- label: i18n._('Instance Groups'),
- type: 'custom',
- awPopOver: i18n._('Select the Instance Groups for this Inventory to run on. Refer to the Ansible Tower documentation for more detail.'),
- dataTitle: i18n._('Instance Groups'),
- dataPlacement: 'right',
- dataContainer: 'body',
- control: '
',
- },
- variables: {
- label: i18n._('Variables'),
- type: 'code_mirror',
- class: 'Form-formGroup--fullWidth',
- variables: 'variables',
- awPopOver: i18n._('Enter inventory variables using either JSON or YAML syntax. Use the radio button to toggle between the two. Refer to the Ansible Tower documentation for example syntax.'),
- ngDisabled: '!(inventory_obj.summary_fields.user_capabilities.edit || canAdd)' // TODO: get working
- }
- },
-
- buttons: {
- cancel: {
- ngClick: 'formCancel()',
- ngShow: '(inventory_obj.summary_fields.user_capabilities.edit || canAdd)'
- },
- close: {
- ngClick: 'formCancel()',
- ngShow: '!(inventory_obj.summary_fields.user_capabilities.edit || canAdd)'
- },
- save: {
- ngClick: 'formSave()',
- ngDisabled: true,
- ngShow: '(inventory_obj.summary_fields.user_capabilities.edit || canAdd)'
- }
- },
- related: {
- permissions: {
- name: 'permissions',
- awToolTip: i18n._('Please save before assigning permissions.'),
- dataPlacement: 'top',
- basePath: 'api/v2/inventories/{{$stateParams.inventory_id}}/access_list/',
- type: 'collection',
- title: i18n._('Permissions'),
- iterator: 'permission',
- index: false,
- open: false,
- search: {
- order_by: 'username'
- },
- actions: {
- add: {
- label: i18n._('Add'),
- ngClick: "$state.go('.add')",
- awToolTip: i18n._('Add a permission'),
- actionClass: 'at-Button--add',
- actionId: 'button-add--permission',
- ngShow: '(inventory_obj.summary_fields.user_capabilities.edit || canAdd)'
-
- }
- },
- fields: {
- username: {
- key: true,
- label: i18n._('User'),
- linkBase: 'users',
- columnClass: 'col-sm-3 col-xs-4'
- },
- role: {
- label: i18n._('Role'),
- type: 'role',
- nosort: true,
- columnClass: 'col-sm-4 col-xs-4'
- },
- team_roles: {
- label: i18n._('Team Roles'),
- type: 'team_roles',
- nosort: true,
- columnClass: 'col-sm-5 col-xs-4'
- }
- }
- },
- groups: {
- name: 'groups',
- awToolTip: i18n._('Please save before creating groups.'),
- dataPlacement: 'top',
- include: "GroupList",
- title: i18n._('Groups'),
- iterator: 'group',
- tabSelected: `$state.includes('inventories.edit.groups') || $state.includes('inventories.edit.rootGroups')`,
- skipGenerator: true
- },
- hosts: {
- name: 'hosts',
- awToolTip: i18n._('Please save before creating hosts.'),
- dataPlacement: 'top',
- include: "RelatedHostsListDefinition",
- title: i18n._('Hosts'),
- iterator: 'host',
- skipGenerator: true
- },
- inventory_sources: {
- name: 'inventory_sources',
- awToolTip: i18n._('Please save before defining inventory sources.'),
- dataPlacement: 'top',
- title: i18n._('Sources'),
- iterator: 'inventory_source',
- skipGenerator: true
- },
- completed_jobs: {
- title: i18n._('Completed Jobs'),
- skipGenerator: true
- }
- },
- relatedButtons: {
- remediate_inventory: {
- ngClick: 'remediateInventory(id, insights_credential)',
- ngShow: "is_insights && mode !== 'add' && canRemediate && ($state.is('inventories.edit') || $state.is('inventories.edit.hosts'))",
- label: i18n._('Remediate Inventory'),
- class: 'Form-primaryButton'
- }
- }
-
- };}];
diff --git a/awx/ui/client/src/inventories-hosts/inventories/standard-inventory/main.js b/awx/ui/client/src/inventories-hosts/inventories/standard-inventory/main.js
deleted file mode 100644
index 1b2f8d8be5..0000000000
--- a/awx/ui/client/src/inventories-hosts/inventories/standard-inventory/main.js
+++ /dev/null
@@ -1,16 +0,0 @@
-/*************************************************
- * Copyright (c) 2017 Ansible, Inc.
- *
- * All Rights Reserved
- *************************************************/
-
- import inventoryAdd from './add/main';
- import inventoryEdit from './edit/main';
- import InventoryForm from './inventory.form';
-
-export default
-angular.module('standardInventory', [
- inventoryAdd.name,
- inventoryEdit.name
- ])
- .factory('InventoryForm', InventoryForm);
diff --git a/awx/ui/client/src/inventories-hosts/inventory-hosts.block.less b/awx/ui/client/src/inventories-hosts/inventory-hosts.block.less
deleted file mode 100644
index e4663663fb..0000000000
--- a/awx/ui/client/src/inventories-hosts/inventory-hosts.block.less
+++ /dev/null
@@ -1,10 +0,0 @@
-#hosts-panel {
- .List-noItems {
- margin-top: 0px;
- }
- .groupsList {
- .List-noItems {
- margin-top: 52px;
- }
- }
-}
\ No newline at end of file
diff --git a/awx/ui/client/src/inventories-hosts/inventory-hosts.strings.js b/awx/ui/client/src/inventories-hosts/inventory-hosts.strings.js
deleted file mode 100644
index 1868698a91..0000000000
--- a/awx/ui/client/src/inventories-hosts/inventory-hosts.strings.js
+++ /dev/null
@@ -1,58 +0,0 @@
-function InventoryHostsStrings (BaseString) {
- BaseString.call(this, 'inventory-hosts');
-
- let t = this.t;
- let ns = this['inventory-hosts'];
-
- ns.deletegroup = {
- GROUP: count => t.p(count, 'group', 'groups'),
- HOST: count => t.p(count, 'host', 'hosts'),
- PROMOTE_GROUPS_AND_HOSTS: data => t.s('Promote {{ group }} and {{ host }}', {
- group: this.get('deletegroup.GROUP', data.groups),
- host: this.get('deletegroup.HOST', data.hosts)
- }),
- DELETE_GROUPS_AND_HOSTS: data => t.s('Delete {{ group }} and {{ host }}', {
- group: this.get('deletegroup.GROUP', data.groups),
- host: this.get('deletegroup.HOST', data.hosts)
- }),
- PROMOTE_GROUP: count => t.p(count, 'Promote group', 'Promote groups'),
- DELETE_GROUP: count => t.p(count, 'Delete group', 'Delete groups'),
- PROMOTE_HOST: count => t.p(count, 'Promote host', 'Promote hosts'),
- DELETE_HOST: count => t.p(count, 'Delete host', 'Delete hosts'),
- };
-
- ns.inventory = {
- EDIT_HOST: t.s('Edit host'),
- VIEW_HOST: t.s('View host'),
- VIEW_INSIGHTS: t.s('View Insights Data')
- };
-
- ns.hostList = {
- DISABLED_TOGGLE_TOOLTIP: () => t.s('{{ str1 }}
{{ str2 }}
', {
- str1: t.s('Indicates if a host is available and should be included in running jobs.'),
- str2: t.s('For hosts that are part of an external inventory, this may be reset by the inventory sync process.')
- })
- };
-
- ns.smartinventories = {
- hostfilter: {
- MISSING_ORG: t.s('Please select an organization before editing the host filter.'),
- INSTRUCTIONS: t.s('Please click the icon to edit the host filter.'),
- MISSING_PERMISSIONS: t.s('You do not have sufficient permissions to edit the host filter.'),
- OPEN: t.s('Open host filter')
- }
- };
-
- ns.smartinventorybutton = {
- DISABLED_INSTRUCTIONS: t.s("Please enter at least one search term to create a new Smart Inventory."),
- ENABLED_INSTRUCTIONS: t.s("Create a new Smart Inventory from search results.
Note: changing the organization of the Smart Inventory could change the hosts included in the Smart Inventory.")
- };
-
- ns.insights = {
- VIEW: t.s("View Insights")
- };
-}
-
-InventoryHostsStrings.$inject = ['BaseStringService'];
-
-export default InventoryHostsStrings;
diff --git a/awx/ui/client/src/inventories-hosts/main.js b/awx/ui/client/src/inventories-hosts/main.js
deleted file mode 100644
index de837d2049..0000000000
--- a/awx/ui/client/src/inventories-hosts/main.js
+++ /dev/null
@@ -1,18 +0,0 @@
-/*************************************************
- * Copyright (c) 2017 Ansible, Inc.
- *
- * All Rights Reserved
- *************************************************/
-
- import hosts from './hosts/main';
- import inventories from './inventories/main';
- import shared from './shared/main';
- import InventoryHostsStrings from './inventory-hosts.strings';
-
-export default
-angular.module('inventories-hosts', [
- hosts.name,
- inventories.name,
- shared.name
- ])
- .service('InventoryHostsStrings', InventoryHostsStrings);
diff --git a/awx/ui/client/src/inventories-hosts/shared/ansible-facts/ansible-facts.controller.js b/awx/ui/client/src/inventories-hosts/shared/ansible-facts/ansible-facts.controller.js
deleted file mode 100644
index a4ab5f1024..0000000000
--- a/awx/ui/client/src/inventories-hosts/shared/ansible-facts/ansible-facts.controller.js
+++ /dev/null
@@ -1,20 +0,0 @@
-/*************************************************
- * Copyright (c) 2017 Ansible, Inc.
- *
- * All Rights Reserved
- *************************************************/
-
-function AnsibleFacts($scope, Facts) {
-
- function init() {
- $scope.facts = Facts;
- let rows = (_.isEmpty(Facts)) ? 6 : 20;
- $("#host_facts").attr("rows", rows);
- $scope.parseType = 'yaml';
- }
-
- init();
-
-}
-
-export default ['$scope', 'Facts', AnsibleFacts];
diff --git a/awx/ui/client/src/inventories-hosts/shared/ansible-facts/ansible-facts.partial.html b/awx/ui/client/src/inventories-hosts/shared/ansible-facts/ansible-facts.partial.html
deleted file mode 100644
index 7976a5cb5d..0000000000
--- a/awx/ui/client/src/inventories-hosts/shared/ansible-facts/ansible-facts.partial.html
+++ /dev/null
@@ -1,12 +0,0 @@
-
diff --git a/awx/ui/client/src/inventories-hosts/shared/ansible-facts/ansible-facts.route.js b/awx/ui/client/src/inventories-hosts/shared/ansible-facts/ansible-facts.route.js
deleted file mode 100644
index 045fe535dd..0000000000
--- a/awx/ui/client/src/inventories-hosts/shared/ansible-facts/ansible-facts.route.js
+++ /dev/null
@@ -1,27 +0,0 @@
-import {templateUrl} from '../../../shared/template-url/template-url.factory';
-import { N_ } from '../../../i18n';
-
-export default {
- url: '/ansible_facts',
- ncyBreadcrumb: {
- label: N_("FACTS")
- },
- views: {
- 'related': {
- controller: 'AnsibleFactsController',
- templateUrl: templateUrl('inventories-hosts/shared/ansible-facts/ansible-facts')
- }
- },
- resolve: {
- Facts: ['$stateParams', 'GetBasePath', 'Rest',
- function($stateParams, GetBasePath, Rest) {
- let ansibleFactsUrl = GetBasePath('hosts') + $stateParams.host_id + '/ansible_facts';
- Rest.setUrl(ansibleFactsUrl);
- return Rest.get()
- .then(({data}) => {
- return data;
- });
- }
- ]
- }
-};
diff --git a/awx/ui/client/src/inventories-hosts/shared/ansible-facts/main.js b/awx/ui/client/src/inventories-hosts/shared/ansible-facts/main.js
deleted file mode 100644
index 506652953f..0000000000
--- a/awx/ui/client/src/inventories-hosts/shared/ansible-facts/main.js
+++ /dev/null
@@ -1,11 +0,0 @@
-/*************************************************
- * Copyright (c) 2017 Ansible, Inc.
- *
- * All Rights Reserved
- *************************************************/
-
-import controller from './ansible-facts.controller';
-
-export default
-angular.module('AnsibleFacts', [])
- .controller('AnsibleFactsController', controller);
diff --git a/awx/ui/client/src/inventories-hosts/shared/associate-groups/associate-groups.block.less b/awx/ui/client/src/inventories-hosts/shared/associate-groups/associate-groups.block.less
deleted file mode 100644
index 6aa733a6e2..0000000000
--- a/awx/ui/client/src/inventories-hosts/shared/associate-groups/associate-groups.block.less
+++ /dev/null
@@ -1,12 +0,0 @@
-.AssociateGroups-modalBody {
- padding-top: 0px;
-}
-.AssociateGroups-backDrop {
- width: 100vw;
- height: 100vh;
- position: fixed;
- top: 0;
- left: 0;
- opacity: 0;
- transition: 0.5s opacity;
-}
diff --git a/awx/ui/client/src/inventories-hosts/shared/associate-groups/associate-groups.controller.js b/awx/ui/client/src/inventories-hosts/shared/associate-groups/associate-groups.controller.js
deleted file mode 100644
index 19c78431d1..0000000000
--- a/awx/ui/client/src/inventories-hosts/shared/associate-groups/associate-groups.controller.js
+++ /dev/null
@@ -1,114 +0,0 @@
-/*************************************************
- * Copyright (c) 2017 Ansible, Inc.
- *
- * All Rights Reserved
- *************************************************/
-
- export default ['$scope', '$rootScope', 'ProcessErrors', 'GetBasePath', 'generateList',
- '$state', 'Rest', '$q', 'Wait', '$window', 'QuerySet', 'GroupList', 'i18n',
- function($scope, $rootScope, ProcessErrors, GetBasePath, generateList,
- $state, Rest, $q, Wait, $window, qs, GroupList, i18n) {
- $scope.$on("linkLists", function() {
-
- init();
-
- function init(){
- $scope.appStrings = $rootScope.appStrings;
- $scope.associate_group_default_params = {
- order_by: 'name',
- page_size: 5
- };
-
- $scope.associate_group_queryset = {
- order_by: 'name',
- page_size: 5
- };
-
- if ($state.params.group_id) {
- $scope.associate_group_default_params.not__id = $state.params.group_id;
- $scope.associate_group_queryset.not__id = $state.params.group_id;
- $scope.associate_group_default_params.not__parents = $state.params.group_id;
- $scope.associate_group_queryset.not__parents = $state.params.group_id;
- } else if ($state.params.host_id) {
- $scope.associate_group_default_params.not__hosts = $state.params.host_id;
- $scope.associate_group_queryset.not__hosts = $state.params.host_id;
- }
-
- let list = _.cloneDeep(GroupList);
- list.basePath = GetBasePath('inventory') + $state.params.inventory_id + '/groups';
- list.iterator = 'associate_group';
- list.name = 'associate_groups';
- list.multiSelect = true;
- list.fields.name.ngClick = 'linkoutGroup(associate_group)';
- list.trackBy = 'associate_group.id';
- list.multiSelectPreview = {
- selectedRows: 'selectedItems',
- availableRows: 'associate_groups'
- };
- list.emptyListText = i18n._('No groups to add');
- delete list.actions;
- delete list.fieldActions;
- delete list.fields.failed_hosts;
- list.well = false;
- $scope.list = list;
-
- // Fire off the initial search
- qs.search(list.basePath, $scope.associate_group_default_params)
- .then(function(res) {
- $scope.associate_group_dataset = res.data;
- $scope.associate_groups = $scope.associate_group_dataset.results;
-
- let html = generateList.build({
- list: list,
- mode: 'edit',
- title: false,
- hideViewPerPage: true
- });
-
- $scope.compileList(html);
-
- $scope.$watchCollection('associate_groups', function () {
- if($scope.selectedItems) {
- $scope.associate_groups.forEach(function(row, i) {
- if ($scope.selectedItems.filter(function(e) { return e.id === row.id; }).length > 0) {
- $scope.associate_groups[i].isSelected = true;
- }
- });
- }
- });
-
- });
-
- $scope.selectedItems = [];
- $scope.$on('selectedOrDeselected', function(e, value) {
- let item = value.value;
-
- if (value.isSelected) {
- $scope.selectedItems.push(item);
- }
- else {
- // _.remove() Returns the new array of removed elements.
- // This will pull all the values out of the array that don't
- // match the deselected item effectively removing it
- $scope.selectedItems = _.remove($scope.selectedItems, function(selectedItem) {
- return selectedItem.id !== item.id;
- });
- }
- });
- }
-
- $scope.linkGroups = function() {
- $scope.saveFunction({selectedItems: $scope.selectedItems})
- .then(() =>{
- $scope.closeModal();
- }).catch(() => {
- $scope.closeModal();
- });
-
- };
-
- $scope.linkoutGroup = function(group) {
- $window.open('/#/inventories/inventory/' + group.inventory + '/groups/edit/' + group.id,'_blank');
- };
- });
- }];
diff --git a/awx/ui/client/src/inventories-hosts/shared/associate-groups/associate-groups.directive.js b/awx/ui/client/src/inventories-hosts/shared/associate-groups/associate-groups.directive.js
deleted file mode 100644
index 7b0595352c..0000000000
--- a/awx/ui/client/src/inventories-hosts/shared/associate-groups/associate-groups.directive.js
+++ /dev/null
@@ -1,60 +0,0 @@
-/*************************************************
- * Copyright (c) 2016 Ansible, Inc.
- *
- * All Rights Reserved
- *************************************************/
-import controller from './associate-groups.controller';
-
-/* jshint unused: vars */
-export default ['templateUrl', 'Wait', '$compile', '$state',
- function(templateUrl, Wait, $compile, $state) {
- return {
- restrict: 'E',
- transclude: true,
- scope: {
- saveFunction: '&'
- },
- controller: controller,
- templateUrl: templateUrl('inventories-hosts/shared/associate-groups/associate-groups'),
- link: function(scope, element, attrs, controller, transcludefn) {
-
- $("body").addClass("is-modalOpen");
-
- //$("body").append(element);
-
- Wait('start');
-
- scope.$broadcast("linkLists");
-
- setTimeout(function() {
- $('#associate-groups-modal').modal("show");
- }, 200);
-
- $('.modal[aria-hidden=false]').each(function () {
- if ($(this).attr('id') !== 'associate-groups-modal') {
- $(this).modal('hide');
- }
- });
-
- scope.closeModal = function() {
- $("body").removeClass("is-modalOpen");
- $('#associate-groups-modal').on('hidden.bs.modal',
- function () {
- $('.AddUsers').remove();
- });
- $('#associate-groups-modal').modal('hide');
-
- $state.go('^', null, {reload: true});
- };
-
- scope.compileList = function(html) {
- $('#associate-groups-list').append($compile(html)(scope));
- };
-
- Wait('stop');
-
- window.scrollTo(0,0);
- }
- };
- }
-];
diff --git a/awx/ui/client/src/inventories-hosts/shared/associate-groups/associate-groups.partial.html b/awx/ui/client/src/inventories-hosts/shared/associate-groups/associate-groups.partial.html
deleted file mode 100644
index 10717c648d..0000000000
--- a/awx/ui/client/src/inventories-hosts/shared/associate-groups/associate-groups.partial.html
+++ /dev/null
@@ -1,21 +0,0 @@
-
diff --git a/awx/ui/client/src/inventories-hosts/shared/associate-hosts/associate-hosts.block.less b/awx/ui/client/src/inventories-hosts/shared/associate-hosts/associate-hosts.block.less
deleted file mode 100644
index 68ea703369..0000000000
--- a/awx/ui/client/src/inventories-hosts/shared/associate-hosts/associate-hosts.block.less
+++ /dev/null
@@ -1,12 +0,0 @@
-.AssociateHosts-modalBody {
- padding-top: 0px;
-}
-.AssociateHosts-backDrop {
- width: 100vw;
- height: 100vh;
- position: fixed;
- top: 0;
- left: 0;
- opacity: 0;
- transition: 0.5s opacity;
-}
diff --git a/awx/ui/client/src/inventories-hosts/shared/associate-hosts/associate-hosts.controller.js b/awx/ui/client/src/inventories-hosts/shared/associate-hosts/associate-hosts.controller.js
deleted file mode 100644
index c2fa4ee523..0000000000
--- a/awx/ui/client/src/inventories-hosts/shared/associate-hosts/associate-hosts.controller.js
+++ /dev/null
@@ -1,113 +0,0 @@
-/*************************************************
- * Copyright (c) 2017 Ansible, Inc.
- *
- * All Rights Reserved
- *************************************************/
-
- export default ['$scope', '$rootScope', 'ProcessErrors', 'GetBasePath', 'generateList',
- '$state', 'Rest', '$q', 'Wait', '$window', 'QuerySet', 'RelatedHostsListDefinition', 'i18n',
- function($scope, $rootScope, ProcessErrors, GetBasePath, generateList,
- $state, Rest, $q, Wait, $window, qs, RelatedHostsListDefinition, i18n) {
- $scope.$on("linkLists", function() {
-
- init();
-
- function init(){
- $scope.appStrings = $rootScope.appStrings;
- $scope.associate_host_default_params = {
- order_by: 'name',
- page_size: 5
- };
-
- $scope.associate_host_queryset = {
- order_by: 'name',
- page_size: 5
- };
-
- if ($state.params.group_id) {
- $scope.associate_host_default_params.not__groups = $state.params.group_id;
- $scope.associate_host_queryset.not__groups = $state.params.group_id;
- }
-
- let list = _.cloneDeep(RelatedHostsListDefinition);
- list.basePath = GetBasePath('inventory') + $state.params.inventory_id + '/hosts';
- list.iterator = 'associate_host';
- list.name = 'associate_hosts';
- list.multiSelect = true;
- list.fields.name.ngClick = 'linkoutHost(associate_host)';
- list.fields.name.ngClass = "{ 'host-disabled-label': !associate_host.enabled }";
- list.fields.name.dataHostId = "{{ associate_host.id }}";
- list.trackBy = 'associate_host.id';
- list.multiSelectPreview = {
- selectedRows: 'selectedItems',
- availableRows: 'associate_hosts'
- };
- list.emptyListText = i18n._('No hosts to add');
- delete list.fields.toggleHost;
- delete list.fields.active_failures;
- delete list.fields.groups;
- delete list.actions;
- delete list.fieldActions;
- list.well = false;
- $scope.list = list;
-
- // Fire off the initial search
- qs.search(list.basePath, $scope.associate_host_default_params)
- .then(function(res) {
- $scope.associate_host_dataset = res.data;
- $scope.associate_hosts = $scope.associate_host_dataset.results;
-
- let html = generateList.build({
- list: list,
- mode: 'edit',
- title: false,
- hideViewPerPage: true
- });
-
- $scope.compileList(html);
-
- $scope.$watchCollection('associate_hosts', function () {
- if($scope.selectedItems) {
- $scope.associate_hosts.forEach(function(row, i) {
- if ($scope.selectedItems.filter(function(e) { return e.id === row.id; }).length > 0) {
- $scope.associate_hosts[i].isSelected = true;
- }
- });
- }
- });
-
- });
-
- $scope.selectedItems = [];
- $scope.$on('selectedOrDeselected', function(e, value) {
- let item = value.value;
-
- if (value.isSelected) {
- $scope.selectedItems.push(item);
- }
- else {
- // _.remove() Returns the new array of removed elements.
- // This will pull all the values out of the array that don't
- // match the deselected item effectively removing it
- $scope.selectedItems = _.remove($scope.selectedItems, function(selectedItem) {
- return selectedItem.id !== item.id;
- });
- }
- });
- }
-
- $scope.linkhosts = function() {
- $scope.saveFunction({selectedItems: $scope.selectedItems})
- .then(() =>{
- $scope.closeModal();
- }).catch(() => {
- $scope.closeModal();
- });
-
- };
-
- $scope.linkoutHost = function(host) {
- $window.open('/#/inventories/inventory/' + host.inventory + '/hosts/edit/' + host.id,'_blank');
- };
- });
- }];
diff --git a/awx/ui/client/src/inventories-hosts/shared/associate-hosts/associate-hosts.directive.js b/awx/ui/client/src/inventories-hosts/shared/associate-hosts/associate-hosts.directive.js
deleted file mode 100644
index 8cfbdb1094..0000000000
--- a/awx/ui/client/src/inventories-hosts/shared/associate-hosts/associate-hosts.directive.js
+++ /dev/null
@@ -1,60 +0,0 @@
-/*************************************************
- * Copyright (c) 2016 Ansible, Inc.
- *
- * All Rights Reserved
- *************************************************/
-import controller from './associate-hosts.controller';
-
-/* jshint unused: vars */
-export default ['templateUrl', 'Wait', '$compile', '$state',
- function(templateUrl, Wait, $compile, $state) {
- return {
- restrict: 'E',
- transclude: true,
- scope: {
- saveFunction: '&'
- },
- controller: controller,
- templateUrl: templateUrl('inventories-hosts/shared/associate-hosts/associate-hosts'),
- link: function(scope, element, attrs, controller, transcludefn) {
-
- $("body").addClass("is-modalOpen");
-
- //$("body").append(element);
-
- Wait('start');
-
- scope.$broadcast("linkLists");
-
- setTimeout(function() {
- $('#associate-hosts-modal').modal("show");
- }, 200);
-
- $('.modal[aria-hidden=false]').each(function () {
- if ($(this).attr('id') !== 'associate-hosts-modal') {
- $(this).modal('hide');
- }
- });
-
- scope.closeModal = function() {
- $("body").removeClass("is-modalOpen");
- $('#associate-hosts-modal').on('hidden.bs.modal',
- function () {
- $('.AddUsers').remove();
- });
- $('#associate-hosts-modal').modal('hide');
-
- $state.go('^', null, {reload: true});
- };
-
- scope.compileList = function(html) {
- $('#associate-hosts-list').append($compile(html)(scope));
- };
-
- Wait('stop');
-
- window.scrollTo(0,0);
- }
- };
- }
-];
diff --git a/awx/ui/client/src/inventories-hosts/shared/associate-hosts/associate-hosts.partial.html b/awx/ui/client/src/inventories-hosts/shared/associate-hosts/associate-hosts.partial.html
deleted file mode 100644
index 2eaeff4035..0000000000
--- a/awx/ui/client/src/inventories-hosts/shared/associate-hosts/associate-hosts.partial.html
+++ /dev/null
@@ -1,21 +0,0 @@
-
diff --git a/awx/ui/client/src/inventories-hosts/shared/factories/set-enabled-msg.factory.js b/awx/ui/client/src/inventories-hosts/shared/factories/set-enabled-msg.factory.js
deleted file mode 100644
index a31b8f73fa..0000000000
--- a/awx/ui/client/src/inventories-hosts/shared/factories/set-enabled-msg.factory.js
+++ /dev/null
@@ -1,16 +0,0 @@
-export default
- function SetEnabledMsg(i18n) {
- return function(host) {
- if (host.has_inventory_sources) {
- // Inventory sync managed, so not clickable
- host.enabledToolTip = (host.enabled) ? i18n._('Host is available') : i18n._('Host is not available');
- }
- else {
- // Clickable
- host.enabledToolTip = (host.enabled) ? i18n._('Host is available. Click to toggle.') : i18n._('Host is not available. Click to toggle.');
- }
- };
- }
-
-SetEnabledMsg.$inject =
- [ 'i18n', ];
diff --git a/awx/ui/client/src/inventories-hosts/shared/factories/set-status.factory.js b/awx/ui/client/src/inventories-hosts/shared/factories/set-status.factory.js
deleted file mode 100644
index 7551b3ee74..0000000000
--- a/awx/ui/client/src/inventories-hosts/shared/factories/set-status.factory.js
+++ /dev/null
@@ -1,103 +0,0 @@
-export default
- function SetStatus($filter, SetEnabledMsg, Empty, i18n) {
- return function(params) {
- var scope = params.scope,
- host = params.host,
- i, html, title;
-
- function ellipsis(a) {
- if (a.length > 25) {
- return a.substr(0,25) + '...';
- }
- return a;
- }
-
- function noRecentJobs() {
- title = i18n._('No job data');
- html = "
" + i18n._("No recent job data available for this host.") + "
\n";
- }
-
- function setMsg(host) {
- var j, job, jobs;
-
- if (host.has_active_failures === true || (host.has_active_failures === false && host.last_job !== null)) {
- if (host.has_active_failures === true) {
- host.badgeToolTip = i18n._('Most recent job failed. Click to view jobs.');
- host.active_failures = 'error';
- }
- else {
- host.badgeToolTip = i18n._("Most recent job successful. Click to view jobs.");
- host.active_failures = 'successful';
- }
- if (host.summary_fields.recent_jobs.length > 0) {
- // build html table of job status info
- jobs = host.summary_fields.recent_jobs.sort(
- function(a,b) {
- // reverse numerical order
- return -1 * (a - b);
- });
- title = "Recent Jobs";
- html = "
\n";
- html += "\n";
- html += "\n";
- html += "" + i18n._("Status") + " \n";
- html += "" + i18n._("Finished") + " \n";
- html += "" + i18n._("Name") + " \n";
- html += " \n";
- html += " \n";
- html += "\n";
- for (j=0; j < jobs.length; j++) {
- job = jobs[j];
- html += "\n";
-
- // SmartStatus-tooltips are named --success whereas icon-job uses successful
- var iconStatus = (job.status === 'successful') ? 'success' : 'failed';
-
- html += " \n";
-
- html += "" + ($filter('longDate')(job.finished)).replace(/ /,' ') + " \n";
-
- html += "" + $filter('sanitize')(ellipsis(job.name)) + " \n";
-
- html += " \n";
- }
- html += " \n";
- html += "
\n";
- }
- else {
- noRecentJobs();
- }
- }
- else if (host.has_active_failures === false && host.last_job === null) {
- host.badgeToolTip = i18n._("No job data available.");
- host.active_failures = 'none';
- noRecentJobs();
- }
- host.job_status_html = html;
- host.job_status_title = title;
- }
-
- if (!Empty(host)) {
- // update single host
- setMsg(host);
- SetEnabledMsg(host);
- }
- else {
- // update all hosts
- for (i=0; i < scope.hosts.length; i++) {
- setMsg(scope.hosts[i]);
- SetEnabledMsg(scope.hosts[i]);
- }
- }
- };
- }
-
-SetStatus.$inject =
- [ '$filter',
- 'SetEnabledMsg',
- 'Empty',
- 'i18n'
- ];
diff --git a/awx/ui/client/src/inventories-hosts/shared/groups.service.js b/awx/ui/client/src/inventories-hosts/shared/groups.service.js
deleted file mode 100644
index 0c6e1f8bef..0000000000
--- a/awx/ui/client/src/inventories-hosts/shared/groups.service.js
+++ /dev/null
@@ -1,131 +0,0 @@
-export default
- ['$rootScope', 'Rest', 'GetBasePath', 'ProcessErrors', 'Wait', function($rootScope, Rest, GetBasePath, ProcessErrors, Wait){
- return {
- stringifyParams: function(params){
- return _.reduce(params, (result, value, key) => {
- return result + key + '=' + value + '&';
- }, '');
- },
- // cute abstractions via fn.bind()
- url: function(){
- return '';
- },
- error: function(data) {
- ProcessErrors($rootScope, data.data, data.status, null, { hdr: 'Error!',
- msg: 'Call to ' + this.url + '. GET returned: ' + data.status });
- },
- success: function(data){
- return data;
- },
- // HTTP methods
- get: function(params){
- Wait('start');
- this.url = GetBasePath('groups') + '?' + this.stringifyParams(params);
- Rest.setUrl(this.url);
- return Rest.get()
- .then(this.success.bind(this))
- .catch(this.error.bind(this))
- .finally(Wait('stop'));
- },
- post: function(group){
- Wait('start');
- this.url = GetBasePath('groups');
- Rest.setUrl(this.url);
- return Rest.post(group)
- .then(this.success.bind(this))
- .catch(this.error.bind(this))
- .finally(Wait('stop'));
- },
- put: function(group){
- Wait('start');
- this.url = GetBasePath('groups') + group.id;
- Rest.setUrl(this.url);
- return Rest.put(group)
- .then(this.success.bind(this))
- .catch(this.error.bind(this))
- .finally(Wait('stop'));
- },
- delete: function(id){
- Wait('start');
- this.url = GetBasePath('groups') + id;
- Rest.setUrl(this.url);
- return Rest.destroy()
- .then(this.success.bind(this))
- .catch(this.error.bind(this))
- .finally(Wait('stop'));
- },
- getCredential: function(id){
- Wait('start');
- this.url = GetBasePath('credentials') + id;
- Rest.setUrl(this.url);
- return Rest.get()
- .then(this.success.bind(this))
- .catch(this.error.bind(this))
- .finally(Wait('stop'));
- },
- getInventorySource: function(params){
- Wait('start');
- this.url = GetBasePath('inventory_sources') + '?' + this.stringifyParams(params);
- Rest.setUrl(this.url);
- return Rest.get()
- .then(this.success.bind(this))
- .catch(this.error.bind(this))
- .finally(Wait('stop'));
- },
- putInventorySource: function(params, url){
- Wait('start');
- this.url = url;
- Rest.setUrl(this.url);
- return Rest.put(params)
- .then(this.success.bind(this))
- .catch(this.error.bind(this))
- .finally(Wait('stop'));
- },
- // these relationship setters could be consolidated, but verbosity makes the operation feel more clear @ controller level
- associateGroup: function(group, target){
- Wait('start');
- this.url = GetBasePath('groups') + target + '/children/';
- Rest.setUrl(this.url);
- return Rest.post(group)
- .then(this.success.bind(this))
- .catch(this.error.bind(this))
- .finally(Wait('stop'));
- },
- disassociateGroup: function(group, parent){
- Wait('start');
- this.url = GetBasePath('groups') + parent + '/children/';
- Rest.setUrl(this.url);
- return Rest.post({id: group, disassociate: 1})
- .then(this.success.bind(this))
- .catch(this.error.bind(this))
- .finally(Wait('stop'));
- },
- associateHost: function(host, target){
- Wait('start');
- this.url = GetBasePath('groups') + target + '/hosts/';
- Rest.setUrl(this.url);
- return Rest.post(host)
- .then(this.success.bind(this))
- .catch(this.error.bind(this))
- .finally(Wait('stop'));
- },
- disassociateHost: function(host, group){
- Wait('start');
- this.url = GetBasePath('groups') + group + '/hosts/';
- Rest.setUrl(this.url);
- return Rest.post({id: host, disassociate: 1})
- .then(this.success.bind(this))
- .catch(this.error.bind(this))
- .finally(Wait('stop'));
- },
- promote: function(group, inventory){
- Wait('start');
- this.url = GetBasePath('inventory') + inventory + '/groups/';
- Rest.setUrl(this.url);
- return Rest.post({id: group, disassociate: 1})
- .then(this.success.bind(this))
- .catch(this.error.bind(this))
- .finally(Wait('stop'));
- }
- };
- }];
diff --git a/awx/ui/client/src/inventories-hosts/shared/hosts.service.js b/awx/ui/client/src/inventories-hosts/shared/hosts.service.js
deleted file mode 100644
index fc4af5acc8..0000000000
--- a/awx/ui/client/src/inventories-hosts/shared/hosts.service.js
+++ /dev/null
@@ -1,74 +0,0 @@
-/*************************************************
- * Copyright (c) 2016 Ansible, Inc.
- *
- * All Rights Reserved
- *************************************************/
-
- export default
- ['$rootScope', 'Rest', 'GetBasePath', 'ProcessErrors', 'Wait',
- function($rootScope, Rest, GetBasePath, ProcessErrors, Wait){
- return {
- stringifyParams: function(params){
- return _.reduce(params, (result, value, key) => {
- return result + key + '=' + value + '&';
- }, '');
- },
- // cute abstractions via fn.bind()
- url: function(){
- return '';
- },
- error: function(data) {
- ProcessErrors($rootScope, data.data, data.status, null, { hdr: 'Error!',
- msg: 'Call to ' + this.url + '. GET returned: ' + data.status });
- },
- success: function(data){
- return data;
- },
- // HTTP methods
- get: function(params){
- Wait('start');
- this.url = GetBasePath('hosts') + '?' + this.stringifyParams(params);
- Rest.setUrl(this.url);
- return Rest.get()
- .then(this.success.bind(this))
- .catch(this.error.bind(this))
- .finally(Wait('stop'));
- },
- patch: function(id, data){
- Wait('start');
- this.url = GetBasePath('hosts') + id;
- Rest.setUrl(this.url);
- return Rest.patch(data)
- .then(this.success.bind(this))
- .catch(this.error.bind(this))
- .finally(Wait('stop'));
- },
- post: function(host){
- Wait('start');
- this.url = GetBasePath('hosts');
- Rest.setUrl(this.url);
- return Rest.post(host)
- .then(this.success.bind(this))
- .catch(this.error.bind(this))
- .finally(Wait('stop'));
- },
- put: function(host){
- Wait('start');
- this.url = GetBasePath('hosts') + host.id;
- Rest.setUrl(this.url);
- return Rest.put(host)
- .then(this.success.bind(this))
- .catch(this.error.bind(this))
- .finally(Wait('stop'));
- },
- delete: function(id){
- Wait('start');
- this.url = GetBasePath('hosts') + id;
- Rest.setUrl(this.url);
- return Rest.destroy()
- .then(this.success.bind(this))
- .catch(this.error.bind(this))
- .finally(Wait('stop'));
- }
- };
- }];
diff --git a/awx/ui/client/src/inventories-hosts/shared/inventories.service.js b/awx/ui/client/src/inventories-hosts/shared/inventories.service.js
deleted file mode 100644
index b6dab8728a..0000000000
--- a/awx/ui/client/src/inventories-hosts/shared/inventories.service.js
+++ /dev/null
@@ -1,81 +0,0 @@
-/*************************************************
- * Copyright (c) 2016 Ansible, Inc.
- *
- * All Rights Reserved
- *************************************************/
-
- export default
- ['$rootScope', 'Rest', 'GetBasePath', 'ProcessErrors', 'Wait',
- function($rootScope, Rest, GetBasePath, ProcessErrors, Wait){
- return {
- // cute abstractions via fn.bind()
- url: function(){
- return '';
- },
- error: function(data, status) {
- ProcessErrors($rootScope, data, status, null, { hdr: 'Error!',
- msg: 'Call to ' + this.url + '. GET returned: ' + status });
- },
- success: function(data){
- return data;
- },
- // data getters
- getInventory: function(id){
- Wait('start');
- this.url = GetBasePath('inventory') + id;
- Rest.setUrl(this.url);
- return Rest.get()
- .then(this.success.bind(this))
- .catch(this.error.bind(this))
- .finally(Wait('stop'));
- },
- getBreadcrumbs: function(groups){
- Wait('start');
- this.url = GetBasePath('groups') + '?' + _.map(groups, function(item){
- return '&or__id=' + item;
- }).join('');
- Rest.setUrl(this.url);
- return Rest.get()
- .then(this.success.bind(this))
- .catch(this.error.bind(this))
- .finally(Wait('stop'));
- },
- rootHostsUrl: function(id){
- var url = GetBasePath('inventory') + id + '/hosts';
- return url;
- },
- childHostsUrl: function(id){
- var url = GetBasePath('groups') + id + '/all_hosts';
- return url;
- },
- childGroupsUrl: function(id){
- var url = GetBasePath('groups') + id + '/children';
- return url;
- },
- groupsUrl: function(id){
- var url = GetBasePath('inventory') + id+ '/groups';
- return url;
- },
- inventorySourcesOptions: function(inventoryId) {
- this.url = GetBasePath('inventory') + inventoryId + '/inventory_sources';
- Rest.setUrl(this.url);
- return Rest.options()
- .then(this.success.bind(this))
- .catch(this.error.bind(this));
- },
- updateInventorySourcesGet: function(inventoryId) {
- this.url = GetBasePath('inventory') + inventoryId + '/update_inventory_sources';
- Rest.setUrl(this.url);
- return Rest.get()
- .then(this.success.bind(this))
- .catch(this.error.bind(this));
- },
- getHost: function(inventoryId, hostId) {
- this.url = GetBasePath('inventory') + inventoryId + '/hosts?id=' + hostId;
- Rest.setUrl(this.url);
- return Rest.get()
- .then(this.success.bind(this))
- .catch(this.error.bind(this));
- }
- };
- }];
diff --git a/awx/ui/client/src/inventories-hosts/shared/main.js b/awx/ui/client/src/inventories-hosts/shared/main.js
deleted file mode 100644
index 37075ddc52..0000000000
--- a/awx/ui/client/src/inventories-hosts/shared/main.js
+++ /dev/null
@@ -1,26 +0,0 @@
-/*************************************************
- * Copyright (c) 2017 Ansible, Inc.
- *
- * All Rights Reserved
- *************************************************/
-
-import SetStatus from './factories/set-status.factory';
-import SetEnabledMsg from './factories/set-enabled-msg.factory';
-import ansibleFacts from './ansible-facts/main';
-import InventoriesService from './inventories.service';
-import GroupsService from './groups.service';
-import HostsService from './hosts.service';
-import associateGroups from './associate-groups/associate-groups.directive';
-import associateHosts from './associate-hosts/associate-hosts.directive';
-
-export default
-angular.module('inventoriesHostsFactories', [
- ansibleFacts.name
-])
- .factory('SetStatus', SetStatus)
- .factory('SetEnabledMsg', SetEnabledMsg)
- .service('HostsService', HostsService)
- .service('InventoriesService', InventoriesService)
- .service('GroupsService', GroupsService)
- .directive('associateGroups', associateGroups)
- .directive('associateHosts', associateHosts);
diff --git a/awx/ui/client/src/inventory-scripts/add/add.controller.js b/awx/ui/client/src/inventory-scripts/add/add.controller.js
deleted file mode 100644
index 60c6714d70..0000000000
--- a/awx/ui/client/src/inventory-scripts/add/add.controller.js
+++ /dev/null
@@ -1,62 +0,0 @@
-/*************************************************
- * Copyright (c) 2015 Ansible, Inc.
- *
- * All Rights Reserved
- *************************************************/
-
-export default ['Rest', 'Wait',
- 'InventoryScriptsForm', 'ProcessErrors', 'GetBasePath',
- 'GenerateForm', '$scope', '$state', 'Alert',
- function(Rest, Wait,
- InventoryScriptsForm, ProcessErrors, GetBasePath,
- GenerateForm, $scope, $state, Alert
- ) {
- var form = InventoryScriptsForm,
- url = GetBasePath('inventory_scripts');
-
- init();
-
- function init() {
- Rest.setUrl(url);
- Rest.options()
- .then(({data}) => {
- if (!data.actions.POST) {
- $state.go("^");
- Alert('Permission Error', 'You do not have permission to add an inventory script.', 'alert-info');
- }
- });
-
- // apply form definition's default field values
- GenerateForm.applyDefaults(form, $scope);
-
- // @issue @jmitchell - this setting probably collides with new RBAC can* implementation?
- $scope.canEdit = true;
- }
-
- // Save
- $scope.formSave = function() {
- Wait('start');
- Rest.setUrl(url);
- Rest.post({
- name: $scope.name,
- description: $scope.description,
- organization: $scope.organization,
- script: $scope.script
- })
- .then(() => {
- $state.go('inventoryScripts', null, { reload: true });
- Wait('stop');
- })
- .catch(({data, status}) => {
- ProcessErrors($scope, data, status, form, {
- hdr: 'Error!',
- msg: 'Failed to add new inventory script. POST returned status: ' + status
- });
- });
- };
-
- $scope.formCancel = function() {
- $state.go('^');
- };
- }
-];
diff --git a/awx/ui/client/src/inventory-scripts/add/main.js b/awx/ui/client/src/inventory-scripts/add/main.js
deleted file mode 100644
index 11d9659f64..0000000000
--- a/awx/ui/client/src/inventory-scripts/add/main.js
+++ /dev/null
@@ -1,11 +0,0 @@
-/*************************************************
- * Copyright (c) 2015 Ansible, Inc.
- *
- * All Rights Reserved
- *************************************************/
-
-import controller from './add.controller';
-
-export default
- angular.module('inventoryScriptsAdd', [])
- .controller('InventoryScriptsAddController', controller);
diff --git a/awx/ui/client/src/inventory-scripts/edit/edit.controller.js b/awx/ui/client/src/inventory-scripts/edit/edit.controller.js
deleted file mode 100644
index 863737a8c4..0000000000
--- a/awx/ui/client/src/inventory-scripts/edit/edit.controller.js
+++ /dev/null
@@ -1,79 +0,0 @@
-/*************************************************
- * Copyright (c) 2015 Ansible, Inc.
- *
- * All Rights Reserved
- *************************************************/
-
-export default ['Rest', 'Wait',
- 'InventoryScriptsForm', 'ProcessErrors', 'GetBasePath',
- 'GenerateForm', 'inventory_scriptData',
- '$scope', '$state',
- function(
- Rest, Wait, InventoryScriptsForm, ProcessErrors, GetBasePath,
- GenerateForm, inventory_scriptData,
- $scope, $state
- ) {
- var generator = GenerateForm,
- data = inventory_scriptData,
- id = inventory_scriptData.id,
- form = InventoryScriptsForm,
- main = {},
- url = GetBasePath('inventory_scripts');
-
- init();
-
- function init() {
- $scope.inventory_script = inventory_scriptData;
-
- $scope.$watch('inventory_script_obj.summary_fields.user_capabilities.edit', function(val) {
- if (val === false) {
- $scope.canAdd = false;
- }
- });
-
- var fld;
- for (fld in form.fields) {
- if (data[fld]) {
- $scope[fld] = data[fld];
- main[fld] = data[fld];
- }
-
- if (form.fields[fld].sourceModel && data.summary_fields &&
- data.summary_fields[form.fields[fld].sourceModel]) {
- $scope[form.fields[fld].sourceModel + '_' + form.fields[fld].sourceField] =
- data.summary_fields[form.fields[fld].sourceModel][form.fields[fld].sourceField];
- main[form.fields[fld].sourceModel + '_' + form.fields[fld].sourceField] =
- data.summary_fields[form.fields[fld].sourceModel][form.fields[fld].sourceField];
- }
- }
-
- }
-
- $scope.formSave = function() {
- generator.clearApiErrors($scope);
- Wait('start');
- Rest.setUrl(url + id + '/');
- Rest.put({
- name: $scope.name,
- description: $scope.description,
- organization: $scope.organization,
- script: $scope.script
- })
- .then(() => {
- $state.go('inventoryScripts', null, { reload: true });
- Wait('stop');
- })
- .catch(({data, status}) => {
- ProcessErrors($scope, data, status, form, {
- hdr: 'Error!',
- msg: 'Failed to add new inventory script. PUT returned status: ' + status
- });
- });
- };
-
- $scope.formCancel = function() {
- $state.go('inventoryScripts');
- };
-
- }
-];
diff --git a/awx/ui/client/src/inventory-scripts/edit/main.js b/awx/ui/client/src/inventory-scripts/edit/main.js
deleted file mode 100644
index b51e421206..0000000000
--- a/awx/ui/client/src/inventory-scripts/edit/main.js
+++ /dev/null
@@ -1,11 +0,0 @@
-/*************************************************
- * Copyright (c) 2015 Ansible, Inc.
- *
- * All Rights Reserved
- *************************************************/
-
-import controller from './edit.controller';
-
-export default
- angular.module('inventoryScriptsEdit', [])
- .controller('InventoryScriptsEditController', controller);
diff --git a/awx/ui/client/src/inventory-scripts/inventory-scripts.form.js b/awx/ui/client/src/inventory-scripts/inventory-scripts.form.js
deleted file mode 100644
index 0dbf97a0ba..0000000000
--- a/awx/ui/client/src/inventory-scripts/inventory-scripts.form.js
+++ /dev/null
@@ -1,82 +0,0 @@
-/*************************************************
- * Copyright (c) 2015 Ansible, Inc.
- *
- * All Rights Reserved
- *************************************************/
-
- /**
- * @ngdoc function
- * @name forms.function:CustomInventory
- * @description This form is for adding/editing an organization
-*/
-
-export default ['i18n', function(i18n) {
- return {
-
- addTitle: i18n._('NEW CUSTOM INVENTORY'),
- editTitle: '{{ name }}',
- name: 'inventory_script',
- basePath: 'inventory_scripts',
- stateTree: 'inventoryScripts',
- // I18N for "CREATE INVENTORY_SCRIPT"
- // on /#/inventory_scripts/add
- breadcrumbName: i18n._('INVENTORY SCRIPT'),
- showActions: true,
-
- fields: {
- name: {
- label: i18n._('Name'),
- type: 'text',
- ngDisabled: '!(inventory_script_obj.summary_fields.user_capabilities.edit || canAdd)',
- required: true,
- capitalize: false
- },
- description: {
- label: i18n._('Description'),
- type: 'text',
- ngDisabled: '!(inventory_script_obj.summary_fields.user_capabilities.edit || canAdd)'
- },
- organization: {
- label: i18n._('Organization'),
- type: 'lookup',
- list: 'OrganizationList',
- basePath: 'organizations',
- required: true,
- sourceModel: 'organization',
- sourceField: 'name',
- ngDisabled: '!(inventory_script_obj.summary_fields.user_capabilities.edit || canAdd)'
- },
- script: {
- label: i18n._('Custom Script'),
- type: 'textarea',
- class: 'Form-formGroup--fullWidth',
- elementClass: 'Form-monospace',
- required: true,
- awDropFile: true,
- ngDisabled: '!(inventory_script_obj.summary_fields.user_capabilities.edit || canAdd)',
- ngTrim: false,
- rows: 10,
- awPopOver: i18n._('Drag and drop your custom inventory script file here or create one in the field to import your custom inventory. Refer to the Ansible Tower documentation for example syntax.'),
- dataTitle: i18n._('Custom Script'),
- dataPlacement: 'right',
- dataContainer: "body"
- },
- },
-
- buttons: { //for now always generates
tags
- cancel: {
- ngClick: 'formCancel()',
- ngShow: '(inventory_script_obj.summary_fields.user_capabilities.edit || canAdd)'
- },
- close: {
- ngClick: 'formCancel()',
- ngShow: '!(inventory_script_obj.summary_fields.user_capabilities.edit || canAdd)'
- },
- save: {
- ngClick: 'formSave()', //$scope.function to call on click, optional
- ngDisabled: 'inventory_script_form.$invalid', //Disable when $invalid, optional
- ngShow: '(inventory_script_obj.summary_fields.user_capabilities.edit || canAdd)'
- }
- }
- };
-}];
diff --git a/awx/ui/client/src/inventory-scripts/inventory-scripts.list.js b/awx/ui/client/src/inventory-scripts/inventory-scripts.list.js
deleted file mode 100644
index b3bd9e792a..0000000000
--- a/awx/ui/client/src/inventory-scripts/inventory-scripts.list.js
+++ /dev/null
@@ -1,87 +0,0 @@
-/*************************************************
- * Copyright (c) 2015 Ansible, Inc.
- *
- * All Rights Reserved
- *************************************************/
-
-
-
-export default ['i18n', function(i18n){
- return {
- name: 'inventory_scripts' ,
- listTitle: i18n._('INVENTORY SCRIPTS'),
- iterator: 'inventory_script',
- index: false,
- hover: false,
-
- fields: {
- name: {
- key: true,
- label: i18n._('Name'),
- columnClass: 'col-md-4 col-sm-9 col-xs-9',
- modalColumnClass: 'col-md-8',
- awToolTip: '{{inventory_script.description | sanitize}}',
- dataPlacement: 'top'
- },
- organization: {
- label: i18n._('Organization'),
- ngBind: 'inventory_script.summary_fields.organization.name',
- sourceModel: 'organization',
- sourceField: 'name',
- excludeModal: true,
- columnClass: 'd-none d-md-flex col-md-4'
- }
- },
-
- actions: {
- add: {
- mode: 'all', // One of: edit, select, all
- ngClick: 'addCustomInv()',
- awToolTip: i18n._('Create a new custom inventory'),
- actionClass: 'at-Button--add',
- actionId: 'button-add',
- ngShow: 'canAdd'
- }
- },
-
- fieldActions: {
-
- columnClass: 'col-md-4 col-sm-3 col-xs-3',
-
- edit: {
- ngClick: "editCustomInv(inventory_script.id)",
- icon: 'fa-edit',
- label: i18n._('Edit'),
- "class": 'btn-sm',
- awToolTip: i18n._('Edit inventory script'),
- dataPlacement: 'top',
- ngShow: 'inventory_script.summary_fields.user_capabilities.edit'
- },
- copy: {
- label: i18n._('Copy'),
- ngClick: 'copyCustomInv(inventory_script)',
- "class": 'btn-danger btn-xs',
- awToolTip: i18n._('Copy inventory script'),
- dataPlacement: 'top',
- ngShow: 'inventory_script.summary_fields.user_capabilities.copy'
- },
- view: {
- ngClick: "editCustomInv(inventory_script.id)",
- label: i18n._('View'),
- "class": 'btn-sm',
- awToolTip: i18n._('View inventory script'),
- dataPlacement: 'top',
- ngShow: '!inventory_script.summary_fields.user_capabilities.edit'
- },
- "delete": {
- ngClick: "deleteCustomInv(inventory_script.id, inventory_script.name)",
- icon: 'fa-trash',
- label: i18n._('Delete'),
- "class": 'btn-sm',
- awToolTip: i18n._('Delete inventory script'),
- dataPlacement: 'top',
- ngShow: 'inventory_script.summary_fields.user_capabilities.delete'
- }
- }
- };
-}];
diff --git a/awx/ui/client/src/inventory-scripts/inventory-scripts.strings.js b/awx/ui/client/src/inventory-scripts/inventory-scripts.strings.js
deleted file mode 100644
index 0760b60add..0000000000
--- a/awx/ui/client/src/inventory-scripts/inventory-scripts.strings.js
+++ /dev/null
@@ -1,7 +0,0 @@
-function InventoryScriptsStrings (BaseString) {
- BaseString.call(this, 'inventory_scripts');
-}
-
-InventoryScriptsStrings.$inject = ['BaseStringService'];
-
-export default InventoryScriptsStrings;
diff --git a/awx/ui/client/src/inventory-scripts/list/list.controller.js b/awx/ui/client/src/inventory-scripts/list/list.controller.js
deleted file mode 100644
index 6db58983cc..0000000000
--- a/awx/ui/client/src/inventory-scripts/list/list.controller.js
+++ /dev/null
@@ -1,140 +0,0 @@
-/*************************************************
- * Copyright (c) 2015 Ansible, Inc.
- *
- * All Rights Reserved
- *************************************************/
-
-export default ['$rootScope', '$scope', 'Wait', 'InventoryScriptsList',
- 'GetBasePath', 'Rest', 'ProcessErrors', 'Prompt', '$state', '$filter',
- 'Dataset', 'rbacUiControlService', 'InventoryScriptModel', 'InventoryScriptsStrings',
- 'i18n', 'ngToast',
- function(
- $rootScope, $scope, Wait, InventoryScriptsList,
- GetBasePath, Rest, ProcessErrors, Prompt, $state, $filter,
- Dataset, rbacUiControlService, InventoryScript, InventoryScriptsStrings,
- i18n, ngToast
- ) {
- let inventoryScript = new InventoryScript();
- var defaultUrl = GetBasePath('inventory_scripts'),
- list = InventoryScriptsList;
-
- init();
-
- function init() {
- $scope.canAdd = false;
-
- rbacUiControlService.canAdd("inventory_scripts")
- .then(function(params) {
- $scope.canAdd = params.canAdd;
- });
-
- // search init
- $scope.list = list;
- $scope[`${list.iterator}_dataset`] = Dataset.data;
- $scope[list.name] = $scope[`${list.iterator}_dataset`].results;
-
- }
-
- // @todo what is going on here, and if it needs to happen in this controller make $rootScope var name more explicit
- if ($rootScope.addedItem) {
- $scope.addedItem = $rootScope.addedItem;
- delete $rootScope.addedItem;
- }
-
- $scope.editCustomInv = function() {
- $state.go('inventoryScripts.edit', {
- inventory_script_id: this.inventory_script.id
- });
- };
-
- $scope.copyCustomInv = inventoryScript => {
- Wait('start');
- new InventoryScript('get', inventoryScript.id)
- .then(model => model.copy())
- .then((copiedInvScript) => {
- ngToast.success({
- content: `
-
-
-
-
-
- ${InventoryScriptsStrings.get('SUCCESSFUL_CREATION', copiedInvScript.name)}
-
-
`,
- dismissButton: false,
- dismissOnTimeout: true
- });
- $state.go('.', null, { reload: true });
- })
- .catch(({ data, status }) => {
- const params = { hdr: 'Error!', msg: `Call to copy failed. Return status: ${status}` };
- ProcessErrors($scope, data, status, null, params);
- })
- .finally(() => Wait('stop'));
- };
-
- $scope.deleteCustomInv = function(id, name) {
-
- var action = function() {
- $('#prompt-modal').modal('hide');
- Wait('start');
- var url = defaultUrl + id + '/';
- inventoryScript.request('delete', id)
- .then(() => {
-
- let reloadListStateParams = null;
-
- if($scope.inventory_scripts.length === 1 && $state.params.inventory_script_search && _.has($state, 'params.inventory_script_search.page') && $state.params.inventory_script_search.page !== '1') {
- reloadListStateParams = _.cloneDeep($state.params);
- reloadListStateParams.inventory_script_search.page = (parseInt(reloadListStateParams.inventory_script_search.page)-1).toString();
- }
-
- if (parseInt($state.params.inventory_script_id) === id) {
- $state.go('^', reloadListStateParams, { reload: true });
- } else {
- $state.go('.', reloadListStateParams, { reload: true });
- }
- })
- .catch(({data, status}) => {
- ProcessErrors($scope, data, status, null, {
- hdr: 'Error!',
- msg: 'Call to ' + url + ' failed. DELETE returned status: ' + status
- });
- });
- };
-
- inventoryScript.getDependentResourceCounts(id)
- .then((counts) => {
- const invalidateRelatedLines = [];
- let deleteModalBody = `${InventoryScriptsStrings.get('deleteResource.CONFIRM', 'inventory script')}
`;
-
- counts.forEach(countObj => {
- if(countObj.count && countObj.count > 0) {
- invalidateRelatedLines.push(`${countObj.label} ${countObj.count}
`);
- }
- });
-
- if (invalidateRelatedLines && invalidateRelatedLines.length > 0) {
- deleteModalBody = `${InventoryScriptsStrings.get('deleteResource.USED_BY', 'inventory script')} ${InventoryScriptsStrings.get('deleteResource.CONFIRM', 'inventory script')}
`;
- invalidateRelatedLines.forEach(invalidateRelatedLine => {
- deleteModalBody += invalidateRelatedLine;
- });
- }
-
- Prompt({
- hdr: i18n._('Delete'),
- resourceName: $filter('sanitize')(name),
- body: deleteModalBody,
- action: action,
- actionText: i18n._('DELETE')
- });
- });
- };
-
- $scope.addCustomInv = function() {
- $state.go('inventoryScripts.add');
- };
-
- }
-];
diff --git a/awx/ui/client/src/inventory-scripts/list/main.js b/awx/ui/client/src/inventory-scripts/list/main.js
deleted file mode 100644
index 49d3966f12..0000000000
--- a/awx/ui/client/src/inventory-scripts/list/main.js
+++ /dev/null
@@ -1,11 +0,0 @@
-/*************************************************
- * Copyright (c) 2015 Ansible, Inc.
- *
- * All Rights Reserved
- *************************************************/
-
-import InventoryScriptListController from './list.controller';
-
-export default
-angular.module('inventoryScriptsList', [])
- .controller('InventoryScriptsListController', InventoryScriptListController);
diff --git a/awx/ui/client/src/inventory-scripts/main.js b/awx/ui/client/src/inventory-scripts/main.js
deleted file mode 100644
index bc57686d0b..0000000000
--- a/awx/ui/client/src/inventory-scripts/main.js
+++ /dev/null
@@ -1,86 +0,0 @@
-/*************************************************
- * Copyright (c) 2015 Ansible, Inc.
- *
- * All Rights Reserved
- *************************************************/
-
-import inventoryScriptsList from './list/main';
-import inventoryScriptsAdd from './add/main';
-import inventoryScriptsEdit from './edit/main';
-import list from './inventory-scripts.list';
-import form from './inventory-scripts.form';
-import { N_ } from '../i18n';
-import InventoryScriptsStrings from './inventory-scripts.strings';
-
-export default
-angular.module('inventoryScripts', [
- inventoryScriptsList.name,
- inventoryScriptsAdd.name,
- inventoryScriptsEdit.name
- ])
- .factory('InventoryScriptsList', list)
- .factory('InventoryScriptsForm', form)
- .service('InventoryScriptsStrings', InventoryScriptsStrings)
- .config(['$stateProvider', 'stateDefinitionsProvider',
- function($stateProvider, stateDefinitionsProvider) {
- let stateDefinitions = stateDefinitionsProvider.$get();
-
- function generateStateTree() {
- let inventoryScriptTree = stateDefinitions.generateTree({
- parent: 'inventoryScripts',
- modes: ['add', 'edit'],
- list: 'InventoryScriptsList',
- form: 'InventoryScriptsForm',
- controllers: {
- list: 'InventoryScriptsListController',
- add: 'InventoryScriptsAddController',
- edit: 'InventoryScriptsEditController'
- },
- resolve: {
- edit: {
- inventory_scriptData: ['$state', '$stateParams', 'Rest', 'GetBasePath', 'ProcessErrors',
- function($state, $stateParams, rest, getBasePath, ProcessErrors) {
- var inventoryScriptId = $stateParams.inventory_script_id;
- var url = getBasePath('inventory_scripts') + inventoryScriptId + '/';
- rest.setUrl(url);
- return rest.get()
- .then(function(data) {
- return data.data;
- }).catch(function(response) {
- ProcessErrors(null, response.data, response.status, null, {
- hdr: 'Error!',
- msg: 'Failed to get inventory script info. GET returned status: ' +
- response.status
- });
- });
- }
- ]
- }
- },
- data: {
- activityStream: true,
- activityStreamTarget: 'custom_inventory_script'
- },
- ncyBreadcrumb: {
- label: N_('INVENTORY SCRIPTS')
- }
- });
-
- return Promise.all([
- inventoryScriptTree
- ]).then((generated) => {
- return {
- states: _.reduce(generated, (result, definition) => {
- return result.concat(definition.states);
- }, [])
- };
- });
- }
- let stateTree = {
- name: 'inventoryScripts.**',
- url: '/inventory_scripts',
- lazyLoad: () => generateStateTree()
- };
- $stateProvider.state(stateTree);
- }
- ]);
diff --git a/awx/ui/client/src/job-submission/job-submission-directives/aw-password-max.directive.js b/awx/ui/client/src/job-submission/job-submission-directives/aw-password-max.directive.js
deleted file mode 100644
index 6ac96eff0e..0000000000
--- a/awx/ui/client/src/job-submission/job-submission-directives/aw-password-max.directive.js
+++ /dev/null
@@ -1,29 +0,0 @@
-/*************************************************
- * Copyright (c) 2017 Ansible, Inc.
- *
- * All Rights Reserved
- *************************************************/
-
-/* jshint unused: vars */
-
-export default
- [ 'Empty',
- function(Empty) {
- return {
- restrict: 'A',
- require: 'ngModel',
- link: function(scope, elem, attr, ctrl) {
- ctrl.$parsers.unshift(function(viewValue) {
- var max = (attr.awPasswordMax) ? scope.$eval(attr.awPasswordMax) : Infinity;
- if (!Empty(max) && !Empty(viewValue) && viewValue.length > max && viewValue !== '$encrypted$') {
- ctrl.$setValidity('awPasswordMax', false);
- return viewValue;
- } else {
- ctrl.$setValidity('awPasswordMax', true);
- return viewValue;
- }
- });
- }
- };
- }
- ];
diff --git a/awx/ui/client/src/job-submission/job-submission-directives/aw-password-min.directive.js b/awx/ui/client/src/job-submission/job-submission-directives/aw-password-min.directive.js
deleted file mode 100644
index 1498313177..0000000000
--- a/awx/ui/client/src/job-submission/job-submission-directives/aw-password-min.directive.js
+++ /dev/null
@@ -1,27 +0,0 @@
-/*************************************************
- * Copyright (c) 2017 Ansible, Inc.
- *
- * All Rights Reserved
- *************************************************/
-
- export default
- [ 'Empty',
- function(Empty) {
- return {
- restrict: 'A',
- require: 'ngModel',
- link: function(scope, elem, attr, ctrl) {
- ctrl.$parsers.unshift(function(viewValue) {
- var min = (attr.awPasswordMin) ? scope.$eval(attr.awPasswordMin) : -Infinity;
- if (!Empty(min) && !Empty(viewValue) && viewValue.length < min && viewValue !== '$encrypted$') {
- ctrl.$setValidity('awPasswordMin', false);
- return viewValue;
- } else {
- ctrl.$setValidity('awPasswordMin', true);
- return viewValue;
- }
- });
- }
- };
- }
- ];
diff --git a/awx/ui/client/src/job-submission/job-submission-factories/adhoc-run.factory.js b/awx/ui/client/src/job-submission/job-submission-factories/adhoc-run.factory.js
deleted file mode 100644
index debb0c9115..0000000000
--- a/awx/ui/client/src/job-submission/job-submission-factories/adhoc-run.factory.js
+++ /dev/null
@@ -1,162 +0,0 @@
-/*************************************************
- * Copyright (c) 2015 Ansible, Inc.
- *
- * All Rights Reserved
- *************************************************/
-
-/**
- * @ngdoc function
- * @name helpers.function:Adhoc
- * @description These routines are shared by adhoc command related controllers.
- * The content here is very similar to the JobSubmission helper, and in fact,
- * certain services are pulled from that helper. This leads to an important
- * point: if you need to create functionality that is shared between the command
- * and playbook run process, put that code in the JobSubmission helper and make
- * it into a reusable step (by specifying a callback parameter in the factory).
- * For a good example of this, please see how the AdhocLaunch factory in this
- * file utilizes the CheckPasswords factory from the JobSubmission helper.
- *
- * #AdhocRelaunch Step 1: preparing the GET to ad_hoc_commands/n/relaunch
- * The adhoc relaunch process is called from the JobSubmission helper. It is a
- * separate process from the initial adhoc run becuase of the way the API
- * endpoints work. For AdhocRelaunch, we have access to the original run and
- * we can pull the related relaunch URL by knowing the original Adhoc runs ID.
- *
- * #AdhocRelaunch Step 2: If we got passwords back, add them
- * The relaunch URL gives us back the passwords we need to prompt for (if any).
- * We'll go to step 3 if there are passwords, and step 4 if not.
- *
- * #AdhocRelaunch Step 3: PromptForPasswords and the CreateLaunchDialog
- *
- * #AdhocRelaunch Step 5: StartAdhocRun
- *
- * #AdhocRelaunch Step 6: LaunchJob and navigate to the standard out page.
-
- * **If you are
- * TODO: once the API endpoint is figured out for running an adhoc command
- * from the form is figured out, the rest work should probably be excised from
- * the controller and moved into here. See the todo statements in the
- * controller for more information about this.
- */
-
- export default
- function AdhocRun($location, PromptForPasswords,
- Rest, GetBasePath, ProcessErrors, Wait, Empty, CreateLaunchDialog, $state) {
- return function(params) {
- var id = params.project_id,
- scope = params.scope.$new(),
- new_job_id,
- html,
- url;
-
- // this is used to cancel a running adhoc command from
- // the jobs page
- if (scope.removeCancelJob) {
- scope.removeCancelJob();
- }
- scope.removeCancelJob = scope.$on('CancelJob', function() {
- // Delete the job
- Wait('start');
- Rest.setUrl(GetBasePath('ad_hoc_commands') + new_job_id + '/');
- Rest.destroy()
- .then(() => {
- Wait('stop');
- })
- .catch(({data, status}) => {
- ProcessErrors(scope, data, status,
- null, { hdr: 'Error!',
- msg: 'Call to ' + url +
- ' failed. DELETE returned status: ' +
- status });
- });
- });
-
- if (scope.removeStartAdhocRun) {
- scope.removeStartAdhocRun();
- }
-
- scope.removeStartAdhocRun = scope.$on('StartAdhocRun', function() {
- var password,
- postData={};
- for (password in scope.passwords) {
- postData[scope.passwords[password]] = scope[
- scope.passwords[password]
- ];
- }
- // Re-launch the adhoc job
- Rest.setUrl(url);
- Rest.post(postData)
- .then(({data}) => {
- Wait('stop');
- if($location.path().replace(/^\//, '').split('/')[0] !== 'jobs') {
- $state.go('output', { id: data.id, type: 'command' });
- }
- })
- .catch(({data, status}) => {
- ProcessErrors(scope, data, status, null, {
- hdr: 'Error!',
- msg: 'Failed to launch adhoc command. POST ' +
- 'returned status: ' + status });
- });
- });
-
- // start routine only if passwords need to be prompted
- if (scope.removeCreateLaunchDialog) {
- scope.removeCreateLaunchDialog();
- }
- scope.removeCreateLaunchDialog = scope.$on('CreateLaunchDialog',
- function(e, html, url) {
- CreateLaunchDialog({
- scope: scope,
- html: html,
- url: url,
- callback: 'StartAdhocRun'
- });
- });
-
- if (scope.removePromptForPasswords) {
- scope.removePromptForPasswords();
- }
- scope.removePromptForPasswords = scope.$on('PromptForPasswords',
- function(e, passwords_needed_to_start,html, url) {
- PromptForPasswords({
- scope: scope,
- passwords: passwords_needed_to_start,
- callback: 'CreateLaunchDialog',
- html: html,
- url: url
- });
- }); // end password prompting routine
-
- // start the adhoc relaunch routine
- Wait('start');
- url = GetBasePath('ad_hoc_commands') + id + '/relaunch/';
- Rest.setUrl(url);
- Rest.get()
- .then(({data}) => {
- new_job_id = data.id;
-
- scope.passwords_needed_to_start = data.passwords_needed_to_start;
- if (!Empty(data.passwords_needed_to_start) &&
- data.passwords_needed_to_start.length > 0) {
- // go through the password prompt routine before
- // starting the adhoc run
- scope.$emit('PromptForPasswords', data.passwords_needed_to_start, html, url);
- }
- else {
- // no prompting of passwords needed
- scope.$emit('StartAdhocRun');
- }
- })
- .catch(({data, status}) => {
- ProcessErrors(scope, data, status, null, { hdr: 'Error!',
- msg: 'Failed to get job template details. GET returned status: ' + status });
- });
- };
- }
-
- AdhocRun.$inject =
- [ '$location',
- 'PromptForPasswords', 'Rest', 'GetBasePath', 'ProcessErrors',
- 'Wait', 'Empty', 'CreateLaunchDialog', '$state'
- ];
diff --git a/awx/ui/client/src/job-submission/job-submission-factories/check-passwords.factory.js b/awx/ui/client/src/job-submission/job-submission-factories/check-passwords.factory.js
deleted file mode 100644
index db7745ebd6..0000000000
--- a/awx/ui/client/src/job-submission/job-submission-factories/check-passwords.factory.js
+++ /dev/null
@@ -1,48 +0,0 @@
-export default
- function CheckPasswords(Rest, GetBasePath, ProcessErrors, Empty, credentialTypesLookup) {
- return function(params) {
- var scope = params.scope,
- callback = params.callback,
- credential = params.credential;
-
- var passwords = [];
- if (!Empty(credential)) {
- Rest.setUrl(GetBasePath('credentials')+credential);
- Rest.get()
- .then(({data}) => {
- credentialTypesLookup()
- .then(kinds => {
- if(data.credential_type === kinds.ssh && data.inputs){
- if(data.inputs.password === "ASK" ){
- passwords.push("ssh_password");
- }
- if(data.inputs.ssh_key_unlock === "ASK"){
- passwords.push("ssh_key_unlock");
- }
- if(data.inputs.become_password === "ASK"){
- passwords.push("become_password");
- }
- if(data.inputs.vault_password === "ASK"){
- passwords.push("vault_password");
- }
- }
- scope.$emit(callback, passwords);
- });
-
- })
- .catch(({data, status}) => {
- ProcessErrors(scope, data, status, null, { hdr: 'Error!',
- msg: 'Failed to get job template details. GET returned status: ' + status });
- });
- }
-
- };
- }
-
-CheckPasswords.$inject =
- [ 'Rest',
- 'GetBasePath',
- 'ProcessErrors',
- 'Empty',
- 'credentialTypesLookup'
- ];
diff --git a/awx/ui/client/src/job-submission/job-submission-factories/create-launch-dialog.factory.js b/awx/ui/client/src/job-submission/job-submission-factories/create-launch-dialog.factory.js
deleted file mode 100644
index a114c65668..0000000000
--- a/awx/ui/client/src/job-submission/job-submission-factories/create-launch-dialog.factory.js
+++ /dev/null
@@ -1,74 +0,0 @@
-export default
- function CreateLaunchDialog($compile, CreateDialog, Wait, ParseTypeChange, i18n) {
- return function(params) {
- var buttons,
- scope = params.scope,
- html = params.html,
- // job_launch_data = {},
- callback = params.callback || 'PlaybookLaunchFinished',
- // url = params.url,
- e;
-
- // html+=' job_launch_form.$valid = {{job_launch_form.$valid}} ';
- html+='';
- $('#password-modal').empty().html(html);
- $('#password-modal').find('#job_extra_vars').before(scope.helpContainer);
- e = angular.element(document.getElementById('password-modal'));
- $compile(e)(scope);
-
- if(scope.prompt_for_vars===true){
- ParseTypeChange({ scope: scope, field_id: 'job_extra_vars' , variable: "extra_vars"});
- }
-
- buttons = [{
- label: i18n._("Cancel"),
- onClick: function() {
- $('#password-modal').dialog('close');
- // scope.$emit('CancelJob');
- // scope.$destroy();
- },
- "class": "btn btn-default",
- "id": "password-cancel-button"
- },{
- label: i18n._("Launch"),
- onClick: function() {
- scope.$emit(callback);
- $('#password-modal').dialog('close');
- },
- "class": "btn btn-primary",
- "id": "password-accept-button"
- }];
-
- CreateDialog({
- id: 'password-modal',
- scope: scope,
- buttons: buttons,
- width: 620,
- height: "auto",
- minWidth: 500,
- title: i18n._('Launch Configuration'),
- callback: 'DialogReady',
- onOpen: function(){
- Wait('stop');
- }
- });
-
- if (scope.removeDialogReady) {
- scope.removeDialogReady();
- }
- scope.removeDialogReady = scope.$on('DialogReady', function() {
- $('#password-modal').dialog('open');
- $('#password-accept-button').attr('ng-disabled', 'job_launch_form.$invalid' );
- e = angular.element(document.getElementById('password-accept-button'));
- $compile(e)(scope);
- });
- };
- }
-
-CreateLaunchDialog.$inject =
- [ '$compile',
- 'CreateDialog',
- 'Wait',
- 'ParseTypeChange',
- 'i18n'
- ];
diff --git a/awx/ui/client/src/job-submission/job-submission-factories/inventory-update.factory.js b/awx/ui/client/src/job-submission/job-submission-factories/inventory-update.factory.js
deleted file mode 100644
index f218ab2767..0000000000
--- a/awx/ui/client/src/job-submission/job-submission-factories/inventory-update.factory.js
+++ /dev/null
@@ -1,67 +0,0 @@
-export default
- function InventoryUpdate(PromptForPasswords, LaunchJob, Rest, ProcessErrors, Alert, Wait) {
- return function (params) {
-
- var scope = params.scope,
- url = params.url,
- inventory_source;
-
- if (scope.removeUpdateSubmitted) {
- scope.removeUpdateSubmitted();
- }
- scope.removeUpdateSubmitted = scope.$on('UpdateSubmitted', function () {
- Wait('stop');
- if (scope.socketStatus === 'error') {
- Alert('Sync Started', 'The request to start the inventory sync process was submitted. ' +
- 'To monitor the status refresh the page by clicking the button.
', 'alert-info', null, null, null, null, true);
- if (scope.refreshGroups) {
- // inventory detail page
- scope.refreshGroups();
- }
- else if (scope.refresh) {
- scope.refresh();
- }
- }
- });
-
- if (scope.removeStartTheUpdate) {
- scope.removeStartTheUpdate();
- }
- scope.removeStartTheUpdate = scope.$on('StartTheUpdate', function(e, passwords) {
- LaunchJob({ scope: scope, url: url, passwords: passwords, callback: 'UpdateSubmitted' });
- });
-
- // Check to see if we have permission to perform the update and if any passwords are needed
- Wait('start');
- Rest.setUrl(url);
- Rest.get()
- .then(({data}) => {
- if(params.updateAllSources) {
- scope.$emit('StartTheUpdate', {});
- }
- else {
- inventory_source = data;
- if (data.can_update) {
- scope.$emit('StartTheUpdate', {});
- } else {
- Wait('stop');
- Alert('Error Launching Sync', 'Unable to execute the inventory sync. Please contact your system administrator.',
- 'alert-danger');
- }
- }
- })
- .catch(({data, status}) => {
- ProcessErrors(scope, data, status, null, { hdr: 'Error!',
- msg: 'Failed to get inventory source ' + url + ' GET returned: ' + status });
- });
- };
- }
-
-InventoryUpdate.$inject =
- [ 'PromptForPasswords',
- 'LaunchJob',
- 'Rest',
- 'ProcessErrors',
- 'Alert',
- 'Wait'
- ];
diff --git a/awx/ui/client/src/job-submission/job-submission-factories/launchjob.factory.js b/awx/ui/client/src/job-submission/job-submission-factories/launchjob.factory.js
deleted file mode 100644
index e8c6553241..0000000000
--- a/awx/ui/client/src/job-submission/job-submission-factories/launchjob.factory.js
+++ /dev/null
@@ -1,251 +0,0 @@
-
-export default
- function LaunchJob(Rest, Wait, ProcessErrors, ToJSON, Empty, GetBasePath, $state, $location, $rootScope, i18n) {
-
- // This factory gathers up all the job launch data and POST's it.
-
- // TODO: outline how these things are gathered
-
- return function (params) {
- var scope = params.scope,
- job_launch_data = {},
- url = params.url,
- submitJobType = params.submitJobType,
- vars_url = GetBasePath('job_templates')+scope.job_template_id + '/',
- base = $location.path().replace(/^\//, '').split('/')[0],
- extra_vars;
-
- if(submitJobType === 'job_template') {
- vars_url = GetBasePath('job_templates')+scope.job_template_id + '/';
- }
- else if(submitJobType === 'workflow_job_template') {
- vars_url = GetBasePath('workflow_job_templates')+scope.workflow_job_template_id + '/';
- }
-
- //found it easier to assume that there will be extra vars, and then check for a blank object at the end
- job_launch_data.extra_vars = {};
-
- //build the data object to be sent to the job launch endpoint. Any variables gathered from the survey and the extra variables text editor are inserted into the extra_vars dict of the job_launch_data
- var buildData = function() {
- if(scope.ssh_password_required) {
- job_launch_data.ssh_password = scope.passwords.ssh_password;
- }
- if(scope.ssh_key_unlock_required) {
- job_launch_data.ssh_key_unlock = scope.passwords.ssh_key_unlock;
- }
- if(scope.become_password_required) {
- job_launch_data.become_password = scope.passwords.become_password;
- }
- if(scope.vault_password_required) {
- job_launch_data.vault_password = scope.passwords.vault_password;
- }
-
- if(scope.ask_variables_on_launch){
- extra_vars = ToJSON(scope.parseType, scope.jobLaunchVariables, false);
- if(!Empty(extra_vars)){
- $.each(extra_vars, function(key,value){
- job_launch_data.extra_vars[key] = value;
- });
- }
-
- }
-
- if(scope.ask_tags_on_launch && scope.other_prompt_data && Array.isArray(scope.other_prompt_data.job_tags)){
- scope.job_tags = _.map(scope.job_tags, function(i){return i.value;});
- $("#job_launch_job_tags").siblings(".select2").first().find(".select2-selection__choice").each(function(optionIndex, option){
- scope.job_tags.push(option.title);
- });
- job_launch_data.job_tags = (Array.isArray(scope.job_tags)) ? _.uniq(scope.job_tags).join() : "";
- }
-
- if(scope.ask_skip_tags_on_launch && scope.other_prompt_data && Array.isArray(scope.other_prompt_data.skip_tags)){
- scope.skip_tags = _.map(scope.skip_tags, function(i){return i.value;});
- $("#job_launch_skip_tags").siblings(".select2").first().find(".select2-selection__choice").each(function(optionIndex, option){
- scope.skip_tags.push(option.title);
- });
- job_launch_data.skip_tags = (Array.isArray(scope.skip_tags)) ? _.uniq(scope.skip_tags).join() : "";
- }
-
- if(scope.ask_limit_on_launch && scope.other_prompt_data && scope.other_prompt_data.limit){
- job_launch_data.limit = scope.other_prompt_data.limit;
- }
-
- if(scope.ask_job_type_on_launch && scope.other_prompt_data && scope.other_prompt_data.job_type) {
- job_launch_data.job_type = scope.other_prompt_data.job_type.value;
- }
-
- if(scope.ask_verbosity_on_launch && scope.other_prompt_data && scope.other_prompt_data.verbosity) {
- job_launch_data.verbosity = scope.other_prompt_data.verbosity.value;
- }
-
- if(scope.survey_enabled===true){
- for (var i=0; i < scope.survey_questions.length; i++){
- var fld = scope.survey_questions[i].variable;
- // grab all survey questions that have answers
- if(scope.survey_questions[i].required || (scope.survey_questions[i].required === false && scope.survey_questions[i].model.toString()!=="")) {
- job_launch_data.extra_vars[fld] = scope.survey_questions[i].model;
- }
-
- if(scope.survey_questions[i].required === false && _.isEmpty(scope.survey_questions[i].model)) {
- switch (scope.survey_questions[i].type) {
- // for optional text and text-areas, submit a blank string if min length is 0
- // -- this is confusing, for an explanation see:
- // http://docs.ansible.com/ansible-tower/latest/html/userguide/job_templates.html#optional-survey-questions
- //
- case "text":
- case "textarea":
- if (scope.survey_questions[i].min === 0) {
- job_launch_data.extra_vars[fld] = "";
- }
- break;
-
- // for optional select lists, if they are left blank make sure we submit
- // a value that the API will consider "empty"
- //
- // ISSUE: I don't think this logic ever actually fires
- // When I tested this, we don't pass this extra var back
- // through the api when the mutliselect is optional and empty
- case "multiselect":
- job_launch_data.extra_vars[fld] = [];
- break;
- }
- }
- }
- }
-
- // include the inventory used if the user was prompted to choose a cred
- if(scope.ask_inventory_on_launch && !Empty(scope.selected_inventory)){
- job_launch_data.inventory_id = scope.selected_inventory.id;
- }
-
- // include the credential used if the user was prompted to choose a cred
- if(scope.ask_credential_on_launch){
- if(!Empty(scope.selected_credentials.machine)) {
- job_launch_data.credential_id = scope.selected_credentials.machine.id;
- }
- job_launch_data.credentials = [];
- scope.selected_credentials.extra.forEach((extraCredential) => {
- job_launch_data.credentials.push(extraCredential.id);
- });
- }
-
- if(scope.ask_diff_mode_on_launch && _.has(scope, 'other_prompt_data.diff_mode')){
- job_launch_data.diff_mode = scope.other_prompt_data.diff_mode;
- }
-
- if(scope.ask_scm_branch_on_launch && _.has(scope, 'other_prompt_data.scm_branch')){
- job_launch_data.scm_branch = scope.other_prompt_data.scm_branch;
- }
-
- if(!Empty(scope.relaunchHostType)) {
- job_launch_data.hosts = scope.relaunchHostType;
- }
-
- // If the extra_vars dict is empty, we don't want to include it if we didn't prompt for anything.
- if(jQuery.isEmptyObject(job_launch_data.extra_vars)===true && scope.prompt_for_vars===false){
- delete job_launch_data.extra_vars;
- }
-
- Rest.setUrl(url);
- Rest.post(job_launch_data)
- .then(({data}) => {
- Wait('stop');
- var job = data.job || data.system_job || data.project_update || data.inventory_update || data.ad_hoc_command;
- if(base !== 'portal' && Empty(data.system_job) || (base === 'home')){
- // use $state.go with reload: true option to re-instantiate sockets in
-
- var goTojobResults = function(type) {
- $state.go('output', {id: job, type}, {reload:true});
- };
-
- if($state.includes('jobs')) {
- return;
- }
-
- else {
- if(_.has(data, 'job')) {
- goTojobResults('playbook');
- } else if(data.type && data.type === 'workflow_job') {
- job = data.id;
- goTojobResults('workflow_job');
- }
- else if(_.has(data, 'ad_hoc_command')) {
- goTojobResults('ad_hoc_command');
- }
- else if(_.has(data, 'system_job')) {
- goTojobResults('system_job');
- }
- else if(_.has(data, 'project_update')) {
- // If we are on the projects list or any child state of that list
- // then we want to stay on that page. Otherwise go to the stdout
- // view.
- if(!$state.includes('projects')) {
- goTojobResults('project_update');
- }
- }
- else if(_.has(data, 'inventory_update')) {
- // If we are on the inventory manage page or any child state of that
- // page then we want to stay on that page. Otherwise go to the stdout
- // view.
- if(!$state.includes('inventories.edit')) {
- goTojobResults('playbook');
- }
- }
- }
- }
- else {
- $state.go('.', null, {reload: true});
- }
- })
- .catch(({data, status}) => {
- let template_id = scope.job_template_id;
- template_id = (template_id === undefined) ? "undefined" : i18n.sprintf("%d", template_id);
- ProcessErrors(scope, data, status, null, { hdr: i18n._('Error!'),
- msg: i18n.sprintf(i18n._('Failed updating job %s with variables. POST returned: %d'), template_id, status) });
- });
- };
-
- //gather the extra vars from the job template if survey is enabled and prompt for vars is false
- var getExtraVars = function() {
- Rest.setUrl(vars_url);
- Rest.get()
- .then(({data}) => {
- if(!Empty(data.extra_vars)){
- data.extra_vars = ToJSON('yaml', data.extra_vars, false);
- $.each(data.extra_vars, function(key,value){
- job_launch_data.extra_vars[key] = value;
- });
- }
- buildData();
- })
- .catch(({data, status}) => {
- ProcessErrors(scope, data, status, { hdr: i18n._('Error!'),
- msg: i18n._('Failed to retrieve job template extra variables.') });
- });
- };
-
- // if the user has a survey and does not have 'prompt for vars' selected, then we want to
- // include the extra vars from the job template in the job launch. so first check for these conditions
- // and then overlay any survey vars over those.
- if(scope.prompt_for_vars===false && scope.survey_enabled===true){
- getExtraVars();
- }
- else {
- buildData();
- }
-
- };
- }
-
-LaunchJob.$inject =
- [ 'Rest',
- 'Wait',
- 'ProcessErrors',
- 'ToJSON',
- 'Empty',
- 'GetBasePath',
- '$state',
- '$location',
- '$rootScope',
- 'i18n'
- ];
diff --git a/awx/ui/client/src/job-submission/job-submission-factories/project-update.factory.js b/awx/ui/client/src/job-submission/job-submission-factories/project-update.factory.js
deleted file mode 100644
index be7fe069fa..0000000000
--- a/awx/ui/client/src/job-submission/job-submission-factories/project-update.factory.js
+++ /dev/null
@@ -1,65 +0,0 @@
-export default
- function ProjectUpdate(PromptForPasswords, LaunchJob, Rest, $location, GetBasePath, ProcessErrors, Alert, Wait) {
- return function (params) {
- var scope = params.scope,
- project_id = params.project_id,
- url = GetBasePath('projects') + project_id + '/update/',
- project;
-
- if (scope.removeUpdateSubmitted) {
- scope.removeUpdateSubmitted();
- }
- scope.removeUpdateSubmitted = scope.$on('UpdateSubmitted', function() {
- // Refresh the project list after update request submitted
- Wait('stop');
- if (/\d$/.test($location.path())) {
- //Request submitted from projects/N page. Navigate back to the list so user can see status
- $location.path('/projects');
- }
- if (scope.socketStatus === 'error') {
- Alert('Update Started', 'The request to start the SCM update process was submitted. ' +
- 'To monitor the update status, refresh the page by clicking the button.
', 'alert-info', null, null, null, null, true);
- if (scope.refresh) {
- scope.refresh();
- }
- }
- });
-
- if (scope.removeStartTheUpdate) {
- scope.removeStartTheUpdate();
- }
- scope.removeStartTheUpdate = scope.$on('StartTheUpdate', function(e, passwords) {
- LaunchJob({ scope: scope, url: url, passwords: passwords, callback: 'UpdateSubmitted' });
- });
-
- // Check to see if we have permission to perform the update and if any passwords are needed
- Wait('start');
- Rest.setUrl(url);
- Rest.get()
- .then(({data}) => {
- project = data;
- if (project.can_update) {
- scope.$emit('StartTheUpdate', {});
- }
- else {
- Alert('Permission Denied', 'You do not have access to update this project. Please contact your system administrator.',
- 'alert-danger');
- }
- })
- .catch(({data, status}) => {
- ProcessErrors(scope, data, status, null, { hdr: 'Error!',
- msg: 'Failed to lookup project ' + url + ' GET returned: ' + status });
- });
- };
- }
-
-ProjectUpdate.$inject =
- [ 'PromptForPasswords',
- 'LaunchJob',
- 'Rest',
- '$location',
- 'GetBasePath',
- 'ProcessErrors',
- 'Alert',
- 'Wait'
- ];
diff --git a/awx/ui/client/src/job-submission/job-submission-factories/prompt-for-passwords.factory.js b/awx/ui/client/src/job-submission/job-submission-factories/prompt-for-passwords.factory.js
deleted file mode 100644
index 16156500ed..0000000000
--- a/awx/ui/client/src/job-submission/job-submission-factories/prompt-for-passwords.factory.js
+++ /dev/null
@@ -1,86 +0,0 @@
-export default
- function PromptForPasswords(CredentialForm) {
- return function(params) {
- var scope = params.scope,
- callback = params.callback || 'PasswordsAccepted',
- url = params.url,
- form = CredentialForm,
- fld, field,
- html=params.html || "";
-
- scope.passwords = params.passwords;
-
- html += "Launching this job requires the passwords listed below. Enter each password before continuing.
\n";
-
- scope.passwords.forEach(function(password) {
- // Prompt for password
- field = form.fields[password];
- fld = password;
- scope[fld] = '';
- html += "\n";
-
- // Add the related confirm field
- if (field.associated) {
- fld = field.associated;
- field = form.fields[field.associated];
- scope[fld] = '';
- html += "\n";
- }
- });
-
- scope.$emit(callback, html, url);
-
- // Password change
- scope.clearPWConfirm = function (fld) {
- // If password value changes, make sure password_confirm must be re-entered
- scope[fld] = '';
- scope.job_launch_form[fld].$setValidity('awpassmatch', false);
- scope.checkStatus();
- };
-
- scope.checkStatus = function() {
- if (!scope.job_launch_form.$invalid) {
- $('#password-accept-button').removeAttr('disabled');
- }
- else {
- $('#password-accept-button').attr({ "disabled": "disabled" });
- }
- };
- };
- }
-
-PromptForPasswords.$inject =
- [ 'CredentialForm' ];
diff --git a/awx/ui/client/src/job-submission/main.js b/awx/ui/client/src/job-submission/main.js
deleted file mode 100644
index 052173de5e..0000000000
--- a/awx/ui/client/src/job-submission/main.js
+++ /dev/null
@@ -1,27 +0,0 @@
-/*************************************************
- * Copyright (c) 2016 Ansible, Inc.
- *
- * All Rights Reserved
- *************************************************/
-
-import LaunchJob from './job-submission-factories/launchjob.factory';
-import AdhocRun from './job-submission-factories/adhoc-run.factory.js';
-import CheckPasswords from './job-submission-factories/check-passwords.factory';
-import CreateLaunchDialog from './job-submission-factories/create-launch-dialog.factory';
-import InventoryUpdate from './job-submission-factories/inventory-update.factory';
-import ProjectUpdate from './job-submission-factories/project-update.factory';
-import PromptForPasswords from './job-submission-factories/prompt-for-passwords.factory';
-import awPasswordMin from './job-submission-directives/aw-password-min.directive';
-import awPasswordMax from './job-submission-directives/aw-password-max.directive';
-
-export default
- angular.module('jobSubmission', [])
- .factory('LaunchJob', LaunchJob)
- .factory('AdhocRun', AdhocRun)
- .factory('CheckPasswords', CheckPasswords)
- .factory('CreateLaunchDialog', CreateLaunchDialog)
- .factory('InventoryUpdate', InventoryUpdate)
- .factory('ProjectUpdate', ProjectUpdate)
- .factory('PromptForPasswords', PromptForPasswords)
- .directive('awPasswordMin', awPasswordMin)
- .directive('awPasswordMax', awPasswordMax);
diff --git a/awx/ui/client/src/license/checkLicense.factory.js b/awx/ui/client/src/license/checkLicense.factory.js
deleted file mode 100644
index 73fdc5e15e..0000000000
--- a/awx/ui/client/src/license/checkLicense.factory.js
+++ /dev/null
@@ -1,81 +0,0 @@
-/*************************************************
- * Copyright (c) 2016 Ansible, Inc.
- *
- * All Rights Reserved
- *************************************************/
-
-export default
- ['$state', '$rootScope', 'Rest', 'GetBasePath',
- 'ConfigService', '$q',
- function($state, $rootScope, Rest, GetBasePath,
- ConfigService, $q){
- return {
- get: function() {
- var config = ConfigService.get();
- return config.license_info;
- },
-
- post: function(payload, eula, attach){
- var defaultUrl = GetBasePath('config') + (attach ? 'attach/' : '');
- Rest.setUrl(defaultUrl);
- var data = payload;
-
- if (!attach) {
- data.eula_accepted = eula;
- }
-
- return Rest.post(JSON.stringify(data))
- .then((response) =>{
- if (attach) {
- var configPayload = {};
- configPayload.eula_accepted = eula;
- Rest.setUrl(GetBasePath('config'));
- return Rest.post(configPayload)
- .then((configResponse) => {
- return configResponse.data;
- });
- }
- return response.data;
- })
- .catch(({data}) => {
- return $q.reject(data);
- });
- },
-
- valid: function(license) {
- if (!license.valid_key){
- return false;
- }
- return true;
- },
-
- test: function(event){
- var license = this.get();
- if(license === null || !$rootScope.license_tested){
- if(this.valid(license) === false) {
- $rootScope.licenseMissing = true;
- $state.go('license');
- if(event){
- event.preventDefault();
- }
- }
- else {
- $rootScope.licenseMissing = false;
- }
- }
- else if(this.valid(license) === false) {
- $rootScope.licenseMissing = true;
- $state.go('license');
- if(event){
- event.preventDefault();
- }
- }
- else {
- $rootScope.licenseMissing = false;
- }
- return;
- }
-
- };
- }
- ];
diff --git a/awx/ui/client/src/license/fileOnChange.directive.js b/awx/ui/client/src/license/fileOnChange.directive.js
deleted file mode 100644
index 2e04441308..0000000000
--- a/awx/ui/client/src/license/fileOnChange.directive.js
+++ /dev/null
@@ -1,16 +0,0 @@
-/*************************************************
- * Copyright (c) 2016 Ansible, Inc.
- *
- * All Rights Reserved
- *************************************************/
-
-export default
- [function(){
- return {
- restrict: 'A',
- link: function(scope, el, attrs){
- var onChange = scope.$eval(attrs.fileOnChange);
- el.bind('change', onChange);
- }
- };
- }];
diff --git a/awx/ui/client/src/license/license.block.less b/awx/ui/client/src/license/license.block.less
deleted file mode 100644
index f86d323ab8..0000000000
--- a/awx/ui/client/src/license/license.block.less
+++ /dev/null
@@ -1,290 +0,0 @@
-/*
-* Style conventions
-* .ModuleName-component-subComponent
-* Naming describes components of the view
-*/
-.License-container{
- .OnePlusTwo-container;
-}
-
-.License-container--missing {
- max-width: 800px;
- margin: 0 auto;
- padding: 0 20px;
-}
-
-.License-field--label{
- .OnePlusTwo-left--detailsLabel;
-}
-.License-fileName{
- padding-left: 20px;
-}
-.License-management .CodeMirror-scroll{
- min-height: 140px;
-}
-.License-file textarea{
- display: block;
- width: 100%;
-}
-.License-file--left {
- display: flex;
- flex:1;
- overflow: hidden;
-}
-.License-file--middle {
- display: flex;
- flex: 0 0 auto;
- padding: 0px 20px;
- flex-direction: column;
-}
-.License-file--right {
- display: flex;
- flex:1;
-}
-.License-submit--success.ng-hide-add, .License-submit--success.ng-hide-remove {
- transition: all ease-in-out 0.5s;
-}
-.License-submit--success{
- opacity: 1;
- transition: all ease-in-out 0.5s;
-}
-.License-submit--success.ng-hide{
- opacity: 0;
-}
-
-.License-eulaNotice{
- font-size: 12px;
- width: 100%;
- max-height: 129px;
- padding: 15px;
- padding-top: 10px;
- margin-bottom: 10px;
- border-radius: 4px;
- border: 1px solid @login-notice-border;
- background-color: @login-notice-bg;
- color: @login-notice-text;
- overflow-y: scroll;
- overflow-x: visible;
- white-space: pre-line;
-}
-
-.License-field label{
- width: 155px;
-}
-.License-field--content{
- .OnePlusTwo-left--detailsContent;
- text-transform: capitalize;
-}
-.License-field--key {
- text-transform: none;
-}
-.License-field{
- .OnePlusTwo-left--detailsRow;
-}
-.License-field + .License-field {
- margin-top: 20px;
-}
-.License-greenText{
- color: @submit-button-bg;
- padding-right: 10px;
-}
-.License-redText{
- color: @default-err;
- padding-right: 10px;
-}
-.License-fields{
- .OnePlusTwo-left--details;
-}
-
-.License-titleText {
- .OnePlusTwo-panelHeader;
-}
-.License-management{
- display: flex;
-}
-.License-management--missingLicense{
- height: auto;
-}
-.License-downloadLicenseButton{
- margin-bottom: 10px;
- color:@default-bg;
-}
-.License-downloadLicenseButton:hover{
- background-color: @default-link-hov !important;
- color:@default-bg !important;
-}
-.License-downloadLicenseButton:focus{
- background-color: @default-link-hov !important;
- color:@default-bg !important;
-}
-
-@media (min-width: 900px) {
- .License-details {
- margin-right: 20px;
- }
-}
-
-.License-submit--success, .License-submit--failure {
- margin: 0;
-}
-.License-file--container {
- display: flex;
- input[type=file] {
- display: none;
- }
-}
-.License-upgradeText {
- margin: 20px 0px;
-}
-.License-body {
- margin-top: 25px;
-}
-.License-subTitleText {
- text-transform: uppercase;
- margin: 20px 0px 15px 0px;
- color: @default-interface-txt;
-}
-.License-helperText {
- color: @default-interface-txt;
-}
-.License-input--fake{
- border-top-right-radius: 4px !important;
- border-bottom-right-radius: 4px !important;
-}
-
-.License-detailsGroup {
- margin-bottom: 20px;
-}
-
-.License-analyticsCheckbox {
- padding-top: 5px;
-}
-
-.License-analyticsCheckboxGroup {
- padding: 10px 0;
- font-weight: bold;
-}
-
-.License-separator {
- display: flex;
- flex: 1;
- background: linear-gradient(#d7d7d7, #d7d7d7) no-repeat center/2px 100%;
-}
-
-.License-licenseStepHelp {
- font-size: 12px;
- font-style: italic;
- margin-bottom: 10px;
-}
-
-.License-filePicker {
- text-overflow: ellipsis;
- white-space: nowrap;
- overflow: hidden;
-}
-
-.License-rhCredField {
- margin-bottom: 10px;
-}
-
-.License-label {
- color: @field-label;
- font-weight: 400;
-}
-
-.License-action {
- display: flex;
- flex-direction: row;
- align-content:flex-end;
-}
-
-.License-actionError {
- flex: 1;
-}
-
-.License-subSelectorModal {
- height: 100%;
- width: 100%;
- position: fixed;
- top: 0;
- left: 0;
- background: rgba(0, 0, 0, 0.3);
- z-index: 1040;
- display: flex;
- align-items: center;
- justify-content: center;
-}
-
-.License-modal {
- width: 750px;
-}
-
-.License-modalBody {
- border: 1px solid @b7grey;
- max-height: 550px;
- overflow: scroll;
- border-radius: 4px;
-}
-
-.License-modalRow {
- display: flex;
- padding: 10px;
-}
-
-.License-modalRow:not(:last-of-type) {
- border-bottom: 1px solid @b7grey;
-}
-
-.License-modalRowRadio {
- flex: 0 0 40px;
- display: flex;
- align-items: center;
-}
-
-.License-trialTag {
- font-weight: 100;
- background-color: #ebebeb;
- border-radius: 5px;
- color: #606060;
- font-size: 10px;
- margin-right: 10px;
- padding: 3px 9px;
- line-height: 14px;
- word-break: keep-all;
- display: inline-flex;
-}
-
-.License-introText {
- margin-bottom: 10px;
-}
-
-.License-getLicensesButton {
- display: flex;
- justify-content: flex-end;
- margin-bottom: 20px;
-}
-
-.License-checkboxLabel {
- margin-left: 5px;
- font-weight: normal;
-}
-
-.License-modalRowDetails {
- flex: 1;
-}
-
-.License-modalRowDetailsLabel {
- font-weight: normal;
- width: 100%;
-}
-
-.License-modalRowDetailsRow {
- margin-bottom: 10px;
-}
-
-.License-modalRowDetails--50 {
- display: flex;
- flex-basis: 50%;
- align-items: center;
- line-height: 21px;
-}
diff --git a/awx/ui/client/src/license/license.controller.js b/awx/ui/client/src/license/license.controller.js
deleted file mode 100644
index 2cae41e363..0000000000
--- a/awx/ui/client/src/license/license.controller.js
+++ /dev/null
@@ -1,232 +0,0 @@
-/*************************************************
- * Copyright (c) 2016 Ansible, Inc.
- *
- * All Rights Reserved
- *************************************************/
-
-import {N_} from "../i18n";
-
-export default
- ['Wait', '$state', '$scope', '$rootScope', 'ProcessErrors', 'CheckLicense', 'moment', '$timeout', 'Rest', 'LicenseStrings',
- '$window', 'ConfigService', 'pendoService', 'insightsEnablementService', 'i18n', 'config', 'subscriptionCreds', 'GetBasePath',
- function(Wait, $state, $scope, $rootScope, ProcessErrors, CheckLicense, moment, $timeout, Rest, LicenseStrings,
- $window, ConfigService, pendoService, insightsEnablementService, i18n, config, subscriptionCreds, GetBasePath) {
-
- $scope.strings = LicenseStrings;
-
- const calcDaysRemaining = function(seconds) {
- // calculate the number of days remaining on the license
- let duration = moment.duration(seconds, 'seconds').asDays();
-
- duration = Math.floor(duration);
- if(duration < 0){
- duration = 0;
- }
-
- duration = (duration!==1) ? `${duration} Days` : `${duration} Day`;
-
- return duration;
- };
-
- const calcExpiresOn = function(seconds) {
- // calculate the expiration date of the license
- return moment.unix(seconds).calendar();
- };
-
- const reset = function() {
- $scope.newLicense.eula = undefined;
- $scope.subscriptionCreds = {};
- $scope.selectedLicense = {};
- };
-
- const initVars = (config) => {
- // license/license.partial.html compares fileName
- $scope.fileName = N_("No file selected.");
-
- if ($rootScope.licenseMissing) {
- $scope.title = $rootScope.BRAND_NAME + i18n._(" Subscription");
- } else {
- $scope.title = i18n._("Subscription Management");
- }
-
- $scope.license = config;
- $scope.license.version = config.version.split('-')[0];
- $scope.time = {};
- $scope.time.remaining = calcDaysRemaining($scope.license.license_info.time_remaining);
- $scope.time.expiresOn = calcExpiresOn($scope.license.license_info.license_date);
- $scope.valid = CheckLicense.valid($scope.license.license_info);
- $scope.compliant = $scope.license.license_info.compliant;
- $scope.selectedLicense = {};
- $scope.newLicense = {
- pendo: true,
- insights: true
- };
-
- $scope.subscriptionCreds = {};
-
- if (subscriptionCreds.SUBSCRIPTIONS_USERNAME && subscriptionCreds.SUBSCRIPTIONS_USERNAME !== "") {
- $scope.subscriptionCreds.username = subscriptionCreds.SUBSCRIPTIONS_USERNAME;
- }
-
- if (subscriptionCreds.SUBSCRIPTIONS_PASSWORD && subscriptionCreds.SUBSCRIPTIONS_PASSWORD !== "") {
- $scope.subscriptionCreds.password = subscriptionCreds.SUBSCRIPTIONS_PASSWORD;
- $scope.showPlaceholderPassword = true;
- }
- };
-
- const updateSubscriptionCreds = (config) => {
- Rest.setUrl(`${GetBasePath('settings')}system/`);
- Rest.get()
- .then(({data}) => {
- initVars(config);
-
- if (data.SUBSCRIPTIONS_USERNAME && data.SUBSCRIPTIONS_USERNAME !== "") {
- $scope.subscriptionCreds.username = data.SUBSCRIPTIONS_USERNAME;
- }
-
- if (data.SUBSCRIPTIONS_PASSWORD && data.SUBSCRIPTIONS_PASSWORD !== "") {
- $scope.subscriptionCreds.password = data.SUBSCRIPTIONS_PASSWORD;
- $scope.showPlaceholderPassword = true;
- }
- }).catch(() => {
- initVars(config);
- });
- };
-
- initVars(config);
-
- $scope.getKey = function(event) {
- // Mimic HTML5 spec, show filename
- $scope.fileName = event.target.files[0].name;
- // Grab the key from the raw license file
- const raw = new FileReader();
-
- raw.onload = function() {
- $scope.newLicense.manifest = btoa(raw.result);
- };
-
- try {
- raw.readAsBinaryString(event.target.files[0]);
- } catch(err) {
- ProcessErrors($rootScope, null, null, null,
- {msg: i18n._('Invalid file format. Please upload a valid Red Hat Subscription Manifest.')});
- }
- };
-
- // HTML5 spec doesn't provide a way to customize file input css
- // So we hide the default input, show our own, and simulate clicks to the hidden input
- $scope.fakeClick = function() {
- if($scope.user_is_superuser && (!$scope.subscriptionCreds.username || $scope.subscriptionCreds.username === '') && (!$scope.subscriptionCreds.password || $scope.subscriptionCreds.password === '')) {
- $('#License-file').click();
- }
- };
-
- $scope.downloadLicense = function() {
- $window.open('https://www.ansible.com/license', '_blank');
- };
-
- $scope.replacePassword = () => {
- if ($scope.user_is_superuser && !$scope.newLicense.manifest) {
- $scope.showPlaceholderPassword = false;
- $scope.subscriptionCreds.password = "";
- $timeout(() => {
- $('.tooltip').remove();
- $('#rh-password').focus();
- });
- }
- };
-
- $scope.lookupLicenses = () => {
- if ($scope.subscriptionCreds.username && $scope.subscriptionCreds.password) {
- Wait('start');
- ConfigService.getSubscriptions($scope.subscriptionCreds.username, $scope.subscriptionCreds.password)
- .then(({data}) => {
- Wait('stop');
- if (data && data.length > 0) {
- $scope.rhLicenses = data;
- if ($scope.selectedLicense.fullLicense) {
- $scope.selectedLicense.modalKey = $scope.selectedLicense.fullLicense.license_key;
- }
- $scope.showLicenseModal = true;
- } else {
- ProcessErrors($scope, data, status, null, {
- hdr: i18n._('No Licenses Found'),
- msg: i18n._('We were unable to locate licenses associated with this account')
- });
- }
- })
- .catch(({data, status}) => {
- Wait('stop');
- ProcessErrors($scope, data, status, null, {
- hdr: i18n._('Error Fetching Licenses')
- });
- });
- }
- };
-
- $scope.confirmLicenseSelection = () => {
- $scope.showLicenseModal = false;
- $scope.selectedLicense.fullLicense = $scope.rhLicenses.find((license) => {
- return license.pool_id === $scope.selectedLicense.modalPoolId;
- });
- $scope.selectedLicense.modalPoolId = undefined;
- };
-
- $scope.cancelLicenseLookup = () => {
- $scope.showLicenseModal = false;
- $scope.selectedLicense.modalPoolId = undefined;
- };
-
- $scope.submit = function() {
- Wait('start');
- let payload = {};
- let attach = false;
- if ($scope.newLicense.manifest) {
- payload.manifest = $scope.newLicense.manifest;
- } else if ($scope.selectedLicense.fullLicense) {
- payload.pool_id = $scope.selectedLicense.fullLicense.pool_id;
- attach = true;
- }
-
- CheckLicense.post(payload, $scope.newLicense.eula, attach)
- .finally((licenseInfo) => {
- reset();
- ConfigService.delete();
- ConfigService.getConfig(licenseInfo)
- .then(function(config) {
-
- if ($rootScope.licenseMissing === true) {
- if ($scope.newLicense.pendo) {
- pendoService.updatePendoTrackingState('detailed');
- pendoService.issuePendoIdentity();
- } else {
- pendoService.updatePendoTrackingState('off');
- }
-
- if ($scope.newLicense.insights) {
- insightsEnablementService.updateInsightsTrackingState(true);
- } else {
- insightsEnablementService.updateInsightsTrackingState(false);
- }
-
- $state.go('dashboard', {
- licenseMissing: false
- });
- } else {
- updateSubscriptionCreds(config);
- $scope.success = true;
- $rootScope.licenseMissing = false;
- // for animation purposes
- const successTimeout = setTimeout(function() {
- $scope.success = false;
- clearTimeout(successTimeout);
- }, 4000);
- }
- });
- }).catch((err) => {
- ProcessErrors($scope, err, null, null, {
- hdr: i18n._('Error Applying License')
- });
- });
- };
-}];
diff --git a/awx/ui/client/src/license/license.partial.html b/awx/ui/client/src/license/license.partial.html
deleted file mode 100644
index d65a829c18..0000000000
--- a/awx/ui/client/src/license/license.partial.html
+++ /dev/null
@@ -1,286 +0,0 @@
-
-
-
-
Details
-
-
-
Subscription
-
- Compliant
- Out of Compliance
-
-
-
-
Version
-
- {{license.version}}
-
-
-
-
Subscription Type
-
- {{license.license_info.license_type}}
-
-
-
-
Subscription
-
- {{license.license_info.subscription_name}}
-
-
-
-
Expires On
-
- {{time.expiresOn}}
-
-
-
-
Time Remaining
-
- {{time.remaining}}
-
-
-
-
Hosts Available
-
- {{license.license_info.available_instances}}
-
-
-
-
Hosts Available
-
Unlimited
-
-
-
Hosts Used
-
- {{license.license_info.current_instances}}
-
-
-
-
Hosts Remaining
-
- {{license.license_info.free_instances}}
-
-
-
-
Hosts Remaining
-
- {{license.license_info.free_instances}}
-
-
-
-
If you are ready to upgrade or renew, please contact us by clicking the button below.
-
Contact Us
-
-
-
-
-
{{title}}
-
-
Welcome to Red Hat Ansible Automation Platform! Please complete the steps below to activate your subscription.
-
-
- 1
-
-
- If you do not have a subscription, you can visit Red Hat to obtain a trial subscription.
-
-
-
- Request Subscription
-
-
-
-
- 2
-
-
- Select your Ansible Automation Platform subscription to use.
-
-
-
-
-
-
- 3
-
-
- Agree to the End User License Agreement, and click submit.
-
-
-
- *
- End User License Agreement
-
-
{{ license.eula }}
-
-
- Tracking and Analytics
-
-
-
-
- Save successful!
-
-
- Submit
-
-
-
-
-
-
-
diff --git a/awx/ui/client/src/license/license.route.js b/awx/ui/client/src/license/license.route.js
deleted file mode 100644
index 2ea594c12a..0000000000
--- a/awx/ui/client/src/license/license.route.js
+++ /dev/null
@@ -1,65 +0,0 @@
-/*************************************************
- * Copyright (c) 2016 Ansible, Inc.
- *
- * All Rights Reserved
- *************************************************/
-
-import {templateUrl} from '../shared/template-url/template-url.factory';
-import { N_ } from '../i18n';
-import _ from 'lodash';
-
-export default {
- name: 'license',
- route: '/license',
- templateUrl: templateUrl('license/license'),
- controller: 'licenseController',
- data: {},
- ncyBreadcrumb: {
- label: N_('SUBSCRIPTION')
- },
- onEnter: ['$state', 'ConfigService', (state, configService) => {
- return configService.getConfig()
- .then(config => {
- if (_.get(config, 'license_info.license_type') === 'open') {
- return state.go('setup');
- }
- });
- }],
- resolve: {
- features: ['CheckLicense', '$rootScope',
- function(CheckLicense, $rootScope) {
- if($rootScope.licenseMissing === undefined){
- return CheckLicense.notify();
- }
- }
- ],
- config: ['ConfigService', 'CheckLicense', '$rootScope',
- function(ConfigService, CheckLicense, $rootScope) {
- ConfigService.delete();
- return ConfigService.getConfig()
- .then(function(config){
- $rootScope.licenseMissing = (CheckLicense.valid(config.license_info) === false) ? true : false;
- return config;
- });
- }
- ],
- subscriptionCreds: ['Rest', 'GetBasePath', function(Rest, GetBasePath) {
- Rest.setUrl(`${GetBasePath('settings')}system/`);
- return Rest.get()
- .then(({data}) => {
- const subscriptionCreds = {};
- if (data.SUBSCRIPTIONS_USERNAME && data.SUBSCRIPTIONS_USERNAME !== "") {
- subscriptionCreds.SUBSCRIPTIONS_USERNAME = data.SUBSCRIPTIONS_USERNAME;
- }
-
- if (data.SUBSCRIPTIONS_PASSWORD && data.SUBSCRIPTIONS_PASSWORD !== "") {
- subscriptionCreds.SUBSCRIPTIONS_PASSWORD = data.SUBSCRIPTIONS_PASSWORD;
- }
-
- return subscriptionCreds;
- }).catch(() => {
- return {};
- });
- }]
- },
-};
diff --git a/awx/ui/client/src/license/license.strings.js b/awx/ui/client/src/license/license.strings.js
deleted file mode 100644
index 4417f5a553..0000000000
--- a/awx/ui/client/src/license/license.strings.js
+++ /dev/null
@@ -1,13 +0,0 @@
-function LicenseStrings (BaseString) {
- BaseString.call(this, 'license');
-
- let t = this.t;
- let ns = this.license;
-
- ns.REPLACE_PASSWORD = t.s('Replace password');
- ns.CANCEL_LOOKUP = t.s('Cancel license lookup');
-}
-
-LicenseStrings.$inject = ['BaseStringService'];
-
-export default LicenseStrings;
diff --git a/awx/ui/client/src/license/main.js b/awx/ui/client/src/license/main.js
deleted file mode 100644
index 78efc73bb8..0000000000
--- a/awx/ui/client/src/license/main.js
+++ /dev/null
@@ -1,21 +0,0 @@
-/*************************************************
- * Copyright (c) 2016 Ansible, Inc.
- *
- * All Rights Reserved
- *************************************************/
-
-import route from './license.route';
-import controller from './license.controller';
-import CheckLicense from './checkLicense.factory';
-import fileOnChange from './fileOnChange.directive';
-import LicenseStrings from './license.strings';
-
-export default
- angular.module('license', [])
- .controller('licenseController', controller)
- .directive('fileOnChange', fileOnChange)
- .factory('CheckLicense', CheckLicense)
- .service('LicenseStrings', LicenseStrings)
- .run(['$stateExtender', function($stateExtender) {
- $stateExtender.addState(route);
- }]);
diff --git a/awx/ui/client/src/login/authenticationServices/authentication.service.js b/awx/ui/client/src/login/authenticationServices/authentication.service.js
deleted file mode 100644
index e57ffa18f6..0000000000
--- a/awx/ui/client/src/login/authenticationServices/authentication.service.js
+++ /dev/null
@@ -1,176 +0,0 @@
-/*************************************************
- * Copyright (c) 2015 Ansible, Inc.
- *
- * All Rights Reserved
- *************************************************/
-
-
- /**
- * @ngdoc function
- * @name shared.function:AuthService
- * @description AuthService.js
- *
- * User authentication functions
- *
- */
-
-export default
- ['$http', '$rootScope', '$cookies', 'GetBasePath', 'Store', '$q',
- '$injector', '$location',
- function ($http, $rootScope, $cookies, GetBasePath, Store, $q,
- $injector, $location) {
- return {
- setToken: function (token, expires) {
- $cookies.remove('token_expires');
- $cookies.remove('userLoggedIn');
-
- $cookies.put('token_expires', expires);
- $cookies.put('userLoggedIn', true);
- $cookies.put('sessionExpired', false);
-
- $rootScope.userLoggedIn = true;
- $rootScope.userLoggedOut = false;
- $rootScope.token_expires = expires;
- $rootScope.sessionExpired = false;
- },
-
- isUserLoggedIn: function () {
- if ($rootScope.userLoggedIn === undefined) {
- // Browser refresh may have occurred
- $rootScope.userLoggedIn = ($cookies.get('userLoggedIn') === 'true');
- $rootScope.sessionExpired = ($cookies.get('sessionExpired') === 'true');
- }
- return $rootScope.userLoggedIn;
- },
- retrieveToken: function (username, password) {
- return $http({
- method: 'POST',
- url: `/api/login/`,
- data: `username=${encodeURIComponent(username)}&password=${encodeURIComponent(password)}&next=%2fapi%2f`,
- headers: {
- 'Content-Type': 'application/x-www-form-urlencoded'
- }
- });
- },
- deleteToken: function () {
- return $http({
- method: 'GET',
- url: '/api/logout/'
- });
- },
-
- logout: function () {
- // the following puts our primary scope up for garbage collection, which
- // should prevent content flash from the prior user.
-
- var x,
- deferred = $q.defer(),
- ConfigService = $injector.get('ConfigService'),
- SocketService = $injector.get('SocketService'),
- scope = angular.element(document.getElementById('main-view')).scope();
-
- this.deleteToken().then(() => {
- if(scope){
- scope.$destroy();
- }
-
- if($cookies.get('lastPath')==='/portal'){
- $cookies.put( 'lastPath', '/portal');
- $rootScope.lastPath = '/portal';
- }
- else if ($cookies.get('lastPath') !== '/home' || $cookies.get('lastPath') !== '/' || $cookies.get('lastPath') !== '/login' || $cookies.get('lastPath') !== '/logout'){
- // do nothing
- $rootScope.lastPath = $cookies.get('lastPath');
- }
- else {
- // your last path was home
- $cookies.remove('lastPath');
- $rootScope.lastPath = '/home';
- }
- x = Store('sessionTime');
- if ($rootScope.current_user && x && x[$rootScope.current_user.id]) {
- x[$rootScope.current_user.id].loggedIn = false;
- }
- Store('sessionTime', x);
-
- if ($cookies.getObject('current_user')) {
- $rootScope.lastUser = $cookies.getObject('current_user').id;
- }
- ConfigService.delete();
- SocketService.disconnect();
- $cookies.remove('token_expires');
- $cookies.remove('current_user');
- $cookies.put('userLoggedIn', false);
- $cookies.put('sessionExpired', false);
- $cookies.putObject('current_user', {});
- $rootScope.current_user = {};
- $rootScope.license_tested = undefined;
- $rootScope.userLoggedIn = false;
- $rootScope.sessionExpired = false;
- $rootScope.licenseMissing = true;
- $rootScope.token_expires = null;
- $rootScope.login_username = null;
- $rootScope.login_password = null;
- $rootScope.userLoggedOut = true;
- $rootScope.pendingApprovalCount = 0;
- if ($rootScope.sessionTimer) {
- $rootScope.sessionTimer.clearTimers();
- }
- deferred.resolve();
- });
-
- return deferred.promise;
-
- },
-
- licenseTested: function () {
- var license, result;
- if ($rootScope.license_tested !== undefined) {
- result = $rootScope.license_tested;
- } else {
- // User may have hit browser refresh
- license = Store('license');
- $rootScope.version = license.version;
- if (license && license.tested !== undefined) {
- result = license.tested;
- } else {
- result = false;
- }
- }
- return result;
- },
-
- getUser: function () {
- return $http({
- method: 'GET',
- url: GetBasePath('me')
- });
- },
-
- setUserInfo: function (response) {
- // store the response values in $rootScope so we can get to them later
- $rootScope.current_user = response.results[0];
- if ($location.protocol() === 'https') {
- $cookies.putObject('current_user', response.results[0], {secure: true}); //keep in session cookie in the event of browser refresh
- } else {
- $cookies.putObject('current_user', response.results[0], {secure: false});
- }
- },
-
- restoreUserInfo: function () {
- $rootScope.current_user = $cookies.getObject('current_user');
- },
-
- getUserInfo: function (key) {
- // Access values returned from the Me API call
- var cu;
- if ($rootScope.current_user) {
- return $rootScope.current_user[key];
- }
- this.restoreUserInfo();
- cu = $cookies.getObject('current_user');
- return cu[key];
- }
- };
- }
-];
diff --git a/awx/ui/client/src/login/authenticationServices/insightsEnablement.service.js b/awx/ui/client/src/login/authenticationServices/insightsEnablement.service.js
deleted file mode 100644
index b76d378f2b..0000000000
--- a/awx/ui/client/src/login/authenticationServices/insightsEnablement.service.js
+++ /dev/null
@@ -1,27 +0,0 @@
-/*************************************************
-* Copyright (c) 2015 Ansible, Inc.
-*
-* All Rights Reserved
-*************************************************/
-
-
-export default ['$rootScope', 'Rest', 'GetBasePath', 'ProcessErrors',
- function ($rootScope, Rest, GetBasePath, ProcessErrors) {
- return {
- updateInsightsTrackingState: function(tracking_type) {
- if (tracking_type === true || tracking_type === false) {
- Rest.setUrl(`${GetBasePath('settings')}system`);
- Rest.patch({ INSIGHTS_TRACKING_STATE: tracking_type })
- .catch(function ({data, status}) {
- ProcessErrors($rootScope, data, status, null, {
- hdr: 'Error!',
- msg: 'Failed to patch INSIGHTS_TRACKING_STATE in settings: ' +
- status });
- });
- } else {
- throw new Error(`Can't update insights data enabled in settings to
- "${tracking_type}"`);
- }
- }
- };
- }];
diff --git a/awx/ui/client/src/login/authenticationServices/isAdmin.factory.js b/awx/ui/client/src/login/authenticationServices/isAdmin.factory.js
deleted file mode 100644
index 41b1b29447..0000000000
--- a/awx/ui/client/src/login/authenticationServices/isAdmin.factory.js
+++ /dev/null
@@ -1,18 +0,0 @@
-/*************************************************
- * Copyright (c) 2015 Ansible, Inc.
- *
- * All Rights Reserved
- *************************************************/
-
-/**
- * @ngdoc function
- * @name
- * @description
- *
- *
- */
-
- export default
- ['$rootScope', function($rootScope) {
- return function() { return ($rootScope.current_user && $rootScope.current_user.is_superuser); };
- }];
diff --git a/awx/ui/client/src/login/authenticationServices/main.js b/awx/ui/client/src/login/authenticationServices/main.js
deleted file mode 100644
index 373ecdbd07..0000000000
--- a/awx/ui/client/src/login/authenticationServices/main.js
+++ /dev/null
@@ -1,19 +0,0 @@
-/*************************************************
- * Copyright (c) 2015 Ansible, Inc.
- *
- * All Rights Reserved
- *************************************************/
-
-import authenticationService from './authentication.service';
-import isAdmin from './isAdmin.factory';
-import timer from './timer.factory';
-import pendoService from './pendo.service';
-import insightsEnablementService from './insightsEnablement.service';
-
-export default
- angular.module('authentication', [])
- .factory('Authorization', authenticationService)
- .factory('IsAdmin', isAdmin)
- .factory('Timer', timer)
- .service('pendoService', pendoService)
- .service('insightsEnablementService', insightsEnablementService);
diff --git a/awx/ui/client/src/login/authenticationServices/pendo.service.js b/awx/ui/client/src/login/authenticationServices/pendo.service.js
deleted file mode 100644
index cab17baea3..0000000000
--- a/awx/ui/client/src/login/authenticationServices/pendo.service.js
+++ /dev/null
@@ -1,128 +0,0 @@
-/*************************************************
-* Copyright (c) 2015 Ansible, Inc.
-*
-* All Rights Reserved
-*************************************************/
-
-
-export default ['$rootScope', 'Rest', 'GetBasePath', 'ProcessErrors', '$q', 'ConfigService', '$log',
- 'AppStrings',
- function ($rootScope, Rest, GetBasePath, ProcessErrors, $q, ConfigService, $log, AppStrings) {
- return {
- setPendoOptions: function (config) {
- const tower_version = config.version.split('-')[0];
- const trial = (config.trial) ? config.trial : false;
- let options = {
- apiKey: AppStrings.get('PENDO_API_KEY'),
- visitor: {
- id: null,
- role: null,
- },
- account: {
- id: null,
- planLevel: config.license_type,
- planPrice: config.instance_count,
- creationDate: config.license_date,
- trial: trial,
- tower_version: tower_version,
- ansible_version: config.ansible_version
- }
- };
-
- options.visitor.id = 0;
- options.account.id = "tower.ansible.com";
-
- return options;
- },
-
- setRole: function(options) {
- const deferred = $q.defer();
-
- if ($rootScope.current_user.is_superuser === true) {
- options.visitor.role = 'admin';
- deferred.resolve(options);
- } else {
- Rest.setUrl(GetBasePath('users') + $rootScope.current_user.id +
- '/admin_of_organizations/');
- Rest.get()
- .then(function (response) {
- if (response.data.count > 0) {
- options.visitor.role = "orgadmin";
- deferred.resolve(options);
- } else {
- options.visitor.role = "user";
- deferred.resolve(options);
- }
- })
- .catch(function (response) {
- ProcessErrors($rootScope, response.data, response.status, null, {
- hdr: 'Error!',
- msg: 'Failed to get admin of org user list. GET returned status: ' +
- response.status });
- deferred.reject('Could not resolve pendo role.');
- });
- }
-
- return deferred.promise;
- },
-
- bootstrap: function(){
- /* jshint ignore:start */
- (function(p,e,n,d,o){var v,w,x,y,z;o=p[d]=p[d]||{};o._q=[];
- v=['initialize','identify','updateOptions','pageLoad'];for(w=0,x=v.length;w
-
-
diff --git a/awx/ui/client/src/login/loginModal/loginModal.block.less b/awx/ui/client/src/login/loginModal/loginModal.block.less
deleted file mode 100644
index 5765b359f4..0000000000
--- a/awx/ui/client/src/login/loginModal/loginModal.block.less
+++ /dev/null
@@ -1,158 +0,0 @@
-/** @define LoginModal */
-.LoginModal-backDrop {
- width: 100vw;
- height: 100vh;
- position: fixed;
- top: 0;
- left: 0;
- z-index: 1041;
- opacity: 0;
- transition: 0.5s opacity;
- background: @login-backdrop;
-}
-
-.LoginModal-backDrop.is-loggedOut {
- opacity: 0.2;
-}
-
-.LoginModal-dialog {
- margin: 30px auto;
- margin-top: 95px;
-}
-
-.LoginModal-content {
- max-width: 550px;
- margin-left: auto;
- margin-right: auto;
- border: 0;
- box-shadow: none;
- background-color: @login-bg;
- border-radius: 4px;
- opacity: 0;
- transition: opacity 0.5s;
- z-index: 1042;
- position: relative;
-}
-
-.LoginModal-content.is-loggedOut {
- opacity: 1;
- transition: opacity 0.5s;
-}
-
-.LoginModal-header {
- text-align: left;
- background-color: @login-header-bg;
- border-bottom: 0;
- border-top-right-radius: 4px;
- border-top-left-radius: 4px;
-}
-
-.LoginModal-body {
- padding-top: 15px;
- padding-bottom: 0px;
- padding-left: 20px;
- padding-right: 20px;
-}
-
-.LoginModal-logoImage {
- max-width: 112px;
- margin: 20px 20px 10px 20px;
-}
-
-.LoginModal-logoImage--notCustom {
- max-width: @login-max-width;
- margin: @login-margin;
-}
-
-.LoginModal-alert {
- margin-bottom: 20px;
- font-size: 16px;
- font-weight: normal;
- color: @login-alert;
- transition: opacity 0.2s;
-}
-
-.LoginModal-alert--error {
- color: @login-alert-error;
- padding-bottom: 4px;
-}
-
-.LoginModal-alert {
- opacity: 1;
- display: flex;
-}
-
-.LoginModal-alert.ng-hide {
- display: none;
- opacity: 0;
-}
-
-.LoginModal-alert.ng-hide-add {
- display: none;
- opacity: 0;
-}
-
-.LoginModal-alert.ng-hide-remove {
- display: block;
-}
-
-.LoginModal-alertIcon {
- display: flex;
- align-items: center;
- line-height: 19px;
-}
-
-.LoginModal-alertIcon:before {
- margin-right: 10px;
-}
-
-.LoginModal-formGroup {
- margin-bottom: 20px;
-}
-
-.LoginModal-label {
- color: @field-label;
- font-weight: 400;
-}
-
-.LoginModal-field {
- color: @field-input-text;
- background-color: @field-bg;
- border: 1px solid @field-border;
-}
-
-.LoginModal-footer {
- display: flex;
- flex-wrap: wrap-reverse;
- align-items: center;
- padding: 20px;
- padding-top: 5px;
- padding-bottom: 0px;
- margin-top: 20px;
-}
-
-.LoginModal-footerBlock {
- flex: 1 0 auto;
- margin-bottom: 20px;
- display: flex;
- max-width: 100%;
-}
-
-.LoginModal-footerBlock--submit {
- flex: initial;
- margin-left: auto;
- padding-left: 20px;
-}
-
-.LoginModal-signInButton {
- transition: background-color 0.2s;
- background-color: @submit-button-bg;
- color: @submit-button-text;
- font-size: 0.875rem;
-}
-
-.LoginModal-signInButton:hover,
-.LoginModal-signInButton:focus {
- color: @submit-button-text;
- background-color: @submit-button-bg-hov;
-}
diff --git a/awx/ui/client/src/login/loginModal/loginModal.controller.js b/awx/ui/client/src/login/loginModal/loginModal.controller.js
deleted file mode 100644
index 657cb55553..0000000000
--- a/awx/ui/client/src/login/loginModal/loginModal.controller.js
+++ /dev/null
@@ -1,188 +0,0 @@
-/*************************************************
- * Copyright (c) 2015 Ansible, Inc.
- *
- * All Rights Reserved
- *************************************************/
-
-/**
- * @ngdoc function
- * @name controllers.function:Authentication
- * @description
- * Controller for handling /#/login and /#/logout routes.
- *
- * (app.js) verifies the user is authenticated and that the user session is not expired. If either condition is not true,
- * the user is redirected to /#/login and the Authentication controller.
- *
- * Methods for checking the session state are found in [js/shared/AuthService.js](/static/docs/api/shared.function:AuthService), which is referenced here as Authorization.
- *
- * #Login Modal Dialog
- *
- * The modal dialog prompting for username and password is found in templates/ui/index.html.
- *```
- *
- *
by the controller. This is done to associate the form with the controller's scope. Because
- *
is outside of the ng-view container, it gets associated with $rootScope by default. In the controller we create a new scope using $rootScope.$new() and associate
- * that with the login form. Doing this each time the controller is instantiated insures the form is clean and not pre-populated with a prior user's username and password.
- *
- * Just before the release of 2.0 a bug was discovered where clicking logout and then immediately clicking login without providing a username and password would successfully log
- * the user back into the app. Implementing the above approach fixed this, forcing a new username/password to be entered each time the login dialog appears.
- *
- *
- * @Usage
- * This is usage information.
- */
-
-export default ['$log', '$cookies', '$rootScope', 'ProcessErrors',
- '$location', 'Authorization', 'Alert', 'Wait', 'Timer',
- 'Empty', '$scope', 'pendoService', 'ConfigService',
- 'CheckLicense', 'SocketService', 'Rest', 'GetBasePath', 'i18n',
- function ($log, $cookies, $rootScope, ProcessErrors,
- $location, Authorization, Alert, Wait, Timer,
- Empty, scope, pendoService, ConfigService,
- CheckLicense, SocketService, Rest, GetBasePath, i18n) {
- var lastPath, lastUser, sessionExpired, loginAgain, preAuthUrl;
-
- loginAgain = function() {
- setTimeout(function() {
- $location.path('/logout');
- }, 1000);
- };
-
- scope.sessionExpired = (Empty($rootScope.sessionExpired)) ? $cookies.get('sessionExpired') : $rootScope.sessionExpired;
- scope.login_username = '';
- scope.login_password = '';
-
-
- lastPath = function () {
- return (Empty($rootScope.lastPath)) ? $cookies.get('lastPath') : $rootScope.lastPath;
- };
-
- lastUser = function(){
- if(!Empty($rootScope.lastUser) && $rootScope.lastUser === $rootScope.current_user.id){
- return true;
- }
- else {
- return false;
- }
- };
-
- preAuthUrl = $rootScope.preAuthUrl;
-
- $log.debug('User session expired: ' + sessionExpired);
- $log.debug('Last URL: ' + lastPath());
-
- $rootScope.loginConfig.promise.then(function () {
- if ($AnsibleConfig.custom_logo) {
- scope.customLogo = $rootScope.custom_logo;
- scope.customLogoPresent = true;
- } else {
- scope.customLogo = "logo-login.svg";
- scope.customLogoPresent = false;
- }
- scope.customLoginInfo = $AnsibleConfig.custom_login_info;
- scope.customLoginInfoPresent = (scope.customLoginInfo) ? true : false;
- scope.customLoginInfoIsHTML = /<\/?[a-z][\s\S]*>/i.test(scope.customLoginInfo);
- });
-
- if (scope.removeAuthorizationGetLicense) {
- scope.removeAuthorizationGetLicense();
- }
- scope.removeAuthorizationGetLicense = scope.$on('AuthorizationGetLicense', function() {
- ConfigService.getConfig().then(function(){
- CheckLicense.test();
- pendoService.issuePendoIdentity();
- Wait("stop");
- if(!Empty(preAuthUrl)){
- $location.path(preAuthUrl);
- delete $rootScope.preAuthUrl;
- }
- else {
- if (lastPath() && lastUser()) {
- // Go back to most recent navigation path
- $location.path(lastPath());
- } else {
- $location.url('/home');
- }
- }
- })
- .catch(function () {
- Wait('stop');
- Alert('Error', 'Failed to access license information. GET returned status: ' + status, 'alert-danger', loginAgain);
- });
- });
-
- if (scope.removeAuthorizationGetUser) {
- scope.removeAuthorizationGetUser();
- }
- scope.removeAuthorizationGetUser = scope.$on('AuthorizationGetUser', function() {
- // Get all the profile/access info regarding the logged in user
- Authorization.getUser()
- .then(({data}) => {
- Authorization.setUserInfo(data);
- Timer.init().then(function(timer){
- $rootScope.sessionTimer = timer;
- SocketService.init();
- $rootScope.user_is_superuser = data.results[0].is_superuser;
- $rootScope.user_is_system_auditor = data.results[0].is_system_auditor;
- scope.$emit('AuthorizationGetLicense');
- });
-
- Rest.setUrl(`${GetBasePath('workflow_approvals')}?status=pending&page_size=1`);
- Rest.get()
- .then(({data}) => {
- $rootScope.pendingApprovalCount = data.count;
- })
- .catch(({data, status}) => {
- ProcessErrors({}, data, status, null, {
- hdr: i18n._('Error!'),
- msg: i18n._('Failed to get workflow jobs pending approval. GET returned status: ') + status
- });
- });
- })
- .catch(({data, status}) => {
- Authorization.logout().then( () => {
- Wait('stop');
- Alert('Error', 'Failed to access user information. GET returned status: ' + status, 'alert-danger', loginAgain);
- });
- });
- });
-
- // Call the API to get an auth token
- scope.systemLogin = function (username, password) {
- $('.api-error').empty();
- if (Empty(username) || Empty(password)) {
- scope.reset();
- scope.attemptFailed = true;
- $('#login-username').focus();
- } else {
- Wait('start');
- Authorization.retrieveToken(username, password)
- .then(function (data) {
- $('#login-modal').modal('hide');
- Authorization.setToken(data.data.expires);
- scope.$emit('AuthorizationGetUser');
- },
- function (data) {
- var key;
- Wait('stop');
- if (data && data.data && data.data.non_field_errors && data.data.non_field_errors.length === 0) {
- // show field specific errors returned by the API
- for (key in data.data) {
- scope[key + 'Error'] = data.data[key][0];
- }
- } else {
- scope.reset();
- scope.attemptFailed = true;
- $('#login-username').focus();
- }
- });
- }
- };
-}];
diff --git a/awx/ui/client/src/login/loginModal/loginModal.directive.js b/awx/ui/client/src/login/loginModal/loginModal.directive.js
deleted file mode 100644
index f9b3f8866b..0000000000
--- a/awx/ui/client/src/login/loginModal/loginModal.directive.js
+++ /dev/null
@@ -1,58 +0,0 @@
-/*************************************************
- * Copyright (c) 2015 Ansible, Inc.
- *
- * All Rights Reserved
- *************************************************/
-import authenticationController from './loginModal.controller';
-
-/* jshint unused: vars */
-export default
- [ 'templateUrl',
- 'Wait',
- function(templateUrl, Wait) {
- return {
- restrict: 'E',
- scope: true,
- controller: authenticationController,
- templateUrl: templateUrl('login/loginModal/loginModal'),
- link: function(scope, element, attrs) {
- var setLoginFocus = function () {
- // Need to clear out any open dialog windows that might be open when this modal opens.
- $('#login-username').focus();
- };
-
- setLoginFocus();
-
- // Hide any lingering modal dialogs
- $('.modal[aria-hidden=false]').each(function () {
- if ($(this).attr('id') !== 'login-modal') {
- $(this).modal('hide');
- }
- });
-
- // Just in case, make sure the wait widget is not active
- // and scroll the window to the top
- Wait('stop');
- window.scrollTo(0,0);
-
- // Set focus to username field
- $('#login-modal').on('shown.bs.modal', function () {
- setLoginFocus();
- });
-
- $('#login-password').bind('keypress', function (e) {
- var code = (e.keyCode ? e.keyCode : e.which);
- if (code === 13) {
- $('#login-button').click();
- }
- });
-
- scope.reset = function () {
- $('#login-form input').each(function () {
- $(this).val('');
- });
- };
- }
- };
- }
- ];
diff --git a/awx/ui/client/src/login/loginModal/loginModal.partial.html b/awx/ui/client/src/login/loginModal/loginModal.partial.html
deleted file mode 100644
index d9fa2c0219..0000000000
--- a/awx/ui/client/src/login/loginModal/loginModal.partial.html
+++ /dev/null
@@ -1,123 +0,0 @@
-
diff --git a/awx/ui/client/src/login/loginModal/loginModalNotice.block.less b/awx/ui/client/src/login/loginModal/loginModalNotice.block.less
deleted file mode 100644
index d5e6d4b517..0000000000
--- a/awx/ui/client/src/login/loginModal/loginModalNotice.block.less
+++ /dev/null
@@ -1,22 +0,0 @@
-/** @define LoginModalNotice */
-.LoginModalNotice {
- font-size: 12px;
- width: 100%;
- max-height: 129px;
- padding: 15px;
- padding-top: 10px;
- margin-bottom: 15px;
- border-radius: 4px;
- border: 1px solid @login-notice-border;
- background-color: @login-notice-bg;
- color: @login-notice-text;
- overflow-y: scroll;
- overflow-x: visible;
-}
-
-.LoginModalNotice-title {
- color: @login-notice-title;
- font-weight: bold;
- padding-bottom: 4px;
- font-size: 14px;
-}
diff --git a/awx/ui/client/src/login/loginModal/main.js b/awx/ui/client/src/login/loginModal/main.js
deleted file mode 100644
index 3d063d4e1c..0000000000
--- a/awx/ui/client/src/login/loginModal/main.js
+++ /dev/null
@@ -1,13 +0,0 @@
-/*************************************************
- * Copyright (c) 2015 Ansible, Inc.
- *
- * All Rights Reserved
- *************************************************/
-
-import thirdPartySignOn from './thirdPartySignOn/main';
-
-import loginModalDirective from './loginModal.directive';
-
-export default
- angular.module('loginModal', [thirdPartySignOn.name])
- .directive('loginModal', loginModalDirective);
diff --git a/awx/ui/client/src/login/loginModal/thirdPartySignOn/main.js b/awx/ui/client/src/login/loginModal/thirdPartySignOn/main.js
deleted file mode 100644
index e6f5f08b64..0000000000
--- a/awx/ui/client/src/login/loginModal/thirdPartySignOn/main.js
+++ /dev/null
@@ -1,13 +0,0 @@
-/*************************************************
- * Copyright (c) 2015 Ansible, Inc.
- *
- * All Rights Reserved
- *************************************************/
-
-import thirdPartySignOnDirective from './thirdPartySignOn.directive';
-import thirdPartySignOnService from './thirdPartySignOn.service';
-
-export default
- angular.module('thirdPartySignOn', [])
- .directive('thirdPartySignOn', thirdPartySignOnDirective)
- .factory('thirdPartySignOnService', thirdPartySignOnService);
diff --git a/awx/ui/client/src/login/loginModal/thirdPartySignOn/thirdPartySignOn.block.less b/awx/ui/client/src/login/loginModal/thirdPartySignOn/thirdPartySignOn.block.less
deleted file mode 100644
index d61006bf50..0000000000
--- a/awx/ui/client/src/login/loginModal/thirdPartySignOn/thirdPartySignOn.block.less
+++ /dev/null
@@ -1,51 +0,0 @@
-/** @define ThirdPartySignOn */
-
-.ThirdPartySignOn {
- display: flex;
- align-items: center;
-}
-
-.ThirdPartySignOn-label {
- flex: initial;
- color: @third-party-label;
-}
-
-.ThirdPartySignOn-item {
- margin-left: 15px;
-}
-
-.ThirdPartySignOn-button {
- transition: color 0.2s;
- flex: 1 0 auto;
- height: 30px;
- width: 30px;
- border-radius: 50%;
- color: @third-party-btn-text;
- background-color: @third-party-btn-bg;
- border: 0;
- padding: 0;
-}
-
-.ThirdPartySignOn-button--error {
- color: @third-party-error;
-}
-
-.ThirdPartySignOn-button:hover {
- color: @third-party-btn-hov;
-}
-
-.ThirdPartySignOn-button--error:hover {
- color: @third-party-error-hov;
-}
-
-.ThirdPartySignOn-icon {
- font-size: 35px;
-}
-
-.ThirdPartySignOn-icon--gitHub {
- margin-top: -3px;
-}
-
-.ThirdPartySignOn-icon--fontCustom {
- font-size: 30px;
-}
diff --git a/awx/ui/client/src/login/loginModal/thirdPartySignOn/thirdPartySignOn.controller.js b/awx/ui/client/src/login/loginModal/thirdPartySignOn/thirdPartySignOn.controller.js
deleted file mode 100644
index 4593344ad3..0000000000
--- a/awx/ui/client/src/login/loginModal/thirdPartySignOn/thirdPartySignOn.controller.js
+++ /dev/null
@@ -1,44 +0,0 @@
-/*************************************************
- * Copyright (c) 2015 Ansible, Inc.
- *
- * All Rights Reserved
- *************************************************/
-
-/**
- * @ngdoc function
- * @name controllers.function:thirdPartySignOn
- * @description
- * Controller for handling third party supported login options.
- */
-
-export default ['$window', '$scope', 'thirdPartySignOnService', '$cookies', 'Authorization',
- function ($window, $scope, thirdPartySignOnService, $cookies, Authorization) {
-
- thirdPartySignOnService(
- {scope: $scope, url: "api/v2/auth/"}).then(function (data) {
- if (data && data.options && data.options.length > 0) {
- $scope.thirdPartyLoginSupported = true;
- $scope.loginItems = data.options;
- } else {
- $scope.thirdPartyLoginSupported = false;
- }
-
- if (data && data.error) {
- $scope.$parent.thirdPartyAttemptFailed = data.error;
- }
- });
-
- $scope.goTo = function(link) {
- // clear out any prior auth state that might exist (e.g: from other
- // tabs, etc.) before redirecting to the auth service
- Authorization.logout().then(() => {
- angular.forEach($cookies.getAll(), (val, name) => {
- $cookies.remove(name);
- });
- $window.location.reload();
- // this is used because $location only lets you navigate inside
- // the "/#/" path, and these are API urls.
- $window.location.href = link;
- });
- };
- }];
diff --git a/awx/ui/client/src/login/loginModal/thirdPartySignOn/thirdPartySignOn.directive.js b/awx/ui/client/src/login/loginModal/thirdPartySignOn/thirdPartySignOn.directive.js
deleted file mode 100644
index 91c6a085c2..0000000000
--- a/awx/ui/client/src/login/loginModal/thirdPartySignOn/thirdPartySignOn.directive.js
+++ /dev/null
@@ -1,23 +0,0 @@
-/*************************************************
- * Copyright (c) 2015 Ansible, Inc.
- *
- * All Rights Reserved
- *************************************************/
-
-/* jshint unused: vars */
-
-import thirdPartySignOnController from './thirdPartySignOn.controller';
-
-export default
- [ 'templateUrl',
- function(templateUrl) {
- return {
- restrict: 'E',
- scope: true,
- controller: thirdPartySignOnController,
- templateUrl: templateUrl('login/loginModal/thirdPartySignOn/thirdPartySignOn'),
- link: function(scope, element, attrs) {
- }
- };
- }
- ];
diff --git a/awx/ui/client/src/login/loginModal/thirdPartySignOn/thirdPartySignOn.partial.html b/awx/ui/client/src/login/loginModal/thirdPartySignOn/thirdPartySignOn.partial.html
deleted file mode 100644
index c1868d51a1..0000000000
--- a/awx/ui/client/src/login/loginModal/thirdPartySignOn/thirdPartySignOn.partial.html
+++ /dev/null
@@ -1,14 +0,0 @@
-
diff --git a/awx/ui/client/src/login/loginModal/thirdPartySignOn/thirdPartySignOn.service.js b/awx/ui/client/src/login/loginModal/thirdPartySignOn/thirdPartySignOn.service.js
deleted file mode 100644
index afc2c97a17..0000000000
--- a/awx/ui/client/src/login/loginModal/thirdPartySignOn/thirdPartySignOn.service.js
+++ /dev/null
@@ -1,121 +0,0 @@
-/*************************************************
- * Copyright (c) 2015 Ansible, Inc.
- *
- * All Rights Reserved
- *************************************************/
-
- /**
- * @ngdoc function
- * @name helpers.function:Permissions
- * @description
- * Gets the configured auth types based on the configurations set in the server
- *
- */
-
- export default
- ['$http', '$log', 'i18n', function($http, $log, i18n) {
- return function (params) {
- var url = params.url;
-
- return $http({
- method: 'GET',
- url: url,
- }).then(function (data) {
- var options = [],
- error = "";
-
- function parseAzure(option) {
- var newOption = {};
-
- newOption.type = "azure";
- newOption.icon = "ThirdPartySignOn-icon--fontCustom icon-microsoft";
- newOption.link = option.login_url;
- newOption.tooltip = i18n.sprintf(i18n._("Sign in with %s"), "Azure AD");
-
- return newOption;
- }
-
- function parseGoogle(option) {
- var newOption = {};
-
- newOption.type = "google";
- newOption.icon = "ThirdPartySignOn-icon--fontCustom icon-google";
- newOption.link = option.login_url;
- newOption.tooltip = i18n.sprintf(i18n._("Sign in with %s"), "Google");
-
- return newOption;
- }
-
- function parseGithub(option, key) {
- var newOption = {};
-
- newOption.type = "github";
- newOption.icon = "fa-github ThirdPartySignOn-icon--gitHub";
- newOption.link = option.login_url;
- newOption.tooltip = i18n.sprintf(i18n._("Sign in with %s"), "GitHub");
-
- // if this is a GitHub team or org, add that to
- // the tooltip
- if (key.split("-")[1]){
- if (key.split("-")[1] === "team") {
- newOption.tooltip = i18n.sprintf(i18n._("Sign in with %s Teams"), "GitHub");
- } else if (key.split("-")[1] === "org") {
- newOption.tooltip = i18n.sprintf(i18n._("Sign in with %s Organizations"), "GitHub");
- }
- }
-
- return newOption;
- }
-
- function parseSaml(option, key) {
- var newOption = {};
-
- newOption.type = "saml";
- newOption.icon = "ThirdPartySignOn-icon--fontCustom icon-saml-02";
- newOption.link = option.login_url;
- newOption.tooltip = i18n.sprintf(i18n._("Sign in with %s"), "SAML");
-
- // add the idp of the saml type to the tooltip
- if (key.split(":")[1]){
- newOption.tooltip += " (" + key.split(":")[1] + ")";
- }
-
- return newOption;
- }
-
- function parseLoginOption(option, key) {
- var finalOption;
-
- // set up the particular tooltip, icon, etc.
- // needed by the login type
- if (key.split("-")[0] === "azuread") {
- finalOption = parseAzure(option, key);
- } else if (key.split("-")[0] === "google") {
- finalOption = parseGoogle(option, key);
- } else if (key.split("-")[0] === "github") {
- finalOption = parseGithub(option, key);
- } else if (key.split(":")[0] === "saml") {
- finalOption = parseSaml(option, key);
- }
-
- // set the button to error red and set the error message to be passed to the login modal.
- if (option.error) {
- finalOption.button = "ThirdPartySignOn-button--error";
- error = option.error;
- }
-
- options.push(finalOption);
- }
-
- // iterate over each login option passed from the API
- _.forEach(data.data, parseLoginOption);
-
- // return the options and the error to be utilized
- // by the loginModal
- return {"options": options, "error": error};
- })
- .catch(function (data) {
- $log.error('Failed to get third-party login types. Returned status: ' + data.status );
- });
- };
- }];
diff --git a/awx/ui/client/src/login/logout.route.js b/awx/ui/client/src/login/logout.route.js
deleted file mode 100644
index 47da767ec5..0000000000
--- a/awx/ui/client/src/login/logout.route.js
+++ /dev/null
@@ -1,22 +0,0 @@
-/*************************************************
- * Copyright (c) 2015 Ansible, Inc.
- *
- * All Rights Reserved
- *************************************************/
-
-// import {templateUrl} from '../../shared/template-url/template-url.factory';
-
-export default {
- name: 'signOut',
- route: '/logout',
- controller: ['Authorization', '$state', function(Authorization, $state) {
- Authorization.logout().then( () =>{
- $state.go('signIn');
- });
-
- }],
- ncyBreadcrumb: {
- skip: true
- },
- templateUrl: '/static/partials/blank.html'
-};
diff --git a/awx/ui/client/src/login/main.js b/awx/ui/client/src/login/main.js
deleted file mode 100644
index 4835feebd3..0000000000
--- a/awx/ui/client/src/login/main.js
+++ /dev/null
@@ -1,18 +0,0 @@
-/*************************************************
- * Copyright (c) 2015 Ansible, Inc.
- *
- * All Rights Reserved
- *************************************************/
-
-import authentication from './authenticationServices/main';
-import loginModal from './loginModal/main';
-
-import loginRoute from './login.route';
-import logoutRoute from './logout.route';
-
-export default
- angular.module('login', [authentication.name, loginModal.name])
- .run(['$stateExtender', function($stateExtender) {
- $stateExtender.addState(loginRoute);
- $stateExtender.addState(logoutRoute);
- }]);
diff --git a/awx/ui/client/src/management-jobs/card/card.controller.js b/awx/ui/client/src/management-jobs/card/card.controller.js
deleted file mode 100644
index d266900ea5..0000000000
--- a/awx/ui/client/src/management-jobs/card/card.controller.js
+++ /dev/null
@@ -1,168 +0,0 @@
-/*************************************************
- * Copyright (c) 2015 Ansible, Inc.
- *
- * All Rights Reserved
- *************************************************/
-
-
-export default
- [ 'Wait', 'CreateDialog', 'GetBasePath' ,
- 'Rest' ,
- 'ProcessErrors', '$rootScope', '$state',
- '$scope', 'CreateSelect2', 'i18n', '$transitions',
- function( Wait, CreateDialog, GetBasePath,
- Rest, ProcessErrors,
- $rootScope, $state, $scope,
- CreateSelect2, i18n, $transitions) {
-
- var defaultUrl = GetBasePath('system_job_templates') + "?order_by=name";
-
- var getManagementJobs = function(){
- Rest.setUrl(defaultUrl);
- Rest.get()
- .then(({data}) => {
- $scope.mgmtCards = data.results;
- Wait('stop');
- })
- .catch(({data, status}) => {
- ProcessErrors($scope, data, status, null, {hdr: i18n._('Error!'),
- msg: i18n.sprintf(i18n._('Call to %s failed. Return status: %d'), (defaultUrl === undefined) ? "undefined" : defaultUrl, status )});
- });
- };
- getManagementJobs();
-
- // This handles the case where the user refreshes the management job notifications page.
- if($state.current.name === 'managementJobsList.notifications') {
- $scope.activeCard = parseInt($state.params.management_id);
- $scope.cardAction = "notifications";
- }
-
- $scope.goToNotifications = function(card){
- $state.transitionTo('managementJobsList.notifications',{
- card: card,
- management_id: card.id
- });
- };
-
- var launchManagementJob = function (defaultUrl){
- var data = {};
- Rest.setUrl(defaultUrl);
- Rest.post(data)
- .then(({data}) => {
- Wait('stop');
- $state.go('output', { id: data.system_job, type: 'system' }, { reload: true });
- })
- .catch(({data, status}) => {
- let template_id = $scope.job_template_id;
- template_id = (template_id === undefined) ? "undefined" : i18n.sprintf("%d", template_id);
- ProcessErrors($scope, data, status, null, { hdr: i18n._('Error!'),
- msg: i18n.sprintf(i18n._('Failed updating job %s with variables. POST returned: %d'), template_id, status) });
- });
- };
-
- $scope.submitJob = function (id, name) {
- Wait('start');
- defaultUrl = GetBasePath('system_job_templates')+id+'/launch/';
- var noModalJobs = ['Cleanup Expired Sessions', 'Cleanup Expired OAuth 2 Tokens'];
- if (noModalJobs.includes(name)) {
- launchManagementJob(defaultUrl, name);
- } else {
-
- CreateDialog({
- id: 'prompt-for-days',
- title: name,
- scope: $scope,
- width: 500,
- height: 300,
- minWidth: 200,
- callback: 'PromptForDays',
- resizable: false,
- onOpen: function(){
- $scope.$watch('prompt_for_days_form.$invalid', function(invalid) {
- if (invalid === true) {
- $('#prompt-for-days-launch').prop("disabled", true);
- } else {
- $('#prompt-for-days-launch').prop("disabled", false);
- }
- });
-
- let fieldScope = $scope.$parent;
- fieldScope.days_to_keep = 30;
- $scope.prompt_for_days_form.$setPristine();
- $scope.prompt_for_days_form.$invalid = false;
- },
- buttons: [
- {
- "label": "Cancel",
- "onClick": function() {
- $(this).dialog('close');
-
- },
- "class": "btn btn-default",
- "id": "prompt-for-days-cancel"
- },
- {
- "label": "Launch",
- "onClick": function() {
- const extra_vars = {"days": $scope.days_to_keep },
- data = {};
- data.extra_vars = JSON.stringify(extra_vars);
-
- Rest.setUrl(defaultUrl);
- Rest.post(data)
- .then(({data}) => {
- Wait('stop');
- $("#prompt-for-days").dialog("close");
- // $("#configure-dialog").dialog('close');
- $state.go('output', { id: data.system_job, type: 'system' }, { reload: true });
- })
- .catch(({data, status}) => {
- let template_id = $scope.job_template_id;
- template_id = (template_id === undefined) ? "undefined" : i18n.sprintf("%d", template_id);
- ProcessErrors($scope, data, status, null, { hdr: i18n._('Error!'),
- msg: i18n.sprintf(i18n._('Failed updating job %s with variables. POST returned: %d'), template_id, status) });
- });
- },
- "class": "btn btn-primary",
- "id": "prompt-for-days-launch"
- }
- ]
- });
- }
-
- if ($scope.removePromptForDays) {
- $scope.removePromptForDays();
- }
- $scope.removePromptForDays = $scope.$on('PromptForDays', function() {
- // $('#configure-dialog').dialog('close');
- $('#prompt-for-days').show();
- $('#prompt-for-days').dialog('open');
- Wait('stop');
- });
- };
-
- $scope.configureSchedule = function(id) {
- $state.transitionTo('managementJobsList.schedule', {
- id: id
- });
- };
-
- var cleanUpStateChangeListener = $transitions.onSuccess({}, function(trans) {
- if(trans.to().name === "managementJobsList") {
- // We are on the management job list view - nothing needs to be highlighted
- delete $scope.activeCard;
- delete $scope.cardAction;
- }
- else if(trans.to().name === "managementJobsList.notifications") {
- // We are on the notifications view - update the active card and the action
- $scope.activeCard = parseInt(trans.params('to').management_id);
- $scope.cardAction = "notifications";
- }
- });
-
- // Remove the listener when the scope is destroyed to avoid a memory leak
- $scope.$on('$destroy', function() {
- cleanUpStateChangeListener();
- });
- }
- ];
diff --git a/awx/ui/client/src/management-jobs/card/card.partial.html b/awx/ui/client/src/management-jobs/card/card.partial.html
deleted file mode 100644
index f53b7a796e..0000000000
--- a/awx/ui/client/src/management-jobs/card/card.partial.html
+++ /dev/null
@@ -1,48 +0,0 @@
-