diff --git a/awx/ui/client/src/activity-stream/factories/build-anchor.factory.js b/awx/ui/client/src/activity-stream/factories/build-anchor.factory.js
index f3ccd0b9b0..914b22c53a 100644
--- a/awx/ui/client/src/activity-stream/factories/build-anchor.factory.js
+++ b/awx/ui/client/src/activity-stream/factories/build-anchor.factory.js
@@ -20,14 +20,14 @@ export default function BuildAnchor($log, $filter) {
if (activity.operation === 'create' || activity.operation === 'delete'){
// the API formats the changes.inventory field as str 'myInventoryName-PrimaryKey'
var inventory_id = _.last(activity.changes.inventory.split('-'));
- url += 'inventories/' + inventory_id + '/manage?group=' + activity.changes.id;
+ url += 'inventories/' + inventory_id + '/groups/edit/' + activity.changes.id;
}
else {
- url += 'inventories/' + activity.summary_fields.inventory[0].id + '/manage?group=' + (activity.changes.id || activity.changes.object1_pk);
+ url += 'inventories/' + activity.summary_fields.inventory[0].id + '/groups/edit/' + (activity.changes.id || activity.changes.object1_pk);
}
break;
case 'host':
- url += 'home/hosts/' + obj.id;
+ url += 'hosts/' + obj.id;
break;
case 'job':
url += 'jobs/' + obj.id;
diff --git a/awx/ui/client/src/app.js b/awx/ui/client/src/app.js
index e367c4d935..ccbf9b04ef 100644
--- a/awx/ui/client/src/app.js
+++ b/awx/ui/client/src/app.js
@@ -39,7 +39,7 @@ if ($basePath) {
// Modules
import portalMode from './portal-mode/main';
import systemTracking from './system-tracking/main';
-import inventories from './inventories/main';
+import inventoriesHosts from './inventories-hosts/main';
import inventoryScripts from './inventory-scripts/main';
import credentials from './credentials/main';
import credentialTypes from './credential-types/main';
@@ -104,7 +104,7 @@ var tower = angular.module('Tower', [
browserData.name,
configuration.name,
systemTracking.name,
- inventories.name,
+ inventoriesHosts.name,
inventoryScripts.name,
credentials.name,
credentialTypes.name,
diff --git a/awx/ui/client/src/inventories/hosts/edit/host-edit.controller.js b/awx/ui/client/src/inventories-hosts/hosts/edit/host-edit.controller.js
similarity index 94%
rename from awx/ui/client/src/inventories/hosts/edit/host-edit.controller.js
rename to awx/ui/client/src/inventories-hosts/hosts/edit/host-edit.controller.js
index f467e8c62f..3cd6a00c28 100644
--- a/awx/ui/client/src/inventories/hosts/edit/host-edit.controller.js
+++ b/awx/ui/client/src/inventories-hosts/hosts/edit/host-edit.controller.js
@@ -5,8 +5,8 @@
*************************************************/
export default
- ['$scope', '$state', '$stateParams', 'GenerateForm', 'ParseTypeChange', 'HostManageService', 'host', '$rootScope',
- function($scope, $state, $stateParams, GenerateForm, ParseTypeChange, HostManageService, host, $rootScope){
+ ['$scope', '$state', '$stateParams', 'GenerateForm', 'ParseTypeChange', 'HostsService', 'host', '$rootScope',
+ function($scope, $state, $stateParams, GenerateForm, ParseTypeChange, HostsService, host, $rootScope){
$scope.parseType = 'yaml';
$scope.formCancel = function(){
$state.go('^', null, {reload: true});
@@ -32,7 +32,7 @@
description: $scope.description,
enabled: $scope.host.enabled
};
- HostManageService.put(host).then(function(){
+ HostsService.put(host).then(function(){
$state.go('.', null, {reload: true});
});
diff --git a/awx/ui/client/src/inventories/hosts/edit/main.js b/awx/ui/client/src/inventories-hosts/hosts/edit/main.js
similarity index 100%
rename from awx/ui/client/src/inventories/hosts/edit/main.js
rename to awx/ui/client/src/inventories-hosts/hosts/edit/main.js
diff --git a/awx/ui/client/src/inventories/hosts/host.form.js b/awx/ui/client/src/inventories-hosts/hosts/host.form.js
similarity index 100%
rename from awx/ui/client/src/inventories/hosts/host.form.js
rename to awx/ui/client/src/inventories-hosts/hosts/host.form.js
diff --git a/awx/ui/client/src/inventories/hosts/host.list.js b/awx/ui/client/src/inventories-hosts/hosts/host.list.js
similarity index 98%
rename from awx/ui/client/src/inventories/hosts/host.list.js
rename to awx/ui/client/src/inventories-hosts/hosts/host.list.js
index bf8ed8673e..865d3eb108 100644
--- a/awx/ui/client/src/inventories/hosts/host.list.js
+++ b/awx/ui/client/src/inventories-hosts/hosts/host.list.js
@@ -110,7 +110,7 @@ export default ['i18n', function(i18n) {
awToolTip: "Create a new Smart Inventory from search results.",
actionClass: 'btn List-buttonDefault',
buttonContent: 'SMART INVENTORY',
- ngShow: 'canAdd',
+ ngShow: 'canAdd && (hosts.length > 0 || !(searchTags | isEmpty))',
dataPlacement: "top",
ngDisabled: '!enableSmartInventoryButton'
}
diff --git a/awx/ui/client/src/inventories/hosts/hosts.partial.html b/awx/ui/client/src/inventories-hosts/hosts/hosts.partial.html
similarity index 100%
rename from awx/ui/client/src/inventories/hosts/hosts.partial.html
rename to awx/ui/client/src/inventories-hosts/hosts/hosts.partial.html
diff --git a/awx/ui/client/src/inventories/hosts/list/host-list.controller.js b/awx/ui/client/src/inventories-hosts/hosts/list/host-list.controller.js
similarity index 95%
rename from awx/ui/client/src/inventories/hosts/list/host-list.controller.js
rename to awx/ui/client/src/inventories-hosts/hosts/list/host-list.controller.js
index d88bfadeb3..3853d80462 100644
--- a/awx/ui/client/src/inventories/hosts/list/host-list.controller.js
+++ b/awx/ui/client/src/inventories-hosts/hosts/list/host-list.controller.js
@@ -7,7 +7,7 @@
function HostsList($scope, HostsList, $rootScope, GetBasePath,
rbacUiControlService, Dataset, $state, $filter, Prompt, Wait,
- HostManageService, SetStatus, canAdd) {
+ HostsService, SetStatus, canAdd) {
let list = HostsList;
@@ -73,7 +73,7 @@ function HostsList($scope, HostsList, $rootScope, GetBasePath,
var action = function(){
delete $rootScope.promptActionBtnClass;
Wait('start');
- HostManageService.delete(id).then(() => {
+ HostsService.delete(id).then(() => {
$('#prompt-modal').modal('hide');
if (parseInt($state.params.host_id) === id) {
$state.go("hosts", null, {reload: true});
@@ -102,7 +102,7 @@ function HostsList($scope, HostsList, $rootScope, GetBasePath,
host.enabled = !host.enabled;
- HostManageService.put(host).then(function(){
+ HostsService.put(host).then(function(){
$state.go($state.current, null, {reload: true});
});
};
@@ -139,5 +139,5 @@ function HostsList($scope, HostsList, $rootScope, GetBasePath,
export default ['$scope', 'HostsList', '$rootScope', 'GetBasePath',
'rbacUiControlService', 'Dataset', '$state', '$filter', 'Prompt', 'Wait',
- 'HostManageService', 'SetStatus', 'canAdd', HostsList
+ 'HostsService', 'SetStatus', 'canAdd', HostsList
];
diff --git a/awx/ui/client/src/inventories/hosts/list/main.js b/awx/ui/client/src/inventories-hosts/hosts/list/main.js
similarity index 100%
rename from awx/ui/client/src/inventories/hosts/list/main.js
rename to awx/ui/client/src/inventories-hosts/hosts/list/main.js
diff --git a/awx/ui/client/src/inventories-hosts/hosts/main.js b/awx/ui/client/src/inventories-hosts/hosts/main.js
new file mode 100644
index 0000000000..09a368a825
--- /dev/null
+++ b/awx/ui/client/src/inventories-hosts/hosts/main.js
@@ -0,0 +1,112 @@
+/*************************************************
+ * Copyright (c) 2017 Ansible, Inc.
+ *
+ * All Rights Reserved
+ *************************************************/
+
+ import hostEdit from './edit/main';
+ import hostList from './list/main';
+ import HostsList from './host.list';
+ import HostsForm from './host.form';
+ import { templateUrl } from '../../shared/template-url/template-url.factory';
+ import { N_ } from '../../i18n';
+ import ansibleFactsRoute from '../shared/ansible-facts/ansible-facts.route';
+ import insightsRoute from '../inventories/insights/insights.route';
+ import hostGroupsRoute from './related/groups/hosts-related-groups.route';
+ import hostGroupsAssociateRoute from './related/groups/hosts-related-groups-associate.route';
+ import hostGroups from './related/groups/main';
+
+export default
+angular.module('host', [
+ hostEdit.name,
+ hostList.name,
+ hostGroups.name
+ ])
+ .factory('HostsForm', HostsForm)
+ .factory('HostsList', HostsList)
+ .config(['$stateProvider', 'stateDefinitionsProvider', '$stateExtenderProvider',
+ function($stateProvider, stateDefinitionsProvider, $stateExtenderProvider) {
+ let stateDefinitions = stateDefinitionsProvider.$get(),
+ stateExtender = $stateExtenderProvider.$get();
+
+ let generateHostStates = function(){
+ let hostTree = stateDefinitions.generateTree({
+ parent: 'hosts', // top-most node in the generated tree (will replace this state definition)
+ modes: ['edit'],
+ list: 'HostsList',
+ form: 'HostsForm',
+ controllers: {
+ edit: 'HostEditController'
+ },
+ breadcrumbs: {
+ edit: '{{breadcrumb.host_name}}'
+ },
+ urls: {
+ list: '/hosts'
+ },
+ data: {
+ activityStream: true,
+ activityStreamTarget: 'host'
+ },
+ resolve: {
+ edit: {
+ host: ['Rest', '$stateParams', 'GetBasePath',
+ function(Rest, $stateParams, GetBasePath) {
+ let path = GetBasePath('hosts') + $stateParams.host_id;
+ Rest.setUrl(path);
+ return Rest.get();
+ }
+ ]
+ },
+ list: {
+ canAdd: ['rbacUiControlService', function(rbacUiControlService) {
+ return rbacUiControlService.canAdd('hosts')
+ .then(function(res) {
+ return res.canAdd;
+ })
+ .catch(function() {
+ return false;
+ });
+ }]
+ }
+ },
+ views: {
+ '@': {
+ templateUrl: templateUrl('inventories-hosts/hosts/hosts'),
+ controller: 'HostListController'
+ }
+ },
+ ncyBreadcrumb: {
+ label: N_('HOSTS')
+ }
+ });
+
+ let hostAnsibleFacts = _.cloneDeep(ansibleFactsRoute);
+ hostAnsibleFacts.name = 'hosts.edit.ansible_facts';
+
+ let hostInsights = _.cloneDeep(insightsRoute);
+ hostInsights.name = 'hosts.edit.insights';
+
+ return Promise.all([
+ hostTree
+ ]).then((generated) => {
+ return {
+ states: _.reduce(generated, (result, definition) => {
+ return result.concat(definition.states);
+ }, [
+ stateExtender.buildDefinition(hostAnsibleFacts),
+ stateExtender.buildDefinition(hostInsights),
+ stateExtender.buildDefinition(hostGroupsRoute),
+ stateExtender.buildDefinition(hostGroupsAssociateRoute)
+ ])
+ };
+ });
+ };
+
+ $stateProvider.state({
+ name: 'hosts',
+ url: '/hosts',
+ lazyLoad: () => generateHostStates()
+ });
+ }
+ ]);
diff --git a/awx/ui/client/src/inventories-hosts/hosts/related/groups/hosts-related-groups-associate.route.js b/awx/ui/client/src/inventories-hosts/hosts/related/groups/hosts-related-groups-associate.route.js
new file mode 100644
index 0000000000..169a9d6b7a
--- /dev/null
+++ b/awx/ui/client/src/inventories-hosts/hosts/related/groups/hosts-related-groups-associate.route.js
@@ -0,0 +1,33 @@
+export default {
+ name: 'hosts.edit.groups.associate',
+ squashSearchUrl: true,
+ url: '/associate?inventory_id',
+ ncyBreadcrumb:{
+ skip:true
+ },
+ views: {
+ 'modal@hosts.edit': {
+ templateProvider: function() {
+ return `
" + + N_("Indicates if a host is available and should be included in running jobs.") + + "
" + + N_("For hosts that are part of an external" + + " inventory, this flag cannot be changed. It will be" + + " set by the inventory sync process.") + + "
", + dataPlacement: "right", + nosort: true, + }, active_failures: { label: '', iconOnly: true, @@ -50,13 +68,6 @@ export default { fieldActions: { columnClass: 'col-lg-6 col-md-4 col-sm-4 col-xs-5 text-right', - copy: { - mode: 'all', - ngClick: "copyMoveHost(nested_host.id)", - awToolTip: 'Copy or move host to another group', - dataPlacement: "top", - ngShow: 'nested_host.summary_fields.user_capabilities.edit' - }, edit: { //label: 'Edit', ngClick: "editHost(nested_host.id)", @@ -74,9 +85,9 @@ export default { }, "delete": { //label: 'Delete', - ngClick: "deleteHost(nested_host.id, nested_host.name)", + ngClick: "disassociateHost(nested_host)", icon: 'icon-trash', - awToolTip: 'Delete host', + awToolTip: 'Disassociate host', dataPlacement: 'top', ngShow: 'nested_host.summary_fields.user_capabilities.delete' } @@ -117,14 +128,26 @@ export default { actionClass: 'btn List-buttonDefault', buttonContent: 'REFRESH' }, - create: { + add: { mode: 'all', - ngClick: "createHost()", - awToolTip: "Create a new host", + type: 'buttonDropdown', + awToolTip: "Add a host", actionClass: 'btn List-buttonSubmit', - buttonContent: '+ ADD HOST', + buttonContent: '+ ADD', ngShow: 'canAdd', dataPlacement: "top", + options: [ + { + optionContent: 'Existing Host', + optionSref: '.associate', + ngShow: 'canAdd' + }, + { + optionContent: 'New Host', + optionSref: '.add', + ngShow: 'canAdd' + } + ], } } diff --git a/awx/ui/client/src/inventories/groups/nested-hosts/nested-hosts.route.js b/awx/ui/client/src/inventories-hosts/inventories/related/groups/related/nested-hosts/group-nested-hosts.route.js similarity index 77% rename from awx/ui/client/src/inventories/groups/nested-hosts/nested-hosts.route.js rename to awx/ui/client/src/inventories-hosts/inventories/related/groups/related/nested-hosts/group-nested-hosts.route.js index 2182a522cf..456da422d9 100644 --- a/awx/ui/client/src/inventories/groups/nested-hosts/nested-hosts.route.js +++ b/awx/ui/client/src/inventories-hosts/inventories/related/groups/related/nested-hosts/group-nested-hosts.route.js @@ -1,4 +1,5 @@ -import { N_ } from '../../../i18n'; +import { N_ } from '../../../../../../i18n'; +import {templateUrl} from '../../../../../../shared/template-url/template-url.factory'; export default { name: "inventories.edit.groups.edit.nested_hosts", @@ -20,18 +21,16 @@ export default { views: { // 'related@inventories.edit.groups.edit': { 'related': { - templateProvider: function(NestedHostsListDefinition, generateList) { + templateProvider: function(NestedHostsListDefinition, generateList, $templateRequest) { let list = _.cloneDeep(NestedHostsListDefinition); let html = generateList.build({ list: list, mode: 'edit' }); - // Include the custom group delete modal template - // return $templateRequest(templateUrl('inventories/groups/list/groups-list')).then((template) => { - // return html.concat(template); - // }); - return html; + return $templateRequest(templateUrl('inventories-hosts/inventories/related/groups/related/nested-hosts/group-nested-hosts-disassociate')).then((template) => { + return html.concat(template); + }); }, controller: 'NestedHostsListController' } @@ -51,8 +50,8 @@ export default { return qs.search(path, $stateParams[`${list.iterator}_search`]); } ], - inventoryData: ['InventoryManageService', '$stateParams', function(InventoryManageService, $stateParams) { - return InventoryManageService.getInventory($stateParams.inventory_id).then(res => res.data); + inventoryData: ['InventoriesService', '$stateParams', function(InventoriesService, $stateParams) { + return InventoriesService.getInventory($stateParams.inventory_id).then(res => res.data); }], canAdd: ['rbacUiControlService', function(rbacUiControlService) { return rbacUiControlService.canAdd('hosts') diff --git a/awx/ui/client/src/inventories/groups/nested-hosts/main.js b/awx/ui/client/src/inventories-hosts/inventories/related/groups/related/nested-hosts/main.js similarity index 56% rename from awx/ui/client/src/inventories/groups/nested-hosts/main.js rename to awx/ui/client/src/inventories-hosts/inventories/related/groups/related/nested-hosts/main.js index 450a20e290..70bb5ae1b1 100644 --- a/awx/ui/client/src/inventories/groups/nested-hosts/main.js +++ b/awx/ui/client/src/inventories-hosts/inventories/related/groups/related/nested-hosts/main.js @@ -4,12 +4,14 @@ * All Rights Reserved *************************************************/ -import nestedHostsListDefinition from './nested-hosts.list'; -import nestedHostsFormDefinition from './nested-hosts.form'; -import controller from './nested-hosts-list.controller'; +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', []) .value('NestedHostsListDefinition', nestedHostsListDefinition) .factory('NestedHostsFormDefinition', nestedHostsFormDefinition) + .controller('NestedHostsAddController', addController) .controller('NestedHostsListController', controller); diff --git a/awx/ui/client/src/inventories/related-hosts/add/host-add.controller.js b/awx/ui/client/src/inventories-hosts/inventories/related/hosts/add/host-add.controller.js similarity index 68% rename from awx/ui/client/src/inventories/related-hosts/add/host-add.controller.js rename to awx/ui/client/src/inventories-hosts/inventories/related/hosts/add/host-add.controller.js index 1247d73979..e9694cebdb 100644 --- a/awx/ui/client/src/inventories/related-hosts/add/host-add.controller.js +++ b/awx/ui/client/src/inventories-hosts/inventories/related/hosts/add/host-add.controller.js @@ -5,9 +5,9 @@ *************************************************/ export default ['$state', '$stateParams', '$scope', 'RelatedHostsFormDefinition', 'ParseTypeChange', - 'GenerateForm', 'HostManageService', 'rbacUiControlService', 'GetBasePath', 'ToJSON', 'canAdd', + 'GenerateForm', 'HostsService', 'rbacUiControlService', 'GetBasePath', 'ToJSON', 'canAdd', function($state, $stateParams, $scope, RelatedHostsFormDefinition, ParseTypeChange, - GenerateForm, HostManageService, rbacUiControlService, GetBasePath, ToJSON, canAdd) { + GenerateForm, HostsService, rbacUiControlService, GetBasePath, ToJSON, canAdd) { init(); @@ -43,15 +43,8 @@ export default ['$state', '$stateParams', '$scope', 'RelatedHostsFormDefinition' enabled: $scope.host.enabled, inventory: $stateParams.inventory_id }; - HostManageService.post(params).then(function(res) { - // assign the host to current group if not at the root level - if ($stateParams.group_id) { - HostManageService.associateGroup(res.data, $stateParams.group_id).then(function() { - $state.go('^.edit', { group_id: $stateParams.group_id, host_id: res.data.id }, { reload: true }); - }); - } else { - $state.go('^.edit', { host_id: res.data.id }, { reload: true }); - } + HostsService.post(params).then(function(res) { + $state.go('^.edit', { host_id: res.data.id }, { reload: true }); }); }; } diff --git a/awx/ui/client/src/inventories/related-hosts/add/host-add.route.js b/awx/ui/client/src/inventories-hosts/inventories/related/hosts/add/host-add.route.js similarity index 93% rename from awx/ui/client/src/inventories/related-hosts/add/host-add.route.js rename to awx/ui/client/src/inventories-hosts/inventories/related/hosts/add/host-add.route.js index 456089f51f..7621eeb045 100644 --- a/awx/ui/client/src/inventories/related-hosts/add/host-add.route.js +++ b/awx/ui/client/src/inventories-hosts/inventories/related/hosts/add/host-add.route.js @@ -1,4 +1,4 @@ -import { N_ } from '../../../i18n'; +import { N_ } from '../../../../../i18n'; export default { name: "inventories.edit.hosts.add", diff --git a/awx/ui/client/src/inventories/related-hosts/add/main.js b/awx/ui/client/src/inventories-hosts/inventories/related/hosts/add/main.js similarity index 100% rename from awx/ui/client/src/inventories/related-hosts/add/main.js rename to awx/ui/client/src/inventories-hosts/inventories/related/hosts/add/main.js diff --git a/awx/ui/client/src/inventories/related-hosts/edit/host-edit.controller.js b/awx/ui/client/src/inventories-hosts/inventories/related/hosts/edit/host-edit.controller.js similarity index 93% rename from awx/ui/client/src/inventories/related-hosts/edit/host-edit.controller.js rename to awx/ui/client/src/inventories-hosts/inventories/related/hosts/edit/host-edit.controller.js index 2dbe122bb5..4a66d48025 100644 --- a/awx/ui/client/src/inventories/related-hosts/edit/host-edit.controller.js +++ b/awx/ui/client/src/inventories-hosts/inventories/related/hosts/edit/host-edit.controller.js @@ -5,8 +5,8 @@ *************************************************/ export default - ['$scope', '$state', '$stateParams', 'GenerateForm', 'ParseTypeChange', 'HostManageService', 'host', '$rootScope', - function($scope, $state, $stateParams, GenerateForm, ParseTypeChange, HostManageService, host, $rootScope){ + ['$scope', '$state', '$stateParams', 'GenerateForm', 'ParseTypeChange', 'HostsService', 'host', '$rootScope', + function($scope, $state, $stateParams, GenerateForm, ParseTypeChange, HostsService, host, $rootScope){ $scope.parseType = 'yaml'; $scope.formCancel = function(){ $state.go('^', null, {reload: true}); @@ -28,7 +28,7 @@ description: $scope.description, enabled: $scope.host.enabled }; - HostManageService.put(host).then(function(){ + HostsService.put(host).then(function(){ $state.go('.', null, {reload: true}); }); diff --git a/awx/ui/client/src/inventories/related-hosts/edit/host-edit.route.js b/awx/ui/client/src/inventories-hosts/inventories/related/hosts/edit/host-edit.route.js similarity index 65% rename from awx/ui/client/src/inventories/related-hosts/edit/host-edit.route.js rename to awx/ui/client/src/inventories-hosts/inventories/related/hosts/edit/host-edit.route.js index 5bc5d264b5..53fb28d48f 100644 --- a/awx/ui/client/src/inventories/related-hosts/edit/host-edit.route.js +++ b/awx/ui/client/src/inventories-hosts/inventories/related/hosts/edit/host-edit.route.js @@ -7,11 +7,8 @@ export default { }, views: { 'hostForm@inventories': { - templateProvider: function(GenerateForm, RelatedHostsFormDefinition, NestedHostsFormDefinition, $stateParams) { + templateProvider: function(GenerateForm, RelatedHostsFormDefinition) { let form = RelatedHostsFormDefinition; - if($stateParams.group_id){ - form = NestedHostsFormDefinition; - } return GenerateForm.buildHTML(form, { mode: 'edit', related: false @@ -21,8 +18,8 @@ export default { } }, resolve: { - host: ['$stateParams', 'HostManageService', function($stateParams, HostManageService) { - return HostManageService.get({ id: $stateParams.host_id }).then(function(res) { + host: ['$stateParams', 'HostsService', function($stateParams, HostsService) { + return HostsService.get({ id: $stateParams.host_id }).then(function(res) { return res.data.results[0]; }); }] diff --git a/awx/ui/client/src/inventories/related-hosts/edit/main.js b/awx/ui/client/src/inventories-hosts/inventories/related/hosts/edit/main.js similarity index 100% rename from awx/ui/client/src/inventories/related-hosts/edit/main.js rename to awx/ui/client/src/inventories-hosts/inventories/related/hosts/edit/main.js diff --git a/awx/ui/client/src/inventories/related-hosts/list/host-list.controller.js b/awx/ui/client/src/inventories-hosts/inventories/related/hosts/list/host-list.controller.js similarity index 93% rename from awx/ui/client/src/inventories/related-hosts/list/host-list.controller.js rename to awx/ui/client/src/inventories-hosts/inventories/related/hosts/list/host-list.controller.js index 83694dfee3..140a83e9dd 100644 --- a/awx/ui/client/src/inventories/related-hosts/list/host-list.controller.js +++ b/awx/ui/client/src/inventories-hosts/inventories/related/hosts/list/host-list.controller.js @@ -4,13 +4,13 @@ * All Rights Reserved *************************************************/ -// import HostManageService from './../hosts/host.service'; +// import HostsService from './../hosts/host.service'; export default ['$scope', 'ListDefinition', '$rootScope', 'GetBasePath', 'rbacUiControlService', 'Dataset', '$state', '$filter', 'Prompt', 'Wait', - 'HostManageService', 'SetStatus', 'canAdd', + 'HostsService', 'SetStatus', 'canAdd', function($scope, ListDefinition, $rootScope, GetBasePath, rbacUiControlService, Dataset, $state, $filter, Prompt, Wait, - HostManageService, SetStatus, canAdd) { + HostsService, SetStatus, canAdd) { let list = ListDefinition; @@ -94,7 +94,7 @@ export default ['$scope', 'ListDefinition', '$rootScope', 'GetBasePath', var action = function(){ delete $rootScope.promptActionBtnClass; Wait('start'); - HostManageService.delete(id).then(() => { + HostsService.delete(id).then(() => { $('#prompt-modal').modal('hide'); if (parseInt($state.params.host_id) === id) { $state.go("hosts", null, {reload: true}); @@ -123,7 +123,7 @@ export default ['$scope', 'ListDefinition', '$rootScope', 'GetBasePath', host.enabled = !host.enabled; - HostManageService.put(host).then(function(){ + HostsService.put(host).then(function(){ $state.go($state.current, null, {reload: true}); }); }; @@ -149,8 +149,4 @@ export default ['$scope', 'ListDefinition', '$rootScope', 'GetBasePath', $state.go('^.adhoc', {pattern: pattern}); }; - - $scope.copyMoveHost = function(id) { - $state.go('inventories.edit.hosts.copyMoveHost', {host_id: id}); - }; }]; diff --git a/awx/ui/client/src/inventories/related-hosts/list/main.js b/awx/ui/client/src/inventories-hosts/inventories/related/hosts/list/main.js similarity index 100% rename from awx/ui/client/src/inventories/related-hosts/list/main.js rename to awx/ui/client/src/inventories-hosts/inventories/related/hosts/list/main.js diff --git a/awx/ui/client/src/inventories/related-hosts/main.js b/awx/ui/client/src/inventories-hosts/inventories/related/hosts/main.js similarity index 86% rename from awx/ui/client/src/inventories/related-hosts/main.js rename to awx/ui/client/src/inventories-hosts/inventories/related/hosts/main.js index 023d0c3dab..08b0cdc5b6 100644 --- a/awx/ui/client/src/inventories/related-hosts/main.js +++ b/awx/ui/client/src/inventories-hosts/inventories/related/hosts/main.js @@ -10,13 +10,15 @@ 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 + relatedGroupsLabels.name, + nestedGroups.name ]) .factory('RelatedHostsFormDefinition', relatedHostsFormDefinition) .factory('RelatedHostsListDefinition', relatedHostsListDefinition); diff --git a/awx/ui/client/src/inventories/related-hosts/related-groups-labels/main.js b/awx/ui/client/src/inventories-hosts/inventories/related/hosts/related-groups-labels/main.js similarity index 100% rename from awx/ui/client/src/inventories/related-hosts/related-groups-labels/main.js rename to awx/ui/client/src/inventories-hosts/inventories/related/hosts/related-groups-labels/main.js diff --git a/awx/ui/client/src/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 similarity index 100% rename from awx/ui/client/src/inventories/related-hosts/related-groups-labels/relatedGroupsLabelsList.block.less rename to awx/ui/client/src/inventories-hosts/inventories/related/hosts/related-groups-labels/relatedGroupsLabelsList.block.less diff --git a/awx/ui/client/src/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 similarity index 97% rename from awx/ui/client/src/inventories/related-hosts/related-groups-labels/relatedGroupsLabelsList.directive.js rename to awx/ui/client/src/inventories-hosts/inventories/related/hosts/related-groups-labels/relatedGroupsLabelsList.directive.js index f8638403d9..e189d9e1a6 100644 --- a/awx/ui/client/src/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 @@ -13,7 +13,7 @@ export default return { restrict: 'E', scope: false, - templateUrl: templateUrl('inventories/related-hosts/related-groups-labels/relatedGroupsLabelsList'), + templateUrl: templateUrl('inventories-hosts/inventories/related/hosts/related-groups-labels/relatedGroupsLabelsList'), link: function(scope, element, attrs) { scope.showDelete = attrs.showDelete === 'true'; scope.seeMoreInactive = true; diff --git a/awx/ui/client/src/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 similarity index 100% rename from awx/ui/client/src/inventories/related-hosts/related-groups-labels/relatedGroupsLabelsList.partial.html rename to awx/ui/client/src/inventories-hosts/inventories/related/hosts/related-groups-labels/relatedGroupsLabelsList.partial.html diff --git a/awx/ui/client/src/inventories/related-hosts/related-host.form.js b/awx/ui/client/src/inventories-hosts/inventories/related/hosts/related-host.form.js similarity index 100% rename from awx/ui/client/src/inventories/related-hosts/related-host.form.js rename to awx/ui/client/src/inventories-hosts/inventories/related/hosts/related-host.form.js diff --git a/awx/ui/client/src/inventories/related-hosts/related-host.list.js b/awx/ui/client/src/inventories-hosts/inventories/related/hosts/related-host.list.js similarity index 95% rename from awx/ui/client/src/inventories/related-hosts/related-host.list.js rename to awx/ui/client/src/inventories-hosts/inventories/related/hosts/related-host.list.js index 3222aed824..851327e90e 100644 --- a/awx/ui/client/src/inventories/related-hosts/related-host.list.js +++ b/awx/ui/client/src/inventories-hosts/inventories/related/hosts/related-host.list.js @@ -88,13 +88,6 @@ export default ['i18n', function(i18n) { dataPlacement: 'top', ngShow: 'host.insights_system_id' }, - copy: { - mode: 'all', - ngClick: "copyMoveHost(host.id)", - awToolTip: 'Copy or move host to another group', - dataPlacement: "top", - ngShow: 'host.summary_fields.user_capabilities.edit' - }, edit: { //label: 'Edit', ngClick: "editHost(host)", diff --git a/awx/ui/client/src/inventories/related-hosts/related-host.route.js b/awx/ui/client/src/inventories-hosts/inventories/related/hosts/related-host.route.js similarity index 85% rename from awx/ui/client/src/inventories/related-hosts/related-host.route.js rename to awx/ui/client/src/inventories-hosts/inventories/related/hosts/related-host.route.js index b3ea2da30c..0c8f6cb23a 100644 --- a/awx/ui/client/src/inventories/related-hosts/related-host.route.js +++ b/awx/ui/client/src/inventories-hosts/inventories/related/hosts/related-host.route.js @@ -1,4 +1,4 @@ -import { N_ } from '../../i18n'; +import { N_ } from '../../../../i18n'; export default { name: "inventories.edit.hosts", @@ -56,19 +56,19 @@ export default { return qs.search(path, $stateParams[`${list.iterator}_search`]); } ], - hostsUrl: ['InventoryManageService', '$stateParams', function(InventoryManageService, $stateParams) { + hostsUrl: ['InventoriesService', '$stateParams', function(InventoriesService, $stateParams) { return $stateParams.group && $stateParams.group.length > 0 ? // nested context - provide all hosts managed by nodes - InventoryManageService.childHostsUrl(_.last($stateParams.group)) : + InventoriesService.childHostsUrl(_.last($stateParams.group)) : // root context - provide all hosts in an inventory - InventoryManageService.rootHostsUrl($stateParams.inventory_id); + 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: ['InventoryManageService', '$stateParams', function(InventoryManageService, $stateParams) { - return InventoryManageService.getInventory($stateParams.inventory_id).then(res => res.data); + inventoryData: ['InventoriesService', '$stateParams', function(InventoriesService, $stateParams) { + return InventoriesService.getInventory($stateParams.inventory_id).then(res => res.data); }], canAdd: ['rbacUiControlService', function(rbacUiControlService) { return rbacUiControlService.canAdd('hosts') 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 new file mode 100644 index 0000000000..2b9a865b18 --- /dev/null +++ b/awx/ui/client/src/inventories-hosts/inventories/related/hosts/related/nested-groups/host-nested-groups-associate.route.js @@ -0,0 +1,33 @@ +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 `