mirror of
https://github.com/ansible/awx.git
synced 2026-05-06 08:57:35 -02:30
Added jsTree to show groups under Inventory/Edit
This commit is contained in:
@@ -102,5 +102,28 @@ angular.module('InventoryHelper', [ 'RestServices', 'Utilities', 'OrganizationLi
|
||||
listScope.toggle_organization(scope.organization);
|
||||
}
|
||||
}
|
||||
}])
|
||||
|
||||
.factory('TreeInit', ['Alert', 'Rest', function(Alert, Rest) {
|
||||
return function(groups) {
|
||||
Rest.setUrl(groups);
|
||||
Rest.get()
|
||||
.success( function(data, status, headers, config) {
|
||||
var treeData = [];
|
||||
for (var i=0; i < data.results.length; i++) {
|
||||
treeData.push({
|
||||
data: data.results[i].name,
|
||||
state: 'closed',
|
||||
attr: { id: data.results[i] }
|
||||
});
|
||||
}
|
||||
$('#tree-view').jstree({ "json_data": { data: treeData },
|
||||
plugins: ['themes', 'json_data', 'ui'] });
|
||||
})
|
||||
.error( function(data, status, headers, config) {
|
||||
Alert('Error', 'Failed to laod tree data. Url: ' + groups + ' GET status: ' + status);
|
||||
});
|
||||
}
|
||||
}]);
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user