fixing add/edit for a related group

This commit is contained in:
Jared Tabor 2017-04-25 21:12:10 -07:00 committed by Jared Tabor
parent fe63303816
commit fed34fff8b
6 changed files with 17 additions and 16 deletions

View File

@ -49,8 +49,8 @@ export default ['$state', '$stateParams', '$scope', 'GroupForm',
};
GroupManageService.post(group).then(res => {
if ($stateParams.group) {
return GroupManageService.associateGroup(res.data, _.last($stateParams.group))
if ($stateParams.group_id) {
return GroupManageService.associateGroup(res.data, $stateParams.group_id)
.then(() => $state.go('^', null, { reload: true }));
} else {
$state.go('^.edit', { group_id: res.data.id }, { reload: true });

View File

@ -5,6 +5,7 @@
*************************************************/
import nestedGroupListState from './nested-groups-list-state.factory';
import nestedGroupAddState from './nested-groups-add-state.factory';
import nestedGroupListDefinition from './nested-groups.list';
import nestedGroupFormDefinition from './nested-groups.form';
import controller from './nested-groups-list.controller';
@ -12,6 +13,7 @@ import controller from './nested-groups-list.controller';
export default
angular.module('nestedGroups', [])
.factory('nestedGroupListState', nestedGroupListState)
.factory('nestedGroupAddState', nestedGroupAddState)
.value('NestedGroupListDefinition', nestedGroupListDefinition)
.factory('NestedGroupFormDefinition', nestedGroupFormDefinition)
.controller('NestedGroupsListController', controller);

View File

@ -64,7 +64,7 @@
}
$scope.createGroup = function(){
$state.go('inventories.edit.groups.add');
$state.go('inventories.edit.groups.edit.nested_groups.add');
};
$scope.editGroup = function(id){
$state.go('inventories.edit.groups.edit', {group_id: id});

View File

@ -88,9 +88,7 @@ function(i18n, nestedGroupListState){
includeForm: "RelatedGroupFormDefinition",
title: i18n._('Groups'),
iterator: 'related_group',
listState: nestedGroupListState,
// addState: buildGroupsAddState,
// editState: buildGroupsEditState
listState: nestedGroupListState
},
}

View File

@ -22,10 +22,10 @@ export default {
nosort: true,
mode: 'all',
iconOnly: true,
awToolTip: "{{ group.hosts_status_tip }}",
awToolTip: "{{ nested_group.hosts_status_tip }}",
dataPlacement: "top",
ngClick: "showFailedHosts(group)",
icon: "{{ 'fa icon-job-' + group.hosts_status_class }}",
ngClick: "showFailedHosts(nested_group)",
icon: "{{ 'fa icon-job-' + nested_group.hosts_status_class }}",
columnClass: 'status-column List-staticColumn--smallStatus'
},
name: {
@ -33,7 +33,7 @@ export default {
key: true,
// ngClick: "groupSelect(group.id)",
ngClick: "editGroup(group.id)",
ngClick: "editGroup(nested_group.id)",
columnClass: 'col-lg-6 col-md-6 col-sm-6 col-xs-6',
class: 'InventoryManage-breakWord',
}
@ -104,7 +104,7 @@ export default {
// },
copy: {
mode: 'all',
ngClick: "copyMoveGroup(group.id)",
ngClick: "copyMoveGroup(nested_group.id)",
awToolTip: 'Copy or move group',
ngShow: "group.id > 0 && group.summary_fields.user_capabilities.copy",
dataPlacement: "top"
@ -120,23 +120,23 @@ export default {
edit: {
//label: 'Edit',
mode: 'all',
ngClick: "editGroup(group.id)",
ngClick: "editGroup(nested_group.id)",
awToolTip: 'Edit group',
dataPlacement: "top",
ngShow: "group.summary_fields.user_capabilities.edit"
ngShow: "nested_group.summary_fields.user_capabilities.edit"
},
view: {
//label: 'Edit',
mode: 'all',
ngClick: "editGroup(group.id)",
ngClick: "editGroup(nested_group.id)",
awToolTip: 'View group',
dataPlacement: "top",
ngShow: "!group.summary_fields.user_capabilities.edit"
ngShow: "!nested_group.summary_fields.user_capabilities.edit"
},
"delete": {
//label: 'Delete',
mode: 'all',
ngClick: "deleteGroup(group)",
ngClick: "deleteGroup(nested_group)",
awToolTip: 'Delete group',
dataPlacement: "top",
ngShow: "group.summary_fields.user_capabilities.delete"

View File

@ -2,6 +2,7 @@
<div ui-view="copyMove"></div>
<div ui-view="adhocForm"></div>
<div ui-view="hostForm"></div>
<div ui-view="nestedGroupForm"></div>
<div ui-view="groupForm"></div>
<div ui-view="sourcesForm"></div>
<div ui-view="form"></div>