From 11f3f057f6bf7594c569cf7563de45033235e520 Mon Sep 17 00:00:00 2001 From: Jared Tabor Date: Thu, 27 Apr 2017 17:45:37 -0700 Subject: [PATCH] related groups for host-edit form --- .../src/inventories/groups/groups.form.js | 4 +--- .../hosts/edit/host-edit.controller.js | 4 ++++ .../client/src/inventories/hosts/host.form.js | 18 +++++++++++++++++- .../related-hosts/related-host.form.js | 17 ++++++++++++++++- 4 files changed, 38 insertions(+), 5 deletions(-) diff --git a/awx/ui/client/src/inventories/groups/groups.form.js b/awx/ui/client/src/inventories/groups/groups.form.js index 308d3555d8..4f6a178a71 100644 --- a/awx/ui/client/src/inventories/groups/groups.form.js +++ b/awx/ui/client/src/inventories/groups/groups.form.js @@ -88,9 +88,7 @@ function(i18n, nestedGroupListState, nestedHostsListState, buildHostAddState){ includeForm: "NestedGroupFormDefinition", title: i18n._('Groups'), iterator: 'nested_group', - listState: nestedGroupListState, - // addState: buildGroupsAddState, - // editState: buildGroupsEditState + listState: nestedGroupListState }, nested_hosts: { name: 'nested_hosts', diff --git a/awx/ui/client/src/inventories/hosts/edit/host-edit.controller.js b/awx/ui/client/src/inventories/hosts/edit/host-edit.controller.js index 250c65e4d7..ab4ab233e4 100644 --- a/awx/ui/client/src/inventories/hosts/edit/host-edit.controller.js +++ b/awx/ui/client/src/inventories/hosts/edit/host-edit.controller.js @@ -20,6 +20,10 @@ $scope.toggleEnabled = function(){ $scope.host.enabled = !$scope.host.enabled; }; + $scope.groupsTab = function(){ + let id = $scope.host.summary_fields.inventory.id; + $state.go('hosts.edit.nested_groups', {inventory_id: id}); + }; $scope.formSave = function(){ var host = { id: $scope.host.id, diff --git a/awx/ui/client/src/inventories/hosts/host.form.js b/awx/ui/client/src/inventories/hosts/host.form.js index 350e2c11cf..fdc8df1d56 100644 --- a/awx/ui/client/src/inventories/hosts/host.form.js +++ b/awx/ui/client/src/inventories/hosts/host.form.js @@ -10,7 +10,8 @@ * @description This form is for adding/editing a host on the inventory page */ -export default ['i18n', function(i18n) { +export default ['i18n', 'nestedGroupListState', +function(i18n, nestedGroupListState) { return { addTitle: i18n._('CREATE HOST'), @@ -107,6 +108,21 @@ export default ['i18n', function(i18n) { name: 'ansible_facts', title: i18n._('Facts'), skipGenerator: true + }, + nested_groups: { + name: 'nested_groups', + // ngClick: "$state.go('hosts.edit.nested_groups')", + ngClick: "groupsTab()", + include: "NestedGroupListDefinition", + includeForm: "NestedGroupFormDefinition", + title: i18n._('Groups'), + iterator: 'nested_group', + listState: nestedGroupListState + }, + insights: { + name: 'insights', + title: i18n._('Insights'), + skipGenerator: true } } }; diff --git a/awx/ui/client/src/inventories/related-hosts/related-host.form.js b/awx/ui/client/src/inventories/related-hosts/related-host.form.js index 00d9d284d9..9e7d30927b 100644 --- a/awx/ui/client/src/inventories/related-hosts/related-host.form.js +++ b/awx/ui/client/src/inventories/related-hosts/related-host.form.js @@ -10,7 +10,8 @@ * @description This form is for adding/editing a host on the inventory page */ -export default ['i18n', function(i18n) { +export default ['i18n', 'nestedGroupListState', +function(i18n,nestedGroupListState) { return { addTitle: i18n._('CREATE HOST'), @@ -108,6 +109,20 @@ export default ['i18n', function(i18n) { name: 'ansible_facts', title: i18n._('Facts'), skipGenerator: true + }, + nested_groups: { + name: 'nested_groups', + ngClick: "$state.go('inventories.edit.hosts.edit.nested_groups')", + include: "NestedGroupListDefinition", + includeForm: "NestedGroupFormDefinition", + title: i18n._('Groups'), + iterator: 'nested_group', + listState: nestedGroupListState + }, + insights: { + name: 'insights', + title: i18n._('Insights'), + skipGenerator: true } } };