mirror of
https://github.com/ansible/awx.git
synced 2026-05-07 17:37:37 -02:30
AC-256 Fixed the out-of-sync tree issue, which leads to 'spurious error message'.
This commit is contained in:
@@ -373,7 +373,13 @@ function InventoriesEdit ($scope, $rootScope, $compile, $location, $log, $routeP
|
|||||||
return {
|
return {
|
||||||
addGroup: {
|
addGroup: {
|
||||||
label: 'Add Group',
|
label: 'Add Group',
|
||||||
action: function(obj) { GroupsAdd({ "inventory_id": id, group_id: null }); }
|
action: function(obj) {
|
||||||
|
scope.group_id = null;
|
||||||
|
if (!scope.$$phase) {
|
||||||
|
scope.$digest();
|
||||||
|
}
|
||||||
|
GroupsAdd({ "inventory_id": id, group_id: null });
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -381,16 +387,34 @@ function InventoriesEdit ($scope, $rootScope, $compile, $location, $log, $routeP
|
|||||||
return {
|
return {
|
||||||
addGroup: {
|
addGroup: {
|
||||||
label: 'Add Group',
|
label: 'Add Group',
|
||||||
action: function(obj) { GroupsList({ "inventory_id": id, group_id: $(obj).attr('group_id') }); }
|
action: function(obj) {
|
||||||
|
scope.group_id = $(obj).attr('group_id');
|
||||||
|
if (!scope.$$phase) {
|
||||||
|
scope.$digest();
|
||||||
|
}
|
||||||
|
GroupsList({ "inventory_id": id, group_id: $(obj).attr('group_id') });
|
||||||
|
}
|
||||||
},
|
},
|
||||||
edit: {
|
edit: {
|
||||||
label: 'Edit Group',
|
label: 'Edit Group',
|
||||||
action: function(obj) { GroupsEdit({ "inventory_id": id, group_id: $(obj).attr('group_id') }); },
|
action: function(obj) {
|
||||||
|
scope.group_id = $(obj).attr('group_id');
|
||||||
|
if (!scope.$$phase) {
|
||||||
|
scope.$digest();
|
||||||
|
}
|
||||||
|
GroupsEdit({ "inventory_id": id, group_id: $(obj).attr('group_id') });
|
||||||
|
},
|
||||||
separator_before: true
|
separator_before: true
|
||||||
},
|
},
|
||||||
"delete": {
|
"delete": {
|
||||||
label: 'Delete Group',
|
label: 'Delete Group',
|
||||||
action: function(obj) { GroupsDelete({ scope: scope, "inventory_id": id, group_id: $(obj).attr('group_id') }) }
|
action: function(obj) {
|
||||||
|
scope.group_id = $(obj).attr('group_id');
|
||||||
|
if (!scope.$$phase) {
|
||||||
|
scope.$digest();
|
||||||
|
}
|
||||||
|
GroupsDelete({ scope: scope, "inventory_id": id, group_id: $(obj).attr('group_id') });
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -328,9 +328,9 @@ angular.module('GroupsHelper', [ 'RestServices', 'Utilities', 'ListGenerator', '
|
|||||||
|
|
||||||
|
|
||||||
.factory('GroupsDelete', ['$rootScope', '$location', '$log', '$routeParams', 'Rest', 'Alert', 'GroupForm', 'GenerateForm',
|
.factory('GroupsDelete', ['$rootScope', '$location', '$log', '$routeParams', 'Rest', 'Alert', 'GroupForm', 'GenerateForm',
|
||||||
'Prompt', 'ProcessErrors', 'GetBasePath',
|
'Prompt', 'ProcessErrors', 'GetBasePath', 'RefreshTree',
|
||||||
function($rootScope, $location, $log, $routeParams, Rest, Alert, GroupForm, GenerateForm, Prompt, ProcessErrors,
|
function($rootScope, $location, $log, $routeParams, Rest, Alert, GroupForm, GenerateForm, Prompt, ProcessErrors,
|
||||||
GetBasePath) {
|
GetBasePath, RefreshTree) {
|
||||||
return function(params) {
|
return function(params) {
|
||||||
// Delete the selected group node. Disassociates it from its parent.
|
// Delete the selected group node. Disassociates it from its parent.
|
||||||
var scope = params.scope;
|
var scope = params.scope;
|
||||||
@@ -338,9 +338,6 @@ angular.module('GroupsHelper', [ 'RestServices', 'Utilities', 'ListGenerator', '
|
|||||||
var inventory_id = params.inventory_id;
|
var inventory_id = params.inventory_id;
|
||||||
var obj = $('#tree-view li[group_id="' + group_id + '"]');
|
var obj = $('#tree-view li[group_id="' + group_id + '"]');
|
||||||
var parent = (obj.parent().last().prop('tagName') == 'LI') ? obj.parent().last() : obj.parent().parent().last();
|
var parent = (obj.parent().last().prop('tagName') == 'LI') ? obj.parent().last() : obj.parent().parent().last();
|
||||||
//if (parent.length > 0) {
|
|
||||||
// parent = parent.last();
|
|
||||||
//}
|
|
||||||
var url;
|
var url;
|
||||||
|
|
||||||
if (parent.attr('type') == 'group') {
|
if (parent.attr('type') == 'group') {
|
||||||
@@ -354,7 +351,8 @@ angular.module('GroupsHelper', [ 'RestServices', 'Utilities', 'ListGenerator', '
|
|||||||
Rest.post({ id: group_id, disassociate: 1 })
|
Rest.post({ id: group_id, disassociate: 1 })
|
||||||
.success( function(data, status, headers, config) {
|
.success( function(data, status, headers, config) {
|
||||||
$('#prompt-modal').modal('hide');
|
$('#prompt-modal').modal('hide');
|
||||||
$('#tree-view').jstree("delete_node",obj);
|
RefreshTree({ scope: scope });
|
||||||
|
//$('#tree-view').jstree("delete_node",obj);
|
||||||
})
|
})
|
||||||
.error( function(data, status, headers, config) {
|
.error( function(data, status, headers, config) {
|
||||||
$('#prompt-modal').modal('hide');
|
$('#prompt-modal').modal('hide');
|
||||||
|
|||||||
Reference in New Issue
Block a user