related groups for host-edit form

This commit is contained in:
Jared Tabor
2017-04-27 17:45:37 -07:00
parent 5c79561b7d
commit 11f3f057f6
4 changed files with 38 additions and 5 deletions

View File

@@ -88,9 +88,7 @@ function(i18n, nestedGroupListState, nestedHostsListState, buildHostAddState){
includeForm: "NestedGroupFormDefinition", includeForm: "NestedGroupFormDefinition",
title: i18n._('Groups'), title: i18n._('Groups'),
iterator: 'nested_group', iterator: 'nested_group',
listState: nestedGroupListState, listState: nestedGroupListState
// addState: buildGroupsAddState,
// editState: buildGroupsEditState
}, },
nested_hosts: { nested_hosts: {
name: 'nested_hosts', name: 'nested_hosts',

View File

@@ -20,6 +20,10 @@
$scope.toggleEnabled = function(){ $scope.toggleEnabled = function(){
$scope.host.enabled = !$scope.host.enabled; $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(){ $scope.formSave = function(){
var host = { var host = {
id: $scope.host.id, id: $scope.host.id,

View File

@@ -10,7 +10,8 @@
* @description This form is for adding/editing a host on the inventory page * @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 { return {
addTitle: i18n._('CREATE HOST'), addTitle: i18n._('CREATE HOST'),
@@ -107,6 +108,21 @@ export default ['i18n', function(i18n) {
name: 'ansible_facts', name: 'ansible_facts',
title: i18n._('Facts'), title: i18n._('Facts'),
skipGenerator: true 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
} }
} }
}; };

View File

@@ -10,7 +10,8 @@
* @description This form is for adding/editing a host on the inventory page * @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 { return {
addTitle: i18n._('CREATE HOST'), addTitle: i18n._('CREATE HOST'),
@@ -108,6 +109,20 @@ export default ['i18n', function(i18n) {
name: 'ansible_facts', name: 'ansible_facts',
title: i18n._('Facts'), title: i18n._('Facts'),
skipGenerator: true 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
} }
} }
}; };